diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 5417d856c6..338544a54c 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -33,7 +33,7 @@ jobs: - name: Checkout RPC Tests Repository & Install Requirements run: | rm -rf ${{runner.workspace}}/rpc-tests - git -c advice.detachedHead=false clone --depth 1 --branch v1.27.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + git -c advice.detachedHead=false clone --depth 1 --branch v1.28.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests cd ${{runner.workspace}}/rpc-tests pip3 install -r requirements.txt --break-system-packages diff --git a/.github/workflows/run_integration_tests.sh b/.github/workflows/run_integration_tests.sh index 7b71015861..81900aebf6 100755 --- a/.github/workflows/run_integration_tests.sh +++ b/.github/workflows/run_integration_tests.sh @@ -28,6 +28,7 @@ debug_traceBlockByNumber/test_09,\ debug_traceBlockByNumber/test_10,\ debug_traceBlockByNumber/test_11,\ debug_traceBlockByNumber/test_12,\ +debug_traceBlockByNumber/test_21,\ debug_traceCallMany/test_07,\ debug_traceCallMany/test_09,\ debug_traceTransaction/test_25.json,\ diff --git a/silkworm/rpc/core/evm_debug.cpp b/silkworm/rpc/core/evm_debug.cpp index 91afb8a428..995eae16d9 100644 --- a/silkworm/rpc/core/evm_debug.cpp +++ b/silkworm/rpc/core/evm_debug.cpp @@ -39,12 +39,17 @@ void from_json(const nlohmann::json& json, DebugConfig& tc) { json.at("disableStorage").get_to(tc.disable_storage); json.at("disableMemory").get_to(tc.disable_memory); json.at("disableStack").get_to(tc.disable_stack); + + if (json.count("NoRefunds") != 0) { + json.at("NoRefunds").get_to(tc.no_refunds); + } } std::ostream& operator<<(std::ostream& out, const DebugConfig& tc) { out << "disableStorage: " << std::boolalpha << tc.disable_storage; out << " disableMemory: " << std::boolalpha << tc.disable_memory; out << " disableStack: " << std::boolalpha << tc.disable_stack; + out << " NoRefunds: " << std::boolalpha << tc.no_refunds; return out; } @@ -443,6 +448,8 @@ Task DebugExecutor::execute(json::Stream& stream, const ChainStorage& stor auto state = state_factory.create_state(current_executor, storage, txn_id); EVMExecutor executor{block, chain_config, workers_, state}; + bool refunds = !config_.no_refunds; + for (std::uint64_t idx = 0; idx < transactions.size(); ++idx) { rpc::Transaction txn{block.transactions[idx]}; SILK_DEBUG << "processing transaction: idx: " << idx << " txn: " << txn; @@ -456,7 +463,7 @@ Task DebugExecutor::execute(json::Stream& stream, const ChainStorage& stor stream.open_array(); Tracers tracers{debug_tracer}; - const auto execution_result = executor.call(block, txn, tracers, /* refund */ false, /* gasBailout */ false); + const auto execution_result = executor.call(block, txn, tracers, refunds, /* gasBailout */ false); debug_tracer->flush_logs(); stream.close_array(); @@ -517,8 +524,9 @@ Task DebugExecutor::execute( stream.write_field("structLogs"); stream.open_array(); + bool refunds = !config_.no_refunds; Tracers tracers{debug_tracer}; - const auto execution_result = executor.call(block, transaction, tracers); + const auto execution_result = executor.call(block, transaction, tracers, refunds); debug_tracer->flush_logs(); stream.close_array(); @@ -587,6 +595,7 @@ Task DebugExecutor::execute( } stream.open_array(); + bool refunds = !config_.no_refunds; for (const auto& call : bundle.transactions) { silkworm::Transaction txn{call.to_transaction()}; @@ -598,7 +607,7 @@ Task DebugExecutor::execute( auto debug_tracer = std::make_shared(stream, config_); Tracers tracers{debug_tracer}; - const auto execution_result = executor.call(block_context.block_with_hash->block, txn, tracers, /* refund */ false, /* gasBailout */ false); + const auto execution_result = executor.call(block_context.block_with_hash->block, txn, tracers, refunds, /* gasBailout */ false); debug_tracer->flush_logs(); stream.close_array(); diff --git a/silkworm/rpc/core/evm_debug.hpp b/silkworm/rpc/core/evm_debug.hpp index f4f569b3d2..35f10a4b21 100644 --- a/silkworm/rpc/core/evm_debug.hpp +++ b/silkworm/rpc/core/evm_debug.hpp @@ -48,6 +48,7 @@ struct DebugConfig { bool disable_storage{false}; bool disable_memory{false}; bool disable_stack{false}; + bool no_refunds{false}; }; std::string uint256_to_hex(const evmone::uint256& x); diff --git a/silkworm/rpc/core/evm_debug_test.cpp b/silkworm/rpc/core/evm_debug_test.cpp index 14326ceaaf..387e39bb60 100644 --- a/silkworm/rpc/core/evm_debug_test.cpp +++ b/silkworm/rpc/core/evm_debug_test.cpp @@ -1087,7 +1087,7 @@ TEST_CASE_METHOD(DebugExecutorTest, "DebugConfig") { std::ostringstream os; os << config; - CHECK(os.str() == "disableStorage: true disableMemory: false disableStack: true"); + CHECK(os.str() == "disableStorage: true disableMemory: false disableStack: true NoRefunds: false"); } }