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

chore: Refactors CPU MSM operations using halo2curves library #230

Merged
merged 1 commit into from
Jan 4, 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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pasta-msm = { git = "https://github.com/lurk-lab/pasta-msm", branch = "dev", ver
grumpkin-msm = { git = "https://github.com/lurk-lab/grumpkin-msm", branch = "dev", features = ["dont-implement-sort"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
halo2curves = { version = "0.5.0", features = ["bits", "derive_serde"] }
halo2curves = { version = "0.5.0", features = ["bits", "derive_serde", "multicore"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
# see https://github.com/rust-random/rand/pull/948
Expand Down
4 changes: 2 additions & 2 deletions src/provider/bn256_grumpkin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use ff::{FromUniformBytes, PrimeField};
use group::{cofactor::CofactorCurveAffine, Curve, Group as AnotherGroup};
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
use grumpkin_msm::{bn256 as bn256_msm, grumpkin as grumpkin_msm};
// Remove this when https://github.com/zcash/pasta_curves/issues/41 resolves
use halo2curves::{CurveAffine, CurveExt};
use num_bigint::BigInt;
use num_traits::Num;
// Remove this when https://github.com/zcash/pasta_curves/issues/41 resolves
use pasta_curves::arithmetic::{CurveAffine, CurveExt};
use rayon::prelude::*;
use sha3::Shake256;
use std::io::Read;
Expand Down
11 changes: 10 additions & 1 deletion src/provider/util/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/// Utilities for provider module
pub(in crate::provider) mod fb_msm;
pub(in crate::provider) mod msm;
pub mod msm {
use halo2curves::msm::best_multiexp;
use halo2curves::CurveAffine;

// this argument swap is useful until Rust gets named arguments
// and saves significant complexity in macro code
pub fn cpu_best_msm<C: CurveAffine>(bases: &[C], scalars: &[C::Scalar]) -> C::Curve {
best_multiexp(scalars, bases)
}
}
154 changes: 0 additions & 154 deletions src/provider/util/msm.rs

This file was deleted.

Loading