Skip to content

Commit

Permalink
Update EIP-7756: Eip7756/table layout
Browse files Browse the repository at this point in the history
Merged by EIP-Bot.
  • Loading branch information
shemnon authored Dec 15, 2024
1 parent d30c484 commit 8bfb155
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions EIPS/eip-7756.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ described in RFC 2119 and RFC 8174.
| Key-Value | Key-Value structure with key and values encoded as hex strings | `"storage":{"0x0":"0x1", "0x1":"0x1"}` |
| Boolean | Json bool can either be true or false | `"pass": true` |

- Clients may OPTIONALLY output Number where a Hex-Number is expected and vice-versa. Clients that
do this SHOULD provide a CLI option to strictly observe the correct output type.
- Numbers larger than 2^53 - 1 must be represented as Hex-Numbers. This is a limitation of JSON.
- Consumers of EIP-7756 traces SHOULD be written in a way that members of type Hex-Number and
Number may be provided a Number or Hex-Number instead, respectively.
- Note that there is no string formatted decimal number alternative. Decimal representations are
always JSON numbers, and hex representations are always strings encoding hex numbers.

### Output

- The client outputs one JSON object per EVM operation executed.
Expand All @@ -67,9 +75,9 @@ Each trace line MUST have these fields.
| Name | Type | Explanation |
|----------|----------------------|---------------------------------------------------------------------|
| `pc` | Number | Program Counter |
| `op` | Number | OpCode |
| `op` | Hex-Number | OpCode |
| `opName` | String | Name of the operation |
| `gas` | Hex-Number | Gas left before executing this operation |
| `gas` | Number | Gas left before executing this operation |
| `stack` | Array of Hex-Numbers | Array of all values on the stack |
| `depth` | Number | Depth of the call stack |
| `error` | Hex-String | Description of an error (SHOULD contain revert reason if supported) |
Expand Down Expand Up @@ -99,7 +107,7 @@ Each trace line SHOULD have these fields in the conditions they are indicated fo

| Name | Type | Explanation |
|--------------|------------|-----------------------------------|
| `gasCost` | Hex-Number | Gas cost of this operation |
| `gasCost` | Number | Gas cost of this operation |
| `memSize` | Number | Size of memory array |
| `returnData` | Hex-String | Data returned by function call |
| `refund` | Hex-Number | Amount of **global** gas refunded |
Expand Down Expand Up @@ -154,7 +162,7 @@ This info SHOULD have the following members.
|-------------|------------|--------------------------------------------------------|
| `stateRoot` | Hex-String | Root of the state trie after executing the transaction |
| `output` | Hex-String | Return values of the function |
| `gasUsed` | Hex-Number | All gas used by the transaction |
| `gasUsed` | Number | All gas used by the transaction |
| `pass` | Boolean | If the tx was successful, or if the test passed |
| `time` | Number | Time in nanoseconds needed to execute the transaction |
| `fork` | String | Name of the fork rules used for execution |
Expand Down Expand Up @@ -188,6 +196,8 @@ except as outlined below
### Changes from EIP-3155

- The term Client Under Test or CUT has been replaced simply with "client."
- `gas`, `gasCost`, and `gasUsed` are now Number types.
- `opcode` is now a Hex-Number type.

### Additions to EIP-3155

Expand All @@ -197,6 +207,9 @@ except as outlined below
- The `section` and `functionDepth` members were added to support [EIP-4750](./eip-4750) EOF
Functions.
- Added clarification around where `pc` indexes when run in an EOF container.
- Added Hex-Number/Number interchangeability expectations. Clients MAY provide either types when
one is specified and consumers SHOULD be prepared to accept either type. Clients SHOULD provide a
flag to output members with the specified number type only.

### Clients

Expand All @@ -211,20 +224,21 @@ parameterized executions of [test_eof_functions_contract_call_succeed](https://g
Memory and return data is disabled.

```json lines
{"pc":0,"op":96,"gas":"0x2fa9e78","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":2,"op":96,"gas":"0x2fa9e75","gasCost":"0x3","memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":4,"op":96,"gas":"0x2fa9e72","gasCost":"0x3","memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":6,"op":96,"gas":"0x2fa9e6f","gasCost":"0x3","memSize":0,"stack":["0x0","0x0","0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":8,"op":96,"gas":"0x2fa9e6c","gasCost":"0x3","memSize":0,"stack":["0x0","0x0","0x0","0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":10,"op":97,"gas":"0x2fa9e69","gasCost":"0x3","memSize":0,"stack":["0x0","0x0","0x0","0x0","0x0"],"depth":1,"refund":0,"opName":"PUSH2"}
{"pc":13,"op":90,"gas":"0x2fa9e66","gasCost":"0x2","memSize":0,"stack":["0x0","0x0","0x0","0x0","0x0","0x1000"],"depth":1,"refund":0,"opName":"GAS"}
{"pc":14,"op":241,"gas":"0x2fa9e64","gasCost":"0x2eeb414","memSize":0,"stack":["0x0","0x0","0x0","0x0","0x0","0x1000","0x2fa9e64"],"depth":1,"refund":0,"opName":"CALL"}
{"pc":0,"section":0,"op":227,"immediate":"0x0001","gas":"0x2eea9ec","gasCost":"0x5","memSize":0,"stack":[],"depth":2,"refund":0,"opName":"CALLF"}
{"pc":0,"section":1,"op":228,"gas":"0x2eea9e7","gasCost":"0x3","memSize":0,"stack":[],"depth":2,"functionDepth":1,"refund":0,"opName":"RETF"}
{"pc":3,"section":0,"op":0,"gas":"0x2eea9e4","gasCost":"0x0","memSize":0,"stack":[],"depth":2,"refund":0,"opName":"STOP"}
{"pc":15,"op":96,"gas":"0x2fa9434","gasCost":"0x3","memSize":0,"stack":["0x1"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":17,"op":85,"gas":"0x2fa9431","gasCost":"0x5654","memSize":0,"stack":["0x1","0x0"],"depth":1,"refund":0,"opName":"SSTORE"}
{"pc":18,"op":0,"gas":"0x2fa3ddd","gasCost":"0x0","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"}
{"pc":0,"op":"0x60","gas":49979000,"gasCost":3,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":2,"op":"0x60","gas":49978997,"gasCost":3,"memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":4,"op":"0x60","gas":49978994,"gasCost":3,"memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":6,"op":"0x60","gas":49978991,"gasCost":3,"memSize":0,"stack":["0x0","0x0","0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":8,"op":"0x60","gas":49978988,"gasCost":3,"memSize":0,"stack":["0x0","0x0","0x0","0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":10,"op":"0x61","gas":49978985,"gasCost":3,"memSize":0,"stack":["0x0","0x0","0x0","0x0","0x0"],"depth":1,"refund":0,"opName":"PUSH2"}
{"pc":13,"op":"0x5a","gas":49978982,"gasCost":2,"memSize":0,"stack":["0x0","0x0","0x0","0x0","0x0","0x1000"],"depth":1,"refund":0,"opName":"GAS"}
{"pc":14,"op":"0xf1","gas":49978980,"gasCost":49198100,"memSize":0,"stack":["0x0","0x0","0x0","0x0","0x0","0x1000","0x2fa9e64"],"depth":1,"refund":0,"opName":"CALL"}
{"pc":25,"section":0,"op":"0xe3","immediate":"0x0001","gas":49195500,"gasCost":5,"memSize":0,"stack":[],"depth":2,"refund":0,"opName":"CALLF"}
{"pc":29,"section":1,"op":"0xe4","gas":49195495,"gasCost":3,"memSize":0,"stack":[],"depth":2,"functionDepth":2,"refund":0,"opName":"RETF"}
{"pc":28,"section":0,"op":"0x00","gas":49195492,"gasCost":0,"memSize":0,"stack":[],"depth":2,"refund":0,"opName":"STOP"}
{"pc":15,"op":"0x60","gas":49976372,"gasCost":3,"memSize":0,"stack":["0x1"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":17,"op":"0x55","gas":49976369,"gasCost":22100,"memSize":0,"stack":["0x1","0x0"],"depth":1,"refund":0,"opName":"SSTORE"}
{"pc":18,"op":"0x00","gas":49954269,"gasCost":0,"memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP"}
{"output":"","gasUsed":45731,"fork":"Osaka","postHash":"0x2c47b4070c1eef501d9548959c3abde2d8dc78ed1d819697c61d2b0861cc78cf","pass":true}
```

## Security Considerations
Expand Down

0 comments on commit 8bfb155

Please sign in to comment.