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 invalid data access for CREATE2 in trace_filter #2649

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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 @@ -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.33.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
git -c advice.detachedHead=false clone --depth 1 --branch v1.34.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
cd ${{runner.workspace}}/rpc-tests
pip3 install -r requirements.txt --break-system-packages

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;

auto index = index_stack_.top();
auto start_gas = start_gas_.top();
Expand Down Expand Up @@ -1038,6 +1042,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
Loading