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 BitVectors TestRandom implementation #5854

Merged
merged 1 commit into from
May 30, 2024

Conversation

eserilev
Copy link
Collaborator

@eserilev eserilev commented May 28, 2024

Issue Addressed

For electra attestations a new field committee_bits: BitVector<E::MaxCommitteesPerSlot> is introduced

Theres some assumptions in BitVectors TestRandom impl that N is divisible by 8. For the minimal spec MaxCommitteesPerSlot = 4. In this case, when generating a random bit vector, a raw_bytes vec of length 1 is created that is filled with a randomly generated value. In some cases the randomly generated value has bits set that are higher than raw_bytes.len(). This PR introduces some bit masking logic to the TestRandom impl for BitVector to ensure that we zero out bits > raw_bytes.len() in the case where N isn't divisible by 8.

This change should fix some failing electra networking tests. This PR along with other electra attestation PR's should get us passing CI for electra attestation changes. Thanks Michael for the assistance!

@eserilev eserilev added electra Required for the Electra/Prague fork ready-for-review The code is ready for review labels May 28, 2024
@eserilev eserilev changed the title fix bitvector testn random impl in situations where N isnt divisible … Fix BitVector TestRandom impl May 28, 2024
@eserilev eserilev changed the title Fix BitVector TestRandom impl Fix BitVectors TestRandom implementation May 28, 2024
@michaelsproul
Copy link
Member

we could even target this at unstable?

@eserilev eserilev changed the base branch from electra_attestation_changes to unstable May 28, 2024 13:51
@eserilev eserilev force-pushed the fix_bit_vector_test_random_impl branch from e6a64e4 to e87cf1d Compare May 28, 2024 13:53
@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels May 30, 2024
@michaelsproul
Copy link
Member

@Mergifyio queue

Copy link

mergify bot commented May 30, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at df6e1c9

mergify bot added a commit that referenced this pull request May 30, 2024
@mergify mergify bot merged commit df6e1c9 into sigp:unstable May 30, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electra Required for the Electra/Prague fork ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants