-
Notifications
You must be signed in to change notification settings - Fork 811
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
[Merged by Bors] - simplify calculate_committee_fraction #4213
[Merged by Bors] - simplify calculate_committee_fraction #4213
Conversation
fork_choice_test_definition::execution_status::test_03 is failing line 1003 mentions a "magic number" generated from |
Huh, that is strange. I wouldn't have thought the values calculated by |
Digging into whats going onthe update to In the previous version of In the new version of so the previous vs new iterations return a slightly different value. Furthermore, in test_03, the magic numbers chosen on lines 990, 994, and 1003 only work for the older version of |
ok I thought about this some more and I think I understand whats going on here in Rust the following calculations could return different results, even though they are mathematically equivalent a * (b /c) vs (a * b) / c that's because w/ integer division, the remainder gets thrown away, so the order in which we divide and multiply plays a factor. so even though the old vs new committee_weight calculations are mathematically equivalent: (total_effective_balance / num_active_validators) * (num_active_validators / slots_per epoch) = total_effective_balance / slots_per_epoch they dont return the exact same results due to the fact that the remainder gets thrown away during integer division |
@eserilev Do you mind rebasing on/merging the latest We'll try to review this ASAP and get it merged for 4.2.0 |
…mplify-calculate-committee-fraction
@michaelsproul i merged the latest unstable. thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Happy to merge.
bors r+ |
## Issue Addressed [#4211](#4211) ## Proposed Changes This PR conforms the helper function `calculate_committee_fraction` to the [v1.3.0 spec](https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/fork-choice.md#get_weight) ## Additional Info the old definition of `calculate_committee_fraction` is almost identical, but the new definition is simpler.
Pull request successfully merged into unstable. Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page.
|
## Issue Addressed [sigp#4211](sigp#4211) ## Proposed Changes This PR conforms the helper function `calculate_committee_fraction` to the [v1.3.0 spec](https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/fork-choice.md#get_weight) ## Additional Info the old definition of `calculate_committee_fraction` is almost identical, but the new definition is simpler.
## Issue Addressed [sigp#4211](sigp#4211) ## Proposed Changes This PR conforms the helper function `calculate_committee_fraction` to the [v1.3.0 spec](https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/fork-choice.md#get_weight) ## Additional Info the old definition of `calculate_committee_fraction` is almost identical, but the new definition is simpler.
## Issue Addressed [sigp#4211](sigp#4211) ## Proposed Changes This PR conforms the helper function `calculate_committee_fraction` to the [v1.3.0 spec](https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/fork-choice.md#get_weight) ## Additional Info the old definition of `calculate_committee_fraction` is almost identical, but the new definition is simpler.
Issue Addressed
#4211
Proposed Changes
This PR conforms the helper function
calculate_committee_fraction
to the v1.3.0 specAdditional Info
the old definition of
calculate_committee_fraction
is almost identical, but the new definition is simpler.