Skip to content

Commit 43cee2a

Browse files
authored
feat: replace local prover by zkm recursion (#61)
* feat: replace local prover by zkm recursion * fix: clippy
1 parent 190c4fb commit 43cee2a

File tree

22 files changed

+33
-1124
lines changed

22 files changed

+33
-1124
lines changed

host-program/mem-alloc-vec/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ edition = "2021"
77

88
[dependencies]
99
zkm-sdk = { path = "../../sdk", features = ["snark"] }
10+
zkm-recursion = {git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false }
11+
1012
#tonic = "0.8.1"
1113
tokio = { version = "1.21.0", features = ["macros", "rt-multi-thread", "signal"] }
1214
log = { version = "0.4.14", default-features = false }

host-program/mem-alloc-vec/src/main.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@ async fn main() -> Result<()> {
1616

1717
//excuting the setup_and_generate_sol_verifier
1818
if prover_input.snark_setup {
19-
match prover_client
20-
.setup_and_generate_sol_verifier(
21-
&client_config.zkm_prover_type,
22-
&client_config.vk_path,
23-
&prover_input,
24-
)
25-
.await
26-
{
19+
match zkm_recursion::groth16_setup(&client_config.vk_path) {
2720
Ok(()) => log::info!("Succussfully setup_and_generate_sol_verifier."),
2821
Err(e) => {
2922
log::info!("Error during setup_and_generate_sol_verifier: {}", e);

host-program/revme/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ edition = "2021"
77

88
[dependencies]
99
zkm-sdk = { path = "../../sdk", features = ["snark"] }
10+
zkm-recursion = {git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false }
11+
1012
tokio = { version = "1.21.0", features = ["macros", "rt-multi-thread", "signal"] }
1113
#ethers = "2.0.14"
1214
log = { version = "0.4.14", default-features = false }

host-program/revme/src/main.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,7 @@ async fn main() -> Result<()> {
2222

2323
//excuting the setup_and_generate_sol_verifier
2424
if prover_input.snark_setup {
25-
match prover_client
26-
.setup_and_generate_sol_verifier(
27-
&client_config.zkm_prover_type,
28-
&client_config.vk_path,
29-
&prover_input,
30-
)
31-
.await
32-
{
25+
match zkm_recursion::groth16_setup(&client_config.vk_path) {
3326
Ok(()) => log::info!("Succussfully setup_and_generate_sol_verifier."),
3427
Err(e) => {
3528
log::info!("Error during setup_and_generate_sol_verifier: {}", e);

host-program/sha2-go/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ edition = "2021"
88
[dependencies]
99
zkm-sdk = { path = "../../sdk", features = ["snark"] }
1010
bincode = "1.3.3"
11+
zkm-recursion = {git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false }
1112

1213
tokio = { version = "1.21.0", features = ["macros", "rt-multi-thread", "signal"] }
1314
#ethers = "2.0.14"

host-program/sha2-go/src/main.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@ async fn main() -> Result<()> {
1717
log::info!("new prover client,ok.");
1818
//excuting the setup_and_generate_sol_verifier
1919
if prover_input.snark_setup {
20-
match prover_client
21-
.setup_and_generate_sol_verifier(
22-
&client_config.zkm_prover_type,
23-
&client_config.vk_path,
24-
&prover_input,
25-
)
26-
.await
27-
{
20+
match zkm_recursion::groth16_setup(&client_config.vk_path) {
2821
Ok(()) => log::info!("Succussfully setup_and_generate_sol_verifier."),
2922
Err(e) => {
3023
log::info!("Error during setup_and_generate_sol_verifier: {}", e);

host-program/sha2-rust/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ edition = "2021"
77

88
[dependencies]
99
zkm-sdk = { path = "../../sdk", features = ["snark"] }
10+
zkm-recursion = {git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false }
1011
bincode = "1.3.3"
1112
sha2 = { version = "0.10.8", default-features = false }
1213

host-program/sha2-rust/src/main.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@ async fn main() -> Result<()> {
1717

1818
//excuting the setup_and_generate_sol_verifier
1919
if prover_input.snark_setup {
20-
match prover_client
21-
.setup_and_generate_sol_verifier(
22-
&client_config.zkm_prover_type,
23-
&client_config.vk_path,
24-
&prover_input,
25-
)
26-
.await
27-
{
20+
match zkm_recursion::groth16_setup(&client_config.vk_path) {
2821
Ok(()) => log::info!("Succussfully setup_and_generate_sol_verifier."),
2922
Err(e) => {
3023
log::info!("Error during setup_and_generate_sol_verifier: {}", e);

sdk/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ async-trait = "0.1"
1313

1414
zkm-prover = { git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false }
1515
zkm-emulator = { git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false }
16+
zkm-recursion = {git = "https://github.com/zkMIPS/zkm", branch = "main", default-features = false }
1617
plonky2 = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" }
1718
#starky = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" }
1819

sdk/build.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
use std::path::PathBuf;
2-
use std::process::Command;
32
fn main() -> Result<(), Box<dyn std::error::Error>> {
43
println!("cargo:rerun-if-changed=go");
54
let out_dir = std::env::var("OUT_DIR").unwrap();
65
let dest_path = PathBuf::from(&out_dir);
76
let lib_name = "zkmgnark";
8-
let dest = dest_path.join(format!("lib{}.a", lib_name));
9-
let status = Command::new("go")
10-
.current_dir("src/local/libsnark")
11-
.env("CGO_ENABLED", "1")
12-
.args(["build", "-tags=debug", "-o", dest.to_str().unwrap(), "-buildmode=c-archive", "."])
13-
.status()
14-
.expect("Failed to build Go library");
15-
if !status.success() {
16-
panic!("Go build failed");
17-
}
7+
// let dest = dest_path.join(format!("lib{}.a", lib_name));
8+
// let status = Command::new("go")
9+
// .current_dir("src/local/libsnark")
10+
// .env("CGO_ENABLED", "1")
11+
// .args(["build", "-tags=debug", "-o", dest.to_str().unwrap(), "-buildmode=c-archive", "."])
12+
// .status()
13+
// .expect("Failed to build Go library");
14+
// if !status.success() {
15+
// panic!("Go build failed");
16+
// }
1817

1918
if std::env::var_os("USE_LOCAL_PROVER").is_some() {
2019
tonic_build::configure()

0 commit comments

Comments
 (0)