feat: optimistically execute notarized blocks #80
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.
Instead of executing blocks after they have been finalized by Simplex, we will optimistically execute blocks after they have been notarized. This serves two purposes: speeds up the overall consensus and fixes an edge case.
The edge case can occur when in the same view a block B is notarized, and a nullification certificate is formed. This can happen without malicious interference, because in Simplex an honest validator may send a notarize and a nullify in the same view (this ensures liveliness). If the leader in the subsequent view already received the notarization certificate, it will build its block on the block B from the previous view. If it has only seen the nullification certificate, it will build its block on the first ancestor before block B that is either notarized or finalized.
If the leader has already seen the notarization certificate, and builds its block on top of block B, then there is a deadlock. A new block B' can only be proposed once its parent was executed, because the parent execution might alter the state that is used to create block B'. Executing blocks once they have been notarized fixes this edge case. It does require the finalizer to keep track of multiple forks at the same time, because it is possible to have two notarized blocks at the same height.
Changes: