paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
3.99k stars 1.21k forks source link

Use generic receipt in `InvalidBlockWitnessHook` impl #12675

Open emhane opened 2 days ago

emhane commented 2 days ago

Describe the feature

Replace reth_primitives::Receipt with reth_primitives_traits::ReceiptTy<P::Primitives> in InvalidBlockWitnessHook impl by adding additional trait bound P: NodeTypes to impl body. https://github.com/paradigmxyz/reth/blob/3408059393bcf03f6727f790ec52f28114e25d02/crates/engine/invalid-block-hooks/src/witness.rs#L40-L297

Additional context

No response

emhane commented 2 days ago

something you are keen on @tcoratger ? hang on till merged....https://github.com/paradigmxyz/reth/pull/12674

tcoratger commented 2 days ago

something you are keen on @tcoratger ? hang on till merged....#12674

This also requires a modification of the InvalidBlockHook trait then like

/// An invalid block hook.
pub trait InvalidBlockHook<P>: Send + Sync,
{
    /// Invoked when an invalid block is encountered.
    fn on_invalid_block(
        &self,
        parent_header: &SealedHeader,
        block: &SealedBlockWithSenders,
        output: &BlockExecutionOutput<ReceiptTy<P>>,
        trie_updates: Option<(&TrieUpdates, B256)>,
    );
}

is it really what we want?

emhane commented 1 day ago

we are generalising traits and types separately, the reason being to keep scope of prs small and the change to the trait spreads to a lot of crates since it was decided to use an associated type on the trait for primitive types, instead of a generic, and as you know default AT is not stable, cc @klkvr