aboutsummaryrefslogtreecommitdiff
path: root/zkvms/zkm/sdk/src
diff options
context:
space:
mode:
authorKamen Mladenov <kamen@syndamia.com>2025-02-10 17:15:21 +0200
committerKamen Mladenov <kamen@syndamia.com>2025-02-10 17:15:21 +0200
commit0baed210fa4946669e9a701bc688a9618f0d9583 (patch)
tree6c83122d6df0906ac00a0f2a6ed6390b73dbdf88 /zkvms/zkm/sdk/src
parent01b199735cffdec1376024b8214499190d08a876 (diff)
downloadzkVMs-benchmarks-0baed210fa4946669e9a701bc688a9618f0d9583.tar
zkVMs-benchmarks-0baed210fa4946669e9a701bc688a9618f0d9583.tar.gz
zkVMs-benchmarks-0baed210fa4946669e9a701bc688a9618f0d9583.zip
feat(zkm): Remove copy of sdk
Diffstat (limited to 'zkvms/zkm/sdk/src')
-rw-r--r--zkvms/zkm/sdk/src/lib.rs287
-rwxr-xr-xzkvms/zkm/sdk/src/local/libsnark/compile.sh23
-rw-r--r--zkvms/zkm/sdk/src/local/libsnark/contract.go253
-rw-r--r--zkvms/zkm/sdk/src/local/libsnark/go.mod56
-rw-r--r--zkvms/zkm/sdk/src/local/libsnark/go.sum225
-rw-r--r--zkvms/zkm/sdk/src/local/libsnark/libsnark.go41
-rw-r--r--zkvms/zkm/sdk/src/local/libsnark/snark_prover.go304
-rw-r--r--zkvms/zkm/sdk/src/local/mod.rs5
-rw-r--r--zkvms/zkm/sdk/src/local/prover.rs177
-rw-r--r--zkvms/zkm/sdk/src/local/snark.rs82
-rw-r--r--zkvms/zkm/sdk/src/local/stark.rs54
-rw-r--r--zkvms/zkm/sdk/src/local/util.rs180
-rw-r--r--zkvms/zkm/sdk/src/network/mod.rs1
-rw-r--r--zkvms/zkm/sdk/src/network/prover.rs246
-rw-r--r--zkvms/zkm/sdk/src/proto/stage.proto82
-rw-r--r--zkvms/zkm/sdk/src/prover.rs91
16 files changed, 0 insertions, 2107 deletions
diff --git a/zkvms/zkm/sdk/src/lib.rs b/zkvms/zkm/sdk/src/lib.rs
deleted file mode 100644
index 3344532..0000000
--- a/zkvms/zkm/sdk/src/lib.rs
+++ /dev/null
@@ -1,287 +0,0 @@
-pub mod local;
-pub mod network;
-pub mod prover;
-
-use anyhow::bail;
-use local::prover::LocalProver;
-use network::prover::NetworkProver;
-use prover::{ClientCfg, Prover, ProverInput, ProverResult};
-use serde::{Deserialize, Serialize};
-use std::fs;
-use std::fs::File;
-use std::io::Write;
-use std::path::Path;
-
-use serde_json::to_writer;
-use sha2::{Digest, Sha256};
-
-use anyhow::Context;
-//use bincode;
-
-pub struct ProverClient {
- pub prover: Box<dyn Prover>,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-pub struct PublicInputs {
- roots_before: Roots,
- roots_after: Roots,
- userdata: Vec<u8>,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-pub struct Roots {
- root: Vec<u64>,
-}
-
-pub const LOCAL_PROVER: &str = "local";
-pub const NETWORK_PROVER: &str = "network";
-
-pub fn is_local_prover(zkm_prover: &str) -> bool {
- zkm_prover.to_lowercase() == *LOCAL_PROVER
-}
-
-// Generic function to save serialized data to a JSON file
-pub fn save_data_as_json<T: Serialize>(
- output_dir: &str,
- file_name: &str,
- data: &T,
-) -> anyhow::Result<()> {
- // Create the output directory
- fs::create_dir_all(output_dir).unwrap();
-
- // Build the full file path
- let output_path = Path::new(&output_dir).join(file_name);
-
- // Open the file and write the data
- let mut file = File::create(&output_path).unwrap();
- to_writer(&mut file, data)?;
-
- log::info!("Data successfully written to file.");
- Ok(())
-}
-
-// Generic function to save data to a file
-pub fn save_data_to_file<P: AsRef<Path>, D: AsRef<[u8]>>(
- output_dir: P,
- file_name: &str,
- data: D,
-) -> anyhow::Result<()> {
- // Create the output directory
- let output_dir = output_dir.as_ref();
- fs::create_dir_all(output_dir).context("Failed to create output directory")?;
-
- // Build the full file path
- let output_path = output_dir.join(file_name);
-
- // Open the file and write the data
- let mut file = File::create(&output_path).context("Unable to create file")?;
- file.write_all(data.as_ref())
- .context("Failed to write to file")?;
-
- let bytes_written = data.as_ref().len();
- log::info!("Successfully written {} bytes.", bytes_written);
-
- Ok(())
-}
-
-pub fn update_public_inputs_with_bincode(
- public_inputstream: Vec<u8>,
- proof_public_inputs: &[u8],
-) -> anyhow::Result<Option<PublicInputs>> {
- let mut hasher = Sha256::new();
- hasher.update(&public_inputstream);
- let result_hs = hasher.finalize();
- let output_hs: [u8; 32] = result_hs.into();
-
- let slice_bt: &[u8] = proof_public_inputs;
- let mut public_inputs: PublicInputs =
- serde_json::from_slice(slice_bt).expect("Failed to parse JSON");
-
- //1.check the userdata (from the proof) = hash(bincode(host's public_inputs)) ?
- let userdata = public_inputs.userdata;
- if userdata == output_hs {
- log::info!(" hash(bincode(pulic_input))1: {:?} ", &userdata);
- //2, update userdata with bincode(host's public_inputs).
- //the userdata is saved in the public_inputs.json.
- //the test contract validates the public inputs in the snark proof file using this userdata.
- public_inputs.userdata = public_inputstream;
- } else if public_inputstream.is_empty() {
- log::info!(" hash(bincode(pulic_input))2: {:?} ", &userdata);
- //2', in this case, the bincode(public inputs) need setting to vec![0u8; 32].
- //the userdata is saved in the public_inputs.json.
- //the test contract validates the public inputs in the snark proof file using this userdata.
- public_inputs.userdata = vec![0u8; 32];
- } else {
- log::info!(
- "public inputs's hash is different. the proof's is: {:?}, host's is :{:?} ",
- userdata,
- output_hs
- );
- bail!("Public inputs's hash does not match the proof's userdata.");
- }
-
- Ok(Some(public_inputs))
-}
-
-impl ProverClient {
- pub async fn new(client_config: &ClientCfg) -> Self {
- #[allow(unreachable_code)]
- match client_config.zkm_prover.as_str() {
- "local" => Self {
- prover: Box::new(LocalProver::new(&client_config.vk_path)),
- },
- "network" => Self {
- prover: Box::new(NetworkProver::new(client_config).await.unwrap()),
- },
- _ => panic!(
- "Invalid value for ZKM_PROVER enviroment variable: expected 'local', or 'network'"
- ),
- }
- }
-
- pub fn local(vk_path: &str) -> Self {
- Self {
- prover: Box::new(LocalProver::new(vk_path)),
- }
- }
-
- pub async fn network(client_config: &ClientCfg) -> Self {
- Self {
- prover: Box::new(NetworkProver::new(client_config).await.unwrap()),
- }
- }
-
- pub async fn setup_and_generate_sol_verifier(
- &self,
- zkm_prover: &str,
- vk_path: &str,
- prover_input: &ProverInput,
- ) -> anyhow::Result<()> {
- if is_local_prover(zkm_prover) {
- log::info!("Excuting the setup.");
- self.prover
- .setup_and_generate_sol_verifier(vk_path, prover_input, None)
- .await?;
- }
-
- Ok(())
- }
-
- pub fn process_proof_results(
- &self,
- prover_result: &ProverResult,
- input: &ProverInput,
- proof_results_path: &String,
- zkm_prover_type: &str,
- ) -> anyhow::Result<()> {
- if prover_result.proof_with_public_inputs.is_empty() {
- if is_local_prover(zkm_prover_type) {
- //local proving
- log::info!("Fail: please try setting SEG_SIZE={}", input.seg_size / 2);
- //return Err(anyhow::anyhow!("SEG_SIZE is excessively large."));
- bail!("SEG_SIZE is excessively large.");
- } else {
- //network proving
- log::info!(
- "Fail: the SEG_SIZE={} out of the range of the proof network's.",
- input.seg_size
- );
-
- bail!("SEG_SIZE is out of the range of the proof network's");
- }
- }
- //1.snark proof
- let output_dir = format!("{}/verifier", proof_results_path);
- log::info!("Save the snark proof: ");
- save_data_to_file(
- &output_dir,
- "snark_proof_with_public_inputs.json",
- &prover_result.proof_with_public_inputs,
- )?;
-
- //2.handle the public inputs
- let public_inputs = update_public_inputs_with_bincode(
- input.public_inputstream.to_owned(),
- &prover_result.public_values,
- );
- match public_inputs {
- Ok(Some(inputs)) => {
- let output_dir = format!("{}/verifier", proof_results_path);
- log::info!("Save the public inputs: ");
- save_data_as_json(&output_dir, "public_inputs.json", &inputs)?;
- }
- Ok(None) => {
- log::info!("Failed to update the public inputs.");
- bail!("Failed to update the public inputs.");
- }
- Err(e) => {
- log::info!("Failed to update the public inputs. error: {}", e);
- bail!("Failed to update the public inputs.");
- }
- }
-
- //3.contract,only for network proving
- if !is_local_prover(zkm_prover_type) {
- let output_dir = format!("{}/src", proof_results_path);
- log::info!("Save the verifier contract: ");
- save_data_to_file(
- &output_dir,
- "verifier.sol",
- &prover_result.solidity_verifier,
- )?;
- }
-
- log::info!("Generating proof successfully .The snark proof and contract are in the the path {}/{{verifier,src}} .", proof_results_path);
-
- Ok(())
- }
-
- // Generic function that automatically determines and prints based on the type T
- pub fn print_guest_execution_output(
- &self,
- has_output: bool,
- prover_result: &ProverResult,
- ) -> anyhow::Result<()> {
- if has_output {
- if prover_result.output_stream.is_empty() {
- log::info!(
- "output_stream.len() is too short: {}",
- prover_result.output_stream.len()
- );
- //return Err(anyhow::anyhow!("output_stream.len() is too short."));
- bail!("output_stream.len() is too short.");
- }
- log::info!("Executing the guest program successfully.");
- log::info!("Guest's output messages: {:?}", prover_result.output_stream);
- } else {
- log::info!("Executing the guest program successfully without output any messages.")
- }
-
- Ok(())
- }
-
- // For handling struct types, we need another function
- pub fn print_guest_execution_output_struct<T>(
- &self,
- prover_result: &ProverResult,
- ) -> anyhow::Result<()>
- where
- T: serde::de::DeserializeOwned + std::fmt::Debug, // Here we restrict T to be deserializable
- {
- if prover_result.output_stream.is_empty() {
- log::info!(
- "output_stream.len() is too short: {}",
- prover_result.output_stream.len()
- );
- bail!("output_stream.len() is too short.");
- }
- log::info!("Executing the guest program successfully.");
- // Deserialize the struct
- let ret_data: T = bincode::deserialize_from(prover_result.output_stream.as_slice())
- .context("Deserialization failed")?;
-
- log::info!("Guest's output messages: {:?}", ret_data);
- Ok(())
- }
-}
diff --git a/zkvms/zkm/sdk/src/local/libsnark/compile.sh b/zkvms/zkm/sdk/src/local/libsnark/compile.sh
deleted file mode 100755
index 0d7ff33..0000000
--- a/zkvms/zkm/sdk/src/local/libsnark/compile.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-cd "$(dirname "$0")"
-
-# Determine the operating system
-OS="$(uname)"
-
-case "$OS" in
- Linux)
- echo "Running on Linux"
- # Compile for Linux
- go build -o libsnark.so -buildmode=c-shared *.go
- ;;
- Darwin)
- echo "Running on macOS"
- # Compile for macOS
- go build -o libsnark.dylib -buildmode=c-shared *.go
- ;;
- *)
- echo "Unsupported OS: $OS"
- exit 1
- ;;
-esac
diff --git a/zkvms/zkm/sdk/src/local/libsnark/contract.go b/zkvms/zkm/sdk/src/local/libsnark/contract.go
deleted file mode 100644
index 2bdb601..0000000
--- a/zkvms/zkm/sdk/src/local/libsnark/contract.go
+++ /dev/null
@@ -1,253 +0,0 @@
-package main
-
-var Gtemplate = `// This file is MIT Licensed.
-//
-// Copyright 2017 Christian Reitwiessner
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-pragma solidity ^0.8.0;
-library Pairing {
- struct G1Point {
- uint X;
- uint Y;
- }
- // Encoding of field elements is: X[0] * z + X[1]
- struct G2Point {
- uint[2] X;
- uint[2] Y;
- }
- /// @return the generator of G1
- function P1() pure internal returns (G1Point memory) {
- return G1Point(1, 2);
- }
- /// @return the generator of G2
- function P2() pure internal returns (G2Point memory) {
- return G2Point(
- [10857046999023057135944570762232829481370756359578518086990519993285655852781,
- 11559732032986387107991004021392285783925812861821192530917403151452391805634],
- [8495653923123431417604973247489272438418190587263600148770280649306958101930,
- 4082367875863433681332203403145435568316851327593401208105741076214120093531]
- );
- }
- /// @return the negation of p, i.e. p.addition(p.negate()) should be zero.
- function negate(G1Point memory p) pure internal returns (G1Point memory) {
- // The prime q in the base field F_q for G1
- uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
- if (p.X == 0 && p.Y == 0)
- return G1Point(0, 0);
- return G1Point(p.X, q - (p.Y % q));
- }
- /// @return r the sum of two points of G1
- function addition(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) {
- uint[4] memory input;
- input[0] = p1.X;
- input[1] = p1.Y;
- input[2] = p2.X;
- input[3] = p2.Y;
- bool success;
- assembly {
- success := staticcall(sub(gas(), 2000), 6, input, 0xc0, r, 0x60)
- // Use "invalid" to make gas estimation work
- switch success case 0 { invalid() }
- }
- require(success);
- }
-
-
- /// @return r the product of a point on G1 and a scalar, i.e.
- /// p == p.scalar_mul(1) and p.addition(p) == p.scalar_mul(2) for all points p.
- function scalar_mul(G1Point memory p, uint s) internal view returns (G1Point memory r) {
- uint[3] memory input;
- input[0] = p.X;
- input[1] = p.Y;
- input[2] = s;
- bool success;
-
- assembly {
- success := staticcall(sub(gas(), 2000), 7, input, 0x80, r, 0x60)
- // Use "invalid" to make gas estimation work
- switch success case 0 { invalid() }
- }
-
- require (success);
- }
- /// @return the result of computing the pairing check
- /// e(p1[0], p2[0]) * .... * e(p1[n], p2[n]) == 1
- /// For example pairing([P1(), P1().negate()], [P2(), P2()]) should
- /// return true.
- function pairing(G1Point[] memory p1, G2Point[] memory p2) internal view returns (bool) {
- require(p1.length == p2.length);
- uint elements = p1.length;
- uint inputSize = elements * 6;
- uint[] memory input = new uint[](inputSize);
- for (uint i = 0; i < elements; i++)
- {
- input[i * 6 + 0] = p1[i].X;
- input[i * 6 + 1] = p1[i].Y;
- input[i * 6 + 2] = p2[i].X[1];
- input[i * 6 + 3] = p2[i].X[0];
- input[i * 6 + 4] = p2[i].Y[1];
- input[i * 6 + 5] = p2[i].Y[0];
- }
- uint[1] memory out;
- bool success;
-
- assembly {
- success := staticcall(sub(gas(), 2000), 8, add(input, 0x20), mul(inputSize, 0x20), out, 0x20)
- // Use "invalid" to make gas estimation work
- // switch success case 0 { invalid() }
- }
-
- require(success,"no");
- return out[0] != 0;
- }
- /// Convenience method for a pairing check for two pairs.
- function pairingProd2(G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2) internal view returns (bool) {
- G1Point[] memory p1 = new G1Point[](2);
- G2Point[] memory p2 = new G2Point[](2);
- p1[0] = a1;
- p1[1] = b1;
- p2[0] = a2;
- p2[1] = b2;
- return pairing(p1, p2);
- }
- /// Convenience method for a pairing check for three pairs.
- function pairingProd3(
- G1Point memory a1, G2Point memory a2,
- G1Point memory b1, G2Point memory b2,
- G1Point memory c1, G2Point memory c2
- ) internal view returns (bool) {
- G1Point[] memory p1 = new G1Point[](3);
- G2Point[] memory p2 = new G2Point[](3);
- p1[0] = a1;
- p1[1] = b1;
- p1[2] = c1;
- p2[0] = a2;
- p2[1] = b2;
- p2[2] = c2;
- return pairing(p1, p2);
- }
- /// Convenience method for a pairing check for four pairs.
- function pairingProd4(
- G1Point memory a1, G2Point memory a2,
- G1Point memory b1, G2Point memory b2,
- G1Point memory c1, G2Point memory c2,
- G1Point memory d1, G2Point memory d2
- ) internal view returns (bool) {
- G1Point[] memory p1 = new G1Point[](4);
- G2Point[] memory p2 = new G2Point[](4);
- p1[0] = a1;
- p1[1] = b1;
- p1[2] = c1;
- p1[3] = d1;
- p2[0] = a2;
- p2[1] = b2;
- p2[2] = c2;
- p2[3] = d2;
- return pairing(p1, p2);
- }
-}
-
-contract Verifier {
- uint256 constant MASK = ~(uint256(0x7) << 253);
- uint256 constant EMPTY_HASH = 0x3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855;
- uint256 constant CIRCUIT_DIGEST = {{.Digest}};
-
- event VerifyEvent(address user);
- event Value(uint x, uint y);
-
- using Pairing for *;
- struct VerifyingKey {
- Pairing.G1Point alpha;
- Pairing.G2Point beta;
- Pairing.G2Point gamma;
- Pairing.G2Point delta;
- Pairing.G1Point[] gamma_abc;
- }
- struct Proof {
- Pairing.G1Point a;
- Pairing.G2Point b;
- Pairing.G1Point c;
- }
- function verifyingKey() pure internal returns (VerifyingKey memory vk) {
- vk.alpha = {{.Alpha}};
- vk.beta = {{.Beta}};
- vk.gamma = {{.Gamma}};
- vk.delta = {{.Delta}};
- {{.Gamma_abc}}
- }
- function verify(uint[2] memory input, Proof memory proof, uint[2] memory proof_commitment) public view returns (uint) {
- uint256 snark_scalar_field = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
-
- VerifyingKey memory vk = verifyingKey();
- require(input.length + 1 == vk.gamma_abc.length);
- // Compute the linear combination vk_x
- Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
- for (uint i = 0; i < input.length; i++) {
- require(input[i] < snark_scalar_field);
- vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.gamma_abc[i + 1], input[i]));
- }
- Pairing.G1Point memory p_c = Pairing.G1Point(proof_commitment[0], proof_commitment[1]);
-
- vk_x = Pairing.addition(vk_x, vk.gamma_abc[0]);
- vk_x = Pairing.addition(vk_x, p_c);
-
- if(!Pairing.pairingProd4(
- proof.a, proof.b,
- Pairing.negate(vk_x), vk.gamma,
- Pairing.negate(proof.c), vk.delta,
- Pairing.negate(vk.alpha), vk.beta)) {
- return 1;
- }
-
- return 0;
- }
- function verifyTx(
- Proof memory proof, uint[2] memory input
- ,uint[2] memory proof_commitment) public returns (bool r) {
-
- if (verify(input, proof , proof_commitment) == 0) {
- emit VerifyEvent(msg.sender);
- return true;
- } else {
- return false;
- }
-
- }
-
- function calculatePublicInput(
- bytes memory _userData,
- uint32[8] memory _memRootBefore,
- uint32[8] memory _memRootAfter
- ) public pure returns (uint256) {
- bytes32 userData = sha256(_userData);
-
- uint256 memRootBefore = 0;
- for (uint256 i = 0; i < 8; i++) {
- memRootBefore |= uint256(_memRootBefore[i]) << (32 * (7 - i));
- }
- uint256 memRootAfter = 0;
- for (uint256 i = 0; i < 8; i++) {
- memRootAfter |= uint256(_memRootAfter[i]) << (32 * (7 - i));
- }
-
- bytes memory dataToHash = abi.encodePacked(
- memRootBefore,
- memRootAfter,
- userData,
- CIRCUIT_DIGEST,
- getConstantSigmasCap()
- );
-
- uint256 hash_o = uint256(sha256(dataToHash)) & MASK;
- uint256 hashValue = uint256(sha256(abi.encodePacked(EMPTY_HASH,hash_o))) & MASK;
-
- return hashValue;
- }
-
- function getConstantSigmasCap() public pure returns (uint256[{{.Len}}] memory) {
- return {{.Sigmas}};
- }
-}
-`
diff --git a/zkvms/zkm/sdk/src/local/libsnark/go.mod b/zkvms/zkm/sdk/src/local/libsnark/go.mod
deleted file mode 100644
index 5c78e72..0000000
--- a/zkvms/zkm/sdk/src/local/libsnark/go.mod
+++ /dev/null
@@ -1,56 +0,0 @@
-module zkm-project-template/sdk/libsnark
-
-go 1.21
-
-require (
- github.com/consensys/gnark v0.9.1
- github.com/consensys/gnark-crypto v0.12.2-0.20231023220848-538dff926c15
- github.com/succinctlabs/gnark-plonky2-verifier v0.1.0
-)
-
-replace github.com/consensys/gnark v0.9.1 => github.com/zkMIPS/gnark v0.9.2-0.20240114074717-11112539ed1e
-
-replace github.com/succinctlabs/gnark-plonky2-verifier v0.1.0 => github.com/zkMIPS/gnark-plonky2-verifier v0.0.0-20241014144329-df6d28e3f777
-
-require (
- github.com/Microsoft/go-winio v0.6.1 // indirect
- github.com/StackExchange/wmi v1.2.1 // indirect
- github.com/bits-and-blooms/bitset v1.13.0 // indirect
- github.com/blang/semver/v4 v4.0.0 // indirect
- github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
- github.com/consensys/bavard v0.1.13 // indirect
- github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
- github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/deckarep/golang-set/v2 v2.1.0 // indirect
- github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
- github.com/ethereum/c-kzg-4844 v1.0.1 // indirect
- github.com/ethereum/go-ethereum v1.14.0 // indirect
- github.com/fsnotify/fsnotify v1.6.0 // indirect
- github.com/fxamacker/cbor/v2 v2.5.0 // indirect
- github.com/go-ole/go-ole v1.3.0 // indirect
- github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect
- github.com/google/uuid v1.3.1 // indirect
- github.com/gorilla/websocket v1.4.2 // indirect
- github.com/holiman/uint256 v1.2.4 // indirect
- github.com/ingonyama-zk/icicle v0.0.0-20230928131117-97f0079e5c71 // indirect
- github.com/ingonyama-zk/iciclegnark v0.1.0 // indirect
- github.com/mattn/go-colorable v0.1.13 // indirect
- github.com/mattn/go-isatty v0.0.19 // indirect
- github.com/mmcloughlin/addchain v0.4.0 // indirect
- github.com/pmezard/go-difflib v1.0.0 // indirect
- github.com/rs/zerolog v1.30.0 // indirect
- github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
- github.com/stretchr/testify v1.8.4 // indirect
- github.com/supranational/blst v0.3.11 // indirect
- github.com/tklauser/go-sysconf v0.3.12 // indirect
- github.com/tklauser/numcpus v0.6.1 // indirect
- github.com/x448/float16 v0.8.4 // indirect
- golang.org/x/crypto v0.22.0 // indirect
- golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
- golang.org/x/mod v0.17.0 // indirect
- golang.org/x/sync v0.7.0 // indirect
- golang.org/x/sys v0.19.0 // indirect
- golang.org/x/tools v0.20.0 // indirect
- gopkg.in/yaml.v3 v3.0.1 // indirect
- rsc.io/tmplfunc v0.0.3 // indirect
-)
diff --git a/zkvms/zkm/sdk/src/local/libsnark/go.sum b/zkvms/zkm/sdk/src/local/libsnark/go.sum
deleted file mode 100644
index 82e09a0..0000000
--- a/zkvms/zkm/sdk/src/local/libsnark/go.sum
+++ /dev/null
@@ -1,225 +0,0 @@
-github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
-github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
-github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
-github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
-github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
-github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
-github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40=
-github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o=
-github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
-github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
-github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
-github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
-github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
-github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
-github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0=
-github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
-github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
-github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
-github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
-github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
-github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
-github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
-github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8=
-github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw=
-github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
-github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
-github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4=
-github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E=
-github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
-github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
-github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
-github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
-github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ=
-github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
-github.com/consensys/gnark-crypto v0.12.2-0.20231023220848-538dff926c15 h1:fu5ienFKWWqrfMPbWnhw4zfIFZW3pzVIbv3KtASymbU=
-github.com/consensys/gnark-crypto v0.12.2-0.20231023220848-538dff926c15/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY=
-github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
-github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
-github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
-github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ=
-github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs=
-github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI=
-github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI=
-github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
-github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
-github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
-github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg=
-github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
-github.com/ethereum/c-kzg-4844 v1.0.1 h1:pGixCbGizcVKSwoV70ge48+PrbB+iSKs2rjgfE4yJmQ=
-github.com/ethereum/c-kzg-4844 v1.0.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
-github.com/ethereum/go-ethereum v1.14.0 h1:xRWC5NlB6g1x7vNy4HDBLuqVNbtLrc7v8S6+Uxim1LU=
-github.com/ethereum/go-ethereum v1.14.0/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8=
-github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
-github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
-github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
-github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
-github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE=
-github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
-github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI=
-github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
-github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE=
-github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc=
-github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0=
-github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ=
-github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
-github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
-github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
-github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
-github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
-github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
-github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
-github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
-github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
-github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
-github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
-github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
-github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk=
-github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
-github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
-github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
-github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
-github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b h1:h9U78+dx9a4BKdQkBBos92HalKpaGKHrp+3Uo6yTodo=
-github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
-github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
-github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
-github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
-github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
-github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE=
-github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0=
-github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4=
-github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc=
-github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
-github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
-github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU=
-github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E=
-github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc=
-github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
-github.com/ingonyama-zk/icicle v0.0.0-20230928131117-97f0079e5c71 h1:YxI1RTPzpFJ3MBmxPl3Bo0F7ume7CmQEC1M9jL6CT94=
-github.com/ingonyama-zk/icicle v0.0.0-20230928131117-97f0079e5c71/go.mod h1:kAK8/EoN7fUEmakzgZIYdWy1a2rBnpCaZLqSHwZWxEk=
-github.com/ingonyama-zk/iciclegnark v0.1.0 h1:88MkEghzjQBMjrYRJFxZ9oR9CTIpB8NG2zLeCJSvXKQ=
-github.com/ingonyama-zk/iciclegnark v0.1.0/go.mod h1:wz6+IpyHKs6UhMMoQpNqz1VY+ddfKqC/gRwR/64W6WU=
-github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
-github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
-github.com/klauspost/compress v1.17.1 h1:NE3C767s2ak2bweCZo3+rdP4U/HoyVXLv/X9f2gPS5g=
-github.com/klauspost/compress v1.17.1/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
-github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
-github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
-github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
-github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
-github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
-github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
-github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
-github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
-github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
-github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
-github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
-github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
-github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
-github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
-github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
-github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
-github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
-github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
-github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
-github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
-github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
-github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
-github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY=
-github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU=
-github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
-github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
-github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
-github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
-github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg=
-github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
-github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a h1:CmF68hwI0XsOQ5UwlBopMi2Ow4Pbg32akc4KIVCOm+Y=
-github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
-github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4=
-github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
-github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
-github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
-github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
-github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
-github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
-github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
-github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
-github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
-github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
-github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
-github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
-github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
-github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
-github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
-github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
-github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA=
-github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg=
-github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
-github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
-github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4=
-github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
-github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
-github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
-github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
-github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
-github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
-github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
-github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8=
-github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U=
-github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs=
-github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
-github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
-github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
-github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
-github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
-github.com/zkMIPS/gnark v0.9.2-0.20240114074717-11112539ed1e h1:T2nl8q9iCxNe5ay+D0OAC+HrQaIj5PmzkbJVuJbn7lk=
-github.com/zkMIPS/gnark v0.9.2-0.20240114074717-11112539ed1e/go.mod h1:s681Fp+KgDAK1Ix0FQgTMkmGOr9yjJLF9M8DOt5TKtA=
-github.com/zkMIPS/gnark-plonky2-verifier v0.0.0-20241014144329-df6d28e3f777 h1:2VojZJszH8dsUon5yIDhZP8evK6vL8fFTN567jZ1rkg=
-github.com/zkMIPS/gnark-plonky2-verifier v0.0.0-20241014144329-df6d28e3f777/go.mod h1:kld+gvw6wy/QS5D+kIb6bWOeWgu/eKZ7krBvbEBdnZ8=
-golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
-golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
-golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
-golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
-golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
-golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
-golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
-golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
-golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
-golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
-golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
-golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
-golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
-golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY=
-golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg=
-google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
-google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
-gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
-gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
-gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
-gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
-gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
-gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
-rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=
diff --git a/zkvms/zkm/sdk/src/local/libsnark/libsnark.go b/zkvms/zkm/sdk/src/local/libsnark/libsnark.go
deleted file mode 100644
index 9ef5024..0000000
--- a/zkvms/zkm/sdk/src/local/libsnark/libsnark.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package main
-
-import (
- "C"
-)
-//import "fmt"
-
-//export Stark2Snark
-func Stark2Snark(keypath *C.char, inputdir *C.char, outputdir *C.char, result **C.char) C.int {
- // Convert C strings to Go strings
- keyPath := C.GoString(keypath)
- inputDir := C.GoString(inputdir)
- outputDir := C.GoString(outputdir)
- var prover SnarkProver
- err := prover.Prove(keyPath, inputDir, outputDir)
- if err != nil {
- //fmt.Printf("Stark2Snark error: %v\n", err)
- cErrMsg := C.CString(err.Error())
- *result = cErrMsg
- return -1
- }
- return 0
-}
-
-//export SetupAndGenerateSolVerifier
-func SetupAndGenerateSolVerifier(inputdir *C.char, result **C.char) C.int {
- // Convert C strings to Go strings
- inputDir := C.GoString(inputdir)
- var prover SnarkProver
- err := prover.SetupAndGenerateSolVerifier(inputDir)
- if err != nil {
- //fmt.Printf("Setup error: %v\n", err)
- cErrMsg := C.CString(err.Error())
- *result = cErrMsg
- return -1
- }
- return 0
-}
-
-
-func main() {}
diff --git a/zkvms/zkm/sdk/src/local/libsnark/snark_prover.go b/zkvms/zkm/sdk/src/local/libsnark/snark_prover.go
deleted file mode 100644
index 56942f3..0000000
--- a/zkvms/zkm/sdk/src/local/libsnark/snark_prover.go
+++ /dev/null
@@ -1,304 +0,0 @@
-package main
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "path/filepath"
- "text/template"
-
- "math/big"
- "os"
- "time"
-
- "github.com/succinctlabs/gnark-plonky2-verifier/types"
- "github.com/succinctlabs/gnark-plonky2-verifier/variables"
- "github.com/succinctlabs/gnark-plonky2-verifier/verifier"
-
- "github.com/consensys/gnark-crypto/ecc"
- "github.com/consensys/gnark/backend/groth16"
- groth16_bn254 "github.com/consensys/gnark/backend/groth16/bn254"
- "github.com/consensys/gnark/constraint"
- "github.com/consensys/gnark/frontend"
- "github.com/consensys/gnark/frontend/cs/r1cs"
-)
-
-type SnarkProver struct {
- r1cs_circuit constraint.ConstraintSystem
- pk groth16.ProvingKey
- vk groth16.VerifyingKey
-}
-
-func (obj *SnarkProver) loadKeys(inputdir string) error {
- if obj.r1cs_circuit != nil {
- return nil
- }
-
- circuitPath := inputdir + "/circuit"
- pkPath := inputdir + "/proving.key"
- vkPath := inputdir + "/verifying.key"
- _, err := os.Stat(circuitPath)
-
- if err == nil {
- fCircuit, err := os.Open(circuitPath)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-
- obj.r1cs_circuit = groth16.NewCS(ecc.BN254)
- obj.r1cs_circuit.ReadFrom(fCircuit)
- fCircuit.Close()
- } else if os.IsNotExist(err) {
- return fmt.Errorf("snark: doesn't find the circuit file in %s.", inputdir)
- } else {
- // Handle other potential errors, such as permission issues
- return fmt.Errorf("snark: no permission to read the circuit file. ")
- }
-
- _, err = os.Stat(pkPath)
-
- if err == nil {
- obj.pk = groth16.NewProvingKey(ecc.BN254)
- obj.vk = groth16.NewVerifyingKey(ecc.BN254)
- fPk, err := os.Open(pkPath)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- obj.pk.ReadFrom(fPk)
-
- fVk, err := os.Open(vkPath)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- obj.vk.ReadFrom(fVk)
- defer fVk.Close()
- } else if os.IsNotExist(err) {
- return fmt.Errorf("snark: doesn't find the pk file in %s.", inputdir)
-
- } else {
- // Handle other potential errors, such as permission issues
- return fmt.Errorf("snark: no permission to read the pk file. ")
- }
- return nil
-}
-
-func (obj *SnarkProver) groth16ProofWithCache(r1cs constraint.ConstraintSystem, inputdir, outputdir string) error {
- proofWithPisData, _ := types.ReadProofWithPublicInputs(inputdir + "/proof_with_public_inputs.json")
- proofWithPis := variables.DeserializeProofWithPublicInputs(proofWithPisData)
-
- verifierOnlyCircuitRawData, _ := types.ReadVerifierOnlyCircuitData(inputdir + "/verifier_only_circuit_data.json")
- verifierOnlyCircuitData := variables.DeserializeVerifierOnlyCircuitData(verifierOnlyCircuitRawData)
-
- assignment := verifier.ExampleVerifierCircuit{
- PublicInputsHash: proofWithPis.PublicInputsHash,
- Proof: proofWithPis.Proof,
- PublicInputs: proofWithPis.PublicInputs,
- VerifierOnlyCircuitData: verifierOnlyCircuitData,
- }
-
- start := time.Now()
- fmt.Println("Generating witness", start)
- witness, _ := frontend.NewWitness(&assignment, ecc.BN254.ScalarField())
- fmt.Printf("frontend.NewWitness cost time: %v ms\n", time.Since(start).Milliseconds())
- publicWitness, _ := witness.Public()
-
- start = time.Now()
- fmt.Println("Creating proof", start)
- proof, err := groth16.Prove(r1cs, obj.pk, witness)
- fmt.Printf("groth16.Prove cost time: %v ms\n", time.Since(start).Milliseconds())
- if err != nil {
- return err
- }
-
- if obj.vk == nil {
- return fmt.Errorf("vk is nil, means you're using dummy setup and we skip verification of proof")
- }
-
- start = time.Now()
- fmt.Println("Verifying proof", start)
- err = groth16.Verify(proof, obj.vk, publicWitness)
- fmt.Printf("groth16.Verify cost time: %v ms\n", time.Since(start).Milliseconds())
- if err != nil {
- return err
- }
-
- fContractProof, _ := os.Create(outputdir + "/snark_proof_with_public_inputs.json")
- _, bPublicWitness, _, _ := groth16.GetBn254Witness(proof, obj.vk, publicWitness)
- nbInputs := len(bPublicWitness)
-
- type ProofPublicData struct {
- Proof groth16.Proof
- PublicWitness []string
- }
- proofPublicData := ProofPublicData{
- Proof: proof,
- PublicWitness: make([]string, nbInputs),
- }
- for i := 0; i < nbInputs; i++ {
- input := new(big.Int)
- bPublicWitness[i].BigInt(input)
- proofPublicData.PublicWitness[i] = input.String()
- }
- proofData, _ := json.Marshal(proofPublicData)
- fContractProof.Write(proofData)
- fContractProof.Close()
- return nil
-}
-
-func (obj *SnarkProver) generateVerifySol(inputDir string) error {
- tmpl, err := template.New("contract").Parse(Gtemplate)
- if err != nil {
- return err
- }
-
- type VerifyingKeyConfig struct {
- Alpha string
- Beta string
- Gamma string
- Delta string
- Digest string
- Gamma_abc string
- Sigmas string
- Len int
- }
-
- var config VerifyingKeyConfig
- vk := obj.vk.(*groth16_bn254.VerifyingKey)
-
- config.Alpha = fmt.Sprint("Pairing.G1Point(uint256(", vk.G1.Alpha.X.String(), "), uint256(", vk.G1.Alpha.Y.String(), "))")
- config.Beta = fmt.Sprint("Pairing.G2Point([uint256(", vk.G2.Beta.X.A0.String(), "), uint256(", vk.G2.Beta.X.A1.String(), ")], [uint256(", vk.G2.Beta.Y.A0.String(), "), uint256(", vk.G2.Beta.Y.A1.String(), ")])")
- config.Gamma = fmt.Sprint("Pairing.G2Point([uint256(", vk.G2.Gamma.X.A0.String(), "), uint256(", vk.G2.Gamma.X.A1.String(), ")], [uint256(", vk.G2.Gamma.Y.A0.String(), "), uint256(", vk.G2.Gamma.Y.A1.String(), ")])")
- config.Delta = fmt.Sprint("Pairing.G2Point([uint256(", vk.G2.Delta.X.A0.String(), "), uint256(", vk.G2.Delta.X.A1.String(), ")], [uint256(", vk.G2.Delta.Y.A0.String(), "), uint256(", vk.G2.Delta.Y.A1.String(), ")])")
- config.Gamma_abc = fmt.Sprint("vk.gamma_abc = new Pairing.G1Point[](", len(vk.G1.K), ");\n")
- for k, v := range vk.G1.K {
- config.Gamma_abc += fmt.Sprint(" vk.gamma_abc[", k, "] = Pairing.G1Point(uint256(", v.X.String(), "), uint256(", v.Y.String(), "));\n")
- }
-
- // constant
- file, err := os.Open(inputDir + "/block_public_inputs.json")
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- defer file.Close()
-
- rawBytes, _ := io.ReadAll(file)
- var publicInputsOnly types.PublicInputsOnly
- err = json.Unmarshal(rawBytes, &publicInputsOnly)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- piData := publicInputsOnly.PublicInputs[48:]
- circuitDIgest := obj.combineToBigInt(piData, 0)
- config.Digest = circuitDIgest.String()
-
- l := len(piData)/4 - 1
- config.Len = l
-
- config.Sigmas = fmt.Sprint("[\n")
- for i := 0; i < l; i++ {
- v := obj.combineToBigInt(piData, i*4+4)
- config.Sigmas += fmt.Sprint("\t\t\t", v)
- if i < l-1 {
- config.Sigmas += fmt.Sprint(",\n")
- }
- }
- config.Sigmas += fmt.Sprint("\n\t\t]")
-
- var buf bytes.Buffer
- err = tmpl.Execute(&buf, config)
- if err != nil {
- return err
- }
- fSol, _ := os.Create(filepath.Join(inputDir, "verifier.sol"))
- _, err = fSol.Write(buf.Bytes())
- if err != nil {
- return err
- }
- fSol.Close()
- return nil
-}
-
-func (obj *SnarkProver) combineToBigInt(data []uint64, idx int) *big.Int {
- result := new(big.Int)
-
- for i := 0; i < 4; i++ {
- part := new(big.Int).SetUint64(data[idx+i])
-
- part.Lsh(part, uint(64*(3-i)))
- result.Add(result, part)
- }
-
- return result
-}
-
-func (obj *SnarkProver) SetupAndGenerateSolVerifier(inputdir string) error {
- circuitPath := inputdir + "/circuit"
- pkPath := inputdir + "/proving.key"
- vkPath := inputdir + "/verifying.key"
- _, err := os.Stat(circuitPath)
-
- if os.IsNotExist(err) {
- commonCircuitData, _ := types.ReadCommonCircuitData(inputdir + "/common_circuit_data.json")
- proofWithPisData, _ := types.ReadProofWithPublicInputs(inputdir + "/proof_with_public_inputs.json")
- proofWithPis := variables.DeserializeProofWithPublicInputs(proofWithPisData)
-
- verifierOnlyCircuitRawData, _ := types.ReadVerifierOnlyCircuitData(inputdir + "/verifier_only_circuit_data.json")
- verifierOnlyCircuitData := variables.DeserializeVerifierOnlyCircuitData(verifierOnlyCircuitRawData)
-
- circuit := verifier.ExampleVerifierCircuit{
- PublicInputsHash: proofWithPis.PublicInputsHash,
- Proof: proofWithPis.Proof,
- PublicInputs: proofWithPis.PublicInputs,
- VerifierOnlyCircuitData: verifierOnlyCircuitData,
- CommonCircuitData: commonCircuitData,
- }
-
- var builder frontend.NewBuilder = r1cs.NewBuilder
- obj.r1cs_circuit, _ = frontend.Compile(ecc.BN254.ScalarField(), builder, &circuit)
- fR1CS, _ := os.Create(circuitPath)
- obj.r1cs_circuit.WriteTo(fR1CS)
- fR1CS.Close()
- }
-
- _, err = os.Stat(pkPath)
- if os.IsNotExist(err) {
- obj.pk, obj.vk, err = groth16.Setup(obj.r1cs_circuit)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-
- fPK, _ := os.Create(pkPath)
- obj.pk.WriteTo(fPK)
- fPK.Close()
-
- if obj.vk != nil {
- fVK, _ := os.Create(vkPath)
- obj.vk.WriteTo(fVK)
- fVK.Close()
- }
- }
-
- if err := obj.generateVerifySol(inputdir); err != nil {
- return err
- }
-
-
- return nil
-}
-
-
-func (obj *SnarkProver) Prove(keypath string, inputdir string, outputdir string) error {
- if err := obj.loadKeys(keypath); err != nil {
- return err
- }
-
-
- return obj.groth16ProofWithCache(obj.r1cs_circuit, inputdir, outputdir)
-}
diff --git a/zkvms/zkm/sdk/src/local/mod.rs b/zkvms/zkm/sdk/src/local/mod.rs
deleted file mode 100644
index 003fe2b..0000000
--- a/zkvms/zkm/sdk/src/local/mod.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#[allow(clippy::module_inception)]
-pub mod prover;
-pub mod snark;
-pub mod stark;
-pub mod util;
diff --git a/zkvms/zkm/sdk/src/local/prover.rs b/zkvms/zkm/sdk/src/local/prover.rs
deleted file mode 100644
index a62d3ca..0000000
--- a/zkvms/zkm/sdk/src/local/prover.rs
+++ /dev/null
@@ -1,177 +0,0 @@
-use crate::prover::{Prover, ProverInput, ProverResult};
-use anyhow::bail;
-use async_trait::async_trait;
-use std::collections::HashMap;
-use std::fs;
-use std::path::Path;
-use std::sync::{Arc, Mutex};
-use std::thread;
-use std::time::Duration;
-use std::time::Instant;
-use tokio::time::sleep;
-
-pub struct ProverTask {
- proof_id: String,
- input: ProverInput,
- result: Option<ProverResult>,
- is_done: bool,
- vk_path: String,
-}
-
-impl ProverTask {
- fn new(proof_id: &str, vk_path: &str, input: &ProverInput) -> ProverTask {
- ProverTask {
- proof_id: proof_id.to_string(),
- input: input.clone(),
- result: None,
- is_done: false,
- vk_path: vk_path.to_string(),
- }
- }
-
- fn run(&mut self) {
- let mut result = ProverResult::default();
- let vk_path = self.vk_path.to_owned();
- let inputdir = format!("/tmp/{}/input", self.proof_id);
- let outputdir = format!("/tmp/{}/output", self.proof_id);
- fs::create_dir_all(&inputdir).unwrap();
- fs::create_dir_all(&outputdir).unwrap();
- let (should_agg, receipt, elf_id) =
- crate::local::stark::prove_stark(&self.input, &inputdir, &mut result).unwrap();
- if self.input.execute_only {
- result.proof_with_public_inputs = vec![];
- result.stark_proof = vec![];
- result.solidity_verifier = vec![];
- } else if !should_agg {
- log::info!(
- "There is only one segment with segment size {}, will skip the aggregation!",
- self.input.seg_size
- );
- } else if !self.input.precompile {
- match crate::local::snark::prove_snark(&vk_path, &inputdir, &outputdir) {
- Ok(()) => {
- result.stark_proof =
- std::fs::read(format!("{}/proof_with_public_inputs.json", inputdir))
- .unwrap();
- result.proof_with_public_inputs =
- std::fs::read(format!("{}/snark_proof_with_public_inputs.json", outputdir))
- .unwrap();
- //result.solidity_verifier =
- // std::fs::read(format!("{}/verifier.sol", outputdir)).unwrap();
- result.public_values =
- std::fs::read(format!("{}/public_values.json", inputdir)).unwrap();
- }
- Err(e) => {
- log::error!("prove_snark error : {}", e);
- }
- }
- }
- if let Some(receipt) = receipt {
- result.receipt.clone_from(&receipt);
- result.elf_id.clone_from(&elf_id.unwrap());
- }
- self.result = Some(result);
- self.is_done = true;
- }
-
- fn is_done(&self) -> bool {
- self.is_done
- }
-}
-
-pub struct LocalProver {
- tasks: Arc<Mutex<HashMap<String, Arc<Mutex<ProverTask>>>>>,
- vk_path: String,
-}
-
-impl LocalProver {
- pub fn new(vk_path: &str) -> LocalProver {
- LocalProver {
- tasks: Arc::new(Mutex::new(HashMap::new())),
- vk_path: vk_path.to_string(),
- }
- }
-}
-
-#[async_trait]
-impl Prover for LocalProver {
- async fn request_proof<'a>(&self, input: &'a ProverInput) -> anyhow::Result<String> {
- let proof_id: String = uuid::Uuid::new_v4().to_string();
- let task: Arc<Mutex<ProverTask>> =
- Arc::new(Mutex::new(ProverTask::new(&proof_id, &self.vk_path, input)));
- self.tasks
- .lock()
- .unwrap()
- .insert(proof_id.clone(), task.clone());
- thread::spawn(move || {
- task.lock().unwrap().run();
- });
- Ok(proof_id)
- }
-
- async fn wait_proof<'a>(
- &self,
- proof_id: &'a str,
- timeout: Option<Duration>,
- ) -> anyhow::Result<Option<ProverResult>> {
- let task = self.tasks.lock().unwrap().get(proof_id).unwrap().clone();
- let start_time = Instant::now();
- loop {
- if let Some(timeout) = timeout {
- if start_time.elapsed() > timeout {
- return Err(anyhow::anyhow!("Proof generation timed out."));
- }
- }
- if task.lock().unwrap().is_done() {
- self.tasks.lock().unwrap().remove(proof_id);
- return Ok(task.lock().unwrap().result.clone());
- }
- log::info!("Waiting the proof result.");
- sleep(Duration::from_secs(30)).await;
- }
- }
-
- async fn setup_and_generate_sol_verifier<'a>(
- &self,
- vk_path: &'a str,
- input: &'a ProverInput,
- _timeout: Option<Duration>,
- ) -> anyhow::Result<()> {
- let mut result = ProverResult::default();
- let path = Path::new(vk_path);
-
- if path.is_dir() {
- fs::remove_dir_all(vk_path).unwrap();
- }
- fs::create_dir_all(vk_path).unwrap();
-
- let (should_agg, _, _) =
- crate::local::stark::prove_stark(input, vk_path, &mut result).unwrap();
- if !should_agg {
- log::info!("Setup: generating the stark proof false, please check the SEG_SIZE or other parameters.");
- bail!("Setup: generating the stark proof false, please check the SEG_SIZE or other parameters!");
- }
-
- match crate::local::snark::setup_and_generate_sol_verifier(vk_path) {
- Ok(()) => {
- log::info!("setup_and_generate_sol_verifier successfully, the verify key and verifier contract are in the {}", vk_path);
- Ok(())
- }
- Err(e) => {
- log::error!("setup_and_generate_sol_verifier error : {}", e);
- bail!("setup_and_generate_sol_verifier error");
- }
- }
- }
-
- async fn prove<'a>(
- &self,
- input: &'a ProverInput,
- timeout: Option<Duration>,
- ) -> anyhow::Result<Option<ProverResult>> {
- log::info!("Calling request_proof.");
- let proof_id = self.request_proof(input).await?;
- log::info!("Calling wait_proof, proof_id={}", proof_id);
- self.wait_proof(&proof_id, timeout).await
- }
-}
diff --git a/zkvms/zkm/sdk/src/local/snark.rs b/zkvms/zkm/sdk/src/local/snark.rs
deleted file mode 100644
index de6460f..0000000
--- a/zkvms/zkm/sdk/src/local/snark.rs
+++ /dev/null
@@ -1,82 +0,0 @@
-extern crate libc;
-use anyhow::bail;
-use libc::c_int;
-use std::os::raw::c_char;
-use std::path::Path;
-
-extern "C" {
- fn Stark2Snark(
- keypath: *const c_char,
- inputdir: *const c_char,
- outputdir: *const c_char,
- result: *mut *mut libc::c_char,
- ) -> c_int;
- fn SetupAndGenerateSolVerifier(
- inputdir: *const c_char,
- result: *mut *mut libc::c_char,
- ) -> c_int;
-}
-
-#[cfg(feature = "snark")]
-pub fn prove_snark(keypath: &str, inputdir: &str, outputdir: &str) -> anyhow::Result<()> {
- let path = Path::new(keypath);
- let pk_file = path.join("proving.key");
- let vk_file = path.join("verifying.key");
-
- if !pk_file.exists() || !vk_file.exists() {
- panic!(
- "The vk or pk doesn't exist in the path: {}. Please first set the SETUP_FLAG=true to run setup_and_generate_sol_verifier.",inputdir
- );
- }
-
- let keypath = std::ffi::CString::new(keypath).unwrap();
- let inputdir = std::ffi::CString::new(inputdir).unwrap();
- let outputdir = std::ffi::CString::new(outputdir).unwrap();
-
- let mut result: *mut libc::c_char = std::ptr::null_mut();
-
- let ret = unsafe {
- Stark2Snark(
- keypath.as_ptr(),
- inputdir.as_ptr(),
- outputdir.as_ptr(),
- &mut result,
- )
- };
- if ret == 0 {
- Ok(())
- } else {
- let error_str = unsafe { std::ffi::CStr::from_ptr(result).to_string_lossy() };
- // Free the allocated C string
- unsafe { libc::free(result as *mut libc::c_void) };
- //Ok(false)
- bail!("prove_snark error: {}", error_str)
- }
-}
-
-#[cfg(not(feature = "snark"))]
-pub fn prove_snark(keypath: &str, inputdir: &str, outputdir: &str) -> anyhow::Result<()> {
- panic!("not support snark");
-}
-
-#[cfg(feature = "snark")]
-pub fn setup_and_generate_sol_verifier(inputdir: &str) -> anyhow::Result<()> {
- let inputdir = std::ffi::CString::new(inputdir).unwrap();
- let mut result: *mut libc::c_char = std::ptr::null_mut();
-
- let ret = unsafe { SetupAndGenerateSolVerifier(inputdir.as_ptr(), &mut result) };
- if ret == 0 {
- Ok(())
- } else {
- let error_str = unsafe { std::ffi::CStr::from_ptr(result).to_string_lossy() };
- // Free the allocated C string
- unsafe { libc::free(result as *mut libc::c_void) };
-
- bail!("prove_snark error: {}", error_str)
- }
-}
-
-#[cfg(not(feature = "snark"))]
-pub fn setup_and_generate_sol_verifier(inputdir: &str) -> anyhow::Result<()> {
- panic!("not support setup_and_generate_sol_verifier");
-}
diff --git a/zkvms/zkm/sdk/src/local/stark.rs b/zkvms/zkm/sdk/src/local/stark.rs
deleted file mode 100644
index 7960456..0000000
--- a/zkvms/zkm/sdk/src/local/stark.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use super::util;
-use crate::prover::{ProverInput, ProverResult};
-use elf::{endian::AnyEndian, ElfBytes};
-use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig};
-use zkm_emulator::state::State;
-use zkm_emulator::utils::split_prog_into_segs;
-use zkm_prover::generation::state::{AssumptionReceipts, Receipt};
-
-#[allow(clippy::type_complexity)]
-pub fn prove_stark(
- input: &ProverInput,
- storedir: &str,
- result: &mut ProverResult,
-) -> anyhow::Result<(bool, Option<Vec<u8>>, Option<Vec<u8>>)> {
- let seg_path = format!("{}/segments", storedir);
- let seg_size = input.seg_size as usize;
- let file = ElfBytes::<AnyEndian>::minimal_parse(input.elf.as_slice())
- .expect("Opening elf file failed");
- let mut state = State::load_elf(&file);
- state.patch_elf(&file);
- state.patch_stack(vec![]);
-
- state.input_stream.push(input.public_inputstream.clone());
- state.input_stream.push(input.private_inputstream.clone());
- for receipt_input in input.receipt_inputs.iter() {
- state.input_stream.push(receipt_input.clone());
- }
-
- let split_start_time = std::time::Instant::now();
- let (total_steps, seg_num, state) = split_prog_into_segs(state, &seg_path, "", seg_size);
- result.output_stream = state.public_values_stream.clone();
- result.total_steps = total_steps as u64;
- result.split_cost = split_start_time.elapsed().as_millis() as u64;
- if input.execute_only {
- return Ok((false, None, None));
- }
- log::info!("[The seg_num is:{} ]", &seg_num);
- const D: usize = 2;
- type C = PoseidonGoldilocksConfig;
- type F = <C as GenericConfig<D>>::F;
- let mut receipts: AssumptionReceipts<F, C, D> = vec![];
- for receipt_data in input.receipts.iter() {
- let receipt: Receipt<F, C, D> =
- bincode::deserialize(receipt_data).map_err(|e| anyhow::anyhow!(e))?;
- receipts.push(receipt.into());
- }
- let receipt = util::prove_segments(&seg_path, "", storedir, "", "", seg_num, 0, receipts)?;
- let receipt_data = bincode::serialize(&receipt).map_err(|e| anyhow::anyhow!(e))?;
- Ok((
- seg_num > 1,
- Some(receipt_data),
- Some(receipt.claim().elf_id),
- ))
-}
diff --git a/zkvms/zkm/sdk/src/local/util.rs b/zkvms/zkm/sdk/src/local/util.rs
deleted file mode 100644
index 04ec68f..0000000
--- a/zkvms/zkm/sdk/src/local/util.rs
+++ /dev/null
@@ -1,180 +0,0 @@
-use std::fs::File;
-use std::io::BufReader;
-use std::ops::Range;
-use std::time::Duration;
-
-use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig};
-use plonky2::util::timing::TimingTree;
-use plonky2x::backend::circuit::Groth16WrapperParameters;
-use plonky2x::backend::wrapper::wrap::WrappedCircuit;
-use plonky2x::frontend::builder::CircuitBuilder as WrapperBuilder;
-use plonky2x::prelude::DefaultParameters;
-
-use zkm_prover::all_stark::AllStark;
-use zkm_prover::config::StarkConfig;
-use zkm_prover::cpu::kernel::assembler::segment_kernel;
-use zkm_prover::fixed_recursive_verifier::AllRecursiveCircuits;
-use zkm_prover::generation::state::{AssumptionReceipts, Receipt};
-
-// Value from before
-// https://github.com/zkMIPS/zkm-project-template/commit/313bea17309bc0bc62bad10e19bf1943b568e00f
-const DEGREE_BITS_RANGE: [Range<usize>; 6] = [10..21, 12..22, 10..21, 10..21, 6..21, 13..23];
-
-const D: usize = 2;
-type C = PoseidonGoldilocksConfig;
-type F = <C as GenericConfig<D>>::F;
-
-#[allow(clippy::too_many_arguments)]
-pub fn prove_segments(
- seg_dir: &str,
- basedir: &str,
- outdir: &str,
- block: &str,
- file: &str,
- seg_file_number: usize,
- seg_start_id: usize,
- assumptions: AssumptionReceipts<F, C, D>,
-) -> anyhow::Result<Receipt<F, C, D>> {
- type InnerParameters = DefaultParameters;
- type OuterParameters = Groth16WrapperParameters;
-
- let total_timing = TimingTree::new("prove total time", log::Level::Info);
- let all_stark = AllStark::<F, D>::default();
- let config = StarkConfig::standard_fast_config();
- // Preprocess all circuits.
- let all_circuits =
- AllRecursiveCircuits::<F, C, D>::new(&all_stark, &DEGREE_BITS_RANGE, &config);
-
- let seg_file = format!("{}/{}", seg_dir, seg_start_id);
- log::info!("Process segment {}", seg_file);
- let seg_reader = BufReader::new(File::open(seg_file)?);
- let input_first = segment_kernel(basedir, block, file, seg_reader);
- let mut timing = TimingTree::new("prove root first", log::Level::Info);
- let mut agg_receipt = all_circuits.prove_root_with_assumption(
- &all_stark,
- &input_first,
- &config,
- &mut timing,
- assumptions.clone(),
- )?;
-
- timing.filter(Duration::from_millis(100)).print();
- all_circuits.verify_root(agg_receipt.clone())?;
-
- let mut base_seg = seg_start_id + 1;
- let mut seg_num = seg_file_number - 1;
- let mut is_agg = false;
-
- if seg_file_number % 2 == 0 {
- let seg_file = format!("{}/{}", seg_dir, seg_start_id + 1);
- log::info!("Process segment {}", seg_file);
- let seg_reader = BufReader::new(File::open(seg_file)?);
- let input = segment_kernel(basedir, block, file, seg_reader);
- timing = TimingTree::new("prove root second", log::Level::Info);
- let receipt = all_circuits.prove_root_with_assumption(
- &all_stark,
- &input,
- &config,
- &mut timing,
- assumptions,
- )?;
- timing.filter(Duration::from_millis(100)).print();
-
- all_circuits.verify_root(receipt.clone())?;
-
- timing = TimingTree::new("prove aggression", log::Level::Info);
- // We can duplicate the proofs here because the state hasn't mutated.
- agg_receipt = all_circuits.prove_aggregation(false, &agg_receipt, false, &receipt)?;
- timing.filter(Duration::from_millis(100)).print();
- all_circuits.verify_aggregation(&agg_receipt)?;
-
- is_agg = true;
- base_seg = seg_start_id + 2;
- seg_num -= 1;
- }
-
- for i in 0..seg_num / 2 {
- let seg_file = format!("{}/{}", seg_dir, base_seg + (i << 1));
- log::info!("Process segment {}", seg_file);
- let seg_reader = BufReader::new(File::open(&seg_file)?);
- let input_first = segment_kernel(basedir, block, file, seg_reader);
- let mut timing = TimingTree::new("prove root first", log::Level::Info);
- let root_receipt_first =
- all_circuits.prove_root(&all_stark, &input_first, &config, &mut timing)?;
-
- timing.filter(Duration::from_millis(100)).print();
- all_circuits.verify_root(root_receipt_first.clone())?;
-
- let seg_file = format!("{}/{}", seg_dir, base_seg + (i << 1) + 1);
- log::info!("Process segment {}", seg_file);
- let seg_reader = BufReader::new(File::open(&seg_file)?);
- let input = segment_kernel(basedir, block, file, seg_reader);
- let mut timing = TimingTree::new("prove root second", log::Level::Info);
- let root_receipt = all_circuits.prove_root(&all_stark, &input, &config, &mut timing)?;
- timing.filter(Duration::from_millis(100)).print();
-
- all_circuits.verify_root(root_receipt.clone())?;
-
- timing = TimingTree::new("prove aggression", log::Level::Info);
- // We can duplicate the proofs here because the state hasn't mutated.
- let new_agg_receipt =
- all_circuits.prove_aggregation(false, &root_receipt_first, false, &root_receipt)?;
- timing.filter(Duration::from_millis(100)).print();
- all_circuits.verify_aggregation(&new_agg_receipt)?;
-
- timing = TimingTree::new("prove nested aggression", log::Level::Info);
-
- // We can duplicate the proofs here because the state hasn't mutated.
- agg_receipt =
- all_circuits.prove_aggregation(is_agg, &agg_receipt, true, &new_agg_receipt)?;
- is_agg = true;
- timing.filter(Duration::from_millis(100)).print();
-
- all_circuits.verify_aggregation(&agg_receipt)?;
- }
-
- log::info!(
- "proof size: {:?}",
- serde_json::to_string(&agg_receipt.proof().proof)
- .unwrap()
- .len()
- );
- let final_receipt = if seg_file_number > 1 {
- let block_receipt = all_circuits.prove_block(None, &agg_receipt)?;
- all_circuits.verify_block(&block_receipt)?;
- let builder = WrapperBuilder::<DefaultParameters, 2>::new();
- let mut circuit = builder.build();
- circuit.set_data(all_circuits.block.circuit);
- let mut bit_size = vec![32usize; 16];
- bit_size.extend(vec![8; 32]);
- bit_size.extend(vec![64; 68]);
- let wrapped_circuit = WrappedCircuit::<InnerParameters, OuterParameters, D>::build(
- circuit,
- Some((vec![], bit_size)),
- );
- let wrapped_proof = wrapped_circuit.prove(&block_receipt.proof()).unwrap();
- wrapped_proof.save(outdir).unwrap();
-
- let src_public_inputs = match &block_receipt {
- Receipt::Segments(receipt) => &receipt.proof.public_inputs,
- Receipt::Composite(recepit) => &recepit.program_receipt.proof.public_inputs,
- };
- let block_public_inputs = serde_json::json!({
- "public_inputs": src_public_inputs,
- });
- let outdir_path = std::path::Path::new(outdir);
- let public_values_file = File::create(outdir_path.join("public_values.json"))?;
- serde_json::to_writer(&public_values_file, &block_receipt.values())?;
- let block_public_inputs_file = File::create(outdir_path.join("block_public_inputs.json"))?;
- serde_json::to_writer(&block_public_inputs_file, &block_public_inputs)?;
-
- block_receipt
- } else {
- agg_receipt
- };
-
- log::info!("build finish");
-
- total_timing.filter(Duration::from_millis(100)).print();
- Ok(final_receipt)
-}
diff --git a/zkvms/zkm/sdk/src/network/mod.rs b/zkvms/zkm/sdk/src/network/mod.rs
deleted file mode 100644
index b8fcb1c..0000000
--- a/zkvms/zkm/sdk/src/network/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub mod prover;
diff --git a/zkvms/zkm/sdk/src/network/prover.rs b/zkvms/zkm/sdk/src/network/prover.rs
deleted file mode 100644
index ea6a2f9..0000000
--- a/zkvms/zkm/sdk/src/network/prover.rs
+++ /dev/null
@@ -1,246 +0,0 @@
-use common::tls::Config;
-use stage_service::stage_service_client::StageServiceClient;
-use stage_service::{GenerateProofRequest, GetStatusRequest, Step};
-
-use std::time::Instant;
-use tonic::transport::Endpoint;
-use tonic::transport::{Channel, ClientTlsConfig};
-
-use crate::prover::{ClientCfg, Prover, ProverInput, ProverResult};
-use ethers::signers::{LocalWallet, Signer};
-use tokio::time::sleep;
-use tokio::time::Duration;
-
-use async_trait::async_trait;
-
-pub mod stage_service {
- tonic::include_proto!("stage.v1");
-}
-
-use crate::network::prover::stage_service::Status;
-
-pub struct NetworkProver {
- pub stage_client: StageServiceClient<Channel>,
- pub wallet: LocalWallet,
-}
-
-impl NetworkProver {
- pub async fn new(client_config: &ClientCfg) -> anyhow::Result<NetworkProver> {
- let ca_cert_path = client_config
- .ca_cert_path
- .to_owned()
- .expect("CA_CERT_PATH must be set");
- let cert_path = client_config
- .cert_path
- .to_owned()
- .expect("CERT_PATH must be set");
- let key_path = client_config
- .key_path
- .to_owned()
- .expect("KEY_PATH must be set");
- let ssl_config = if ca_cert_path.is_empty() {
- None
- } else {
- Some(Config::new(ca_cert_path, cert_path, key_path).await?)
- };
- let endpoint_para = client_config
- .endpoint
- .to_owned()
- .expect("ENDPOINT must be set");
- let endpoint = match ssl_config {
- Some(config) => {
- let mut tls_config = ClientTlsConfig::new().domain_name(
- client_config
- .domain_name
- .to_owned()
- .expect("DOMAIN_NAME must be set"),
- );
- if let Some(ca_cert) = config.ca_cert {
- tls_config = tls_config.ca_certificate(ca_cert);
- }
- if let Some(identity) = config.identity {
- tls_config = tls_config.identity(identity);
- }
- Endpoint::new(endpoint_para.to_owned())?.tls_config(tls_config)?
- }
- None => Endpoint::new(endpoint_para.to_owned())?,
- };
- let private_key = client_config
- .proof_network_privkey
- .to_owned()
- .expect("PROOF_NETWORK_PRVKEY must be set");
- if private_key.is_empty() {
- panic!("Please set the PROOF_NETWORK_PRVKEY");
- }
- let stage_client = StageServiceClient::connect(endpoint).await?;
- let wallet = private_key.parse::<LocalWallet>().unwrap();
- Ok(NetworkProver {
- stage_client,
- wallet,
- })
- }
-
- pub async fn sign_ecdsa(&self, request: &mut GenerateProofRequest) {
- let sign_data = match request.block_no {
- Some(block_no) => {
- format!("{}&{}&{}", request.proof_id, block_no, request.seg_size)
- }
- None => {
- format!("{}&{}", request.proof_id, request.seg_size)
- }
- };
- let signature = self.wallet.sign_message(sign_data).await.unwrap();
- request.signature = signature.to_string();
- }
-
- pub async fn download_file(url: &str) -> anyhow::Result<Vec<u8>> {
- let response = reqwest::get(url).await?;
- let content = response.bytes().await?;
- Ok(content.to_vec())
- }
-}
-
-#[async_trait]
-impl Prover for NetworkProver {
- async fn request_proof<'a>(&self, input: &'a ProverInput) -> anyhow::Result<String> {
- let proof_id = uuid::Uuid::new_v4().to_string();
- let mut request = GenerateProofRequest {
- proof_id: proof_id.clone(),
- elf_data: input.elf.clone(),
- seg_size: input.seg_size,
- public_input_stream: input.public_inputstream.clone(),
- private_input_stream: input.private_inputstream.clone(),
- execute_only: input.execute_only,
- precompile: input.precompile,
- ..Default::default()
- };
- for receipt in input.receipts.iter() {
- request.receipt.push(receipt.clone());
- }
- for receipt_input in input.receipt_inputs.iter() {
- request.receipt_input.push(receipt_input.clone());
- }
- self.sign_ecdsa(&mut request).await;
- let mut client = self.stage_client.clone();
- let response = client.generate_proof(request).await?.into_inner();
- Ok(response.proof_id)
- }
-
- async fn wait_proof<'a>(
- &self,
- proof_id: &'a str,
- timeout: Option<Duration>,
- ) -> anyhow::Result<Option<ProverResult>> {
- let start_time = Instant::now();
- let mut split_start_time = Instant::now();
- let mut split_end_time = Instant::now();
- let mut client = self.stage_client.clone();
- let mut last_step = 0;
- loop {
- if let Some(timeout) = timeout {
- if start_time.elapsed() > timeout {
- return Err(anyhow::anyhow!("Proof generation timed out."));
- }
- }
-
- let get_status_request = GetStatusRequest {
- proof_id: proof_id.to_string(),
- };
- let get_status_response = client.get_status(get_status_request).await?.into_inner();
-
- match Status::from_i32(get_status_response.status as i32) {
- Some(Status::Computing) => {
- //log::info!("generate_proof step: {}", get_status_response.step);
- match Step::from_i32(get_status_response.step) {
- Some(Step::Init) => log::info!("generate_proof : queuing the task."),
- Some(Step::InSplit) => {
- if last_step == 0 {
- split_start_time = Instant::now();
- }
- log::info!("generate_proof : splitting the task.");
- }
- Some(Step::InProve) => {
- if last_step == 1 {
- split_end_time = Instant::now();
- }
- log::info!("generate_proof : proving the task.");
- }
- Some(Step::InAgg) => log::info!("generate_proof : aggregating the proof."),
- Some(Step::InAggAll) => {
- log::info!("generate_proof : aggregating all proofs.")
- }
- Some(Step::InFinal) => log::info!("generate_proof : finalizing the proof."),
- Some(Step::End) => log::info!("generate_proof : completing the proof."),
- None => todo!(),
- }
- last_step = get_status_response.step;
- sleep(Duration::from_secs(30)).await;
- }
- Some(Status::Success) => {
- let mut proof_result = ProverResult {
- output_stream: get_status_response.output_stream,
- proof_with_public_inputs: get_status_response.proof_with_public_inputs,
- stark_proof: vec![],
- solidity_verifier: vec![],
- public_values: vec![],
- total_steps: get_status_response.total_steps,
- split_cost: split_end_time.duration_since(split_start_time).as_millis()
- as u64,
- receipt: get_status_response.receipt,
- elf_id: get_status_response.elf_id,
- };
- if !get_status_response.stark_proof_url.is_empty() {
- proof_result.stark_proof =
- NetworkProver::download_file(&get_status_response.stark_proof_url)
- .await?;
- }
- if !get_status_response.solidity_verifier_url.is_empty() {
- proof_result.solidity_verifier = NetworkProver::download_file(
- &get_status_response.solidity_verifier_url,
- )
- .await?;
- }
- if !get_status_response.public_values_url.is_empty() {
- proof_result.public_values =
- NetworkProver::download_file(&get_status_response.public_values_url)
- .await?;
- }
- return Ok(Some(proof_result));
- }
- _ => {
- log::error!(
- "generate_proof failed status: {}",
- get_status_response.status
- );
- //return Ok(None);
- return Err(anyhow::anyhow!(
- "generate_proof failed status: {}",
- get_status_response.status
- ));
- }
- }
- }
- }
-
- async fn setup_and_generate_sol_verifier<'a>(
- &self,
- _vk_path: &'a str,
- _input: &'a ProverInput,
- _timeout: Option<Duration>,
- ) -> anyhow::Result<()> {
- log::info!("The proof network does not support the method.");
-
- panic!("The proof network does not support the method!");
- }
-
- async fn prove<'a>(
- &self,
- input: &'a ProverInput,
- timeout: Option<Duration>,
- ) -> anyhow::Result<Option<ProverResult>> {
- log::info!("calling request_proof.");
- let proof_id = self.request_proof(input).await?;
- log::info!("calling wait_proof, proof_id={}", proof_id);
- self.wait_proof(&proof_id, timeout).await
- }
-}
diff --git a/zkvms/zkm/sdk/src/proto/stage.proto b/zkvms/zkm/sdk/src/proto/stage.proto
deleted file mode 100644
index dea3e92..0000000
--- a/zkvms/zkm/sdk/src/proto/stage.proto
+++ /dev/null
@@ -1,82 +0,0 @@
-syntax = "proto3";
-
-package stage.v1;
-
-
-service StageService {
- rpc GenerateProof(GenerateProofRequest) returns (GenerateProofResponse) {}
- rpc GetStatus(GetStatusRequest) returns (GetStatusResponse) {}
-}
-
-enum Status {
- SUCCESS = 0;
- UNSPECIFIED = 1;
- COMPUTING = 2;
- INVALID_PARAMETER = 3;
- INTERNAL_ERROR = 4;
- SPLIT_ERROR = 5;
- PROVE_ERROR = 6;
- AGG_ERROR = 7;
- FINAL_ERROR = 8;
-}
-
-enum Step {
- Init = 0;
- InSplit = 1;
- InProve = 2;
- InAgg = 3;
- InAggAll = 4;
- InFinal = 5;
- End = 6;
-}
-
-message BlockFileItem {
- string file_name = 1;
- bytes file_content = 2;
-}
-
-message GenerateProofRequest {
- string proof_id = 1;
- bytes elf_data = 2;
- repeated BlockFileItem block_data = 3;
- optional uint64 block_no = 4;
- uint32 seg_size = 5;
-
- string signature = 7;
- bytes public_input_stream = 8;
- bytes private_input_stream = 9;
- bool execute_only = 10;
- bool precompile = 11;
- repeated bytes receipt_input = 12;
- repeated bytes receipt = 13;
-}
-
-message GenerateProofResponse {
- uint32 status = 1;
- string error_message = 2;
- string proof_id = 3;
- string proof_url = 4;
- string stark_proof_url = 5;
- string solidity_verifier_url = 6;
- bytes output_stream = 7;
- string public_values_url = 8;
-}
-
-message GetStatusRequest {
- string proof_id = 1;
-}
-
-message GetStatusResponse {
- string proof_id = 1;
- uint32 status = 2;
- bytes proof_with_public_inputs = 3;
- string proof_url = 4;
- string stark_proof_url = 5;
- string solidity_verifier_url = 6;
- bytes output_stream = 7;
- int32 step = 8; // Step
- string public_values_url = 9;
- uint64 total_steps = 10;
- bytes receipt = 11;
- bytes elf_id = 12;
-} \ No newline at end of file
diff --git a/zkvms/zkm/sdk/src/prover.rs b/zkvms/zkm/sdk/src/prover.rs
deleted file mode 100644
index 60da1e5..0000000
--- a/zkvms/zkm/sdk/src/prover.rs
+++ /dev/null
@@ -1,91 +0,0 @@
-use async_trait::async_trait;
-use serde::Deserialize;
-use serde::Serialize;
-use std::default::Default;
-use tokio::time::Duration;
-
-#[derive(Debug, Default, Clone)]
-pub struct ClientCfg {
- pub zkm_prover: String,
- pub vk_path: String,
- //pub setup_flag: bool,
- pub endpoint: Option<String>,
- pub ca_cert_path: Option<String>,
- pub cert_path: Option<String>,
- pub key_path: Option<String>,
- pub domain_name: Option<String>,
- pub proof_network_privkey: Option<String>,
-}
-
-impl ClientCfg {
- pub fn new(zkm_prover_type: String, vk_path: String) -> ClientCfg {
- ClientCfg {
- zkm_prover: zkm_prover_type,
- vk_path,
- ..Default::default()
- }
- }
-
- pub fn set_network(
- &mut self,
- endpoint: String,
- ca_cert_path: String,
- cert_path: String,
- key_path: String,
- domain_name: String,
- private_key: String,
- ) {
- self.endpoint = Some(endpoint);
- self.ca_cert_path = Some(ca_cert_path);
- self.cert_path = Some(cert_path);
- self.key_path = Some(key_path);
- self.domain_name = Some(domain_name);
- self.proof_network_privkey = Some(private_key);
- }
-}
-
-#[derive(Debug, Default, Deserialize, Serialize, Clone)]
-pub struct ProverInput {
- pub elf: Vec<u8>,
- pub public_inputstream: Vec<u8>,
- pub private_inputstream: Vec<u8>,
- pub seg_size: u32,
- pub execute_only: bool,
- pub precompile: bool,
- pub receipt_inputs: Vec<Vec<u8>>,
- pub receipts: Vec<Vec<u8>>,
-}
-
-#[derive(Debug, Default, Deserialize, Serialize, Clone)]
-pub struct ProverResult {
- pub total_steps: u64,
- pub split_cost: u64,
- pub output_stream: Vec<u8>,
- pub proof_with_public_inputs: Vec<u8>,
- pub stark_proof: Vec<u8>,
- pub solidity_verifier: Vec<u8>,
- pub public_values: Vec<u8>,
- pub receipt: Vec<u8>,
- pub elf_id: Vec<u8>,
-}
-
-#[async_trait]
-pub trait Prover {
- async fn request_proof<'a>(&self, input: &'a ProverInput) -> anyhow::Result<String>;
- async fn wait_proof<'a>(
- &self,
- proof_id: &'a str,
- timeout: Option<Duration>,
- ) -> anyhow::Result<Option<ProverResult>>;
- async fn setup_and_generate_sol_verifier<'a>(
- &self,
- vk_path: &'a str,
- input: &'a ProverInput,
- timeout: Option<Duration>,
- ) -> anyhow::Result<()>;
- async fn prove<'a>(
- &self,
- input: &'a ProverInput,
- timeout: Option<Duration>,
- ) -> anyhow::Result<Option<ProverResult>>;
-}