From fd4c43ec701ed4ae813bb45334a2a42eabb73184 Mon Sep 17 00:00:00 2001 From: chiro-hiro Date: Tue, 8 Oct 2024 18:13:08 +0700 Subject: [PATCH] Update dependencies halo2proof to v0.3.0 and halo2curve to v0.7.0 --- Cargo.lock | 90 ++++++++++++++------------ Cargo.toml | 7 +- verkletree/src/circuit.rs | 15 ++--- zkmemory/src/commitment/verkle_tree.rs | 13 ++-- 4 files changed, 63 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 88c8811..a041e2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -729,6 +729,15 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "blake2b_simd" version = "1.0.2" @@ -1759,81 +1768,82 @@ dependencies = [ [[package]] name = "halo2_proofs" -version = "0.2.0" -source = "git+https://github.com/orochi-network/halo2?tag=v0_0_2#8270a67b0a847221a21bcd31b099462346674189" +version = "0.3.0" +source = "git+https://github.com/privacy-scaling-explorations/halo2?tag=v0.3.0#73408a140737d8336490452193b21f5a7a94e7de" dependencies = [ "blake2b_simd", "ff", "group", - "halo2curves 0.1.0", - "maybe-rayon", + "halo2curves 0.6.1", "rand_chacha", "rand_core", + "rayon", "sha3 0.9.1", "tracing", ] [[package]] name = "halo2curves" -version = "0.1.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b1142bd1059aacde1b477e0c80c142910f1ceae67fc619311d6a17428007ab" +checksum = "db81d01d0bbfec9f624d7590fc6929ee2537a64ec1e080d8f8c9e2d2da291405" dependencies = [ "blake2b_simd", "ff", "group", + "hex", "lazy_static", "num-bigint 0.4.6", "num-traits", + "pairing", "pasta_curves", "paste", "rand", "rand_core", + "rayon", + "serde", + "serde_arrays", "static_assertions", "subtle", ] [[package]] name = "halo2curves" -version = "0.3.2" -source = "git+https://github.com/privacy-scaling-explorations/halo2curves?tag=0.3.2#9f5c50810bbefe779ee5cf1d852b2fe85dc35d5e" +version = "0.7.0" +source = "git+https://github.com/privacy-scaling-explorations/halo2curves?tag=v0.7.0#b753a832e92d5c86c5c997327a9cf9de86a18851" dependencies = [ + "blake2", + "digest 0.10.7", "ff", "group", + "halo2derive", "lazy_static", "num-bigint 0.4.6", + "num-integer", "num-traits", + "pairing", "pasta_curves", "paste", "rand", "rand_core", + "rayon", + "sha2 0.10.8", "static_assertions", "subtle", + "unroll", ] [[package]] -name = "halo2curves" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db81d01d0bbfec9f624d7590fc6929ee2537a64ec1e080d8f8c9e2d2da291405" +name = "halo2derive" +version = "0.1.0" +source = "git+https://github.com/privacy-scaling-explorations/halo2curves?tag=v0.7.0#b753a832e92d5c86c5c997327a9cf9de86a18851" dependencies = [ - "blake2b_simd", - "ff", - "group", - "hex", - "lazy_static", "num-bigint 0.4.6", + "num-integer", "num-traits", - "pairing", - "pasta_curves", - "paste", - "rand", - "rand_core", - "rayon", - "serde", - "serde_arrays", - "static_assertions", - "subtle", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -2370,16 +2380,6 @@ dependencies = [ "regex-automata 0.1.10", ] -[[package]] -name = "maybe-rayon" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" -dependencies = [ - "cfg-if", - "rayon", -] - [[package]] name = "md-5" version = "0.10.6" @@ -2950,7 +2950,7 @@ version = "0.1.1" dependencies = [ "ff", "halo2_proofs", - "halo2curves 0.3.2", + "halo2curves 0.7.0", "rand", "rand_core", ] @@ -4676,6 +4676,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unroll" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ad948c1cb799b1a70f836077721a92a35ac177d4daddf4c20a633786d4cf618" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "untrusted" version = "0.9.0" @@ -4765,7 +4775,7 @@ dependencies = [ "ff", "group", "halo2_proofs", - "halo2curves 0.3.2", + "halo2curves 0.7.0", "poseidon", "rand", "rand_core", @@ -5200,7 +5210,7 @@ dependencies = [ "ff", "group", "halo2_proofs", - "halo2curves 0.3.2", + "halo2curves 0.7.0", "hex", "itertools 0.13.0", "nova-snark", diff --git a/Cargo.toml b/Cargo.toml index d855efb..55d02cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,8 +31,8 @@ cargo-llvm-cov = "0.6.13" ethnum = "1.5.0" hex = "0.4.3" rbtree = "0.2.0" -halo2_proofs = { git = "https://github.com/orochi-network/halo2", tag = "v0_0_2" } -halo2curves = { git = "https://github.com/privacy-scaling-explorations/halo2curves", tag = "0.3.2" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2", tag = "v0.3.0" } +halo2curves = { git = "https://github.com/privacy-scaling-explorations/halo2curves", tag = "v0.7.0" } ff = "0.13.0" group = "0.13.0" rand_core = "0.6.4" @@ -40,6 +40,5 @@ rand = "0.8.5" serde_json = "1.0.128" serde = "1.0.210" nova-snark = { git = "https://github.com/microsoft/Nova", default-features = false } -bellpepper-core = { version="0.4.0", default-features = false } +bellpepper-core = { version = "0.4.0", default-features = false } arecibo = { git = "https://github.com/argumentcomputer/arecibo" } - diff --git a/verkletree/src/circuit.rs b/verkletree/src/circuit.rs index df5d743..edc39a6 100644 --- a/verkletree/src/circuit.rs +++ b/verkletree/src/circuit.rs @@ -11,10 +11,7 @@ use group::Curve; use halo2_proofs::{ arithmetic::lagrange_interpolate, circuit::{Layouter, Region, SimpleFloorPlanner, Value}, - halo2curves::{ - bn256::{Bn256, Fr, G1Affine}, - CurveAffineExt, - }, + halo2curves::bn256::{Bn256, Fr, G1Affine}, plonk::{ create_proof, keygen_pk, keygen_vk, verify_proof, Advice, Circuit, Column, ConstraintSystem, Error, Expression, Fixed, Instance, ProvingKey, Selector, @@ -281,9 +278,8 @@ impl, const W: usize, const R: usize, const A: usize> )?; // hash the commitment into a scalar value. We use Poseidon hash function - let (x, y) = commitment.into_coordinates(); - let x_fr = Fr::from_bytes(&x.to_bytes()).unwrap(); - let y_fr = Fr::from_bytes(&y.to_bytes()).unwrap(); + let x_fr = Fr::from_bytes(&commitment.x.to_bytes()).unwrap(); + let y_fr = Fr::from_bytes(&commitment.y.to_bytes()).unwrap(); let next_value = Hash::, W, R>::init().hash([x_fr, y_fr]); // assign the current path node @@ -458,11 +454,10 @@ impl KZGStruct { &self, commitment: G1Affine, ) -> Fr { - let (x_coordinate, y_coordinate) = commitment.into_coordinates(); let x_coordinate_fr = - Fr::from_bytes(&x_coordinate.to_bytes()).expect("Cannot convert x into Fr"); + Fr::from_bytes(&commitment.x.to_bytes()).expect("Cannot convert x into Fr"); let y_coordinate_fr = - Fr::from_bytes(&y_coordinate.to_bytes()).expect("Cannot convert y into Fr"); + Fr::from_bytes(&commitment.y.to_bytes()).expect("Cannot convert y into Fr"); Hash::, W, R>::init().hash([x_coordinate_fr, y_coordinate_fr]) } } diff --git a/zkmemory/src/commitment/verkle_tree.rs b/zkmemory/src/commitment/verkle_tree.rs index dea6331..e4937bc 100644 --- a/zkmemory/src/commitment/verkle_tree.rs +++ b/zkmemory/src/commitment/verkle_tree.rs @@ -12,7 +12,6 @@ use ff::Field; use halo2_proofs::{ circuit::{Layouter, Region, SimpleFloorPlanner, Value}, halo2curves::bn256::{Bn256, Fr, G1Affine}, - halo2curves::CurveAffineExt, plonk::{ Advice, Circuit, Column, ConstraintSystem, Error, Expression, Fixed, Instance, Selector, }, @@ -275,9 +274,9 @@ impl, const W: usize, const R: usize, const A: usize> )?; // hash the commitment into a scalar value. We use Poseidon hash function - let (x, y) = commitment.into_coordinates(); - let x_fr = Fr::from_bytes(&x.to_bytes()).unwrap(); - let y_fr = Fr::from_bytes(&y.to_bytes()).unwrap(); + + let x_fr = Fr::from_bytes(&commitment.x.to_bytes()).unwrap(); + let y_fr = Fr::from_bytes(&commitment.y.to_bytes()).unwrap(); let next_value = Hash::, W, R>::init().hash([x_fr, y_fr]); // assign the current path node @@ -341,7 +340,6 @@ mod tests { use halo2_proofs::{ arithmetic::lagrange_interpolate, dev::MockProver, - halo2curves::CurveAffineExt, poly::{ commitment::Blind, kzg::multiopen::ProverSHPLONK, Coeff, EvaluationDomain, Polynomial, }, @@ -398,11 +396,10 @@ mod tests { &self, commitment: G1Affine, ) -> Fr { - let (x_coordinate, y_coordinate) = commitment.into_coordinates(); let x_coordinate_fr = - Fr::from_bytes(&x_coordinate.to_bytes()).expect("Cannot convert x into Fr"); + Fr::from_bytes(&commitment.x.to_bytes()).expect("Cannot convert x into Fr"); let y_coordinate_fr = - Fr::from_bytes(&y_coordinate.to_bytes()).expect("Cannot convert y into Fr"); + Fr::from_bytes(&commitment.y.to_bytes()).expect("Cannot convert y into Fr"); Hash::, W, R>::init().hash([x_coordinate_fr, y_coordinate_fr]) } }