Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce header-erased StageError #13197

Closed
Rjected opened this issue Dec 6, 2024 · 0 comments · Fixed by #13198
Closed

Introduce header-erased StageError #13197

Rjected opened this issue Dec 6, 2024 · 0 comments · Fixed by #13198
Labels
A-sdk Related to reth's use as a library C-enhancement New feature or request

Comments

@Rjected
Copy link
Member

Rjected commented Dec 6, 2024

We currently have the following SealedHeader types in StageError:

/// A stage execution error.
#[derive(Error, Debug)]
pub enum StageError {
/// The stage encountered an error related to a block.
#[error("stage encountered an error in block #{number}: {error}", number = block.number)]
Block {
/// The block that caused the error.
block: Box<SealedHeader>,
/// The specific error type, either consensus or execution error.
#[source]
error: BlockErrorKind,
},
/// The stage encountered a downloader error where the responses cannot be attached to the
/// current head.
#[error(
"stage encountered inconsistent chain: \
downloaded header #{header_number} ({header_hash}) is detached from \
local head #{head_number} ({head_hash}): {error}",
header_number = header.number,
header_hash = header.hash(),
head_number = local_head.number,
head_hash = local_head.hash(),
)]
DetachedHead {
/// The local head we attempted to attach to.
local_head: Box<SealedHeader>,
/// The header we attempted to attach.
header: Box<SealedHeader>,
/// The error that occurred when attempting to attach the header.
#[source]
error: Box<ConsensusError>,
},
/// The headers stage is missing sync gap.
#[error("missing sync gap")]
MissingSyncGap,
/// The stage encountered a database error.
#[error("internal database error occurred: {0}")]
Database(#[from] DatabaseError),
/// Invalid pruning configuration
#[error(transparent)]
PruningConfiguration(#[from] PruneSegmentError),
/// Pruner error
#[error(transparent)]
Pruner(#[from] PrunerError),
/// Invalid checkpoint passed to the stage
#[error("invalid stage checkpoint: {0}")]
StageCheckpoint(u64),
/// Missing download buffer on stage execution.
/// Returned if stage execution was called without polling for readiness.
#[error("missing download buffer")]
MissingDownloadBuffer,
/// Download channel closed
#[error("download channel closed")]
ChannelClosed,
/// The stage encountered a database integrity error.
#[error("database integrity error occurred: {0}")]
DatabaseIntegrity(#[from] ProviderError),
/// Invalid download response. Applicable for stages which
/// rely on external downloaders
#[error("invalid download response: {0}")]
Download(#[from] DownloadError),
/// Database is ahead of static file data.
#[error("missing static file data for block number: {number}", number = block.number)]
MissingStaticFileData {
/// Starting block with missing data.
block: Box<SealedHeader>,
/// Static File segment
segment: StaticFileSegment,
},
/// The prune checkpoint for the given segment is missing.
#[error("missing prune checkpoint for {0}")]
MissingPruneCheckpoint(PruneSegment),
/// Post Execute Commit error
#[error("post execute commit error occurred: {_0}")]
PostExecuteCommit(&'static str),
/// Internal error
#[error(transparent)]
Internal(#[from] RethError),
/// The stage encountered a recoverable error.
///
/// These types of errors are caught by the [Pipeline][crate::Pipeline] and trigger a restart
/// of the stage.
#[error(transparent)]
Recoverable(Box<dyn core::error::Error + Send + Sync>),
/// The stage encountered a fatal error.
///
/// These types of errors stop the pipeline.
#[error(transparent)]
Fatal(Box<dyn core::error::Error + Send + Sync>),
}

This will be incompatible with other components once we make the Header type generic, for example when we make downloaders generic over the header type.

It would be nice if we didn't use the default SealedHeader type here, or created an error type that could be converted from a StageError<H: BlockHeader> type

@Rjected Rjected added A-sdk Related to reth's use as a library C-enhancement New feature or request labels Dec 6, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Reth Tracker Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sdk Related to reth's use as a library C-enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant