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

Implement BLS verification #314

Open
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

NikolayKostadinov21
Copy link
Contributor

No description provided.

Copy link
Contributor

@smanilov smanilov left a comment

Choose a reason for hiding this comment

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

1 comment to fix failing tests in debug mode.

Comment on lines +30 to +32
if value >= 1 << (8 * LENGHT) {
assert!(false);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 30 causes two of the tests added by this PR to fail when invoked in debug mode (cargo test <test_name> without --release). This is because the Rust compiler generates a hidden assert for 1 << (8 * LENGHT) in case the shift value would cause an overflow and that assert fails, if LENGTH is larger than 4 (numeric literals are of type i32 by default). The test passes in release mode, because the asserts are disabled. Note that it is NOT the case that the assert on line 31 fails the tests; it is the hidden/implicit assert mentioned earlier.

To fix, please, replace with:

    if LENGHT < std::mem::size_of::<usize>() && value >= 1usize << (8 * LENGHT) {
        assert!(false, "value ({value}) does not fit in {LENGHT} bytes");
    }

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.

2 participants