Skip to content
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

Fix: pass Set instead of Sequence to get_total_balance #2359

Conversation

ericsson49
Copy link
Contributor

Fixed typing problem in process_pending_headers and in update_pending_votes: Sequence[ValidatorIndex] passed instead of Set[ValidatorIndex].
In both cases the collection of indices passed to get_total_balance originates from get_beacon_committee: either filtered (process_pending_headers) or "as is" (update_pending_votes).
That means there should be no duplicates, if there is no duplicates in the get_beacon_committee result. So, converting to Set shouldn't affect result.

… be of `Set[ValidatorIndex]` type, however, `Sequence` is passed
Copy link
Contributor

@protolambda protolambda left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

@@ -539,7 +539,7 @@ def update_pending_votes(state: BeaconState, attestation: Attestation) -> None:
participants = get_attesting_indices(state, attestation.data, pending_header.votes)
participants_balance = get_total_balance(state, participants)
full_committee = get_beacon_committee(state, attestation.data.slot, attestation.data.index)
full_committee_balance = get_total_balance(state, full_committee)
full_committee_balance = get_total_balance(state, set(full_committee))
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should introduce some type for an ordered-set in the spec. The committee members each have an index, and are unique, at the same time. The total-balance computation is order-independent though, so a set is fine here.

@protolambda protolambda added the scope:sharding Sharding label Apr 26, 2021
@protolambda protolambda merged commit ac98da6 into ethereum:dev Apr 26, 2021
@ericsson49 ericsson49 deleted the ericsson49/fix_pass_set_instead_of_sequence_to_get_total_balance branch April 26, 2021 18:41
@ericsson49 ericsson49 restored the ericsson49/fix_pass_set_instead_of_sequence_to_get_total_balance branch April 27, 2021 10:31
@ericsson49 ericsson49 deleted the ericsson49/fix_pass_set_instead_of_sequence_to_get_total_balance branch August 23, 2021 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants