Skip to content

Sort in **descending** stake order#8787

Merged
apfitzge merged 1 commit intoanza-xyz:masterfrom
apfitzge:stake_weight_order
Oct 31, 2025
Merged

Sort in **descending** stake order#8787
apfitzge merged 1 commit intoanza-xyz:masterfrom
apfitzge:stake_weight_order

Conversation

@apfitzge
Copy link

Problem

  • stake-weighted sorting with some randomness was doing it backward
    • ignore randomness for now, assume rng always return 0.5
    • 2 nodes, stake=1, stake=2
    • weights = 0.5^(1/1) = 0.5
    • weights = 0.5^(1/2) = 0.707
    • node with stake 2 would come 2nd in list

Summary of Changes

  • reverse the sort comparison

Fixes #

@apfitzge apfitzge requested a review from AshwinSekar October 30, 2025 21:23
Copy link

@AshwinSekar AshwinSekar left a comment

Choose a reason for hiding this comment

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

thanks for catching this :shipit:

@apfitzge
Copy link
Author

thanks for catching this :shipit:

credit goes to xyphus8335 on discord 🫡 I did not catch it myself.

@AshwinSekar do you think this should be backported? Not sure if it will change too much tbh

@AshwinSekar
Copy link

In theory this could speedup confirmation times as votes are streamed from replay to cluster_info_vote_listener. If the higher staked votes are first, then we reach 2/3 faster.

Hard to say what the difference is, but I imagine we could reach 2/3 within the first 32 data shreds, which means fewer blockstore inserts / verifications in the hot path. I'd be in favor of backporting this PR.

@HGuillemet
Copy link

Less important : it'll significantly change average vote latencies as reported by vortex, or as used in ranking like xshin.fi

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.2%. Comparing base (082f13a) to head (95de9c9).
⚠️ Report is 34 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #8787     +/-   ##
=========================================
- Coverage    83.2%    83.2%   -0.1%     
=========================================
  Files         857      857             
  Lines      372859   372859             
=========================================
- Hits       310522   310517      -5     
- Misses      62337    62342      +5     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@apfitzge apfitzge added this pull request to the merge queue Oct 31, 2025
@apfitzge apfitzge added the v3.0 Backport to v3.0 branch label Oct 31, 2025
@mergify
Copy link

mergify bot commented Oct 31, 2025

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

Merged via the queue into anza-xyz:master with commit cefa44b Oct 31, 2025
45 checks passed
@apfitzge apfitzge deleted the stake_weight_order branch October 31, 2025 13:07
mergify bot pushed a commit that referenced this pull request Oct 31, 2025
rustopian pushed a commit to rustopian/agave that referenced this pull request Nov 20, 2025
AshwinSekar pushed a commit that referenced this pull request Nov 24, 2025
Sort in **descending** stake order (#8787)

(cherry picked from commit cefa44b)

Co-authored-by: Andrew Fitzgerald <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3.0 Backport to v3.0 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants