Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Consensus generics with generic aggregate #12821

Open
Tracked by #12578
emhane opened this issue Nov 24, 2024 · 0 comments
Open
Tracked by #12578

Replace Consensus generics with generic aggregate #12821

emhane opened this issue Nov 24, 2024 · 0 comments
Labels
A-consensus Related to the consensus engine A-sdk Related to reth's use as a library C-debt Refactor of code section that is hard to understand or maintain S-blocked This cannot more forward until something else changes

Comments

@emhane
Copy link
Member

emhane commented Nov 24, 2024

Describe the feature

  1. Replace generics for header and body on Consensus trait with generic aggregate N: NodePrimitives.
  2. Pass N::Receipt as generic to PostExecutionInput

/// Consensus is a protocol that chooses canonical chain.
#[auto_impl::auto_impl(&, Arc)]
pub trait Consensus<H = Header, B = BlockBody>:
AsHeaderValidator<H> + HeaderValidator<H> + Debug + Send + Sync
{
/// Ensures that body field values match the header.
fn validate_body_against_header(
&self,
body: &B,
header: &SealedHeader<H>,
) -> Result<(), ConsensusError>;
/// Validate a block disregarding world state, i.e. things that can be checked before sender
/// recovery and execution.
///
/// See the Yellow Paper sections 4.3.2 "Holistic Validity", 4.3.4 "Block Header Validity", and
/// 11.1 "Ommer Validation".
///
/// **This should not be called for the genesis block**.
///
/// Note: validating blocks does not include other validations of the Consensus
fn validate_block_pre_execution(&self, block: &SealedBlock<H, B>)
-> Result<(), ConsensusError>;
/// Validate a block considering world state, i.e. things that can not be checked before
/// execution.
///
/// See the Yellow Paper sections 4.3.2 "Holistic Validity".
///
/// Note: validating blocks does not include other validations of the Consensus
fn validate_block_post_execution(
&self,
block: &BlockWithSenders,
input: PostExecutionInput<'_>,
) -> Result<(), ConsensusError>;
}

Additional context

No response

@emhane emhane added A-consensus Related to the consensus engine A-sdk Related to reth's use as a library C-debt Refactor of code section that is hard to understand or maintain D-good-first-issue Nice and easy! A great choice to get started labels Nov 24, 2024
@emhane emhane removed the D-good-first-issue Nice and easy! A great choice to get started label Nov 24, 2024
@mattsse mattsse added the S-blocked This cannot more forward until something else changes label Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Related to the consensus engine A-sdk Related to reth's use as a library C-debt Refactor of code section that is hard to understand or maintain S-blocked This cannot more forward until something else changes
Projects
Status: Todo
Development

No branches or pull requests

2 participants