Skip to content

Commit

Permalink
Update EIP-6800: Clarify BASIC_DATA layout and update naming
Browse files Browse the repository at this point in the history
Merged by EIP-Bot.
  • Loading branch information
jsign authored Jul 24, 2024
1 parent ff802af commit d46092b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions EIPS/eip-6800.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| CODE_HASH_LEAF_KEY | 1 |
| HEADER_STORAGE_OFFSET | 64 |
| CODE_OFFSET | 128 |
| VERKLE_NODE_WIDTH | 256 |
Expand Down Expand Up @@ -158,11 +158,11 @@ 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_code_hash(address: Address32):
return get_tree_key(address, 0, CODE_HASH_LEAF_KEY)
```

An account's `version`, `balance`, `nonce` and `code_size` fields are packed in the value found at `BASIC_DATA_LEAF_KEY`:
An account's `version`, `balance`, `nonce` and `code_size` fields are packed with big-endian encoding in the value found at `BASIC_DATA_LEAF_KEY`:

| Name | Offset | Size |
| ----------- | ------ | ---- |
Expand All @@ -173,9 +173,9 @@ An account's `version`, `balance`, `nonce` and `code_size` fields are packed in

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.
The current layout and encoding allow for an extension of `code_size` to 4 bytes without changing the account version.

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.
When any account header field is set, the `version` field is also set to zero. The `codehash` and `code_size` fields are set upon contract or EoA creation.

#### Code

Expand Down

0 comments on commit d46092b

Please sign in to comment.