From fe33841f410e794661aef469ad187ef4b117948c Mon Sep 17 00:00:00 2001 From: Nikita Masych Date: Thu, 14 Nov 2024 16:49:10 +0200 Subject: [PATCH 1/3] feat!(): update bignum, bigcurve and noir to stable 0.36.0 --- crates/plume/Nargo.toml | 6 +++--- crates/plume/src/hash_to_field.nr | 6 +++--- crates/plume/src/iso_map.nr | 34 +++++++++++++++---------------- crates/plume/src/lib.nr | 28 ++++++++++++------------- crates/plume/src/map_to_curve.nr | 30 +++++++++++++-------------- crates/use_v1/Nargo.toml | 6 +++--- crates/use_v2/Nargo.toml | 6 +++--- 7 files changed, 58 insertions(+), 58 deletions(-) diff --git a/crates/plume/Nargo.toml b/crates/plume/Nargo.toml index 1c0868e..6d4526e 100644 --- a/crates/plume/Nargo.toml +++ b/crates/plume/Nargo.toml @@ -4,8 +4,8 @@ type = "lib" authors = ["Distributed Lab"] license = "MIT" description = "PLUME implementation in Noir." -compiler_version = ">=0.35.0" +compiler_version = ">=0.36.0" [dependencies] -bignum = {tag = "v0.3.7", git = "https://github.com/noir-lang/noir-bignum"} -noir_bigcurve = {tag = "v0.4", git = "https://github.com/noir-lang/noir_bigcurve"} \ No newline at end of file +bignum = {tag = "v0.4.1", git = "https://github.com/noir-lang/noir-bignum"} +noir_bigcurve = {tag = "v0.5.0", git = "https://github.com/noir-lang/noir_bigcurve"} \ No newline at end of file diff --git a/crates/plume/src/hash_to_field.nr b/crates/plume/src/hash_to_field.nr index c841cb6..70533ed 100644 --- a/crates/plume/src/hash_to_field.nr +++ b/crates/plume/src/hash_to_field.nr @@ -30,7 +30,7 @@ pub fn hash_to_field(msg: [u8; N]) -> Secp256k1 { } fn bytes_to_registers(ui: [u8; 48]) -> Secp256k1Fq { - let shift = BigNum::from_array([0, 0x100, 0]); + let shift = BigNum::from_slice([0, 0x100, 0]); let mut small = [0 as u8; 32]; let mut big = [0 as u8; 32]; @@ -54,7 +54,7 @@ fn test_u0_bytes_to_registers() { let actual = bytes_to_registers(u0_bytes); - let expected = BigNum::from_array([0x491f544767e18a4873f397b08a2b61, 0xab5d3679a1f7601e3bdf94ced1f43e, 0x128a]); + let expected = BigNum::from_slice([0x491f544767e18a4873f397b08a2b61, 0xab5d3679a1f7601e3bdf94ced1f43e, 0x128a]); assert(actual == expected); } @@ -69,7 +69,7 @@ fn test_u1_bytes_to_registers() { let actual = bytes_to_registers(u1_bytes); - let expected = BigNum::from_array([0x1be76a03518b044daaa0f2e4689e00, 0xb65da3b595a813d0fdcc75c895dc53, 0x5897]); + let expected = BigNum::from_slice([0x1be76a03518b044daaa0f2e4689e00, 0xb65da3b595a813d0fdcc75c895dc53, 0x5897]); assert(actual == expected); } diff --git a/crates/plume/src/iso_map.nr b/crates/plume/src/iso_map.nr index e2ad046..492b1ae 100644 --- a/crates/plume/src/iso_map.nr +++ b/crates/plume/src/iso_map.nr @@ -10,22 +10,22 @@ use bignum::BigNum; use noir_bigcurve::curves::secp256k1::{Secp256k1, Secp256k1Fq}; use noir_bigcurve::BigCurve; -comptime global K1_0: Secp256k1Fq = BigNum::from_array([0xe38e38e38e38e38e38e38daaaaa8c7, 0xe38e38e38e38e38e38e38e38e38e38, 0x8e38]); -comptime global K1_1: Secp256k1Fq = BigNum::from_array([0x95d2fc0bf63b92dfff1044f17c6581, 0xd4c80bc321d5b9f315cea7fd44c5d5, 0x7d3]); -comptime global K1_2: Secp256k1Fq = BigNum::from_array([0x506144037c40314ecbd0b53d9dd262, 0x328d23f234e6e2a413deca25caece4, 0x534c]); -comptime global K1_3: Secp256k1Fq = BigNum::from_array([0xe38e38e38e38e38e38e38daaaaa88c, 0xe38e38e38e38e38e38e38e38e38e38, 0x8e38]); +global K1_0: Secp256k1Fq = BigNum::from_slice([0xe38e38e38e38e38e38e38daaaaa8c7, 0xe38e38e38e38e38e38e38e38e38e38, 0x8e38]); +global K1_1: Secp256k1Fq = BigNum::from_slice([0x95d2fc0bf63b92dfff1044f17c6581, 0xd4c80bc321d5b9f315cea7fd44c5d5, 0x7d3]); +global K1_2: Secp256k1Fq = BigNum::from_slice([0x506144037c40314ecbd0b53d9dd262, 0x328d23f234e6e2a413deca25caece4, 0x534c]); +global K1_3: Secp256k1Fq = BigNum::from_slice([0xe38e38e38e38e38e38e38daaaaa88c, 0xe38e38e38e38e38e38e38e38e38e38, 0x8e38]); -comptime global K2_0: Secp256k1Fq = BigNum::from_array([0xcd409542f8487d9fe6b745781eb49b, 0x71193d94918a9ca34ccbb7b640dd86, 0xd357]); -comptime global K2_1: Secp256k1Fq = BigNum::from_array([0xd36b641f5e41bbc52a56612a8c6d14, 0xc6f64383dc1df7c4b2d51b54225406, 0xedad]); +global K2_0: Secp256k1Fq = BigNum::from_slice([0xcd409542f8487d9fe6b745781eb49b, 0x71193d94918a9ca34ccbb7b640dd86, 0xd357]); +global K2_1: Secp256k1Fq = BigNum::from_slice([0xd36b641f5e41bbc52a56612a8c6d14, 0xc6f64383dc1df7c4b2d51b54225406, 0xedad]); -comptime global K3_0: Secp256k1Fq = BigNum::from_array([0x684bda12f684bda12f684b8e38e23c, 0x12f684bda12f684bda12f684bda12f, 0x4bda]); -comptime global K3_1: Secp256k1Fq = BigNum::from_array([0x7ab046d686da6fdffc90fc201d71a3, 0xc32d5cb7c0fa9d0a54b12a0a6d564, 0xc75e]); -comptime global K3_2: Secp256k1Fq = BigNum::from_array([0x2830a201be2018a765e85a9ecee931, 0x194691f91a73715209ef6512e57672, 0x29a6]); -comptime global K3_3: Secp256k1Fq = BigNum::from_array([0xa12f684bda12f684bda12f38e38d84, 0x4bda12f684bda12f684bda12f684bd, 0x2f68]); +global K3_0: Secp256k1Fq = BigNum::from_slice([0x684bda12f684bda12f684b8e38e23c, 0x12f684bda12f684bda12f684bda12f, 0x4bda]); +global K3_1: Secp256k1Fq = BigNum::from_slice([0x7ab046d686da6fdffc90fc201d71a3, 0xc32d5cb7c0fa9d0a54b12a0a6d564, 0xc75e]); +global K3_2: Secp256k1Fq = BigNum::from_slice([0x2830a201be2018a765e85a9ecee931, 0x194691f91a73715209ef6512e57672, 0x29a6]); +global K3_3: Secp256k1Fq = BigNum::from_slice([0xa12f684bda12f684bda12f38e38d84, 0x4bda12f684bda12f684bda12f684bd, 0x2f68]); -comptime global K4_0: Secp256k1Fq = BigNum::from_array([0xfffffffffffffffffffffefffff93b, 0xffffffffffffffffffffffffffffff, 0xffff]); -comptime global K4_1: Secp256k1Fq = BigNum::from_array([0x67c1bfc8e8d978dfb425d2685c2573, 0x534bb8bdb49fd5e9e6632722c29894, 0x7a06]); -comptime global K4_2: Secp256k1Fq = BigNum::from_array([0x3d21162f0d6299a7bf8192bfd2a76f, 0xaa716545ca2cf3a70c3fa8fe337e0a, 0x6484]); +global K4_0: Secp256k1Fq = BigNum::from_slice([0xfffffffffffffffffffffefffff93b, 0xffffffffffffffffffffffffffffff, 0xffff]); +global K4_1: Secp256k1Fq = BigNum::from_slice([0x67c1bfc8e8d978dfb425d2685c2573, 0x534bb8bdb49fd5e9e6632722c29894, 0x7a06]); +global K4_2: Secp256k1Fq = BigNum::from_slice([0x3d21162f0d6299a7bf8192bfd2a76f, 0xaa716545ca2cf3a70c3fa8fe337e0a, 0x6484]); pub fn iso_map(p: Secp256k1) -> Secp256k1 { let x2 = p.x * p.x; @@ -61,16 +61,16 @@ fn y_den(x: Secp256k1Fq, x2: Secp256k1Fq, x3: Secp256k1Fq) -> Secp256k1Fq { #[test] fn test_iso_map() { let p: Secp256k1 = BigCurve { - x: BigNum::from_array([0xf7ae5f23c431edeb6be5bb360925ea, 0xce532d92416a9488104157036455a0, 0x8dec]), - y: BigNum::from_array([0x13d22e4d45e5bef361e486c6a5da4a, 0xae1c326847bd4a133e5dee6b2ca67c, 0xe249]), + x: BigNum::from_slice([0xf7ae5f23c431edeb6be5bb360925ea, 0xce532d92416a9488104157036455a0, 0x8dec]), + y: BigNum::from_slice([0x13d22e4d45e5bef361e486c6a5da4a, 0xae1c326847bd4a133e5dee6b2ca67c, 0xe249]), is_infinity: false }; let actual = iso_map(p); let expected: Secp256k1 = BigCurve { - x: BigNum::from_array([0x7c2a947a20fd9ad71039f8b0e29ff8, 0x6d261a5e00fe5cf45e827b507643e6, 0xf89d]), - y: BigNum::from_array([0x1ce936d563bc1cee1dcffc806caf57, 0x55e0cc34a9176ead91c6c3acb1aacb, 0xb338]), + x: BigNum::from_slice([0x7c2a947a20fd9ad71039f8b0e29ff8, 0x6d261a5e00fe5cf45e827b507643e6, 0xf89d]), + y: BigNum::from_slice([0x1ce936d563bc1cee1dcffc806caf57, 0x55e0cc34a9176ead91c6c3acb1aacb, 0xb338]), is_infinity: false }; diff --git a/crates/plume/src/lib.nr b/crates/plume/src/lib.nr index 2654ace..8fa84ac 100644 --- a/crates/plume/src/lib.nr +++ b/crates/plume/src/lib.nr @@ -135,8 +135,8 @@ fn test_nullifier() { let sk: Secp256k1Scalar = ScalarField::from_bignum(sk); let H: Secp256k1 = BigCurve { - x: BigNum::from_array([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), - y: BigNum::from_array([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), + x: BigNum::from_slice([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), + y: BigNum::from_slice([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), is_infinity: false }; @@ -258,8 +258,8 @@ fn test_hashed_to_curve_r() { let sk: Secp256k1Scalar = ScalarField::from_bignum(sk); let H: Secp256k1 = BigCurve { - x: BigNum::from_array([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), - y: BigNum::from_array([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), + x: BigNum::from_slice([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), + y: BigNum::from_slice([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), is_infinity: false }; @@ -295,20 +295,20 @@ fn test_hashed_to_curve_r() { #[test] fn test_sha_256_12_coordinates() { let hashed_to_curve: Secp256k1 = BigCurve { - x: BigNum::from_array([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), - y: BigNum::from_array([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), + x: BigNum::from_slice([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), + y: BigNum::from_slice([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), is_infinity: false }; let r_point: Secp256k1 = BigCurve { - x: BigNum::from_array([0x76662962a28429590e2dc736fe9804, 0xa4350e7e2ad27abc6d2a2813658180, 0x9d8c]), - y: BigNum::from_array([0xebe45112472d9b9054816a7670c5a1, 0xc30b8afd4e854623c835d9c3aac6bc, 0xff08]), + x: BigNum::from_slice([0x76662962a28429590e2dc736fe9804, 0xa4350e7e2ad27abc6d2a2813658180, 0x9d8c]), + y: BigNum::from_slice([0xebe45112472d9b9054816a7670c5a1, 0xc30b8afd4e854623c835d9c3aac6bc, 0xff08]), is_infinity: false }; let hashed_to_curve_r: Secp256k1 = BigCurve { - x: BigNum::from_array([0x579f4d152131db270558fccd27b97c, 0x7c6f63c59fa7a5b1e9a654e27d2869, 0x6d01]), - y: BigNum::from_array([0x3f44d3c6caf5a1a4e290b777ac56ed, 0x43fb5c99818c564a8f80a88a65f83e, 0x586c]), + x: BigNum::from_slice([0x579f4d152131db270558fccd27b97c, 0x7c6f63c59fa7a5b1e9a654e27d2869, 0x6d01]), + y: BigNum::from_slice([0x3f44d3c6caf5a1a4e290b777ac56ed, 0x43fb5c99818c564a8f80a88a65f83e, 0x586c]), is_infinity: false }; @@ -361,8 +361,8 @@ fn test_plume_v1() { let pk = G.mul(sk); let H: Secp256k1 = BigCurve { - x: BigNum::from_array([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), - y: BigNum::from_array([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), + x: BigNum::from_slice([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), + y: BigNum::from_slice([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), is_infinity: false }; @@ -403,8 +403,8 @@ fn test_plume_v2() { let pk = G.mul(sk); let H: Secp256k1 = BigCurve { - x: BigNum::from_array([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), - y: BigNum::from_array([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), + x: BigNum::from_slice([0x2affbc49c54d1136a2190db0800b65, 0x2d0e12679f23c218889395abcdc01f, 0xbcac]), + y: BigNum::from_slice([0xa91a53e32b3752145d87f0cd70966e, 0xb339c974c0e757d348081f90a123b0, 0x3bcf]), is_infinity: false }; diff --git a/crates/plume/src/map_to_curve.nr b/crates/plume/src/map_to_curve.nr index 39c226e..19b4c85 100644 --- a/crates/plume/src/map_to_curve.nr +++ b/crates/plume/src/map_to_curve.nr @@ -11,9 +11,9 @@ use noir_bigcurve::curves::secp256k1::{Secp256k1, Secp256k1Fq, Secp256k1_Params} use noir_bigcurve::BigCurve; // https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-13.html#section-8.7 -comptime global Z: Secp256k1Fq = BigNum::from_array([0xfffffffffffffffffffffefffffc24, 0xffffffffffffffffffffffffffffff, 0xffff]); -comptime global A: Secp256k1Fq = BigNum::from_array([0x53d363cb6f0e5d405447c01a444533, 0x31abdd661adca08a5558f0f5d272e9, 0x3f87]); -comptime global B: Secp256k1Fq = BigNum::from_array([0x6eb, 0, 0]); +global Z: Secp256k1Fq = BigNum::from_slice([0xfffffffffffffffffffffefffffc24, 0xffffffffffffffffffffffffffffff, 0xffff]); +global A: Secp256k1Fq = BigNum::from_slice([0x53d363cb6f0e5d405447c01a444533, 0x31abdd661adca08a5558f0f5d272e9, 0x3f87]); +global B: Secp256k1Fq = BigNum::from_slice([0x6eb, 0, 0]); comptime global ONE: Secp256k1Fq = BigNum::one(); @@ -68,7 +68,7 @@ fn select_xy( #[test] fn test_inverse() { - let value: Secp256k1Fq = BigNum::from_array([0x387936733e29cddb43759809208354, 0xc334daf72303fb27f6aad8201a9465, 0xc6f1]); + let value: Secp256k1Fq = BigNum::from_slice([0x387936733e29cddb43759809208354, 0xc334daf72303fb27f6aad8201a9465, 0xc6f1]); let actual = ONE / value; @@ -84,33 +84,33 @@ fn test_inverse() { #[test] fn test_select_xy_1() { - let x1: Secp256k1Fq = BigNum::from_array([123, 0, 0]); - let x2: Secp256k1Fq = BigNum::from_array([200, 0, 0]); - let gx1: Secp256k1Fq = BigNum::from_array([4, 0, 0]); - let gx2: Secp256k1Fq = BigNum::from_array([5, 0, 0]); + let x1: Secp256k1Fq = BigNum::from_slice([123, 0, 0]); + let x2: Secp256k1Fq = BigNum::from_slice([200, 0, 0]); + let gx1: Secp256k1Fq = BigNum::from_slice([4, 0, 0]); + let gx2: Secp256k1Fq = BigNum::from_slice([5, 0, 0]); let (actual_x, actual_y) = select_xy(x1, x2, gx1, gx2); assert(actual_x == x1); - assert(actual_y == BigNum::from_array([2, 0, 0])); + assert(actual_y == BigNum::from_slice([2, 0, 0])); } #[test] fn test_select_xy_2() { - let x1: Secp256k1Fq = BigNum::from_array([123, 0, 0]); - let x2: Secp256k1Fq = BigNum::from_array([200, 1, 0]); - let gx1: Secp256k1Fq = BigNum::from_array([5, 0, 0]); - let gx2: Secp256k1Fq = BigNum::from_array([4, 0, 0]); + let x1: Secp256k1Fq = BigNum::from_slice([123, 0, 0]); + let x2: Secp256k1Fq = BigNum::from_slice([200, 1, 0]); + let gx1: Secp256k1Fq = BigNum::from_slice([5, 0, 0]); + let gx2: Secp256k1Fq = BigNum::from_slice([4, 0, 0]); let (actual_x, actual_y) = select_xy(x1, x2, gx1, gx2); assert(actual_x == x2); - assert(actual_y == BigNum::from_array([2, 0, 0])); + assert(actual_y == BigNum::from_slice([2, 0, 0])); } #[test] fn test_map_to_curve() { - let u = BigNum::from_array([0x491f544767e18a4873f397b08a2b61, 0xab5d3679a1f7601e3bdf94ced1f43e, 0x128a]); + let u = BigNum::from_slice([0x491f544767e18a4873f397b08a2b61, 0xab5d3679a1f7601e3bdf94ced1f43e, 0x128a]); let actual_p= map_to_curve(u); diff --git a/crates/use_v1/Nargo.toml b/crates/use_v1/Nargo.toml index 570fd95..a7db35d 100644 --- a/crates/use_v1/Nargo.toml +++ b/crates/use_v1/Nargo.toml @@ -4,9 +4,9 @@ type = "bin" authors = ["Distributed Lab"] license = "MIT" description = "PLUME V1 usage in Noir." -compiler_version = ">=0.35.0" +compiler_version = ">=0.36.0" [dependencies] plume = { path = "../plume" } -bignum = {tag = "v0.3.7", git = "https://github.com/noir-lang/noir-bignum"} -noir_bigcurve = {tag = "v0.4", git = "https://github.com/noir-lang/noir_bigcurve"} \ No newline at end of file +bignum = {tag = "v0.4.1", git = "https://github.com/noir-lang/noir-bignum"} +noir_bigcurve = {tag = "v0.5.0", git = "https://github.com/noir-lang/noir_bigcurve"} \ No newline at end of file diff --git a/crates/use_v2/Nargo.toml b/crates/use_v2/Nargo.toml index d130e2c..be74e34 100644 --- a/crates/use_v2/Nargo.toml +++ b/crates/use_v2/Nargo.toml @@ -4,9 +4,9 @@ type = "bin" authors = ["Distributed Lab"] license = "MIT" description = "PLUME V2 usage in Noir." -compiler_version = ">=0.35.0" +compiler_version = ">=0.36.0" [dependencies] plume = { path = "../plume" } -bignum = {tag = "v0.3.7", git = "https://github.com/noir-lang/noir-bignum"} -noir_bigcurve = {tag = "v0.4", git = "https://github.com/noir-lang/noir_bigcurve"} \ No newline at end of file +bignum = {tag = "v0.4.1", git = "https://github.com/noir-lang/noir-bignum"} +noir_bigcurve = {tag = "v0.5.0", git = "https://github.com/noir-lang/noir_bigcurve"} \ No newline at end of file From c8fd3e0f9f416286c9dcf54562575182b4ed803c Mon Sep 17 00:00:00 2001 From: Nikita Masych Date: Thu, 14 Nov 2024 16:50:04 +0200 Subject: [PATCH 2/3] chore: updated noir CI and added issue templates --- .github/ISSUE_TEMPLATE/bug_report.yml | 41 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.yml | 29 +++++++++++++++ .github/workflows/noir.yml | 22 ++---------- 4 files changed, 74 insertions(+), 19 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..8eb801e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,41 @@ +name: "🐛 Bug Report" +description: Create a new ticket for a bug. +title: "🐛 [BUG] - " +labels: ["bug"] +body: + - type: markdown + attributes: + value: "## Thanks for filing this out ❤️!" + - type: textarea + id: description + attributes: + label: "Description" + placeholder: Short and explicit description of your incident... + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: "Reproduction steps" + placeholder: How can we reproduce the issue? + validations: + required: false + - type: dropdown + id: os + attributes: + label: "OS" + description: What is the impacted environment? + multiple: true + options: + - Windows + - Linux + - Mac + validations: + required: false + - type: textarea + id: additional_context + attributes: + label: "Additional context" + placeholder: Provide any additional information. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..6001e51 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,29 @@ +name: "💡 Feature Request" +description: Create a new ticket for a new feature request +title: "💡 [REQUEST] - <title>" +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: "## Thanks for filing this out ❤️!" + - type: textarea + id: summary + attributes: + label: "Summary" + placeholder: Provide a brief explanation of the feature... + validations: + required: true + - type: textarea + id: basic_example + attributes: + label: "Basic Example" + placeholder: Provide a basic example of how the feature would work... + validations: + required: false + - type: textarea + id: additional_context + attributes: + label: "Additional context" + placeholder: Provide any additional information. + validations: + required: false diff --git a/.github/workflows/noir.yml b/.github/workflows/noir.yml index 35cd4df..e1b0dc5 100644 --- a/.github/workflows/noir.yml +++ b/.github/workflows/noir.yml @@ -18,26 +18,10 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Cache Nargo Binary - uses: actions/cache@v4 - id: nargo-cache + - name: Install Nargo + uses: noir-lang/noirup@v0.1.3 with: - path: ~/.nargo/bin/nargo - key: ${{ runner.os }}-nargo-binary - restore-keys: | - ${{ runner.os }}-nargo-binary - - - name: Create `.nargo/bin` directory - shell: bash - run: | - mkdir -p $HOME/.nargo/bin - echo "${HOME}/.nargo/bin" >> $GITHUB_PATH - - - name: Install Noir - if: steps.nargo-cache.outputs.cache-hit != 'true' - run: | - curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/noirup | bash -s -- \ - -C 51ae1b324cd73fdb4fe3695b5d483a44b4aff4a9 + toolchain: 0.36.0 - name: Run nargo fmt run: nargo fmt --check From 4a3d620e9b3d04b570ccba6c3f3f93109bb49084 Mon Sep 17 00:00:00 2001 From: Nikita Masych <nikitamasich152@gmail.com> Date: Thu, 14 Nov 2024 16:50:40 +0200 Subject: [PATCH 3/3] chore: new benchmarks and updated readme --- BENCHMARK.md | 36 ++++++++++++++++++++++++++++++++++++ README.md | 22 ++++++++++++---------- bench.sh | 2 ++ 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/BENCHMARK.md b/BENCHMARK.md index ffafcd0..4d9eb24 100644 --- a/BENCHMARK.md +++ b/BENCHMARK.md @@ -2,6 +2,42 @@ > Computational statistics. +## v2.0.0 + +_Machine_: `MacBook Pro M2 Max 32 GB RAM 1 TB Storage` + +_Maximum RAM consumption_: `15 GB` + +### Nightly + +_Noir_: 0.38.0+0fc0c53ec183890370c69aa4148952b3123cb055 + +_Barrettenberg_: 0.61.0 + +--- + +| Version | Message Length | ACIR Opcodes | Brillig Opcodes | Compilation Time | Execution Time | Ultra Plonk Proof Time | Ultra Plonk VK Writing Time | Ultra Plonk Verification Time | Ultra Honk Proof Time | Ultra Honk VK Writing Time | Ultra Honk Verification Time | +|---------|----------------|--------------|-----------------|------------------|----------------|------------------------|-----------------------------|-------------------------------|-----------------------|----------------------------|------------------------------| +| v1 | 32 | 131,108 | 504,525 | 39.561 seconds | 17.225 seconds | 10.986 seconds | 10.692 seconds | 0.042 seconds | 4.693 seconds | 3.408 seconds | 0.049 seconds | +| v2 | 32 | 129,980 | 504,091 | 39.495 seconds | 17.297 seconds | 11.160 seconds | 10.464 seconds | 0.043 seconds | 4.639 seconds | 3.300 seconds | 0.048 seconds | +| v1 | 10,000 | 171,428 | 514,493 | 56.903 seconds | 25.853 seconds | 41.484 seconds | 37.037 seconds | 0.047 seconds | 13.253 seconds | 9.469 seconds | 0.048 seconds | +| v2 | 10,000 | 170,300 | 514,059 | 57.884 seconds | 25.965 seconds | 40.587 seconds | 36.827 seconds | 0.045 seconds | 13.457 seconds | 9.096 seconds | 0.048 seconds | + +### Stable + +_Noir_: 0.36.0+801c71880ecf8386a26737a5d8bb5b4cb164b2ab + +_Barrettenberg_: 0.58.0 + +--- + +| Version | Message Length | ACIR Opcodes | Brillig Opcodes | Compilation Time | Execution Time | Ultra Plonk Proof Time | Ultra Plonk VK Writing Time | Ultra Plonk Verification Time | Ultra Honk Proof Time | Ultra Honk VK Writing Time | Ultra Honk Verification Time | +|---------|----------------|--------------|-----------------|------------------|----------------|------------------------|-----------------------------|-------------------------------|-----------------------|----------------------------|------------------------------| +| v1 | 32 | 253689 | 484059 | 100.064 seconds | 20.297 seconds | 20.463 seconds | 18.725 seconds | 0.036 seconds | 7.058 seconds | 4.701 seconds | 0.043 seconds | +| v2 | 32 | 251841 | 483707 | 62.891 seconds | 20.155 seconds | 20.109 seconds | 18.627 seconds | 0.037 seconds | 7.219 seconds | 4.380 seconds | 0.041 seconds | +| v1 | 10,000 | 311503 | 494027 | 119.118 seconds | 28.322 seconds | 41.477 seconds | 37.529 seconds | 0.040 seconds | 14.187 seconds | 9.771 seconds | 0.041 seconds | +| v2 | 10,000 | 309655 | 493675 | 83.594 seconds | 28.443 seconds | 41.999 seconds | 37.829 seconds | 0.038 seconds | 14.588 seconds | 9.760 seconds | 0.043 seconds | + ## v1.0.0 _Machine_: `MacBook Pro M2 Max 32 GB RAM 1 TB Storage` diff --git a/README.md b/README.md index e70bb6c..ba2145d 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,20 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Noir CI 🌌](https://github.com/distributed-lab/noir-plume/actions/workflows/noir.yml/badge.svg)](https://github.com/distributed-lab/noir-plume/actions/workflows/noir.yml) -Plume is needed to confirm your identity without disclosing your private data, i.e. [zero-knowledge proof](https://en.wikipedia.org/wiki/Zero-knowledge_proof). Plume has another feature: you can send a message from a private group using special group message. For more details visit <https://blog.aayushg.com/nullifier/>. +> Signature nullification cryptography. -## Eager to try? 😎 +Read about PLUME [here](https://blog.aayushg.com/nullifier/). + +## How to use? ### Add dependency to your project's `Nargo.toml` ```toml [dependencies] -plume = { git = "https://github.com/distributed-lab/noir-plume", tag = "v1.0.0", directory = "crates/plume"} +plume = { git = "https://github.com/distributed-lab/noir-plume", tag = "v2.0.0", directory = "crates/plume"} ``` -### Use in your `Noir` code as following +### Employ in your `Noir` code as following ```rust use plume::plume_v1; @@ -23,7 +25,7 @@ use plume::plume_v1; plume_v1(msg, c, s, pk, nullifier); ``` -Or in case you prefer 2 version: +Or in case you prefer [second version](https://www.notion.so/mantanetwork/PLUME-Discussion-6f4b7e7cf63e4e33976f6e697bf349ff): ```rust use plume::plume_v2; @@ -36,15 +38,15 @@ plume_v2(msg, c, s, pk, nullifier); ### Examples Check out how to generate proofs with PLUME in either `crates/use_v1` or `crates/use_v2`. -For proving data generation, see our `SageMath` [implementation](./etc). +Sample data generation in our `SageMath` [implementation](./etc). -## Benchmark 📊 +## Benchmarks We have provided information regarding different computational statistics such as constraints amount and time for various activities, see [Benchmark.md](./BENCHMARK.md) -## There is more? 🤯 +## Need something else? -In order to bring in `PLUME` to `Noir`, we needed to implement `secp256k1_XMD:SHA-256_SSWU_RO_` hash-to-curve algorithm, ergo now it is available in `Noir` ecosystem! +In order to bring `PLUME` to `Noir`, we needed to implement +[secp256k1_XMD:SHA-256_SSWU_RO_](https://datatracker.ietf.org/doc/id/draft-irtf-cfrg-hash-to-curve-06.html) hash-to-curve algorithm, thus now it is available in `Noir` ecosystem! -Based on [this description](https://datatracker.ietf.org/doc/id/draft-irtf-cfrg-hash-to-curve-06.html). Tested using [this data](https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-13.html#appendix-J.8.1). diff --git a/bench.sh b/bench.sh index 9867b1b..ea94881 100755 --- a/bench.sh +++ b/bench.sh @@ -1,5 +1,7 @@ #!/bin/bash +rm -rf ./target + set -e # Exit immediately if a command exits with a non-zero status export TIMEFORMAT="%R"