From e2043061ca6305db1dd6ea27c7106c956684581b Mon Sep 17 00:00:00 2001 From: lupin012 <58134934+lupin012@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:03:19 +0000 Subject: [PATCH] rpcdaemon: fix gas cost in case of early failures (#2378) --- .github/workflows/rpc-integration-tests.yml | 2 +- silkworm/rpc/core/evm_debug.cpp | 2 +- silkworm/rpc/core/evm_debug_test.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 1725da5528..e36a4109c5 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -30,7 +30,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 v0.51.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + git -c advice.detachedHead=false clone --depth 1 --branch v0.52.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests cd ${{runner.workspace}}/rpc-tests pip3 install -r requirements.txt diff --git a/silkworm/rpc/core/evm_debug.cpp b/silkworm/rpc/core/evm_debug.cpp index 0267b5515d..a66be9c40d 100644 --- a/silkworm/rpc/core/evm_debug.cpp +++ b/silkworm/rpc/core/evm_debug.cpp @@ -226,7 +226,7 @@ void DebugTracer::on_execution_end(const evmc_result& result, const silkworm::In case evmc_status_code::EVMC_INVALID_INSTRUCTION: case evmc_status_code::EVMC_STACK_OVERFLOW: case evmc_status_code::EVMC_STACK_UNDERFLOW: - log.gas_cost = result.gas_cost; + log.gas_cost = 0; break; case evmc_status_code::EVMC_OUT_OF_GAS: diff --git a/silkworm/rpc/core/evm_debug_test.cpp b/silkworm/rpc/core/evm_debug_test.cpp index 2fe5bd8836..2f3282a205 100644 --- a/silkworm/rpc/core/evm_debug_test.cpp +++ b/silkworm/rpc/core/evm_debug_test.cpp @@ -1230,7 +1230,7 @@ TEST_CASE_METHOD(DebugExecutorTest, "DebugExecutor::execute call with error") { { "depth": 1, "gas": 156080, - "gasCost": 2, + "gasCost": 0, "memory": [], "op": "opcode 0x4b not defined", "pc": 1,