Skip to content

bug in computing proof size rounded up to next higher 2-power #3762

@tromp

Description

@tromp

Describe the bug
Line 264 of core/src/pow/cuckatoo.rs computes

	let mask = u64::MAX >> size.leading_zeros(); // round size up to 2-power - 1

assuming that size of type usize is the same 64-bit size as u64::MAX. Which is the case on 64-bit platforms, but on 32-bit platforms the right shift falls short by 32, leaving mask with a wrong value, and these platforms fail to verify valid PoWs.

The fix could be as simple as change size to (size as u64).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions