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

Use little endian bit order #575

Merged
merged 1 commit into from
Feb 12, 2019
Merged

Conversation

arnetheduck
Copy link
Contributor

Slightly more simple and common to find bit n at position 1 << n

Slightly more simple and common to find bit n at position `1 << n`
@arnetheduck
Copy link
Contributor Author

@hwwhww
Copy link
Contributor

hwwhww commented Feb 11, 2019

Ah, sorry, I just realize, maybe we need to update verify_bitfield too.

def verify_bitfield(bitfield: bytes, committee_size: int) -> bool:
    """
    Verify ``bitfield`` against the ``committee_size``.
    """
    if len(bitfield) != (committee_size + 7) // 8:
        return False

    # Check `bitfield` is padded with zero bits only
    for i in range(committee_size, len(bitfield) * 8):
        if get_bitfield_bit(bitfield, i) == 0b1:
            return False

    return True

The padding zero part.

@hwwhww
Copy link
Contributor

hwwhww commented Feb 11, 2019

^^^^^ False alarm. 🤦‍♀️

@djrtwo @vbuterin can we merge it?

@JustinDrake
Copy link
Collaborator

Agreed this is simpler

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.

None yet

3 participants