-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sdk(network prover) * fmt * default * use async new * Optimize Protocol * Option proto3_optional * cargo fmt
- Loading branch information
1 parent
82abbff
commit 719c05e
Showing
11 changed files
with
823 additions
and
1 deletion.
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,7 +1,8 @@ | ||
[workspace] | ||
members = [ | ||
|
||
"host-program" | ||
"host-program", | ||
"sdk" | ||
] | ||
resolver = "2" | ||
|
||
|
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,2 @@ | ||
[toolchain] | ||
channel = "nightly-2024-07-20" |
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,64 @@ | ||
[package] | ||
name = "zkm-sdk" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
##zkm-emulator = { path = "../emulator" } | ||
#plonky2 = { path = "../plonky2/plonky2" } | ||
##starky = { path = "../plonky2/starky" } | ||
#plonky2_util = { path = "../plonky2/util" } | ||
#plonky2_maybe_rayon = { path = "../plonky2/maybe_rayon" } | ||
|
||
bincode = "1.3.3" | ||
|
||
async-trait = "0.1" | ||
|
||
stage-service = {package = "service", git = "https://github.com/zkMIPS/zkm-prover", branch = "main", default-features = false } | ||
zkm-prover = { git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false } | ||
zkm-emulator = { git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false } | ||
common = { git = "https://github.com/zkMIPS/zkm-prover", branch = "main", default-features = false } | ||
plonky2 = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" } | ||
#starky = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" } | ||
plonky2_util = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" } | ||
plonky2_maybe_rayon = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" } | ||
|
||
tonic = "0.8.1" | ||
prost = "0.11.0" | ||
tokio = { version = "1.21.0", features = ["macros", "rt-multi-thread", "signal"] } | ||
ethers = "2.0.14" | ||
|
||
itertools = "0.11.0" | ||
log = { version = "0.4.14", default-features = false } | ||
anyhow = "1.0.75" | ||
num = "0.4.0" | ||
num-bigint = "0.4.3" | ||
serde = { version = "1.0.144", features = ["derive"] } | ||
serde_json = "1.0" | ||
tiny-keccak = "2.0.2" | ||
rand = "0.8.5" | ||
rand_chacha = "0.3.1" | ||
once_cell = "1.13.0" | ||
static_assertions = "1.1.0" | ||
byteorder = "1.5.0" | ||
hex = "0.4" | ||
hashbrown = { version = "0.14.0", default-features = false, features = ["ahash", "serde"] } # NOTE: When upgrading, see `ahash` dependency. | ||
lazy_static = "1.4.0" | ||
|
||
elf = { version = "0.7", default-features = false } | ||
uuid = { version = "1.2", features = ["v4", "fast-rng", "macro-diagnostics"] } | ||
|
||
##[dev-dependencies] | ||
env_logger = "0.10.0" | ||
keccak-hash = "0.10.0" | ||
plonky2x = { git = "https://github.com/zkMIPS/succinctx.git", package = "plonky2x", branch = "zkm" } | ||
plonky2x-derive = { git = "https://github.com/zkMIPS/succinctx.git", package = "plonky2x-derive", branch = "zkm" } | ||
|
||
[build-dependencies] | ||
tonic-build = "0.8.0" | ||
|
||
[features] | ||
test = [] | ||
|
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,6 @@ | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
tonic_build::configure() | ||
.protoc_arg("--experimental_allow_proto3_optional") | ||
.compile(&["src/proto/stage.proto"], &["src/proto"])?; | ||
Ok(()) | ||
} |
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,42 @@ | ||
pub mod local; | ||
pub mod network; | ||
pub mod prover; | ||
|
||
use network::prover::NetworkProver; | ||
use prover::Prover; | ||
use std::env; | ||
|
||
pub struct ProverClient { | ||
pub prover: Box<dyn Prover>, | ||
} | ||
|
||
impl ProverClient { | ||
pub async fn new() -> Self { | ||
#[allow(unreachable_code)] | ||
match env::var("ZKM_PROVER") | ||
.unwrap_or("network".to_string()) | ||
.to_lowercase() | ||
.as_str() | ||
{ | ||
// "local" => Self { | ||
// prover: Box::new(CpuProver::new()), | ||
// }, | ||
"network" => Self { | ||
prover: Box::new(NetworkProver::new().await.unwrap()), | ||
}, | ||
_ => panic!( | ||
"invalid value for ZKM_PROVER enviroment variable: expected 'local', or 'network'" | ||
), | ||
} | ||
} | ||
|
||
// pub fn local() -> Self { | ||
// Self { prover: Box::new(CpuProver::new()) } | ||
// } | ||
|
||
pub async fn network() -> Self { | ||
Self { | ||
prover: Box::new(NetworkProver::new().await.unwrap()), | ||
} | ||
} | ||
} |
Oops, something went wrong.