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

[1.0 -> master] Do not rely on exists to determine if it's create in traces #222

Merged
merged 6 commits into from
Nov 4, 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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if(NOT SILKWORM_HAS_PARENT)
endif()

project(silkworm)
set(PROJECT_VERSION 1.0.5)
set(PROJECT_VERSION 1.0.7)

# conan must be initiailzed after project definition to properly detect target architecture.
if(NOT SILKWORM_HAS_PARENT)
Expand Down
9 changes: 5 additions & 4 deletions silkworm/silkrpc/core/evm_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ 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);
auto create = ((initial_ibs_.get_nonce(recipient) == 0 && initial_ibs_.get_code_hash(recipient) == kEmptyHash) && created_address_.find(recipient) == created_address_.end() && recipient != code_address);

start_gas_.push(msg.gas);

Expand Down Expand Up @@ -1675,7 +1675,7 @@ void CreateTracer::on_execution_start(evmc_revision, const evmc_message& msg, ev
auto recipient = evmc::address{msg.recipient};
auto code_address = evmc::address{msg.code_address};

bool create = (!initial_ibs_.exists(recipient) && recipient != code_address);
bool create = ((initial_ibs_.get_nonce(recipient) == 0 && initial_ibs_.get_code_hash(recipient) == kEmptyHash) && recipient != code_address);

if (create && recipient == contract_address_) {
this->found_ = true;
Expand All @@ -1696,7 +1696,8 @@ void EntryTracer::on_execution_start(evmc_revision, const evmc_message& msg, evm
auto sender = evmc::address{msg.sender};
auto recipient = evmc::address{msg.recipient};
auto code_address = evmc::address{msg.code_address};
bool create = (!initial_ibs_.exists(recipient) && recipient != code_address);

bool create = ((initial_ibs_.get_nonce(recipient) == 0 && initial_ibs_.get_code_hash(recipient) == kEmptyHash) && recipient != code_address);
auto input = silkworm::ByteView{msg.input_data, msg.input_size};

auto str_value = "0x" + intx::hex(intx::be::load<intx::uint256>(msg.value));
Expand Down Expand Up @@ -1753,7 +1754,7 @@ void OperationTracer::on_execution_start(evmc_revision, const evmc_message& msg,
auto depth = msg.depth;
auto kind = msg.kind;

bool create = (!initial_ibs_.exists(recipient) && recipient != code_address);
bool create = ((initial_ibs_.get_nonce(recipient) == 0 && initial_ibs_.get_code_hash(recipient) == kEmptyHash) && recipient != code_address);
auto str_value = "0x" + intx::hex(intx::be::load<intx::uint256>(msg.value));

if (create && msg.depth > 0) {
Expand Down
28 changes: 14 additions & 14 deletions silkworm/silkrpc/core/evm_trace_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1458,21 +1458,21 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_call with erro
"storage": {}
}
},
"trace": [
"trace":[
{
"action": {
"callType": "call",
"from": "0x578f0a154b23be77fc2033197fbc775637648ad4",
"gas": "0x261b2",
"input": "0x",
"to": "0x6951c35e335fa18c97cb207119133cd8009580cd",
"value": "0x0"
},
"error": "bad instruction",
"result": null,
"subtraces": 0,
"traceAddress": [],
"type": "call"
"action":{
"from":"0x578f0a154b23be77fc2033197fbc775637648ad4",
"gas":"0x261b2",
"init":"0x414bf3890000000000000000000000009d381f0b1637475f133c92d9b9fdc5493ae19b630000000000000000000000009b73fc193bfa16abe18d1ea30734e4a6444a753f0000000000000000000000000000000000000000000000000000000000002710000000000000000000000000578f0a154b23be77fc2033197fbc775637648ad400000000000000000000000000000000000000000000000000000000612ba19c00000000000000000000000000000000000000000001a784379d99db4200000000000000000000000000000000000000000000000002cdc48e6cca575707722c0000000000000000000000000000000000000000000000000000000000000000",
"value":"0x0"
},
"error":"bad instruction",
"result":null,
"subtraces":0,
"traceAddress":[
],
"type":"create"
}
],
"vmTrace": {
Expand Down
Loading