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

Allow opting out of beacon engine timestamp check #11651

Open
emostov opened this issue Oct 10, 2024 · 6 comments
Open

Allow opting out of beacon engine timestamp check #11651

emostov opened this issue Oct 10, 2024 · 6 comments
Labels
C-enhancement New feature or request S-needs-triage This issue needs to be labelled S-stale This issue/PR is stale and will close with no further activity

Comments

@emostov
Copy link

emostov commented Oct 10, 2024

Describe the feature

To support sub second block times, it would be helpful to disable the timestamp check here

if attrs.timestamp() <= head.timestamp {
return OnForkChoiceUpdated::invalid_payload_attributes()
}

The Ethereum engine api spec enforces that the timestamp on new execution block must be greater then the previous block. Execution block timestamps are denominated in seconds, so if blocks are being requested within a second of each other they are likely to have the exact same timestamp and Reth will not create/validate the block.

To quickly fix this I propose allowing a way to opt out of the timestamp check - either with a runtime configuration or compilation feature gate. @mattsse mentioned here that they have some pointers on how to tackle this.

Additional context

No response

Tasks

No tasks being tracked yet.
@emostov emostov added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Oct 10, 2024
@nadtech-hub
Copy link
Contributor

Do you mind me working on this one?

@mattsse
Copy link
Collaborator

mattsse commented Oct 15, 2024

the way this should be done is by extending

pub trait EngineValidator<Types: EngineTypes>: Clone + Send + Sync + Unpin + 'static {

with checks for payload against header and then plugged into the engine impl

@emostov
Copy link
Author

emostov commented Oct 16, 2024

@mattsse thanks for the response! I think I might be missing something. From my read, implementing EngineValidator will allow me to add custom validation at the RPC level but will not allow me bypass the timestamp validation done by the engine.

Specifically in the case of forkchoice updated, the ensure_well_formed_attributes is called here

self.inner.validator.ensure_well_formed_attributes(version, attrs);

which then uses the consensus engine handle to normally call the new engine-tree logic here:

let fcu_res = self.inner.beacon_consensus.fork_choice_updated(state, None).await?;

In the engine-tree logic it appears the payload is still unconditionally subject to the timestamp check here

if attrs.timestamp() <= head.timestamp {

Which is executed by the BeaconEngineMessage::ForkchoiceUpdated request handler

fn on_forkchoice_updated(

Is my understanding correct here?

EDIT: rereading your comment again, is your suggestion to create a PR that adds a method to the EngineValidator trait for checking the payload against the header and then calling that new method in process_payload_attributes instead of doing the timestamp check? If so, I can work on that

@mattsse
Copy link
Collaborator

mattsse commented Oct 16, 2024

ereading your comment again, is your suggestion to create a PR that adds a method to the EngineValidator trait for

I thought about this a bit, and I think we could start introducing a different trait for this entirely like a new validator trait or similar

@emostov
Copy link
Author

emostov commented Oct 16, 2024

Makes sense. I will try and work on something later this week. Feel free to assign it to me

Copy link
Contributor

github-actions bot commented Nov 7, 2024

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

@github-actions github-actions bot added the S-stale This issue/PR is stale and will close with no further activity label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New feature or request S-needs-triage This issue needs to be labelled S-stale This issue/PR is stale and will close with no further activity
Projects
Status: Todo
Development

No branches or pull requests

3 participants