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

chore(stdlib)!: Rename fixed_base_scalar_mul to be more descriptive #2488

Merged
merged 5 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ fn main(x: Field) {
let bytes = x.to_be_bytes(32);

let hash = std::hash::pedersen([x]);
let _p1 = std::scalar_mul::fixed_base(x);
let _p1 = std::scalar_mul::fixed_base_embedded_curve(x);

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ unconstrained fn main(
pub_x = b_pub_x;
pub_y = b_pub_y;
}
let res = std::scalar_mul::fixed_base(priv_key);
let res = std::scalar_mul::fixed_base_embedded_curve(priv_key);
assert(res[0] == pub_x);
assert(res[1] == pub_y);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main(
pub_x = b_pub_x;
pub_y = b_pub_y;
}
let res = std::scalar_mul::fixed_base(priv_key);
let res = std::scalar_mul::fixed_base_embedded_curve(priv_key);
assert(res[0] == pub_x);
assert(res[1] == pub_y);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn main(
to_pubkey_y: Field,
) -> pub [Field; 2] {
// Compute public key from private key to show ownership
let pubkey = std::scalar_mul::fixed_base(priv_key);
let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key);
let pubkey_x = pubkey[0];
let pubkey_y = pubkey[1];

Expand Down
8 changes: 7 additions & 1 deletion noir_stdlib/src/scalar_mul.nr
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
// Computes a fixed base scalar multiplication over the embedded curve.
// For bn254, We have Grumpkin and Baby JubJub.
// For bls12-381, we have JubJub and Bandersnatch.
//
// The embedded curve being used is decided by the
// underlying proof system.
#[foreign(fixed_base_scalar_mul)]
fn fixed_base(_input : Field) -> [Field; 2] {}
fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] {}