BFT-498: Add genesis to BatchVotes operations #160
Merged
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 ❔
Adds
genesis: GenesisHash
toBatch
and reject votes inBatchVotes
unless they have the same genesis hash as the local node.Why ❔
To prevent replay attacks either from other chains or after a fork resulting from an L1 batch reorg.
The expected behaviour now is that
BatchVotes
only accepts a single vote per attester, and in the event of an L1 batch reorg the following will have to happen:Once the nodes are restarted they will have the new genesis which will prevent any accidental or malicious replay of the old batch votes to them via gossip. They will pick up the new batch number on which they have to vote from the main node, and cast fresh votes on them with the correct genesis hash.
The main node won't have to adjust
BatchVotes::min_batch_number
down while running, because it will be restarted and will re-initialise the whole stack from scratch.What if we don't fix this?
Without this change, a reorg can play out like this:
I could be wrong on this, maybe they won't connect via gossip because their genesis is different. A malicious node could certainly do it, but maybe it won't happen by accident.