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

get_attesting_indices set instead of sorted #1225

Merged
merged 5 commits into from
Jun 28, 2019
Merged

get_attesting_indices set instead of sorted #1225

merged 5 commits into from
Jun 28, 2019

Conversation

djrtwo
Copy link
Contributor

@djrtwo djrtwo commented Jun 27, 2019

It came to my attention that get_attesting_indices was still unnecessarily sorting instead of returning a set. The only case that needs sorting is when it is used in convert_to_indexed rather than in all of the attester accessors used in rewards processing during epoch processing.

This actually let me to uncover a small bug in phase 1 that has been resolved.

Thanks @prestonvanloon for bringing this to my attention. I hope this relieves that hotspot you found in your epoch processing.

@@ -566,7 +569,8 @@ def process_bit_challenge(state: BeaconState,
chunk_count = get_custody_chunk_count(attestation.data.crosslink)
assert verify_bitfield(challenge.chunk_bits, chunk_count)
# Verify the first bit of the hash of the chunk bits does not equal the custody bit
custody_bit = get_bitfield_bit(attestation.custody_bitfield, attesters.index(challenge.responder_index))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bugfix: The previous accessor here for the responder bit just from the list of attestors would likely correspond to the incorrect bit in the bitfield. Instead it should be the index of the responder within the entire committee.

Copy link
Collaborator

@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.

Verified the Sequence -> Set change part of the PR

specs/core/0_beacon-chain.md Show resolved Hide resolved
specs/core/0_beacon-chain.md Outdated Show resolved Hide resolved
@prestonvanloon
Copy link
Contributor

Thanks for putting this together so quickly.

djrtwo and others added 2 commits June 27, 2019 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants