1use std::{fmt::Debug, sync::Arc};
8
9use reth_chainspec::{EthChainSpec, EthereumHardforks};
10use reth_consensus::{Consensus, ConsensusError, FullConsensus, HeaderValidator};
11use reth_execution_types::BlockExecutionResult;
12use reth_primitives_traits::{
13 Block, BlockHeader, NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader,
14};
15
16#[derive(Debug, Clone, PartialEq, Eq)]
21pub struct ArbConsensus<CS> {
22 chain_spec: Arc<CS>,
23}
24
25impl<CS> ArbConsensus<CS> {
26 pub fn new(chain_spec: Arc<CS>) -> Self {
28 Self { chain_spec }
29 }
30}
31
32impl<H, CS> HeaderValidator<H> for ArbConsensus<CS>
33where
34 H: BlockHeader,
35 CS: EthChainSpec<Header = H> + EthereumHardforks + Debug + Send + Sync,
36{
37 fn validate_header(&self, _header: &SealedHeader<H>) -> Result<(), ConsensusError> {
38 Ok(())
39 }
40
41 fn validate_header_against_parent(
42 &self,
43 _header: &SealedHeader<H>,
44 _parent: &SealedHeader<H>,
45 ) -> Result<(), ConsensusError> {
46 Ok(())
47 }
48}
49
50impl<B, CS> Consensus<B> for ArbConsensus<CS>
51where
52 B: Block,
53 CS: EthChainSpec<Header = B::Header> + EthereumHardforks + Debug + Send + Sync,
54{
55 fn validate_body_against_header(
56 &self,
57 _body: &B::Body,
58 _header: &SealedHeader<B::Header>,
59 ) -> Result<(), ConsensusError> {
60 Ok(())
61 }
62
63 fn validate_block_pre_execution(&self, _block: &SealedBlock<B>) -> Result<(), ConsensusError> {
64 Ok(())
65 }
66}
67
68impl<N, CS> FullConsensus<N> for ArbConsensus<CS>
69where
70 N: NodePrimitives,
71 CS: EthChainSpec<Header = N::BlockHeader> + EthereumHardforks + Debug + Send + Sync,
72{
73 fn validate_block_post_execution(
74 &self,
75 _block: &RecoveredBlock<N::Block>,
76 _result: &BlockExecutionResult<N::Receipt>,
77 _receipt_root_bloom: Option<reth_consensus::ReceiptRootBloom>,
78 ) -> Result<(), ConsensusError> {
79 Ok(())
80 }
81}