Skip to content
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
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ rand = "0.8"
hex = "0.4"
halo2_curves = { git = "https://github.com/privacy-scaling-explorations/halo2curves", tag = "0.3.0", package = "halo2curves" }

# parallel
rayon = { version = "1.5.3", optional = true }

# system_halo2
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2", tag = "v2022_10_22", optional = true }

Expand Down Expand Up @@ -41,13 +44,13 @@ tui = { version = "0.19", default-features = false, features = ["crossterm"] }
[features]
default = ["loader_evm", "loader_halo2", "system_halo2"]

parallel = ["dep:rayon"]

loader_evm = ["dep:ethereum_types", "dep:sha3", "dep:revm", "dep:bytes", "dep:rlp"]
loader_halo2 = ["dep:halo2_proofs", "dep:halo2_wrong_ecc", "dep:poseidon"]

system_halo2 = ["dep:halo2_proofs"]

sanity_check = []

[[example]]
name = "evm-verifier"
required-features = ["loader_evm", "system_halo2"]
Expand Down
21 changes: 14 additions & 7 deletions src/loader/halo2/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{
};
use halo2_proofs::circuit::Value;

#[derive(Clone, Debug)]
pub struct Snark<C: CurveAffine> {
pub protocol: Protocol<C>,
pub instances: Vec<Vec<C::Scalar>>,
Expand All @@ -27,6 +28,7 @@ impl<C: CurveAffine> Snark<C> {
}
}

#[derive(Clone, Debug)]
pub struct SnarkWitness<C: CurveAffine> {
pub protocol: Protocol<C>,
pub instances: Vec<Vec<Value<C::Scalar>>>,
Expand All @@ -48,18 +50,23 @@ impl<C: CurveAffine> From<Snark<C>> for SnarkWitness<C> {
}

impl<C: CurveAffine> SnarkWitness<C> {
pub fn without_witnesses(&self) -> Self {
pub fn new_without_witness(protocol: Protocol<C>) -> Self {
let instances = protocol
.num_instance
.iter()
.map(|num_instance| vec![Value::unknown(); *num_instance])
.collect();
SnarkWitness {
protocol: self.protocol.clone(),
instances: self
.instances
.iter()
.map(|instances| vec![Value::unknown(); instances.len()])
.collect(),
protocol,
instances,
proof: Value::unknown(),
}
}

pub fn without_witnesses(&self) -> Self {
SnarkWitness::new_without_witness(self.protocol.clone())
}

pub fn proof(&self) -> Value<&[u8]> {
self.proof.as_ref().map(Vec::as_slice)
}
Expand Down
1 change: 1 addition & 0 deletions src/pcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
use rand::Rng;
use std::fmt::Debug;

pub mod ipa;
pub mod kzg;

pub trait PolynomialCommitmentScheme<C, L>: Clone + Debug
Expand Down
Loading