From 28ebf81e51136a823eef5044862f946d8de9b723 Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Mon, 18 Mar 2024 12:12:16 +0100 Subject: [PATCH] Update EIP-7620: minor fixes and clarifications in the spec Merged by EIP-Bot. --- EIPS/eip-7620.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/EIPS/eip-7620.md b/EIPS/eip-7620.md index 43822c1146c08a..e6eb04b189722f 100644 --- a/EIPS/eip-7620.md +++ b/EIPS/eip-7620.md @@ -35,6 +35,7 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S | `MAX_INITCODE_COUNT` | `256` | | `GAS_KECCAK256_WORD` | Defined as `6` in the [Ethereum Execution Layer Specs](https://github.com/ethereum/execution-specs/blob/0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba/src/ethereum/shanghai/vm/gas.py#L37C1-L37C19) | | `TX_CREATE_COST` | Defined as `32000` in the [Ethereum Execution Layer Specs](https://github.com/ethereum/execution-specs/blob/0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba/src/ethereum/shanghai/fork_types.py#L42) | +| `STACK_DEPTH_LIMIT` | Defined as `1024` in the [Ethereum Execution Layer Specs](https://github.com/ethereum/execution-specs/blob/0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba/src/ethereum/shanghai/vm/interpreter.py#L60) | | `GAS_CODE_DEPOSIT` | Defined as `200` in the [Ethereum Execution Layer Specs](https://github.com/ethereum/execution-specs/blob/0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba/src/ethereum/shanghai/vm/gas.py#L44) | | `TX_DATA_COST_PER_ZERO` | Defined as `4` in the [Ethereum Execution Layer Specs](https://github.com/ethereum/execution-specs/blob/0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba/src/ethereum/shanghai/fork_types.py#L41) | | `TX_DATA_COST_PER_NON_ZERO` | Defined as `16` in the [Ethereum Execution Layer Specs](https://github.com/ethereum/execution-specs/blob/0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba/src/ethereum/shanghai/fork_types.py#L40) | @@ -118,6 +119,8 @@ Details on each instruction follow in the next sections. - pop `value`, `salt`, `data_offset`, `data_size` from the operand stack - load initcode EOF subcontainer at `initcontainer_index` in the container from which `EOFCREATE` is executed - deduct `GAS_KECCAK256_WORD * ((initcontainer_size + 31) // 32)` gas (hashing charge) +- check that current call depth is below `STACK_DEPTH_LIMIT` and that caller balance is enough to transfer `value` + - in case of failure return 0 on the stack, caller's nonce is not updated and gas for initcode execution is not consumed. - follow steps in the [Initcontainer execution](#initcontainer-execution) below - deduct `GAS_CODE_DEPOSIT * deployed_code_size` gas @@ -129,11 +132,12 @@ Details on each instruction follow in the next sections. - fails (returns 0 on the stack) if such initcode does not exist in the transaction, or if called from a transaction of `TransactionType` other than `INITCODE_TX_TYPE` - caller's nonce is not updated and gas for initcode execution is not consumed. Only `TXCREATE` constant gas was consumed - deduct `INITCODE_WORD_COST * ((initcontainer_size + 31) // 32)` gas +- deduct `GAS_KECCAK256_WORD * ((initcontainer_size + 31) // 32)` gas (hashing charge) +- check that current call depth is below `STACK_DEPTH_LIMIT` and that caller balance is enough to transfer `value` - **validate the initcode container and all its subcontainers recursively** - in addition to this, check if the initcode container has its `len(data_section)` equal `data_size`, i.e. data section content is exactly as the size declared in the header (see [Data section lifecycle](#data-section-lifecycle)) -- fails (returns 0 on the stack) if any of those was invalid - - caller’s nonce is not updated and gas for initcode execution is not consumed. Only `TXCREATE` constant and [EIP-3860](./eip-3860.md) gas were consumed -- deduct `GAS_KECCAK256_WORD * ((initcontainer_size + 31) // 32)` gas (hashing charge) +- fails (returns 0 on the stack) if any of the checks above was invalid + - caller’s nonce is not updated and gas for initcode execution is not consumed. Only `TX_CREATE_COST` constant, [EIP-3860](./eip-3860.md) gas and hashing gas were consumed - follow steps in the [Initcontainer execution](#initcontainer-execution) below - deduct `GAS_CODE_DEPOSIT * deployed_code_size` gas