Enforce proper check of ParentAgregatedSeal during preprepare phase (1.5.x release) #1830
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.
Problem
During consensus, when a validator has to verify that a proposed block is valid, the validators are not checking the
ParentAggregatedSeal
. Thus, they can potentially accept an invalid block as valid.Full Nodes during regular block syncing don't have the same problem, and thus reject the block. In a scenario with validators depending on proxies (full nodes) this also implies that after such a block, network connections between validators and proxies will break, thus the network will stall.
How?
To verify a block, validators have to check the header, but ignore the
AggreatedSeal
since this field is the result of consensus and will only be added as the final step of it.To achieve this,
backend.VerifyProposal()
callsengine.VerifyHeader
and it will mark the block as invalid if this call fails, unless the error is related to the AggregatedSeal. This is incorrect, since ifengine.VerifyHeader()
fails due to the missing AggregatedSeal it does not imply that the rest of the header is valid, just that the first error on it found is that.In particular,
engine.VerifyHeader()
will not verify theParentAggregatedSeal
ifAggreatedSeal
is missing.Fix
In this PR, instead of calling
VerifyHeader
we call a new functionverifyHeaderFromProposal
that checks that theAggregatedSeal
's signature is empty, and checks all others fields. As expected from a consensus proposal.This PR is applied on top of the 1.5.x version branch