chore: Move consensus trait to standalone crate (#7757)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
ThreeHrSleep
2024-04-23 17:20:19 +05:30
committed by GitHub
parent 3224837523
commit 6d2e20cd85
66 changed files with 185 additions and 146 deletions

View File

@ -18,6 +18,7 @@ reth-db.workspace = true
reth-interfaces.workspace = true
reth-static-file.workspace = true
reth-tokio-util.workspace = true
reth-consensus.workspace = true
# metrics
reth-metrics.workspace = true

View File

@ -1,5 +1,6 @@
use reth_consensus::ConsensusError;
use reth_interfaces::{
consensus, db::DatabaseError as DbError, executor, p2p::error::DownloadError, RethError,
db::DatabaseError as DbError, executor, p2p::error::DownloadError, RethError,
};
use reth_primitives::{BlockNumber, SealedHeader, StaticFileSegment, TxNumber};
use reth_provider::ProviderError;
@ -13,7 +14,7 @@ use tokio::sync::mpsc::error::SendError;
pub enum BlockErrorKind {
/// The block encountered a validation error.
#[error("validation error: {0}")]
Validation(#[from] consensus::ConsensusError),
Validation(#[from] ConsensusError),
/// The block encountered an execution error.
#[error("execution error: {0}")]
Execution(#[from] executor::BlockExecutionError),
@ -49,7 +50,7 @@ pub enum StageError {
header: Box<SealedHeader>,
/// The error that occurred when attempting to attach the header.
#[source]
error: Box<consensus::ConsensusError>,
error: Box<ConsensusError>,
},
/// The headers stage is missing sync gap.
#[error("missing sync gap")]

View File

@ -552,8 +552,8 @@ mod tests {
use super::*;
use crate::{test_utils::TestStage, UnwindOutput};
use assert_matches::assert_matches;
use reth_consensus::ConsensusError;
use reth_interfaces::{
consensus,
provider::ProviderError,
test_utils::{generators, generators::random_header},
};
@ -922,9 +922,7 @@ mod tests {
5,
Default::default(),
)),
error: BlockErrorKind::Validation(
consensus::ConsensusError::BaseFeeMissing,
),
error: BlockErrorKind::Validation(ConsensusError::BaseFeeMissing),
}))
.add_unwind(Ok(UnwindOutput { checkpoint: StageCheckpoint::new(0) }))
.add_exec(Ok(ExecOutput { checkpoint: StageCheckpoint::new(10), done: true })),