diff --git a/EIPS/eip-4762.md b/EIPS/eip-4762.md index 7ba1a830d7266..eec94f0c1c84e 100644 --- a/EIPS/eip-4762.md +++ b/EIPS/eip-4762.md @@ -35,7 +35,7 @@ def get_storage_slot_tree_keys(storage_key: int) -> [int, int]: ### Access events -We define access events as follows. When an access event takes place, the accessed data is saved to the Verkle tree (even if it was not modified). An access event is of the form`(address, sub_key, leaf_key)`, determining what data is being accessed. +Whenever the state is read, one or more of the access events of the form`(address, sub_key, leaf_key)` take place, determining what data is being accessed. We define access events as follows: #### Access events for account headers @@ -46,7 +46,7 @@ When: 3. any address is the target of the `BALANCE` opcode 4. a _deployed_ contract calls `CODECOPY` -process this access events: +process this access event: ``` (address, 0, BASIC_DATA_LEAF_KEY) @@ -54,13 +54,13 @@ process this access events: Note: a non-value-bearing `SELFDESTRUCT` or `*CALL`, targetting a precompile, will not cause the `BASIC_DATA_LEAF_KEY` to be added to the witness. -If a `*CALL` or `SELFDESTRUCT` is value-bearing (ie. it transfers nonzero wei), whether or not the callee is a precompile, process this additional access event: +If a `*CALL` or `SELFDESTRUCT` is value-bearing (ie. it transfers nonzero wei), whether or not the `callee` is a precompile, process this additional access event: ``` -(origin, 0, BASIC_DATA_LEAF_KEY) +(caller, 0, BASIC_DATA_LEAF_KEY) ``` -Note: when checking for the existence of the callee, the existence check is done by validating that there is an extension-and-suffix tree at the corresponding stem, and does not rely on `CODEHASH_LEAF_KEY`. +Note: when checking for the existence of the `callee`, the existence check is done by validating that there is an extension-and-suffix tree at the corresponding stem, and does not rely on `CODEHASH_LEAF_KEY`. When calling `EXTCODEHASH` on a non-precompile target, process the access event: @@ -111,21 +111,21 @@ In the conditions below, “chunk chunk_id is accessed” is understood to mean ### Write Events -We define **write events** as follows. Note that when a write takes place, an access event also takes place (so the definition below should be a subset of the definition of access lists) A write event is of the form `(address, sub_key, leaf_key)`, determining what data is being written to. +We define **write events** as follows. Note that when a write takes place, an access event also takes place (so the definition below should be a subset of the definition of access events). A write event is of the form `(address, sub_key, leaf_key)`, determining what data is being written to. #### Write events for account headers When a nonzero-balance-sending `*CALL` or `SELFDESTRUCT` with a given sender and recipient takes place, process these write events: ``` -(origin, 0, BASIC_DATA_LEAF_KEY) -(target, 0, BASIC_DATA_LEAF_KEY) +(caller, 0, BASIC_DATA_LEAF_KEY) +(callee, 0, BASIC_DATA_LEAF_KEY) ``` if no account exists at `callee_address`, also process: ``` -(target, 0, CODEHASH_LEAF_KEY) +(callee, 0, CODEHASH_LEAF_KEY) ``` When a contract creation is initialized, process these write events: @@ -166,7 +166,7 @@ For `i` in `0 ... (len(code)+30)//31`. Note: since no access list existed for code up until this EIP, note that no warm costs are charged for code accesses. -### Transactions +### Transaction #### Access events @@ -221,15 +221,13 @@ When executing a transaction, maintain four sets: When an **access** event of `(address, sub_key, leaf_key)` occurs, perform the following checks: - * Perform the following steps unless `address` is either: - * the transaction's originator; - * the transactions's target; + * Perform the following steps unless event is a _Transaction access event_; * If `(address, sub_key)` is not in `accessed_subtrees`, charge `WITNESS_BRANCH_COST` gas and add that tuple to `accessed_subtrees`. * If `leaf_key` is not `None` and `(address, sub_key, leaf_key)` is not in `accessed_leaves`, charge `WITNESS_CHUNK_COST` gas and add it to `accessed_leaves` When a **write** event of `(address, sub_key, leaf_key)` occurs, perform the following checks: - * If `address` is either the transaction's originator or target, skip the following steps. + * If event is _Transaction write event_, skip the following steps. * If `(address, sub_key)` is not in `edited_subtrees`, charge `SUBTREE_EDIT_COST` gas and add that tuple to `edited_subtrees`. * If `leaf_key` is not `None` and `(address, sub_key, leaf_key)` is not in `edited_leaves`, charge `CHUNK_EDIT_COST` gas and add it to `edited_leaves` * Additionally, if there was no value stored at `(address, sub_key, leaf_key)` (ie. the state held `None` at that position), charge `CHUNK_FILL_COST` @@ -243,23 +241,6 @@ Note that values should only be added to the witness if there is sufficient gas * this minimum 1/64th gas reservation is checked **AFTER** charging the witness costs when performing a `CALL`, `CODECALL`, `DELEGATECALL` or`STATICCALL` * this 1/64th of the gas is subtracted **BEFORE** charging the witness costs when performing a `CREATE` or `CREATE2` -### Replacement for access lists - -We replace [EIP-2930](./eip-2930.md) access lists with an SSZ structure of the form: - -```python -class AccessList(Container): - addresses: List[AccountAccessList, ACCESS_LIST_MAX_ELEMENTS] - -class AccountAccessList(Container): - address: Address32 - subtrees: List[AccessSubtree, ACCESS_LIST_MAX_ELEMENTS] - -class AccessSubtree(Container): - subtree_key: uint256 - elements: BitVector[256] -``` - ### Block-level operations None of: