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: remove references to stdlib implementation of schnorr #3

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: remove references to stdlib implementation of schnorr
  • Loading branch information
TomAFrench committed Dec 3, 2024
commit ffe904913993667e682ae7d7e873117c6cc95859
23 changes: 2 additions & 21 deletions src/lib.nr
Original file line number Diff line number Diff line change
@@ -114,7 +114,6 @@ mod test {
#[test]
fn smoke_test() {
let message: [u8; 10] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
let message_field: Field = 0x010203040506070809;
let pub_key_x: Field = 0x04b260954662e97f00cab9adb773a259097f7a274b83b113532bce27fa3fb96a;
let pub_key_y: Field = 0x2fd51571db6c08666b0edfbfbc57d432068bccd0110a39b166ab243da0037197;
let signature: [u8; 64] = [
@@ -124,28 +123,10 @@ mod test {
199, 19, 84, 239, 138, 124, 12,
];

// Regression for issue #2421
// We want to make sure that we can accurately verify a signature whose message is a slice vs. an array
let message_field_bytes: [u8; 10] = message_field.to_be_bytes();

// Is there ever a situation where someone would want
// to ensure that a signature was invalid?
// Check that passing a slice as the message is valid
let valid_signature = std::schnorr::verify_signature_slice(
pub_key_x,
pub_key_y,
signature,
message_field_bytes,
);
assert(valid_signature);
// Check that passing an array as the message is valid
let valid_signature =
std::schnorr::verify_signature(pub_key_x, pub_key_y, signature, message);
assert(valid_signature);
let pub_key = EmbeddedCurvePoint { x: pub_key_x, y: pub_key_y, is_infinite: false };
let valid_signature = std::schnorr::verify_signature_noir(pub_key, signature, message);
let valid_signature = verify_signature(pub_key, signature, message);
assert(valid_signature);
std::schnorr::assert_valid_signature(pub_key, signature, message);
super::assert_valid_signature(pub_key, signature, message);
}

}
Loading