Skip to content

Comments

fix: validator membership checks#5009

Open
JonathanOppenheimer wants to merge 1 commit intoaaronbuchwald/benchlist-ewmafrom
JonathanOppenheimer/ewma-patch
Open

fix: validator membership checks#5009
JonathanOppenheimer wants to merge 1 commit intoaaronbuchwald/benchlist-ewmafrom
JonathanOppenheimer/ewma-patch

Conversation

@JonathanOppenheimer
Copy link
Member

@JonathanOppenheimer JonathanOppenheimer commented Feb 19, 2026

Why this should be merged

This fixes a semantic bug in p2p validator filtering. ValidatorHandler was using Validators.Has(...), but Has now means connected validator, not just validator-set membership. During temporary disconnects this causes real validators to be rejected with ErrNotValidator / "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

@JonathanOppenheimer JonathanOppenheimer self-assigned this Feb 19, 2026
@JonathanOppenheimer JonathanOppenheimer requested a review from a team as a code owner February 19, 2026 18:59
@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/ewma-patch branch from 4cdedce to a956948 Compare February 19, 2026 19:16
@aaronbuchwald aaronbuchwald force-pushed the aaronbuchwald/benchlist-ewma branch from 00f59ac to e001544 Compare February 19, 2026 19:30
@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/ewma-patch branch from a362aba to 8ab5b3e Compare February 19, 2026 20:30
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
Copy link
Member Author

@JonathanOppenheimer JonathanOppenheimer Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/ewma-patch branch from 8ab5b3e to 293e70e Compare February 19, 2026 21:00
@JonathanOppenheimer JonathanOppenheimer moved this to Ready 🚦 in avalanchego Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready 🚦

Development

Successfully merging this pull request may close these issues.

1 participant