Skip to content

feat(engine): add validate_payload and validate_block methods to EngineValidator trait #17429

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

Merged
merged 1 commit into from
Jul 23, 2025

Conversation

fgimenez
Copy link
Member

@fgimenez fgimenez commented Jul 15, 2025

towards #17413

Adds new validation methods to the EngineValidator trait as a first step towards repurposing it for more flexible payload and block validation.

  • add validate_payload and validate_block methods with default implementations to maintain backward compatibility

@fgimenez fgimenez requested a review from klkvr July 15, 2025 17:42
@fgimenez fgimenez self-assigned this Jul 15, 2025
@fgimenez fgimenez added C-enhancement New feature or request C-perf A change motivated by improving speed, memory usage or disk footprint A-engine Related to the engine implementation labels Jul 15, 2025
@fgimenez fgimenez added the A-sdk Related to reth's use as a library label Jul 15, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Jul 15, 2025
@fgimenez fgimenez moved this from Backlog to In Progress in Reth Tracker Jul 15, 2025
@fgimenez fgimenez force-pushed the fgimenez/extend-payload-validator branch from 48b5476 to d24e849 Compare July 16, 2025 10:54
@fgimenez fgimenez moved this from In Progress to In Review in Reth Tracker Jul 16, 2025
@@ -106,7 +130,7 @@ pub trait EngineTypes:

/// Type that validates an [`ExecutionPayload`].
#[auto_impl::auto_impl(&, Arc)]
pub trait PayloadValidator: Send + Sync + Unpin + 'static {
pub trait PayloadValidator<State = ()>: Send + Sync + Unpin + 'static {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we likely don't need this generic if we make TreeCtx<'_, Self::Block>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe it would be easier if TreeCtx can hold a full state instance, so that we can call the new methods like validate_payload(payload, TreeCtx { state: &self.state}) if we make TreeCtx generic over block this would be more difficult, or am i missing something?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let#s figure this out later

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the trait is now generic over N: NodePrimitives

@fgimenez fgimenez force-pushed the fgimenez/extend-payload-validator branch from d24e849 to 9ffce5b Compare July 18, 2025 07:52
@fgimenez fgimenez force-pushed the fgimenez/extend-payload-validator branch from 9ffce5b to 801520e Compare July 22, 2025 09:17
@fgimenez fgimenez force-pushed the fgimenez/extend-payload-validator branch from 801520e to 8c8c463 Compare July 22, 2025 11:24
@fgimenez fgimenez changed the base branch from main to fgimenez/validation-engine-primitives July 22, 2025 11:25
@fgimenez fgimenez force-pushed the fgimenez/validation-engine-primitives branch from e8d32ea to cfb66da Compare July 22, 2025 11:25
@fgimenez fgimenez force-pushed the fgimenez/extend-payload-validator branch from 8c8c463 to 22354ff Compare July 22, 2025 11:26
@fgimenez fgimenez force-pushed the fgimenez/validation-engine-primitives branch from cfb66da to a18e6be Compare July 22, 2025 19:30
@fgimenez fgimenez force-pushed the fgimenez/extend-payload-validator branch from 22354ff to 92dd6c1 Compare July 23, 2025 08:26
@fgimenez fgimenez changed the title feat(engine): add validate_payload and validate_block methods to PayloadValidator trait feat(engine): add validate_payload and validate_block methods to EngineValidator trait Jul 23, 2025
Comment on lines 976 to 979
pub trait EngineValidator<
Types: PayloadTypes,
N: NodePrimitives = reth_ethereum_primitives::EthPrimitives,
>: PayloadValidator<ExecutionData = Types::ExecutionData>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NodePrimitives are already available as Types::BuiltPayload::Primitives

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome thx! done ptal

Base automatically changed from fgimenez/validation-engine-primitives to main July 23, 2025 11:41
@fgimenez fgimenez force-pushed the fgimenez/extend-payload-validator branch from e1481b7 to c139158 Compare July 23, 2025 11:50
@github-project-automation github-project-automation bot moved this from In Review to In Progress in Reth Tracker Jul 23, 2025
@fgimenez fgimenez added this pull request to the merge queue Jul 23, 2025
Merged via the queue into main with commit 8bd6bf5 Jul 23, 2025
43 checks passed
@fgimenez fgimenez deleted the fgimenez/extend-payload-validator branch July 23, 2025 14:02
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-engine Related to the engine implementation A-sdk Related to reth's use as a library C-enhancement New feature or request C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants