Skip to main content

Module state

Module state 

Source

EnumsΒ§

EmptyStateStart πŸ”’
Where the state loop starts when it has no state of its own.

ConstantsΒ§

BOUNDARY_RETRY_INTERVAL πŸ”’
How long the loop waits before it retries a step of its start that failed, such as a try to start from a recent epoch boundary.
LOCAL_CATCHUP_TIMEOUT πŸ”’
How long the loop waits on a local catchup read. Consensus cuts local reads short, so that it can still vote in time. The loop has no such deadline, while peers may have pruned the heights it reads, so a slow read cut short on every try would stall it.
PRUNED_LEAF_CHECK_INTERVAL πŸ”’
How long the loop waits on the local leaf stream before checking whether the data pruner has passed the height it is waiting for.

TraitsΒ§

SequencerStateDataSource πŸ”’
SequencerStateUpdate πŸ”’

FunctionsΒ§

apply_leaf πŸ”’
Apply leaf to the merklized state, retrying until it is stored, then make it the parent.
compute_state_update πŸ”’
fetch_boundary_state πŸ”’
The state at the epoch boundary leaf, from catchup: the block frontier and the whole reward tree, each checked against its root in the boundary header.
fetch_pruned_leaves πŸ”’
The leaves at heights, which the data pruned height says are gone, from the query module’s peers through its light client, retrying until they arrive. The light client verifies leaves of every protocol version, and one proof covers the run: it proves the last leaf final and chains the rest to it. The loop needs each leaf once, so the leaves are stored neither in this database, where the pruner would only delete them again, nor in the light client’s cache.
follow_leaves πŸ”’
Apply every leaf above parent_leaf as it arrives. Leaves come from the local stream, except those the data pruner has already deleted: the availability layer never fetches a leaf at or below the data pruned height, so the stream would wait for one forever. Those come from peers, in runs. Returns when the stream ends, or when a leaf from peers does not extend the parent.
leaf_at πŸ”’
The leaf at height, from local storage, or from peers once the data pruner has deleted it.
load_parent_reward_tree πŸ”’
The reward tree of parent_leaf, from storage.
local_tip_above πŸ”’
The height of the newest block in local storage, once it is above pruned.
pruned_past πŸ”’
The data pruned height when it is at or above height. The leaf and header there are out of local reach: the pruner deleted them, and the availability layer never fetches below its marker. A failed read counts as not pruned; every caller asks again before long, and the loop must not end over a transient database error.
report_incomplete_trees πŸ”’
Archive nodes and nodes without a pruner are meant to have complete trees, which a state that started from a boundary snapshot, as on a node that was pruned before, never gets: the loop only moves forward. So say so.
retry_until_ok πŸ”’
Run f until it succeeds. An error would end the loop for good, possibly after a seed that waited minutes for peers, so the steps of its start retry, as the leaves it applies do.
seed_boundary_snapshot πŸ”’
Store a snapshot at a recent epoch boundary for a loop with no state of its own, and return the boundary, which the loop then resumes from as after a restart.
store_block_frontier πŸ”’
Store the frontier of block_merkle_tree, the block tree at block_number, as that snapshot’s block tree nodes.
store_boundary_snapshot πŸ”’
Store state, the state at the epoch boundary height, as the loop’s head snapshot. The loop keeps nothing of state: on every start it rebuilds the head’s state from the header and fills it from this database, so the head needs what a state update stores:
store_genesis_state πŸ”’
store_state_update πŸ”’
update_state_storage πŸ”’
update_state_storage_loop πŸ”’