Skip to content

Commit

Permalink
Bump halo2curves to 0.7 (#366)
Browse files Browse the repository at this point in the history
* bump halo2curves to 0.7

* fix: update compression tests

* fix: update mycircuit, plonk_api and seride tests

---------

Co-authored-by: kilic <[email protected]>
  • Loading branch information
davidnevadoc and kilic authored Sep 13, 2024
1 parent 26fc7c2 commit fac4db0
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion halo2_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
backtrace = { version = "0.3", optional = true }
ff = "0.13"
group = "0.13"
halo2curves = { version = "0.6.1", default-features = false }
halo2curves = { version = "0.7.0", default-features = false }
rand_core = { version = "0.6", default-features = false }
tracing = "0.1"
blake2b_simd = "1" # MSRV 1.66.0
Expand Down
2 changes: 1 addition & 1 deletion halo2_debug/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]

[dependencies]
ff = "0.13"
halo2curves = { version = "0.6.1", default-features = false }
halo2curves = { version = "0.7.0", default-features = false }
num-bigint = "0.4.5"
halo2_middleware = { path = "../halo2_middleware" }
tiny-keccak = { version = "2.0.2", features=["keccak"] }
Expand Down
2 changes: 1 addition & 1 deletion halo2_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
backtrace = { version = "0.3", optional = true }
ff = "0.13"
group = "0.13"
halo2curves = { version = "0.6.1", default-features = false }
halo2curves = { version = "0.7.0", default-features = false }
tracing = "0.1"
blake2b_simd = "1" # MSRV 1.66.0
serde = { version = "1", optional = true, features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion halo2_middleware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]

[dependencies]
ff = "0.13"
halo2curves = { version = "0.6.1", default-features = false }
halo2curves = { version = "0.7.0", default-features = false }
serde = { version = "1", optional = true, features = ["derive"] }
serde_derive = { version = "1", optional = true}
rayon = "1.8"
Expand Down
16 changes: 8 additions & 8 deletions halo2_middleware/src/zal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub mod impls {
use std::marker::PhantomData;

use crate::zal::traits::MsmAccel;
use halo2curves::msm::best_multiexp;
use halo2curves::msm::msm_best;
use halo2curves::CurveAffine;

// Halo2curve Backend
Expand All @@ -134,7 +134,7 @@ pub mod impls {

impl<C: CurveAffine> MsmAccel<C> for H2cEngine {
fn msm(&self, coeffs: &[C::Scalar], bases: &[C]) -> C::Curve {
best_multiexp(coeffs, bases)
msm_best(coeffs, bases)
}

// Caching API
Expand All @@ -156,23 +156,23 @@ pub mod impls {
coeffs: &Self::CoeffsDescriptor<'_>,
base: &[C],
) -> C::Curve {
best_multiexp(coeffs.raw, base)
msm_best(coeffs.raw, base)
}

fn msm_with_cached_base(
&self,
coeffs: &[C::Scalar],
base: &Self::BaseDescriptor<'_>,
) -> C::Curve {
best_multiexp(coeffs, base.raw)
msm_best(coeffs, base.raw)
}

fn msm_with_cached_inputs(
&self,
coeffs: &Self::CoeffsDescriptor<'_>,
base: &Self::BaseDescriptor<'_>,
) -> C::Curve {
best_multiexp(coeffs.raw, base.raw)
msm_best(coeffs.raw, base.raw)
}
}

Expand Down Expand Up @@ -251,7 +251,7 @@ mod test {
use crate::zal::impls::{H2cEngine, PlonkEngineConfig};
use crate::zal::traits::MsmAccel;
use halo2curves::bn256::G1Affine;
use halo2curves::msm::best_multiexp;
use halo2curves::msm::msm_best;
use halo2curves::CurveAffine;

use ark_std::{end_timer, start_timer};
Expand Down Expand Up @@ -282,7 +282,7 @@ mod test {
let scalars = &scalars[..1 << k];

let t0 = start_timer!(|| format!("freestanding msm k={}", k));
let e0 = best_multiexp(scalars, points);
let e0 = msm_best(scalars, points);
end_timer!(t0);

let engine = PlonkEngineConfig::build_default::<C>();
Expand Down Expand Up @@ -323,7 +323,7 @@ mod test {
let scalars = &scalars[..1 << k];

let t0 = start_timer!(|| format!("freestanding msm k={}", k));
let e0 = best_multiexp(scalars, points);
let e0 = msm_best(scalars, points);
end_timer!(t0);

let engine = PlonkEngineConfig::new()
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ harness = false
halo2_middleware = { path = "../halo2_middleware" }
halo2_backend = { path = "../halo2_backend", default-features = false }
halo2_frontend = { path = "../halo2_frontend", default-features = false }
halo2curves = { version = "0.6.1", default-features = false }
halo2curves = { version = "0.7.0", default-features = false }
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
plotters = { version = "0.3.0", default-features = false, optional = true }
group = "0.13"
Expand Down
14 changes: 7 additions & 7 deletions halo2_proofs/tests/compress_selectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,32 +484,32 @@ fn test_compress_gates() {
}

#[test]
fn test_success() -> Result<(), halo2_proofs::plonk::Error> {
// vk & pk keygen both WITH compress
fn test_key_compression() -> Result<(), halo2_proofs::plonk::Error> {
// vk & pk keygen both WITH compression
test_result(
|| test_mycircuit(true, true).expect("should pass"),
"8326140d1873a91630d439a8812d1f104667144e03e0cd5c59eb358ae5d1a4eb",
"acae50508de5ead584170dd83b139daf40e1026b6debbb78eb05d515173fc2dd",
);

// vk & pk keygen both WITHOUT compress
// vk & pk keygen both WITHOUT compression
test_result(
|| test_mycircuit(false, false).expect("should pass"),
"73dd4c3c9c51d55dc8cf68ca2b5d8acdb40ed44bc8a88d718325bc0023688f64",
"f9c99bd341705ac6a13724a526dd28df0bac1c745e0cde40ab39cab3e1b95309",
);

Ok(())
}

#[should_panic]
#[test]
fn test_failure_1() {
fn test_key_compression_failure_1() {
// vk keygen WITH compress
// pk keygen WITHOUT compress
assert!(test_mycircuit(false, true).is_err());
}

#[test]
fn test_failure_2() {
fn test_key_compression_failure_2() {
// vk keygen WITHOUT compress
// pk keygen WITH compress
assert!(test_mycircuit(true, false).is_err());
Expand Down
4 changes: 2 additions & 2 deletions halo2_proofs/tests/frontend_backend_split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ fn test_mycircuit_full_legacy() {

proof
},
"427e55eafeaafd9f4dfc7ec6f782ec7464251c749bb08e23efb663790c0419ed",
"78aadfd46b5cc58b90d832ee47e4df57af3dfc28d1457c4ceeb5d0323a72f130",
);
}

Expand Down Expand Up @@ -619,6 +619,6 @@ fn test_mycircuit_full_split() {

proof
},
"427e55eafeaafd9f4dfc7ec6f782ec7464251c749bb08e23efb663790c0419ed",
"78aadfd46b5cc58b90d832ee47e4df57af3dfc28d1457c4ceeb5d0323a72f130",
);
}
4 changes: 2 additions & 2 deletions halo2_proofs/tests/plonk_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ fn plonk_api() {

proof
},
"b749dfa90ac3bc3d45f994cc8bf527928a274c2225e4e87668eece79938e6d12",
"f87ba1010dede5a2148ed94403ca12a566d3154ebb12ccb6c20a330e9b280af8",
);
}

Expand Down Expand Up @@ -638,7 +638,7 @@ fn plonk_api() {

proof
},
"284001f93f86a5d18ad9ebff6da81031e5ad9f799ea1dc2606271a6ff240fbd3",
"0fc67d890faef0ef8ea7ef680cc566b2ab7dabef12fcceb74d3655a0fb08c708",
);
}

Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/tests/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,6 @@ fn test_serialization() {

proof
},
"0d3baeea90249588c3939dc2f64b071b24b7e4744c4ca8442fe4b2553aae9167",
"b51ea51140e9fbd1f0c665c788bab9e4b3e648ac674b6d07a24ca0844f0962ad",
);
}
2 changes: 1 addition & 1 deletion p3_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ serde = { version = "1.0", default-features = false, features = ["derive", "allo
num-bigint = { version = "0.4.3", default-features = false }

[dev-dependencies]
halo2curves = { version = "0.6.0", default-features = false }
halo2curves = { version = "0.7.0", default-features = false }
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
halo2_backend = { path = "../halo2_backend" }
serde_test = { version = "1.0" }
Expand Down

0 comments on commit fac4db0

Please sign in to comment.