fix: validate wall clock when submitting a voluntary exit message #14720
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.
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
If a user submit an voluntary exit message with a valid signature(via
POST /eth/v1/beacon/pool/voluntary_exits
), the current implementation never checks the validation of its exit epoch. It seemsVerifyExitAndSignature
has that validation logic, but theheadState
passed to the function is already processed until theexit_epoch
, so the following code will never help.e9314c5 contains an example of this scenario: the current wall epoch is 256, but a "valid" exit message whose
exit_epoch
is 500 can be accepted in the handler.This could be a severe problem for the node who received the
POST
request, as it will broadcast the message that other nodes will eventually mark as "invalid". By rejecting that gossip message, the node's reputation would be worse, leading a disconnection problem.I found lighthouse has its validation logic before broadcasting the exit message. I added a simple implementation using
GenesisTimeFetcher
like it.Other notes for review
I'm quite unconfident of introducing
voluntaryExitEpochValidationBuffer
, which will accept an exit message with in a very near future(~5 epoch). Feel free to give an opinion of this.Acknowledgements