Expand description
snap/2 state synchronization for EIP-8189.
Coordinates a state bootstrap that starts from a recent pivot block, downloads accounts, storage and bytecode authenticated against that pivot’s state root, and advances the pivot with EIP-7928 block access lists as the chain moves past it.
This crate owns download progress only. Authenticated downloads come from
reth-downloaders, and verified state is handed back to node integration once its trie root
matches the target header.
Downloaded state goes into the hashed state tables, owned by an attempt record that commits with it. Scheduling, in-flight requests and cancellation stay in memory.
use reth_snap_sync::SnapPivotPolicy;
let policy = SnapPivotPolicy::default();
// Without a finalized block, anchor at the EIP's example distance.
assert_eq!(policy.pivot_block(1_000, None), Some(936));
// A recent finalized block is anchored to directly.
assert_eq!(policy.pivot_block(1_000, Some(950)), Some(950));
// Stalled finality falls back to the example distance.
assert_eq!(policy.pivot_block(1_000, Some(500)), Some(936));
// A chain shorter than the head distance has no pivot yet.
assert_eq!(policy.pivot_block(4, None), None);Structs§
- Snap
Generation - One attempt at downloading state, anchored to the pivot block it targets.
- Snap
Pivot Policy - Distance and history bounds that decide where a generation is anchored.
- Snap
Sync Session - One snap synchronization attempt, from the pivot it targets to the work it owns.
- Snap
Write - What a write presents to prove it belongs to the attempt owning the persisted state.
Enums§
- Snap
Phase - The stage a
SnapGenerationhas reached. - Snap
Sync Error - Error returned while assembling a snap state generation.
- Snap
Sync Session State - What a
SnapSyncSessionis doing.
Traits§
- Snap
Attempt Store - Persistence for the attempt that owns downloaded snap state.