[wip] Disseminate approvals and auxiliary info #439
Draft
samliok wants to merge 7 commits into
Draft
Conversation
Collaborator
|
If we rely on blocks being indexed to be the trigger for message dissemination, we need to add a test that ensures that if we only notarize blocks and do not finalize them for a few rounds, the MSM doesn't get stuck. I don't think it will get stuck because we should keep on building blocks when we're in the collecting approvals state, but we should nevertheless test this. Now when we merged the orchestration layer we have the test infrastructure to test this with MSM and epoch both being production implementations in the test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
wip: disseminates approvals and auxiliary info in a more efficient way regardless of validator status
This PR reworks how epoch-transition approvals are produced and propagated. Instead of a validator only contributing its approval when it happens to be the block builder, every prospective next-epoch validator AND non-validator now broadcasts its approval (and any required auxiliary info) as soon as it observes a finalized block indicating an epoch transition is underway.
A new
EpochTransitionListener(transition_listener.go) listens to finalized blocks and reacts based on the block's type:Transitioning block indexed: an epoch change is incoming. If the referenced P-chain height's validator set includes our node ID:
If the auxiliary info history is not yet sufficient, we generate our auxiliary contribution and broadcast it as a new
AuxiliaryInfomessage.If aux info is sufficient, we sign an approval over
(nextPChainReferenceHeight, auxInfoDigest)and broadcast it as a newEpochTransitionApprovalmessage, feeding it to our own approval store as well. A timeout task tracks the approval so it can be re-sent on network issues until the epoch change completes.Sealing block indexed: the transition is complete. Stale approval timeout tasks for the old epoch are cleared, and the
onEpochChangecallback fires with the new epoch's validator set.Why this is better than the previous flow
Faster epoch transitions. Previously a validator's approval was only created inline during block building, so the sealing quorum accumulated one builder at a time. Now approvals are processed and sent asynchronously from block building.
One code path for validators and non-validators. Both roles react to indexed blocks through the same listener, meaning we dont need to re-write logic for non-validators.
More simplex block building. The builder no longer generates approvals or aux info; it just aggregates whatever the
ApprovalStorehas collected when deciding whether the epoch can be sealed.