Skip to content

collator-protocol revamp: use ratio for peer eviction from DB #11576

Merged
tdimitrov merged 7 commits intomasterfrom
tsv-collator-revamp-adjust-scoring
Apr 3, 2026
Merged

collator-protocol revamp: use ratio for peer eviction from DB #11576
tdimitrov merged 7 commits intomasterfrom
tsv-collator-revamp-adjust-scoring

Conversation

@tdimitrov
Copy link
Copy Markdown
Contributor

@tdimitrov tdimitrov commented Mar 31, 2026

The current implementation of prune_for_para gives edge to new peers because it uses only the timestamp of the last bump when evicting peers to the DB. As a result, a high score collator which is inactive for a while can easily be evicted by new peers with minimal score.

To fix this we now calculate score / time_since_last_bump ratio for each peer and evict the one with the min value.

…last_bump / score` ratio when deciding which peer to evict from the db
@tdimitrov tdimitrov requested review from alindima and eskimor March 31, 2026 11:11
@tdimitrov tdimitrov added the T8-polkadot This PR/Issue is related to/affects the Polkadot network. label Mar 31, 2026
@tdimitrov
Copy link
Copy Markdown
Contributor Author

/cmd prdoc --audience node_dev --bump patch

Copy link
Copy Markdown
Contributor

@AlexandruCihodaru AlexandruCihodaru left a comment

Choose a reason for hiding this comment

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

🚀 Nice work on testing

@tdimitrov tdimitrov added the A4-backport-stable2603 Pull request must be backported to the stable2603 release branch label Apr 1, 2026
Copy link
Copy Markdown
Contributor

@alindima alindima left a comment

Choose a reason for hiding this comment

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

LGTM

@tdimitrov tdimitrov added this pull request to the merge queue Apr 3, 2026
Merged via the queue into master with commit fea7d4d Apr 3, 2026
227 of 231 checks passed
@tdimitrov tdimitrov deleted the tsv-collator-revamp-adjust-scoring branch April 3, 2026 11:44
paritytech-release-backport-bot Bot pushed a commit that referenced this pull request Apr 3, 2026
The current implementation of `prune_for_para` gives edge to new peers
because it uses only the timestamp of the last bump when evicting peers
to the DB. As a result, a high score collator which is inactive for a
while can easily be evicted by new peers with minimal score.

To fix this we now calculate `score / time_since_last_bump` ratio for
each peer and evict the one with the min value.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit fea7d4d)
@paritytech-release-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for stable2603:

tdimitrov added a commit that referenced this pull request Apr 3, 2026
Backport #11576 into `stable2603` from tdimitrov.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A4-backport-stable2603 Pull request must be backported to the stable2603 release branch T8-polkadot This PR/Issue is related to/affects the Polkadot network.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants