erigontech / erigontech/silkworm

evmone: missing specific error string for OOG in check_memory

Open
#2,745 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
318
Forks
84
PR merge metrics
No merged PRs in 30d

Description

Calling

```
{
"jsonrpc":"2.0",
"method":"debug_traceTransaction",
"params":[
"0x2a4e49c20034492eabf4a82d50994e3c49ecc1ee733d189059304c1e285305ab",
{"disableStorage": true,"disableMemory": true,"disableStack": true}
],
"id":1
}

```
the silkworm RPC JSON result differs from erigon in the trace `error` field for opcode `CODECOPY` at `PC 70` (the last one).
That's due to the check made in [check_memory](https://github.com/erigontech/evmone/blob/1aa56aebb472bfee4901047f369809c85c2ed82c/lib/evmone/instructions.hpp#L476).

The `size` value passed to `check_memory` is

[0] = 6148606209921031844
[1] = 744862842900218413
[2] = 2901806814
[3] = 0

that does not fit into `uint64_t` type. The `check_memory` function returns `false` and so `codecopy` function returns the status code `EVMC_OUT_OF_GAS`. We would need to receive also an error string indicating the specific reason for the OOG error.

Current JSON result:
```
{
"depth": 1,
"error": "out of gas",
"gas": 426354,
"gasCost": 3,
"op": "CODECOPY",
"pc": 70
}
```

Expected JSON result:
```
{
"depth": 1,
"error": "gas uint64 overflow",
"gas": 426354,
"gasCost": 3,
"op": "CODECOPY",
"pc": 70
}
```

See also skipped integration tests in #2754

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.