-
Notifications
You must be signed in to change notification settings - Fork 377
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
engine: clarify payloadAttributes
checks and fcu v3 processing flow
#498
Conversation
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
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.
adding -38003 here helps a lot
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
LGTM! Just as a heads up, this change will result in adding hive tests where we send malformed payload attributes to syncing clients, which very likely will result in new failures. We will tag all EL devs on the hive PR that implements these tests. |
@marioevz note that this change also includes the following statement to the fcU V1 that is inherently applicable to all further versions:
One of the intentions of that statement is skipping |
|
||
2. Extend point (7) of the `engine_forkchoiceUpdatedV1` [specification](./paris.md#specification-1) by defining the following sequence of checks that **MUST** be run over `payloadAttributes`: | ||
|
||
1. `payloadAttributes` matches the [`PayloadAttributesV3`](#payloadattributesv3) structure, return `-38003: Invalid payload attributes` on failure. |
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.
It's not clear how we extend point 7 of Paris fork. Might be better just to add this rules to Paris also in expected order
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.
One of this rules is in Paris which is checking the timestamp
wrt parent block’s timestamp. Other two are introduced in Cancun, so they aren’t relevant for Paris. The point (7) in Cancun has an extended list of checks wrt to Paris
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.
I also had some confusion wrt to this. We have an engine api test:
ForkchoiceUpdatedV2 To Request Shanghai Payload, Non-Null Beacon Root
where we essentially fcuV2 before Cancun, with a Shanghai timestamp
and a non null parentBeaconBlockRoot
(incorrect Payload Attributes structure).
As we are before Cancun my assumption would be that the extended points to (7) are not yet applied. Most clients return -38003: Invalid payload attributes
for this case. The addition to Paris only validates the Payload Attributes based on the timestamp. So to my understanding we don't explicitly state what to return in this case.
So I agree with @flcl42 that we could add the Payload Attributes structure check to Paris. Apologies if I am missing something here
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.
Ahh, I just noticed that this check would be covered by: https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#engine_forkchoiceupdatedv2. And the appropraite response should be -32602: Invalid params
.
As most clients return -38003: Invalid payload attributes
would it make sense to change it here. Similarly, I personally found this tricky to determine based on the current spec regarding the Payload Attributes structure check (but I could be the stupid odd one out).
I added a potential change for the latter here: main...spencer-tb:execution-apis:src/engine/payload-attributes-updates
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.
why should the parent.timestamp
check be removed from cancun?
Also, i am hesitant to change the previous versions of any methods in the spec unless the change is coherent with the behavior of the majority of EL clients
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.
Do EL clients check payloadAttributes
structure in case of V1? If we remove a check from V3 then it is not clear in which order they are applied which may result in the return error message to be different on the same payloadAttributes in different client implementations
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.
why should the parent.timestamp check be removed from cancun?
My fault - it should be kept, I wasn't taking into consideration the order of the checks!
I'd like to double check our tests for the payloadAttributes
structure in case of V1. Will get back to you :)
This PR incorporates changes proposed by #476, #479 and results from the conversations happening in-person during the DevConnect and in the Discord after the event.
The list of proposed changes:
payloadAttributes
validations and build process can only be run afterforkchoiceState
is processed and only if thehead
isVALID
implying that if a client isSYNCING
nopayloadAttributes
validations are run.forkchoiceState
fields must be validated before any processing starts with the corresponding error on failure.payloadAttributes
checks that must be run after applying the fork choice state.The first step of this sequence is to verify that
payloadAttributes
matches the expected fields and return-38003: Invalid payload attributes
on failure. This step is what can cause additional engineering efforts on EL side. The problem here is that EL clients definePayloadAttributesV1
fields as required and if any of them is missed then the method will return with an error before processing theforkchoiceState
, this behaviour would contradict the proposed change. cc @jflo @lightclient @MarekM25 @yperbasisHive test scenarios covering
forkchoiceState
andpayloadAttributes
checks should be validated when this PR gets merged. cc @marioevzSupersedes #476 #479