diff --git a/test/data/arbitrage/block_numbers.json b/test/data/arbitrage/block_numbers.json new file mode 100644 index 0000000000000000000000000000000000000000..1d320570ff15847b0010c0bd75b4493667f30d39 --- /dev/null +++ b/test/data/arbitrage/block_numbers.json @@ -0,0 +1,30 @@ +[ +23044978, +22374001, +22943193, +20217499, +22225805, +21979741, +22866516, +23139959, +23139267, +23181373, +23187000, +23221520, +23224362, +22217789, +23294563, +23316084, +23339830, +21598428, +19974269, +21960556, +22632053, +23397519, +23397398, +22954077, +23517910, +23528932, +23563100, +23546900 +] \ No newline at end of file diff --git a/test/data/arbitrage/blocks_data.json b/test/data/arbitrage/blocks_data.json new file mode 100644 index 0000000000000000000000000000000000000000..acd84a088e80055edaeeba5393b88888b2ab0571 Binary files /dev/null and b/test/data/arbitrage/blocks_data.json differ diff --git a/test/test_common/test_common.ml b/test/test_common/test_common.ml index b702809b93d2257dd222c7e0942428b5d420dd00..240b9efcadf8d7da65df18eaf0a90d3d29edd90c 100644 --- a/test/test_common/test_common.ml +++ b/test/test_common/test_common.ml @@ -30,6 +30,8 @@ module Test_types = struct } [@@deriving encoding { camel; remove_prefix = "st_" }, eq] + type arbitrage_test = int [@@deriving encoding, eq] + type 'a blk_analysis_test = { bat_block_number : bint; bat_resume : 'a; @@ -46,6 +48,7 @@ module Test_types = struct | AT_Flashloan of tx_analysis_test [@wrap "value"] | AT_Liquidate of tx_analysis_test [@wrap "value"] | AT_Sandwich of sandwich_test blk_analysis_test [@wrap "value"] + | AT_Arbitrage of arbitrage_test blk_analysis_test [@wrap "value"] | AT_Transfer [@@deriving encoding { remove_prefix = "AT_"; camel; kind = "type"; union }, eq] @@ -72,6 +75,7 @@ module Test_tools = struct | "sandwich" -> Some `sandwich | "liquidate" -> Some `liquidate | "flashloan" -> Some `flashloan + | "arbitrage" -> Some `arbitrage | _ -> Common.Log.log_error_fail ~here:[%here] "Required analysis type" let sandwich_output_to_sandwich_test @@ -134,7 +138,6 @@ module Test_tools = struct let perform_analysis database analysis_type = match database with - | Traces _ -> [] | Receipts block_receipts -> ( match analysis_type with | `liquidate -> @@ -171,6 +174,19 @@ module Test_tools = struct }) block_receipts | _ -> []) + | Traces _ -> ( + match analysis_type with + | `arbitrage -> [] + (* | `arbitrage -> List.map (fun (trace : block_debug_traces) -> let + analyses = Eth_analysis.Eth_analyse.blk_detect ( BAI_Arbitrage + (trace.bdt_debug_traces, [ { cfti_block_number = + trace.bdt_block_number; cfti_block_builder = trace.bdt_debug_traces; + cfti_base_fee = trace.base_fee; cfti_effective_price = + trace.r_effective_gas_price; cfti_max_fee_per_gas = + trace.max_fee_per_gas; cfti_gas_used = trace.r_gas_used; }; ] )) in { + ab_analyses = List.map analyses_to_analyses_test analyses; + ab_block_number = trace.bdt_block_number; }) traces *) + | _ -> []) let number_of_blocks = Int64.of_int 200