Skip to content

Cleanup VAT-Filtering#11993

Draft
0xzrf wants to merge 3 commits intoanza-xyz:masterfrom
0xzrf:cleanup_vat
Draft

Cleanup VAT-Filtering#11993
0xzrf wants to merge 3 commits intoanza-xyz:masterfrom
0xzrf:cleanup_vat

Conversation

@0xzrf
Copy link
Copy Markdown

@0xzrf 0xzrf commented Apr 16, 2026

Problem

VAT filtering currently is being calculated independently inside compute_new_epoch_caches_and_rewards and update_epoch_stakes while nothing enforcing them to be same.

Summary of Changes

  • Compute the VAT-filtered “distribution vote accounts” once during compute_new_epoch_caches_and_rewards, and store it on NewEpochBundle
  • Thread that precomputed vote-account snapshot into update_epoch_stakes, so epoch_stakes is built from the same distribution set used for rewards.
  • Changed get_top_epoch_stakes to accept an optional precomputed filtered VoteAccounts, avoiding recomputation and keeping the epoch-boundary path consistent.
  • Adjust Stakes::clone_and_filter_for_vat (in runtime/src/stakes.rs) to accept the already-filtered VoteAccounts when available, so epoch-stakes construction can reuse it directly.

Additional changes

As suggested in the original issue, here few more refactoring in the code:

  1. in ‎runtime/src/bank/partitioned_epoch_rewards/calculation.rs, change the code to calculate filtered vote account len from:
let filtered_vote_accounts_len = stakes
                .vote_accounts()
                .iter()
                .filter(|va| va.1.lamports() > self.minimum_vote_account_balance_for_vat())
                .count()
                .min(MAX_ALPENGLOW_VOTE_ACCOUNTS);
  1. add a new function Bank::minimum_vote_account_balance_for_vat() for minimum balance calculation for vat

Closes #11645

@mergify mergify bot requested a review from a team April 16, 2026 05:55
@0xzrf
Copy link
Copy Markdown
Author

0xzrf commented Apr 16, 2026

Hey @AshwinSekar
The work on this PR is done.
Thoughts on it?

@buffalojoec buffalojoec added the CI Pull Request is ready to enter CI label Apr 17, 2026
@buffalojoec buffalojoec self-requested a review April 17, 2026 04:09
@anza-team anza-team removed the CI Pull Request is ready to enter CI label Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove replicode and cleanup VAT filtering

3 participants