Skip to main content

Crate bal_codec

Crate bal_codec 

Source
Expand description

EIP-7928 Block-Level Access List codec.

This crate is the only place the 7928 wire format is known. Everything above it (archive, layout, cli) consumes the typed structures and must not touch RLP.

Wire schema (from the EIP, Review status, subject to change):

StorageChange   = [BlockAccessIndex(u32), StorageValue(u256)]
BalanceChange   = [BlockAccessIndex(u32), Balance(u256)]
NonceChange     = [BlockAccessIndex(u32), Nonce(u64)]
CodeChange      = [BlockAccessIndex(u32), Bytecode(bytes)]
SlotChanges     = [StorageKey(u256), [StorageChange...]]
AccountChanges  = [Address, [SlotChanges...], [StorageKey...],
                   [BalanceChange...], [NonceChange...], [CodeChange...]]
BlockAccessList = [AccountChanges...]
block_access_list_hash = keccak256(rlp(BlockAccessList))

Ordering is part of validity: accounts by address, slots by key, changes by index, all strictly ascending. A BAL that violates ordering or uniqueness is rejected by BlockAccessList::decode; it is never softly accepted.

With the json feature, [BlockAccessList::from_rpc_json] accepts the execution-apis JSON form served by eth_getBlockAccessList.

Structs§

AccountChanges
Everything that happened to one account within the block.
BalanceChange
One balance change.
BlockAccessList
The whole list. Wire form is a bare RLP list of AccountChanges (no wrapping struct), so encoding is transparent over accounts.
CodeChange
One code change (deployment or self-destruct).
NonceChange
One nonce change.
SlotChanges
All writes to one slot within the block.
StorageChange
One write to a storage slot.

Enums§

CodecError
Decoding, validation and verification failures.

Constants§

EMPTY_BAL_HASH
Hash of the empty BAL: keccak256(rlp([])) = keccak256(0xc0).

Type Aliases§

BlockAccessIndex
Position of a change in the block’s life cycle. 0 = pre-execution system calls, 1..=n = transactions, n+1 = post-execution.