mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: remove reth-primitives dep from consensus (#14067)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -6734,7 +6734,6 @@ dependencies = [
|
||||
"alloy-primitives",
|
||||
"auto_impl",
|
||||
"derive_more",
|
||||
"reth-primitives",
|
||||
"reth-primitives-traits",
|
||||
]
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
|
||||
) -> eyre::Result<()> {
|
||||
let Environment { provider_factory, .. } = self.env.init::<N>(AccessRights::RW)?;
|
||||
|
||||
let consensus: Arc<dyn FullConsensus<Error = ConsensusError>> =
|
||||
let consensus: Arc<dyn FullConsensus<EthPrimitives, Error = ConsensusError>> =
|
||||
Arc::new(EthBeaconConsensus::new(provider_factory.chain_spec()));
|
||||
|
||||
// fetch the best block from the database
|
||||
|
||||
@ -12,7 +12,6 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
# reth
|
||||
reth-primitives.workspace = true
|
||||
reth-primitives-traits.workspace = true
|
||||
|
||||
# ethereum
|
||||
@ -27,7 +26,6 @@ derive_more.workspace = true
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"reth-primitives/std",
|
||||
"reth-primitives-traits/std",
|
||||
"alloy-primitives/std",
|
||||
"alloy-eips/std",
|
||||
@ -36,6 +34,5 @@ std = [
|
||||
"derive_more/std",
|
||||
]
|
||||
test-utils = [
|
||||
"reth-primitives/test-utils",
|
||||
"reth-primitives-traits/test-utils",
|
||||
]
|
||||
|
||||
@ -15,11 +15,10 @@ use alloc::{fmt::Debug, sync::Arc, vec::Vec};
|
||||
use alloy_consensus::Header;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{BlockHash, BlockNumber, Bloom, B256, U256};
|
||||
use reth_primitives::{
|
||||
EthPrimitives, GotExpected, GotExpectedBoxed, InvalidTransactionError, NodePrimitives, Receipt,
|
||||
RecoveredBlock, SealedBlock, SealedHeader,
|
||||
use reth_primitives_traits::{
|
||||
constants::MINIMUM_GAS_LIMIT, transaction::error::InvalidTransactionError, Block, GotExpected,
|
||||
GotExpectedBoxed, NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader,
|
||||
};
|
||||
use reth_primitives_traits::{constants::MINIMUM_GAS_LIMIT, Block};
|
||||
|
||||
/// A consensus implementation that does nothing.
|
||||
pub mod noop;
|
||||
@ -30,7 +29,7 @@ pub mod test_utils;
|
||||
|
||||
/// Post execution input passed to [`FullConsensus::validate_block_post_execution`].
|
||||
#[derive(Debug)]
|
||||
pub struct PostExecutionInput<'a, R = Receipt> {
|
||||
pub struct PostExecutionInput<'a, R> {
|
||||
/// Receipts of the block.
|
||||
pub receipts: &'a [R],
|
||||
/// EIP-7685 requests of the block.
|
||||
@ -47,7 +46,7 @@ impl<'a, R> PostExecutionInput<'a, R> {
|
||||
/// [`Consensus`] implementation which knows full node primitives and is able to validation block's
|
||||
/// execution outcome.
|
||||
#[auto_impl::auto_impl(&, Arc)]
|
||||
pub trait FullConsensus<N: NodePrimitives = EthPrimitives>: AsConsensus<N::Block> {
|
||||
pub trait FullConsensus<N: NodePrimitives>: AsConsensus<N::Block> {
|
||||
/// Validate a block considering world state, i.e. things that can not be checked before
|
||||
/// execution.
|
||||
///
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
use crate::{Consensus, ConsensusError, FullConsensus, HeaderValidator, PostExecutionInput};
|
||||
use alloc::sync::Arc;
|
||||
use alloy_primitives::U256;
|
||||
use reth_primitives::{NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader};
|
||||
use reth_primitives_traits::Block;
|
||||
use reth_primitives_traits::{Block, NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader};
|
||||
|
||||
/// A Consensus implementation that does nothing.
|
||||
#[derive(Debug, Copy, Clone, Default)]
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
use crate::{Consensus, ConsensusError, FullConsensus, HeaderValidator, PostExecutionInput};
|
||||
use alloy_primitives::U256;
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
use reth_primitives::{NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader};
|
||||
use reth_primitives_traits::Block;
|
||||
use reth_primitives_traits::{Block, NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader};
|
||||
|
||||
/// Consensus engine implementation for testing
|
||||
#[derive(Debug)]
|
||||
|
||||
@ -104,7 +104,7 @@ where
|
||||
fn validate_block_post_execution(
|
||||
&self,
|
||||
block: &RecoveredBlock<N::Block>,
|
||||
input: PostExecutionInput<'_>,
|
||||
input: PostExecutionInput<'_, N::Receipt>,
|
||||
) -> Result<(), ConsensusError> {
|
||||
validate_block_post_execution(block, &self.chain_spec, input.receipts, input.requests)
|
||||
}
|
||||
|
||||
@ -287,7 +287,7 @@ impl<Node> ConsensusBuilder<Node> for EthereumConsensusBuilder
|
||||
where
|
||||
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives>>,
|
||||
{
|
||||
type Consensus = Arc<dyn FullConsensus<Error = ConsensusError>>;
|
||||
type Consensus = Arc<dyn FullConsensus<EthPrimitives, Error = ConsensusError>>;
|
||||
|
||||
async fn build_consensus(self, ctx: &BuilderContext<Node>) -> eyre::Result<Self::Consensus> {
|
||||
Ok(Arc::new(EthBeaconConsensus::new(ctx.chain_spec())))
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
//! + 'static,
|
||||
//! Network: NetworkInfo + Peers + Clone + 'static,
|
||||
//! BlockExecutor: BlockExecutorProvider<Primitives = Provider::Primitives>,
|
||||
//! Consensus: FullConsensus<Error = ConsensusError> + Clone + 'static,
|
||||
//! Consensus: FullConsensus<Provider::Primitives, Error = ConsensusError> + Clone + 'static,
|
||||
//! Validator: PayloadValidator<Block = reth_primitives::Block>,
|
||||
//! {
|
||||
//! // configure the rpc module per transport
|
||||
@ -145,7 +145,7 @@
|
||||
//! EngineApi: EngineApiServer<EngineT>,
|
||||
//! EngineT: EngineTypes,
|
||||
//! BlockExecutor: BlockExecutorProvider<Primitives = Provider::Primitives>,
|
||||
//! Consensus: FullConsensus<Error = ConsensusError> + Clone + 'static,
|
||||
//! Consensus: FullConsensus<Provider::Primitives, Error = ConsensusError> + Clone + 'static,
|
||||
//! Validator: PayloadValidator<Block = reth_primitives::Block>,
|
||||
//! {
|
||||
//! // configure the rpc module per transport
|
||||
|
||||
Reference in New Issue
Block a user