-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix: apply FCU on invalid PayloadAttributes #4591
Conversation
Codecov Report
... and 10 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
let attr_validation_res = | ||
self.validate_version_specific_fields(EngineApiMessageVersion::V2, &attrs.into()); | ||
|
||
// From the engine API spec: | ||
// | ||
// Client software MUST ensure that payloadAttributes.timestamp is greater than | ||
// timestamp of a block referenced by forkchoiceState.headBlockHash. If this condition | ||
// isn't held client software MUST respond with -38003: Invalid payload attributes and | ||
// MUST NOT begin a payload build process. In such an event, the forkchoiceState | ||
// update MUST NOT be rolled back. | ||
// | ||
// NOTE: This will also apply to the validation result for the shanghai-specific fields | ||
// provided in the payload attributes. | ||
// | ||
// To do this, we set the payload attrs to `None` if attribute validation failed, but | ||
// we still apply the forkchoice update. | ||
if let Err(err) = attr_validation_res { | ||
let fcu_res = self.inner.beacon_consensus.fork_choice_updated(state, None).await?; | ||
// TODO: decide if we want this branch - the FCU INVALID response might be more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is duplicated code, right?
I think this could be moved to a helper function instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, added a helper
ca6d843
to
4acbc3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Closes #4589
Makes the
Invalid PayloadAttributes: Missing BeaconRoot
hive test passThis will call
fork_choice_updated
withNone
if the payload attributes fail validation.