Skip to content

Commit c7de6af

Browse files
authored
Update EIP-4762: Cleanup/refactor the text as per clarifications
Merged by EIP-Bot.
1 parent 9590d79 commit c7de6af

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

EIPS/eip-4762.md

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_storage_slot_tree_keys(storage_key: int) -> [int, int]:
3535

3636
### Access events
3737

38-
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.
38+
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:
3939

4040
#### Access events for account headers
4141

@@ -46,21 +46,21 @@ When:
4646
3. any address is the target of the `BALANCE` opcode
4747
4. a _deployed_ contract calls `CODECOPY`
4848

49-
process this access events:
49+
process this access event:
5050

5151
```
5252
(address, 0, BASIC_DATA_LEAF_KEY)
5353
```
5454

5555
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.
5656

57-
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:
57+
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:
5858

5959
```
60-
(origin, 0, BASIC_DATA_LEAF_KEY)
60+
(caller, 0, BASIC_DATA_LEAF_KEY)
6161
```
6262

63-
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`.
63+
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`.
6464

6565
When calling `EXTCODEHASH` on a non-precompile target, process the access event:
6666

@@ -111,21 +111,21 @@ In the conditions below, “chunk chunk_id is accessed” is understood to mean
111111

112112
### Write Events
113113

114-
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.
114+
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.
115115

116116
#### Write events for account headers
117117

118118
When a nonzero-balance-sending `*CALL` or `SELFDESTRUCT` with a given sender and recipient takes place, process these write events:
119119

120120
```
121-
(origin, 0, BASIC_DATA_LEAF_KEY)
122-
(target, 0, BASIC_DATA_LEAF_KEY)
121+
(caller, 0, BASIC_DATA_LEAF_KEY)
122+
(callee, 0, BASIC_DATA_LEAF_KEY)
123123
```
124124

125125
if no account exists at `callee_address`, also process:
126126

127127
```
128-
(target, 0, CODEHASH_LEAF_KEY)
128+
(callee, 0, CODEHASH_LEAF_KEY)
129129
```
130130

131131
When a contract creation is initialized, process these write events:
@@ -166,7 +166,7 @@ For `i` in `0 ... (len(code)+30)//31`.
166166

167167
Note: since no access list existed for code up until this EIP, note that no warm costs are charged for code accesses.
168168

169-
### Transactions
169+
### Transaction
170170

171171
#### Access events
172172

@@ -221,15 +221,13 @@ When executing a transaction, maintain four sets:
221221

222222
When an **access** event of `(address, sub_key, leaf_key)` occurs, perform the following checks:
223223

224-
* Perform the following steps unless `address` is either:
225-
* the transaction's originator;
226-
* the transactions's target;
224+
* Perform the following steps unless event is a _Transaction access event_;
227225
* If `(address, sub_key)` is not in `accessed_subtrees`, charge `WITNESS_BRANCH_COST` gas and add that tuple to `accessed_subtrees`.
228226
* 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`
229227

230228
When a **write** event of `(address, sub_key, leaf_key)` occurs, perform the following checks:
231229

232-
* If `address` is either the transaction's originator or target, skip the following steps.
230+
* If event is _Transaction write event_, skip the following steps.
233231
* If `(address, sub_key)` is not in `edited_subtrees`, charge `SUBTREE_EDIT_COST` gas and add that tuple to `edited_subtrees`.
234232
* 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`
235233
* 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
243241
* this minimum 1/64th gas reservation is checked **AFTER** charging the witness costs when performing a `CALL`, `CODECALL`, `DELEGATECALL` or`STATICCALL`
244242
* this 1/64th of the gas is subtracted **BEFORE** charging the witness costs when performing a `CREATE` or `CREATE2`
245243

246-
### Replacement for access lists
247-
248-
We replace [EIP-2930](./eip-2930.md) access lists with an SSZ structure of the form:
249-
250-
```python
251-
class AccessList(Container):
252-
addresses: List[AccountAccessList, ACCESS_LIST_MAX_ELEMENTS]
253-
254-
class AccountAccessList(Container):
255-
address: Address32
256-
subtrees: List[AccessSubtree, ACCESS_LIST_MAX_ELEMENTS]
257-
258-
class AccessSubtree(Container):
259-
subtree_key: uint256
260-
elements: BitVector[256]
261-
```
262-
263244
### Block-level operations
264245

265246
None of:

0 commit comments

Comments
 (0)