Repository navigation
feat(consensus): proposer locks part set until all parts are added - #4009
Merged
Merged
Conversation
Author
|
Some my internal comments:
|
sergio-mena
reviewed
Sep 6, 2024
sergio-mena
reviewed
Sep 6, 2024
sergio-mena
reviewed
Sep 6, 2024
sergio-mena
reviewed
Sep 6, 2024
sergio-mena
approved these changes
Sep 6, 2024
sergio-mena
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, thanks for this
sergio-mena
reviewed
Sep 6, 2024
|
|
||
| // If we are the proposer, lock the PartSet until we load all | ||
| // the block parts, that should come just after this Proposal. | ||
| if bytes.Equal(proposerPubKey.Bytes(), cs.privValidatorPubKey.Bytes()) { |
Collaborator
There was a problem hiding this comment.
Suggested change
| if bytes.Equal(proposerPubKey.Bytes(), cs.privValidatorPubKey.Bytes()) { | |
| if cs.isProposer(cs.privValidatorPubKey.Address()) { |
More readable
Author
There was a problem hiding this comment.
I have accepted it then reverted it.
We have to test if the Proposal has been signed by us.
Co-authored-by: Sergio Mena <[email protected]>
This reverts commit 03fb8bc.
cason
enabled auto-merge
September 9, 2024 15:05
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.
Addresses #1742.
When a validator is the round proposer, it produces a
Proposaland a number of blockParts that it then delivers to itself (code). When aProposalis accepted, the validator initializes atypes.PartSetinstance from the proposedBlockID(code). Then, when each of the blockParts are delivered, they are added to this part set. Once aPartis added to thecs.ProposalBlockPartspart set, it becomes available to the consensus reactor, that sends them to peers.The issue reported in #1742 is that we add the block parts in order to
cs.ProposalBlockParts, and one by one, even when the we are the proposer. When we are the proposer we know all the block parts and could producecs.ProposalBlockPartsimmediately, instead of processing allParts, one by one, as they were received from the network. This would have as a consequence that the consensus reactor will only start sending blockParts to peers once all of them are available. Since we randomly choose the next part to send to a peer, we are less likely to send to all peers the same part. That is what currently happens, as reported in #1742.The solution proposed here is relatively simple and non-intrusive. To the
types.PartSettype we add a booleanlockedvalue. Once the proposer receives its ownProposal, it creates and locks itscs.ProposalBlockParts, which is unlocked when all the expected parts are received and processed.The consensus reactor, in turn, only send blocks
Parts to peers whencs.ProposalBlockPartsis unlocked. When the node is not the proposed of the round, it is always unlocked. When the node is the current round proposer, it is unlocked once all the parts it should contain are added, likely fixing the issue reported in #1742.PR checklist
.changelog(we use unclog to manage our changelog)docs/orspec/) and code comments