-
Notifications
You must be signed in to change notification settings - Fork 10
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
base: main
Are you sure you want to change the base?
Implement BLS verification #314
Conversation
…de `curve25519-dalek`
There was a problem hiding this 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.
if value >= 1 << (8 * LENGHT) { | ||
assert!(false); | ||
} |
There was a problem hiding this comment.
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");
}
No description provided.