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 undefined instruction error in trace_call #2020

Merged
merged 2 commits into from
May 13, 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.17.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
git -c advice.detachedHead=false clone --depth 1 --branch v0.17.1 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
cd ${{runner.workspace}}/rpc-tests
pip3 install -r requirements.txt

Expand Down
16 changes: 10 additions & 6 deletions silkworm/rpc/core/evm_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,16 +535,20 @@ void push_memory_offset_len(std::uint8_t op_code, const evmone::uint256* stack,
}
}

static std::string get_opcode_hex(uint8_t opcode) {
auto hex = evmc::hex(opcode);
if (opcode < 16) {
hex = hex.substr(1);
}
return hex;
}

std::string get_op_name(const char* const* names, std::uint8_t opcode) {
const auto name = names[opcode];
if (name != nullptr) {
return name;
}
auto hex = evmc::hex(opcode);
if (opcode < 16) {
hex = hex.substr(1);
}
return "opcode 0x" + hex + " not defined";
return "opcode 0x" + get_opcode_hex(opcode) + " not defined";
}

static const char* PADDING = "0x0000000000000000000000000000000000000000000000000000000000000000";
Expand Down Expand Up @@ -855,7 +859,7 @@ void TraceTracer::on_execution_end(const evmc_result& result, const silkworm::In
trace.trace_result.reset();
break;
case evmc_status_code::EVMC_UNDEFINED_INSTRUCTION:
trace.error = "invalid opcode: opcode 0x" + evmc::hex(current_opcode_.value_or(0)) + " not defined";
trace.error = "invalid opcode: opcode 0x" + get_opcode_hex(current_opcode_.value_or(0)) + " not defined";
trace.trace_result.reset();
break;
case evmc_status_code::EVMC_INVALID_INSTRUCTION:
Expand Down
Loading