1use crate::{Consensus, ConsensusError, FullConsensus, HeaderValidator, ReceiptRootBloom};
22use alloc::sync::Arc;
23use alloy_primitives::B256;
24use reth_execution_types::BlockExecutionResult;
25use reth_primitives_traits::{Block, NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader};
26
27#[derive(Debug, Copy, Clone, Default)]
32#[non_exhaustive]
33pub struct NoopConsensus;
34
35impl NoopConsensus {
36 pub fn arc() -> Arc<Self> {
38 Arc::new(Self::default())
39 }
40}
41
42impl<H> HeaderValidator<H> for NoopConsensus {
43 fn validate_header(&self, _header: &SealedHeader<H>) -> Result<(), ConsensusError> {
45 Ok(())
46 }
47
48 fn validate_header_against_parent(
50 &self,
51 _header: &SealedHeader<H>,
52 _parent: &SealedHeader<H>,
53 ) -> Result<(), ConsensusError> {
54 Ok(())
55 }
56}
57
58impl<B: Block> Consensus<B> for NoopConsensus {
59 fn validate_body_against_header(
61 &self,
62 _body: &B::Body,
63 _header: &SealedHeader<B::Header>,
64 ) -> Result<(), ConsensusError> {
65 Ok(())
66 }
67
68 fn validate_block_pre_execution(&self, _block: &SealedBlock<B>) -> Result<(), ConsensusError> {
70 Ok(())
71 }
72}
73
74impl<N: NodePrimitives> FullConsensus<N> for NoopConsensus {
75 fn validate_block_post_execution(
77 &self,
78 _block: &RecoveredBlock<N::Block>,
79 _result: &BlockExecutionResult<N::Receipt>,
80 _receipt_root_bloom: Option<ReceiptRootBloom>,
81 _block_access_list_hash: Option<B256>,
82 ) -> Result<(), ConsensusError> {
83 Ok(())
84 }
85}