From b7f33dbbc8021ef622d8c5ae3ab24db7c139d1b4 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Wed, 30 Aug 2023 15:49:11 +0100 Subject: [PATCH 1/5] Update scalar_mul.nr --- noir_stdlib/src/scalar_mul.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir_stdlib/src/scalar_mul.nr b/noir_stdlib/src/scalar_mul.nr index 8399284f149..5585f412ecc 100644 --- a/noir_stdlib/src/scalar_mul.nr +++ b/noir_stdlib/src/scalar_mul.nr @@ -1,2 +1,2 @@ #[foreign(fixed_base_scalar_mul)] -fn fixed_base(_input : Field) -> [Field; 2] {} +fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] {} From 5ec137488a6499717aa6509f79529dfc8964cb14 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Wed, 30 Aug 2023 15:53:21 +0100 Subject: [PATCH 2/5] add more doc comments --- noir_stdlib/src/scalar_mul.nr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/noir_stdlib/src/scalar_mul.nr b/noir_stdlib/src/scalar_mul.nr index 5585f412ecc..90069d90a9b 100644 --- a/noir_stdlib/src/scalar_mul.nr +++ b/noir_stdlib/src/scalar_mul.nr @@ -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, currently is decided by the +// underlying proof system. #[foreign(fixed_base_scalar_mul)] fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] {} From f1a3ce94443cb8b7a3fc8e3bb6127c7c28775b20 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:27:08 +0100 Subject: [PATCH 3/5] Update scalar_mul.nr --- noir_stdlib/src/scalar_mul.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir_stdlib/src/scalar_mul.nr b/noir_stdlib/src/scalar_mul.nr index 90069d90a9b..379309a9e1b 100644 --- a/noir_stdlib/src/scalar_mul.nr +++ b/noir_stdlib/src/scalar_mul.nr @@ -1,5 +1,5 @@ // Computes a fixed base scalar multiplication over the embedded curve. -// For bn254, We have Grumpkin and Baby JubJub. +// For bn254, We have Grumpkin and Baby JubJub. // For bls12-381, we have JubJub and Bandersnatch. // // The embedded curve being used, currently is decided by the From 4e76de122ce7ec6d759ca5c62a43e4d7a7e41221 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 30 Aug 2023 17:11:21 +0100 Subject: [PATCH 4/5] update tests --- .../tests/compile_success_empty/intrinsic_die/src/main.nr | 2 +- .../tests/execution_success/brillig_scalar_mul/src/main.nr | 2 +- crates/nargo_cli/tests/execution_success/scalar_mul/src/main.nr | 2 +- .../nargo_cli/tests/execution_success/simple_shield/src/main.nr | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/nargo_cli/tests/compile_success_empty/intrinsic_die/src/main.nr b/crates/nargo_cli/tests/compile_success_empty/intrinsic_die/src/main.nr index 2762baf929c..1bd5f5a43f3 100644 --- a/crates/nargo_cli/tests/compile_success_empty/intrinsic_die/src/main.nr +++ b/crates/nargo_cli/tests/compile_success_empty/intrinsic_die/src/main.nr @@ -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); } diff --git a/crates/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr b/crates/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr index 7941765a327..d3965188950 100644 --- a/crates/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr +++ b/crates/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr @@ -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); } diff --git a/crates/nargo_cli/tests/execution_success/scalar_mul/src/main.nr b/crates/nargo_cli/tests/execution_success/scalar_mul/src/main.nr index d9d267f1dcd..2ff13d9f5ec 100644 --- a/crates/nargo_cli/tests/execution_success/scalar_mul/src/main.nr +++ b/crates/nargo_cli/tests/execution_success/scalar_mul/src/main.nr @@ -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); } diff --git a/crates/nargo_cli/tests/execution_success/simple_shield/src/main.nr b/crates/nargo_cli/tests/execution_success/simple_shield/src/main.nr index 18fccd862b5..88cf6091852 100644 --- a/crates/nargo_cli/tests/execution_success/simple_shield/src/main.nr +++ b/crates/nargo_cli/tests/execution_success/simple_shield/src/main.nr @@ -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]; From 56875991b5d6ccf5bba30cd8a09fc2a355c70000 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 1 Sep 2023 00:12:53 +0100 Subject: [PATCH 5/5] Update noir_stdlib/src/scalar_mul.nr Co-authored-by: Maxim Vezenov --- noir_stdlib/src/scalar_mul.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir_stdlib/src/scalar_mul.nr b/noir_stdlib/src/scalar_mul.nr index 379309a9e1b..482edb35e9f 100644 --- a/noir_stdlib/src/scalar_mul.nr +++ b/noir_stdlib/src/scalar_mul.nr @@ -2,7 +2,7 @@ // For bn254, We have Grumpkin and Baby JubJub. // For bls12-381, we have JubJub and Bandersnatch. // -// The embedded curve being used, currently is decided by the +// The embedded curve being used is decided by the // underlying proof system. #[foreign(fixed_base_scalar_mul)] fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] {}