Skip to main content

seed_boundary_snapshot

Function seed_boundary_snapshot 

Source
async fn seed_boundary_snapshot<T>(
    storage: &Arc<T>,
    instance: &NodeState,
    provider: &LightClientProvider,
) -> Option<u64>
where T: SequencerStateDataSource, for<'a> T::Transaction<'a>: SequencerStateUpdate,
Expand description

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.

The boundary is the newest one at or below the local tip, once the node holds a block above the data pruned height, or above genesis before the data pruner has run; a fresh node holds none until consensus decides one. It has to be recent: the reward tree is stored only at boundaries, and every node garbage collects all but the last few, so peers have no tree for an older snapshot.

The snapshot holds the block frontier and the reward tree, fetched from peers and checked against the boundary header. Peers serve fee accounts only by address, and the loop cannot know them all, so the fee tree starts empty and the catchup in apply_leaf fetches each account from peers when the loop first needs it. From V0.6 on no block reads one, so it stays empty.

Returns None, which leaves the loop to replay from genesis, when there is no boundary yet, or when it predates epoch rewards and so has no reward tree stored at it.