Skip to content

Commit

Permalink
rpcdaemon: fix invalid data access for CREATE2 in trace_filter (#2649)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sixtysixter authored Jan 28, 2025
1 parent d24f0e4 commit c497134
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ debug_traceTransaction/test_90,\
debug_traceTransaction/test_91,\
debug_traceTransaction/test_92,\
debug_traceTransaction/test_96,\
trace_filter/test_24,\
trace_replayBlockTransactions/test_29,\
engine_,\
trace_filter/test_24.json,\
trace_replayTransaction/test_48.tar,\
trace_transaction/test_37.json
trace_replayTransaction/test_48,\
trace_transaction/test_37,\
engine_

failed_test=$?

Expand Down
7 changes: 6 additions & 1 deletion silkworm/rpc/core/evm_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,9 @@ void TraceTracer::on_execution_start(evmc_revision rev, const evmc_message& msg,
current_depth_ = msg.depth;

auto create = (!initial_ibs_.exists(recipient) && created_address_.find(recipient) == created_address_.end() && recipient != code_address);

if (last_opcode_) {
create = create || last_opcode_.value() == OP_CREATE2 || last_opcode_.value() == OP_CREATE;
}
start_gas_.push(msg.gas);

size_t index = traces_.size();
Expand Down Expand Up @@ -937,6 +939,8 @@ void TraceTracer::on_execution_end(const evmc_result& result, const silkworm::In
is_precompile_ = false;
return;
}
if (index_stack_.empty())
return;

if (index_stack_.empty()) {
return;
Expand Down Expand Up @@ -1042,6 +1046,7 @@ void TraceTracer::on_creation_completed(const evmc_result& result, const silkwor
auto start_gas = start_gas_.top();
index_stack_.pop();
start_gas_.pop();

Trace& trace = traces_[index];
trace.trace_result->gas_used = start_gas - result.gas_left;
}
Expand Down

0 comments on commit c497134

Please sign in to comment.