Hi @Nerolation,
@CPerezz and I are looking for some feedback on the feasibility of using BAL as a vehicle for the payload needed by nodes to become partially stateful. The proposal’s timeline is post - Glamsterdam.
I’m writing the TL;DR on partial statefulness below for context, followed by the link to the Hackmd note containing more detailed information, including the high-level proposed spec changes:
Abstract
With the advent of zero-knowledge proofs, and stateless attesting nodes, state growth and the lack of decentralized RPC access could have a compounded down-side effect on the network: builders might be the only entities that will be incentivised to continue to serve state or answer RPC requests in the future, due to the rational behavior of network participants. This might run Ethereum’s data layer dry.
The gist of Partial Statefulness
Partial statefulness can be viewed as a topology-based approach to state growth and state serving.
Partial statefulness does not require every node to store complex datasets (the entire tree), instead, it makes use of selective persistence , i.e. storing domain-separated subtrees, while a widely affordable and minimal dataset of global commitments, keeps nodes coherent under the canonical state root.
State Topology - refresher
Looking at Ethereum state as a partially divisible graph, we can identify certain state subtrees as functional domains, i.e. Accounts and Contract Storage. Domain separation supports partial statefulness and could help state expiry tooling and enable better caching strategies.
How make partial statefulness technically possible?
In order for partial nodes to be able to correctly store and offer verified slices of state, as well as proofs, they must check two main conditions:
- They must be coherent. Partial nodes must maintain the tip of the trie and ensure that their stored state sits under the canonical chain.
- They must be Merkle-proof capable. In order to be proof-capable, partial nodes will need to prove that a specific state or storage is correctly included in the account or storage tries, without persisting the entire state. For that it is mandatory to pass all the siblings of a particular node along the path to state root (the authentication path), otherwise the hash of their local storage would not make sense.
Minimal local state
-
For coherence, partially stateful nodes MUST, at least store accountHash for all accounts. Nodes could store it as an address → accountHash map (~ 10 GB). This dataset is small enough for modest machines, yet complete enough to verify any account’s correct inclusion under the state root, and verify any account or contract changes.
-
For proof capabilities, the nodes MUST locally persist the Merkle path any tracked account or contract, alongside the minimal data set required for coherence.
Syncing via block enforced diffs
Two types of diffs are needed to to unlock partial state storage, in a coherent, persistent and consistent way, without re-execution:
i. Full-state diffs - a list of all nonce, balance, storage and code changes that the current
block induces to a certain account. These block-enforced state full diffs allow partial nodes to update the stored state values and keep local state persistent - EIP-7928 already adds this to protocol.
ii. Account-hash diffs - the hashes of the account state for the addresses touched by the current block →old_accountHash and their updated correspondent hash after executing the block’s txs →new_accountHash.
These block-enforced state hash diffs allow partial nodes to be synchronized with the global state-root - We see BAL as the ideal vehicle for hash-diffs.
Partial Statefulness capability ladder
Depending on the complexity of locally stored data sets, we have different levels of partial statefulness functionality. The richer the locally stored dataset, the more nodes becomes less dependent on third-party RPC / state providers, while still staying far below “full node” requirements.
The scope of this proposal is to add protocol native support for the minimal payload needed to make partial statefulness functional (the account-hash diffs) leaving the extra functionality optional, for node operators to decide.
Resources