Skip to main content

evm_fork_cache/cold_start/
error.rs

1//! The typed error surface for cold-start runs.
2
3use crate::errors::CacheError;
4
5/// A hard error that aborts a cold-start round or run.
6///
7/// Deliberately typed (no blanket dynamic-error arm): composed-primitive
8/// errors are converted explicitly at call sites via [`ColdStartError::Fetch`], so
9/// a partial round's outcomes are never silently collapsed.
10#[derive(Debug, thiserror::Error)]
11pub enum ColdStartError {
12    /// A round declared verify/probe slots but the cache has no storage batch
13    /// fetcher configured.
14    #[error("cold-start requires a storage batch fetcher")]
15    NoBatchFetcher,
16    /// A round declared probe-roots accounts but the cache has no account proof
17    /// fetcher configured.
18    #[error("cold-start requires an account proof fetcher")]
19    NoAccountProofFetcher,
20    /// The cache holds pending code seeds but has no account-fields fetcher to
21    /// verify them with (fires only for pending-bearing rounds).
22    #[error("cold-start code-seed verification requires an account fields fetcher")]
23    NoAccountFieldsFetcher,
24    /// The planner kept returning `Continue` past `max_rounds` executed rounds.
25    #[error("cold-start round budget exceeded ({max_rounds})")]
26    RoundBudgetExceeded {
27        /// The configured maximum number of executed rounds.
28        max_rounds: usize,
29    },
30    /// A composed fetch/call error, carrying the underlying cause explicitly.
31    #[error("cold-start fetch error: {0}")]
32    Fetch(#[source] CacheError),
33}