Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SDK handler to drop messages from non-validators #1917

Merged
merged 7 commits into from
Aug 28, 2023

Conversation

joshua-kim
Copy link
Contributor

Why this should be merged

Implements a handler that drops messages from non-validators

How this works

Adds a ValidatorSet interface we lookup incoming nodeIDs from to see if we should handle the request or not.

How this was tested

Added a unit test

@joshua-kim joshua-kim self-assigned this Aug 24, 2023
@joshua-kim joshua-kim added the sdk This involves SDK tooling or frameworks label Aug 24, 2023
network/p2p/handler_test.go Show resolved Hide resolved
network/p2p/validators.go Outdated Show resolved Hide resolved
network/p2p/handler.go Show resolved Hide resolved
// ValidatorHandler drops messages from non-validators
type ValidatorHandler struct {
Handler
ValidatorSet ValidatorSet
Copy link
Contributor

Choose a reason for hiding this comment

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

I know we don't do this very well in the rest of the repo... but should we make this a minimal interface? Doesn't seem like we need any of the sampling functionality here.

Copy link
Contributor

@StephenButtolph StephenButtolph left a comment

Choose a reason for hiding this comment

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

last nit then lgtm

network/p2p/handler_test.go Outdated Show resolved Hide resolved
Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
@StephenButtolph StephenButtolph added this to the v1.10.10 milestone Aug 28, 2023
@StephenButtolph StephenButtolph merged commit 21e7a65 into ava-labs:dev Aug 28, 2023
15 checks passed
@joshua-kim joshua-kim deleted the sdk-validator-handler branch August 30, 2023 17:49
Copy link
Contributor

@patrick-ogrady patrick-ogrady left a comment

Choose a reason for hiding this comment

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

approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sdk This involves SDK tooling or frameworks
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants