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

[Fix] Clear cached validator requests on disconnect #3254

Merged
merged 3 commits into from
May 23, 2024

Conversation

niklaslong
Copy link
Collaborator

@niklaslong niklaslong commented May 13, 2024

This PR clears the validator requests cache map for a particular peer on disconnect. This ensures the collection is periodically cleaned up despite not having a time-based expiry and is sufficient to avoid infinite growth as the committee size is bounded (but the IP may change).

A small aside for future discussion: when time permits, we may want to revisit our approach to cache invalidation both in the gateway and the router. One option would be to use an LRU with a fixed size that we clear on specific state transitions (e.g. on round increment).

@niklaslong niklaslong changed the title [Fix] clear cached validator requests on disconnect [Fix] Clear cached validator requests on disconnect May 13, 2024
@niklaslong niklaslong marked this pull request as ready for review May 14, 2024 11:45
node/bft/src/helpers/cache.rs Outdated Show resolved Hide resolved
node/bft/src/gateway.rs Show resolved Hide resolved
Copy link
Contributor

@raychu86 raychu86 left a comment

Choose a reason for hiding this comment

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

LGTM,

The only use of seen_outbound_validators_requests is when we check that an incoming ValidatorsResponse corresponds to an existing ValidatorsRequest.

@howardwu howardwu merged commit 7ff06a8 into AleoNet:mainnet-staging May 23, 2024
zosorock added a commit that referenced this pull request May 24, 2024
This reverts commit 7ff06a8, reversing
changes made to 9cc67c9.
@niklaslong niklaslong deleted the fix/cache branch May 24, 2024 09:00
vicsn added a commit to ProvableHQ/snarkOS that referenced this pull request May 28, 2024
joske pushed a commit to eqlabs/snarkOS that referenced this pull request May 29, 2024
vicsn added a commit to ProvableHQ/snarkOS that referenced this pull request Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants