forked from axiom-crypto/snark-verifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure for more kind of verifier (axiom-crypto#21)
* feat: restructure to monorepo and expand the project scope to be generic (s)nark verifier * feat: reorganize mods and traits for further new features * refactor: simplify trait bounds * chore: use hyphen case for crate name (`snark_verifier` -> `snark-verifier`)
- Loading branch information
Showing
68 changed files
with
1,268 additions
and
846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,4 @@ | ||
[package] | ||
name = "plonk_verifier" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
itertools = "0.10.3" | ||
lazy_static = "1.4.0" | ||
num-bigint = "0.4.3" | ||
num-integer = "0.1.45" | ||
num-traits = "0.2.15" | ||
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 } | ||
|
||
# loader_evm | ||
sha3 = { version = "0.10", optional = true } | ||
bytes = { version = "1.1.0", default-features = false, optional = true } | ||
primitive-types = { version = "0.12.1", default-features = false, features = ["std"], optional = true } | ||
rlp = { version = "0.5.2", default-features = false, features = ["std"], optional = true } | ||
revm = { version = "= 2.3.1", optional = true } | ||
|
||
# loader_halo2 | ||
halo2_wrong_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2022_10_22", package = "ecc", optional = true } | ||
poseidon = { git = "https://github.com/privacy-scaling-explorations/poseidon", tag = "v2022_10_22", optional = true } | ||
|
||
[dev-dependencies] | ||
rand_chacha = "0.3.1" | ||
paste = "1.0.7" | ||
|
||
# system_halo2 | ||
halo2_wrong_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2022_10_22", package = "ecc" } | ||
|
||
# loader_evm | ||
crossterm = { version = "0.25" } | ||
tui = { version = "0.19", default-features = false, features = ["crossterm"] } | ||
|
||
[features] | ||
default = ["loader_evm", "loader_halo2", "system_halo2"] | ||
|
||
parallel = ["dep:rayon"] | ||
|
||
loader_evm = ["dep:bytes", "dep:sha3", "dep:primitive-types", "dep:rlp", "dep:revm"] | ||
loader_halo2 = ["dep:halo2_proofs", "dep:halo2_wrong_ecc", "dep:poseidon"] | ||
|
||
system_halo2 = ["dep:halo2_proofs"] | ||
|
||
[[example]] | ||
name = "evm-verifier" | ||
required-features = ["loader_evm", "system_halo2"] | ||
|
||
[[example]] | ||
name = "evm-verifier-with-accumulator" | ||
required-features = ["loader_halo2", "loader_evm", "system_halo2"] | ||
[workspace] | ||
members = [ | ||
"snark-verifier", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# PLONK Verifier | ||
# SNARK Verifier | ||
|
||
Generic PLONK verifier. | ||
Generic (S)NARK verifier. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[package] | ||
name = "snark-verifier" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
itertools = "0.10.3" | ||
lazy_static = "1.4.0" | ||
num-bigint = "0.4.3" | ||
num-integer = "0.1.45" | ||
num-traits = "0.2.15" | ||
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 } | ||
|
||
# loader_evm | ||
sha3 = { version = "0.10", optional = true } | ||
bytes = { version = "1.1.0", default-features = false, optional = true } | ||
primitive-types = { version = "0.12.1", default-features = false, features = ["std"], optional = true } | ||
rlp = { version = "0.5.2", default-features = false, features = ["std"], optional = true } | ||
revm = { version = "= 2.3.1", optional = true } | ||
|
||
# loader_halo2 | ||
halo2_wrong_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2022_10_22", package = "ecc", optional = true } | ||
poseidon = { git = "https://github.com/privacy-scaling-explorations/poseidon", tag = "v2022_10_22", optional = true } | ||
|
||
[dev-dependencies] | ||
rand_chacha = "0.3.1" | ||
paste = "1.0.7" | ||
|
||
# system_halo2 | ||
halo2_wrong_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2022_10_22", package = "ecc" } | ||
|
||
# loader_evm | ||
crossterm = { version = "0.25" } | ||
tui = { version = "0.19", default-features = false, features = ["crossterm"] } | ||
|
||
[features] | ||
default = ["loader_evm", "loader_halo2", "system_halo2"] | ||
|
||
parallel = ["dep:rayon"] | ||
|
||
loader_evm = ["dep:bytes", "dep:sha3", "dep:primitive-types", "dep:rlp", "dep:revm"] | ||
loader_halo2 = ["dep:halo2_proofs", "dep:halo2_wrong_ecc", "dep:poseidon"] | ||
|
||
system_halo2 = ["dep:halo2_proofs"] | ||
|
||
[[example]] | ||
name = "evm-verifier" | ||
required-features = ["loader_evm", "system_halo2"] | ||
|
||
[[example]] | ||
name = "evm-verifier-with-accumulator" | ||
required-features = ["loader_halo2", "loader_evm", "system_halo2"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::ops::Add; | ||
|
||
#[derive(Debug, Default, Clone, PartialEq, Eq)] | ||
pub struct Cost { | ||
pub num_instance: usize, | ||
pub num_commitment: usize, | ||
pub num_evaluation: usize, | ||
pub num_msm: usize, | ||
pub num_pairing: usize, | ||
} | ||
|
||
impl Add<Cost> for Cost { | ||
type Output = Cost; | ||
|
||
fn add(mut self, rhs: Cost) -> Self::Output { | ||
self.num_instance += rhs.num_instance; | ||
self.num_commitment += rhs.num_commitment; | ||
self.num_evaluation += rhs.num_evaluation; | ||
self.num_msm += rhs.num_msm; | ||
self.num_pairing += rhs.num_pairing; | ||
self | ||
} | ||
} | ||
|
||
pub trait CostEstimation<T> { | ||
type Input; | ||
|
||
fn estimate_cost(input: &Self::Input) -> Cost; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#![allow(clippy::type_complexity)] | ||
#![allow(clippy::too_many_arguments)] | ||
#![allow(clippy::upper_case_acronyms)] | ||
|
||
pub mod cost; | ||
pub mod loader; | ||
pub mod pcs; | ||
pub mod system; | ||
pub mod util; | ||
pub mod verifier; | ||
|
||
#[derive(Clone, Debug)] | ||
pub enum Error { | ||
InvalidInstances, | ||
InvalidProtocol(String), | ||
AssertionFailure(String), | ||
Transcript(std::io::ErrorKind, String), | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.