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

Halo2 0.4 and Halo2curves 0.7 compat + Rust warnings fixes #468

Merged
merged 2 commits into from
Sep 25, 2024
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 @@ -28,11 +28,11 @@ macro_rules! test_dir {
}

const AGGREGATE_VERIFY_TESTS: &str = concat!(test_dir!(), "aggregate_verify/*");
const AGGREGATE_TESTS: &str = concat!(test_dir!(), "aggregate/*");
// const AGGREGATE_TESTS: &str = concat!(test_dir!(), "aggregate/*");
const DESERIALIZATION_G1_TESTS: &str = concat!(test_dir!(), "deserialization_G1/*");
const BATCH_VERIFY_TESTS: &str = concat!(test_dir!(), "batch_verify/*");
const FAST_AGGREGATE_VERIFY_TESTS: &str = concat!(test_dir!(), "fast_aggregate_verify/*");
const HASH_TO_G2_TESTS: &str = concat!(test_dir!(), "hash_to_G2/*");
// const HASH_TO_G2_TESTS: &str = concat!(test_dir!(), "hash_to_G2/*");
const DESERIALIZATION_G2_TESTS: &str = concat!(test_dir!(), "deserialization_G2/*");
const VERIFY_TESTS: &str = concat!(test_dir!(), "verify/*");
const SIGN_TESTS: &str = concat!(test_dir!(), "sign/*");
Expand Down Expand Up @@ -294,7 +294,7 @@ fn t_sign() {
match skey {
Err(_e) => {
// empty output due to `null` JSON value
let (Some(tout), Some(tmsg)) =
let (Some(tout), Some(_)) =
(test.output.opt_bytes.0, test.input.message.opt_bytes.0)
else {
assert!(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const FAIL_MAP_FP2_TO_G2_BLS_TESTS: &str =

type HexString = String;

#[allow(dead_code, non_snake_case)]
#[derive(Deserialize, Debug)]
struct PrecompileTest {
Input: HexString,
Expand Down Expand Up @@ -238,17 +239,17 @@ fn t_map_fp_to_g1_bls_tests() {
t_generate(test_name, evm_bls12381_map_fp_to_g1);
}
#[test]
fn t_fail_map_fp_to_G1_bls_tests() {
fn t_fail_map_fp_to_g1_bls_tests() {
let test_name = FAIL_MAP_FP_TO_G1_BLS_TESTS.to_string();
t_generate(test_name, evm_bls12381_map_fp_to_g1);
}
#[test]
fn t_map_fp2_to_G2_bls_tests() {
fn t_map_fp2_to_g2_bls_tests() {
let test_name = MAP_FP2_TO_G2_BLS_TESTS.to_string();
t_generate(test_name, evm_bls12381_map_fp2_to_g2);
}
#[test]
fn t_fail_map_fp2_to_G2_bls_tests() {
fn t_fail_map_fp2_to_g2_bls_tests() {
let test_name = FAIL_MAP_FP2_TO_G2_BLS_TESTS.to_string();
t_generate(test_name, evm_bls12381_map_fp2_to_g2);
}
4 changes: 2 additions & 2 deletions constantine-rust/constantine-halo2-zal/benches/msm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use constantine_halo2_zal::CttEngine;

use halo2curves::bn256::{Fr as Scalar, G1Affine as Point};
use halo2curves::ff::Field;
use halo2curves::msm::best_multiexp;
use halo2curves::msm::msm_best;
use halo2curves::zal::MsmAccel;

use rayon::current_thread_index;
Expand Down Expand Up @@ -94,7 +94,7 @@ fn msm(c: &mut Criterion) {
assert!(k < 64);
let n: usize = 1 << k;
b.iter(|| {
best_multiexp(&coeffs[..n], &bases[..n]);
msm_best(&coeffs[..n], &bases[..n]);
})
})
.sample_size(SAMPLE_SIZE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use halo2_middleware::halo2curves::bn256;
use halo2_middleware::halo2curves::ff::Field;
use halo2_middleware::halo2curves::group::prime::PrimeCurveAffine;
use halo2_middleware::halo2curves::group::{Curve, Group};
use halo2_middleware::halo2curves::msm::best_multiexp;
use halo2_middleware::halo2curves::msm::msm_best;
use halo2_middleware::zal::traits::MsmAccel;

#[test]
Expand All @@ -42,7 +42,7 @@ fn run_msm_zal(min_k: usize, max_k: usize) {
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 = CttEngine::new(hardware::get_num_threads_os());
Expand Down
6 changes: 3 additions & 3 deletions docs/zk_accel_layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ mod tests {
use halo2curves::ff::Field;
use halo2curves::group::prime::PrimeCurveAffine;
use halo2curves::group::{Curve, Group};
use halo2curves::msm::best_multiexp;
use halo2curves::msm::msm_best;
use halo2curves::zal::MsmAccel;

#[test]
Expand All @@ -181,7 +181,7 @@ mod tests {
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 = CttEngine::new(num_cpus::get());
Expand Down Expand Up @@ -232,4 +232,4 @@ mod tests {
prj.z *= jac.z
```
Coordinates are ordered (X, Y, Z)
- Result requires 96 bytes
- Result requires 96 bytes
Loading