fix: validator membership checks#5009
Open
JonathanOppenheimer wants to merge 1 commit intoaaronbuchwald/benchlist-ewmafrom
Open
fix: validator membership checks#5009JonathanOppenheimer wants to merge 1 commit intoaaronbuchwald/benchlist-ewmafrom
JonathanOppenheimer wants to merge 1 commit intoaaronbuchwald/benchlist-ewmafrom
Conversation
4cdedce to
a956948
Compare
00f59ac to
e001544
Compare
a362aba to
8ab5b3e
Compare
Comment on lines
+33
to
+37
| // Has returns true if nodeID is a connected validator. | ||
| Has(ctx context.Context, nodeID ids.NodeID) bool // TODO return error | ||
| // HasValidator returns true if nodeID is in the validator set, regardless of | ||
| // connection status. | ||
| HasValidator(ctx context.Context, nodeID ids.NodeID) bool // TODO return error |
Member
Author
There was a problem hiding this comment.
These names are terrible, as evidenced by the need for comments (you shound't have to explain).
Changing Has to HasConnected would be a much bigger difference, but I think those names would be more clear. Thoughts?
8ab5b3e to
293e70e
Compare
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.
Why this should be merged
This fixes a semantic bug in p2p validator filtering.
ValidatorHandlerwas usingValidators.Has(...), butHasnow means connected validator, not just validator-set membership. During temporary disconnects this causes real validators to be rejected withErrNotValidator/"not a validator".From my understanding, if a peer is truly disconnected, it generally will not be sending us requests anyway, so we should not drop them?
How this works
Introduces
Validators.HasValidators(ctx, nodeID)to check validator membership only.How this was tested
CI.
Need to be documented in RELEASES.md?
No