Engine API: respond with error if payload attributes are invalid #211
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enforces the following validity condition before starting a build process:
payloadAttributes.timestamp > headBlock.timestamp
. If this condition isn't met responds with error but does not rolls back fork choice updated. EntireforkchoiceUpdated
processing flow looks as follows after this change:headBlock
is known and there is no missing data. If there are missing data respond withSYNCING
headBlock
isVALID
. If it's not respond withINVALID
forkchoiceState
payloadAttributes.timestamp
. If it's invalid respond with error:-32002: Invalid payload attributes
VALID
This might seem a bit ugly but this is a cost of double semantics of
forkchoiceUpdated
call. An alternative would be to checkpayloadAttributes
at the beginning and stop processing a call if attributes are invalid, i.e. do not apply fork choice state ifpayloadAttributes
are invalid. Though, this check may not always be performed at the very beginning (imagine the case whenheadBlock
is missing and EL has to respond withSYNCING
). Also, having forkchoice state applied disregarding a build process state is valuable.cc @djrtwo @MariusVanDerWijden @MarekM25