Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpcdaemon: fix trace gasCost for opcode EXP in case of stack fault #2190

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rpc-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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.32.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
git -c advice.detachedHead=false clone --depth 1 --branch v0.33.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
cd ${{runner.workspace}}/rpc-tests
pip3 install -r requirements.txt

Expand Down
9 changes: 7 additions & 2 deletions silkworm/rpc/core/evm_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,13 @@ void VmTraceTracer::on_execution_end(const evmc_result& result, const silkworm::
case evmc_status_code::EVMC_STACK_UNDERFLOW:
case evmc_status_code::EVMC_STACK_OVERFLOW:
case evmc_status_code::EVMC_BAD_JUMP_DESTINATION:
op.trace_ex.used = op.gas_cost - metrics_[op.op_code].gas_cost;
op.gas_cost = metrics_[op.op_code].gas_cost;
if (op.op_code == evmc_opcode::OP_EXP) { // Erigon the static part is 0
op.trace_ex.used = op.gas_cost;
op.gas_cost = 0;
} else {
op.trace_ex.used = op.gas_cost - metrics_[op.op_code].gas_cost;
op.gas_cost = metrics_[op.op_code].gas_cost;
}
break;

case evmc_status_code::EVMC_UNDEFINED_INSTRUCTION:
Expand Down
Loading