From f547d9900a72607fd855e66fad1ea36f707533b0 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:43:55 +0200 Subject: [PATCH] eip6800: EOFv1 tweaks --- EIPS/eip-6800.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/EIPS/eip-6800.md b/EIPS/eip-6800.md index 9c3585682d3738..1627686956f5c9 100644 --- a/EIPS/eip-6800.md +++ b/EIPS/eip-6800.md @@ -116,7 +116,7 @@ Instead of a two-layer structure as in the Patricia tree, in the Verkle tree we | Parameter | Value | | --------------------- | ------- | | BASIC_DATA_LEAF_KEY | 0 | -| CODE_KECCAK_LEAF_KEY | 1 | +| CODEHASH_LEAF_KEY | 1 | | HEADER_STORAGE_OFFSET | 64 | | CODE_OFFSET | 128 | | VERKLE_NODE_WIDTH | 256 | @@ -158,8 +158,8 @@ def get_tree_key_for_basic_data(address: Address32): return get_tree_key(address, 0, BASIC_DATA_LEAF_KEY) # Backwards compatibility for EXTCODEHASH -def get_tree_key_for_code_keccak(address: Address32): - return get_tree_key(address, 0, CODE_KECCAK_LEAF_KEY) +def get_tree_key_for_codehash(address: Address32): + return get_tree_key(address, 0, CODEHASH_LEAF_KEY) ``` An account's `version`, `balance`, `nonce` and `code_size` fields are packed in the value found at `BASIC_DATA_LEAF_KEY`: @@ -175,7 +175,12 @@ Bytes `1..4` are reserved for future use. Note: the code size is stored on 3 bytes. To allow for an extension to 4 bytes without changing the account version is possible, reserved byte #4 should be allocated last. -When any account header field is set, the `version` field is also set to zero. The `code_keccak` and `code_size` fields are set upon contract or EoA creation. +The `code_hash` and `code_size` fields are set upon contract or EoA creation. + +`version` can have two values: + + * `0`, in which case this is a legacy contract. `code_hash` and `code_size` have the meaning they do in legacy contract; + * `1`, in which case this is an EOFv1 contract. The `code_size` field isn't set, and the `code_hash` leaf isn't created, as these values are known by the client. #### Code