@@ -2499,78 +2499,82 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do
24992499 assert :ok = ExJsonSchema.Validator . validate ( txlistinternal_schema ( ) , response )
25002500 end
25012501
2502- test "via on-demand fetcher" , % { conn: conn } do
2503- original_config = Application . get_env ( :explorer , Explorer.Migrator.DeleteZeroValueInternalTransactions )
2502+ if Application . compile_env ( :explorer , :chain_type ) not in [ :rsk , :filecoin ] do
2503+ test "via on-demand fetcher" , % { conn: conn } do
2504+ original_config = Application . get_env ( :explorer , Explorer.Migrator.DeleteZeroValueInternalTransactions )
25042505
2505- Application . put_env ( :explorer , Explorer.Migrator.DeleteZeroValueInternalTransactions ,
2506- enabled: true ,
2507- storage_period: 0
2508- )
2506+ Application . put_env ( :explorer , Explorer.Migrator.DeleteZeroValueInternalTransactions ,
2507+ enabled: true ,
2508+ storage_period: 0
2509+ )
25092510
2510- transaction = :transaction |> insert ( ) |> with_block ( )
2511-
2512- expect ( EthereumJSONRPC.Mox , :json_rpc , 1 , fn
2513- [ % { id: id , params: _ } ] , _ ->
2514- { :ok ,
2515- [
2516- % {
2517- id: id ,
2518- result: % {
2519- "type" => "create" ,
2520- "from" => "0x117b358218da5a4f647072ddb50ded038ed63d17" ,
2521- "to" => "0x205a6b72ce16736c9d87172568a9c0cb9304de0d" ,
2522- "value" => "0x0" ,
2523- "gas" => "0x106f5" ,
2524- "gasUsed" => "0x106f5" ,
2525- "input" =>
2526- "0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033" ,
2527- "output" =>
2528- "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033"
2529- }
2530- }
2531- ] }
2532- end )
2511+ on_exit ( fn ->
2512+ Application . put_env ( :explorer , Explorer.Migrator.DeleteZeroValueInternalTransactions , original_config )
2513+ end )
25332514
2534- Application . put_env ( :ethereum_jsonrpc , EthereumJSONRPC.Geth , tracer: "call_tracer" , debug_trace_timeout: "5s" )
2515+ transaction = :transaction |> insert ( ) |> with_block ( )
25352516
2536- expected_result = [
2537- % {
2538- "blockNumber" => "#{ transaction . block_number } " ,
2539- "callType" => "" ,
2540- "contractAddress" => "0x205a6b72ce16736c9d87172568a9c0cb9304de0d" ,
2541- "errCode" => "" ,
2542- "from" => "0x117b358218da5a4f647072ddb50ded038ed63d17" ,
2543- "gas" => "67317" ,
2544- "gasUsed" => "67317" ,
2545- "index" => "0" ,
2546- "input" => "" ,
2547- "isError" => "0" ,
2548- "timeStamp" => "#{ DateTime . to_unix ( transaction . block . timestamp ) } " ,
2549- "to" => "" ,
2550- "transactionHash" => "#{ transaction . hash } " ,
2551- "type" => "create" ,
2552- "value" => "0"
2553- }
2554- ]
2555-
2556- params = % {
2557- "module" => "account" ,
2558- "action" => "txlistinternal" ,
2559- "txhash" => "#{ transaction . hash } " ,
2560- "include_zero_value" => "true"
2561- }
2517+ expect ( EthereumJSONRPC.Mox , :json_rpc , 1 , fn
2518+ [ % { id: id , params: _ } ] , _ ->
2519+ { :ok ,
2520+ [
2521+ % {
2522+ id: id ,
2523+ result: % {
2524+ "type" => "create" ,
2525+ "from" => "0x117b358218da5a4f647072ddb50ded038ed63d17" ,
2526+ "to" => "0x205a6b72ce16736c9d87172568a9c0cb9304de0d" ,
2527+ "value" => "0x0" ,
2528+ "gas" => "0x106f5" ,
2529+ "gasUsed" => "0x106f5" ,
2530+ "input" =>
2531+ "0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033" ,
2532+ "output" =>
2533+ "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100d9565b60405180910390f35b610073600480360381019061006e919061009d565b61007e565b005b60008054905090565b8060008190555050565b60008135905061009781610103565b92915050565b6000602082840312156100b3576100b26100fe565b5b60006100c184828501610088565b91505092915050565b6100d3816100f4565b82525050565b60006020820190506100ee60008301846100ca565b92915050565b6000819050919050565b600080fd5b61010c816100f4565b811461011757600080fd5b5056fea26469706673582212209a159a4f3847890f10bfb87871a61eba91c5dbf5ee3cf6398207e292eee22a1664736f6c63430008070033"
2534+ }
2535+ }
2536+ ] }
2537+ end )
25622538
2563- assert response =
2564- conn
2565- |> get ( "/api/v1" , params )
2566- |> json_response ( 200 )
2539+ Application . put_env ( :ethereum_jsonrpc , EthereumJSONRPC.Geth , tracer: "call_tracer" , debug_trace_timeout: "5s" )
2540+
2541+ expected_result = [
2542+ % {
2543+ "blockNumber" => "#{ transaction . block_number } " ,
2544+ "callType" => "" ,
2545+ "contractAddress" => "0x205a6b72ce16736c9d87172568a9c0cb9304de0d" ,
2546+ "errCode" => "" ,
2547+ "from" => "0x117b358218da5a4f647072ddb50ded038ed63d17" ,
2548+ "gas" => "67317" ,
2549+ "gasUsed" => "67317" ,
2550+ "index" => "0" ,
2551+ "input" => "" ,
2552+ "isError" => "0" ,
2553+ "timeStamp" => "#{ DateTime . to_unix ( transaction . block . timestamp ) } " ,
2554+ "to" => "" ,
2555+ "transactionHash" => "#{ transaction . hash } " ,
2556+ "type" => "create" ,
2557+ "value" => "0"
2558+ }
2559+ ]
2560+
2561+ params = % {
2562+ "module" => "account" ,
2563+ "action" => "txlistinternal" ,
2564+ "txhash" => "#{ transaction . hash } " ,
2565+ "include_zero_value" => "true"
2566+ }
25672567
2568- assert response [ "result" ] == expected_result
2569- assert response [ "status" ] == "1"
2570- assert response [ "message" ] == "OK"
2571- assert :ok = ExJsonSchema.Validator . validate ( txlistinternal_schema ( ) , response )
2568+ assert response =
2569+ conn
2570+ |> get ( "/api/v1" , params )
2571+ |> json_response ( 200 )
25722572
2573- Application . put_env ( :explorer , Explorer.Migrator.DeleteZeroValueInternalTransactions , original_config )
2573+ assert response [ "result" ] == expected_result
2574+ assert response [ "status" ] == "1"
2575+ assert response [ "message" ] == "OK"
2576+ assert :ok = ExJsonSchema.Validator . validate ( txlistinternal_schema ( ) , response )
2577+ end
25742578 end
25752579 end
25762580
0 commit comments