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. EntireforkchoiceUpdatedprocessing flow looks as follows after this change:headBlockis known and there is no missing data. If there are missing data respond withSYNCINGheadBlockisVALID. If it's not respond withINVALIDforkchoiceStatepayloadAttributes.timestamp. If it's invalid respond with error:-32002: Invalid payload attributesVALIDThis might seem a bit ugly but this is a cost of double semantics of
forkchoiceUpdatedcall. An alternative would be to checkpayloadAttributesat the beginning and stop processing a call if attributes are invalid, i.e. do not apply fork choice state ifpayloadAttributesare invalid. Though, this check may not always be performed at the very beginning (imagine the case whenheadBlockis missing and EL has to respond withSYNCING). Also, having forkchoice state applied disregarding a build process state is valuable.cc @djrtwo @MariusVanDerWijden @MarekM25