Skip to main content

reth_snap_sync/
error.rs

1//! Failures raised while assembling a snap state generation.
2
3use reth_storage_api::SnapAttemptId;
4use reth_storage_errors::provider::ProviderError;
5
6/// Error returned while assembling a snap state generation.
7#[derive(Debug, thiserror::Error)]
8pub enum SnapSyncError {
9    /// A header lookup failed.
10    #[error(transparent)]
11    Provider(#[from] ProviderError),
12    /// The storage layout keys state by address, which snap cannot fill in without preimages.
13    #[error("snap synchronization requires the hashed state layout")]
14    UnsupportedStorage,
15    /// No attempt owns the persisted state.
16    #[error("no snap attempt owns the persisted state")]
17    NoAttempt,
18    /// A write was presented for an attempt or pivot that no longer owns the persisted state.
19    #[error("stale snap write for attempt {attempt} at state version {state_version}")]
20    StaleWrite {
21        /// Attempt the rejected write claims.
22        attempt: SnapAttemptId,
23        /// State version the rejected write was proved against.
24        state_version: u64,
25    },
26}