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

inbound eviction logic / policy. #431

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

D-Stacks
Copy link
Collaborator

@D-Stacks D-Stacks commented Mar 12, 2024

This adds eviction logic and a policy to rusty-kaspa.

The idea is borrowed from btc and straight forward:

  1. rank peers, by last_ping_duration, time_connected, last_tx_transfer (duration), last_block_transfer (duration), prefix_bucket (dispersal).

  2. keep 40% of the best performing peers on any individual metric:

  • This means an eclipse attacker most outperform the best individual performer with all of its rankings.
  1. from the remaining peers, evicted peers are selected via a weighted choose function accounting for time-connected and prefix_bucket:
  • Here weights are not influenced by latency (as to not starve low-latency peers), This will also cause the node to prefer selection of newer peers, and peers from localized clusters (via prefix bucket), for eviction.

On the side, it also logs last tx transfer and last block transfer for each peer, as well as does a small overhaul on the PrefixBucket struct, (mostly inlining and refactoring).

protocol/flows/src/v5/txrelay/flow.rs Show resolved Hide resolved
components/connectionmanager/src/lib.rs Outdated Show resolved Hide resolved
components/connectionmanager/src/lib.rs Outdated Show resolved Hide resolved
utils/src/networking.rs Show resolved Hide resolved
@D-Stacks D-Stacks changed the base branch from master to dev August 28, 2024 19:42
@michaelsutton michaelsutton deleted the branch kaspanet:master September 11, 2024 18:34
@michaelsutton michaelsutton reopened this Sep 11, 2024
@michaelsutton michaelsutton changed the base branch from dev to master September 11, 2024 18:44
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