paradigmxyz / reth

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

feat(primitives): move header validation methods from consensus to primitive #9207

Closed tcoratger closed 1 month ago

tcoratger commented 2 months ago

Describe the feature

At the moment, in this file:

https://github.com/paradigmxyz/reth/blob/2a9fa4869e658ca89e050d0d985a7ccbfa360bfa/crates/consensus/common/src/validation.rs

we have a lot of header validation methods like this one:

https://github.com/paradigmxyz/reth/blob/2a9fa4869e658ca89e050d0d985a7ccbfa360bfa/crates/consensus/common/src/validation.rs#L14-L24

I have the impression that rather than keeping these methods here, it would make more sense to integrate them into the SealedHeader implementation with a specific error type HeaderConsensusError which would group together all possible errors when validating the sealed headers and which would then be passed transparently to the ConsensusError.

This would make it possible to make the implementation more structural and to use:

header.validate_gas();

for example.

Additional context

No response

Villegas2003 commented 2 months ago

Hi @tcoratger , Are you still in need of support for this issue? I'd be happy to help.

tcoratger commented 2 months ago

Hi @tcoratger , Are you still in need of support for this issue? I'd be happy to help.

@Villegas2003 Before you start working on it, I don't know if this proposal will be accepted, wdyt @mattsse ?

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 21 days with no activity.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 7 days since being marked as stale.