Skip to content

Commit

Permalink
Move OptimizedPoseidonSpec to halo2-base (#31)
Browse files Browse the repository at this point in the history
* chore: move `OptimizedPoseidonSpec` to `halo2-base`

* Bump version to 0.1.5 and remove poseidon-rs dep
  • Loading branch information
jonathanpwang authored Sep 8, 2023
1 parent 10ef300 commit 260962d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 343 deletions.
24 changes: 15 additions & 9 deletions snark-verifier-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snark-verifier-sdk"
version = "0.1.4"
version = "0.1.5"
edition = "2021"

[dependencies]
Expand All @@ -22,14 +22,14 @@ snark-verifier = { path = "../snark-verifier", default-features = false }
getset = "0.1.2"

# loader_evm
ethereum-types = { version = "0.14.1", default-features = false, features = ["std"], optional = true }
# sha3 = { version = "0.10", optional = true }
# revm = { version = "2.3.1", optional = true }
# bytes = { version = "1.2", optional = true }
# rlp = { version = "0.5", default-features = false, features = ["std"], optional = true }
ethereum-types = { version = "0.14.1", default-features = false, features = [
"std",
], optional = true }

# zkevm benchmarks
zkevm-circuits = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits.git", rev = "f834e61", features = ["test"], optional = true }
zkevm-circuits = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits.git", rev = "f834e61", features = [
"test",
], optional = true }
bus-mapping = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits.git", rev = "f834e61", optional = true }
eth-types = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits.git", rev = "f834e61", optional = true }
mock = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits.git", rev = "f834e61", optional = true }
Expand All @@ -45,7 +45,13 @@ crossterm = { version = "0.25" }
tui = { version = "0.19", default-features = false, features = ["crossterm"] }

[features]
default = ["loader_halo2", "loader_evm", "halo2-axiom", "halo2-base/jemallocator", "display"]
default = [
"loader_halo2",
"loader_evm",
"halo2-axiom",
"halo2-base/jemallocator",
"display",
]
display = ["snark-verifier/display", "dep:ark-std"]
loader_evm = ["snark-verifier/loader_evm", "dep:ethereum-types"]
loader_halo2 = ["snark-verifier/loader_halo2"]
Expand Down Expand Up @@ -74,4 +80,4 @@ harness = false
[[bench]]
name = "read_pk"
required-features = ["loader_halo2"]
harness = false
harness = false
2 changes: 1 addition & 1 deletion snark-verifier-sdk/src/halo2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::{read_instances, write_instances, CircuitExt, PlonkSuccinctVerifier,
#[cfg(feature = "display")]
use ark_std::{end_timer, start_timer};
use halo2_base::halo2_proofs;
pub use halo2_base::poseidon::hasher::spec::OptimizedPoseidonSpec;
use halo2_proofs::{
circuit::Layouter,
halo2curves::{
Expand All @@ -26,7 +27,6 @@ use halo2_proofs::{
use itertools::Itertools;
use lazy_static::lazy_static;
use rand::{rngs::StdRng, SeedableRng};
pub use snark_verifier::util::hash::OptimizedPoseidonSpec;
use snark_verifier::{
cost::CostEstimation,
loader::native::NativeLoader,
Expand Down
6 changes: 1 addition & 5 deletions snark-verifier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snark-verifier"
version = "0.1.4"
version = "0.1.5"
edition = "2021"

[dependencies]
Expand All @@ -16,10 +16,6 @@ pairing = { version = "0.23" }

# Use halo2-base as non-optional dependency because it re-exports halo2_proofs, halo2curves, and poseidon, using different repos based on feature flag "halo2-axiom" or "halo2-pse"
halo2-base = { git = "https://github.com/axiom-crypto/halo2-lib.git", branch = "develop", default-features = false }
# This is Scroll's audited poseidon circuit. We only use it for the Native Poseidon spec. We do not use the halo2 circuit at all (and it wouldn't even work because the halo2_proofs tag is not compatbile).
# We forked it to upgrade to ff v0.13 and removed the circuit module
poseidon-rs = { git = "https://github.com/axiom-crypto/poseidon-circuit.git", rev = "1aee4a1" }
# poseidon-circuit = { git = "https://github.com/scroll-tech/poseidon-circuit.git", rev = "50015b7" }

# parallel
rayon = { version = "1.7", optional = true }
Expand Down
4 changes: 3 additions & 1 deletion snark-verifier/src/util/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
mod poseidon;

#[cfg(feature = "loader_halo2")]
pub use crate::util::hash::poseidon::{OptimizedPoseidonSpec, Poseidon};
pub use crate::util::hash::poseidon::Poseidon;
#[cfg(feature = "loader_halo2")]
pub(crate) use halo2_base::poseidon::hasher::spec::OptimizedPoseidonSpec;

#[cfg(feature = "loader_evm")]
pub use sha3::{Digest, Keccak256};
Loading

0 comments on commit 260962d

Please sign in to comment.