Skip to content

Precisely compute committee weight in FCR - #5670

Open
mkalinin wants to merge 5 commits into
ethereum:masterfrom
mkalinin:compute-committee-weight
Open

mkalinin wants to merge 5 commits into
ethereum:masterfrom
mkalinin:compute-committee-weight

Conversation

@mkalinin

Copy link
Copy Markdown
Contributor

Motivation

To calculate committee weights between slots, the existing algorithm relies on an estimate whose accuracy depends on the level of stake consolidation. This PR replaces that estimate with an exact computation, making this part of the algorithm independent of stake consolidation.

Details

  • The estimation logic is replaced with obtaining an exact set of validator indices participating in the committees of a span of slots and then computing the total balance of this set.
    Note that if a span of slots crosses an epoch boundary there can be an overlap in participating indices but the final participants set must have no duplicates. Thus, caching each committee weight and using a sum of committee weights as a result will not work in general case.
  • This change affects is_one_confirmed and compute_honest_ffg_support_for_current_target which use different balance sources passed to the compute_committee_weight_between_slots.

Tests

  • Fixes tests affected by this change, some of the tests are changed significantly as precise computation doesn’t allow for the support discount to reduce the safety threshold to 0; some of the old tests were superseded by new ones
  • New tests covering FFG and is_on_confirmed checks are written with the help of AI but reviewed manually

@github-actions github-actions Bot added testing CI, actions, tests, testing infra phase0 labels Sep 23, 2026

@jtraglia jtraglia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, LGTM. I pushed a little nit fix, hope that's fine.

@jtraglia

Copy link
Copy Markdown
Member

Hey @mkalinin feel free to merge this whenever you think it's ready. I'm not sure if you want to have more reviews from others or if there's any reason to wait. Note that you'll need to click the "update branch" button & wait for the CI checks to pass, then you should be able to merge it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

phase0 testing CI, actions, tests, testing infra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants