Skip to content

Commit

Permalink
feat: sxg cli
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVikasRushi committed Oct 15, 2024
1 parent a936fb3 commit 1a1d91b
Show file tree
Hide file tree
Showing 9 changed files with 26,962 additions and 18 deletions.
5 changes: 0 additions & 5 deletions .env.example

This file was deleted.

5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions contracts/src/fixtures/groth16-fixture.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"a": 6765,
"b": 10946,
"n": 20,
"vkey": "0x00a22fd3af2b4ec77de39ec50023cf6c2b64984d0156a3df1984262984ef71bf",
"publicValues": "0x00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000001a6d0000000000000000000000000000000000000000000000000000000000002ac2",
"proof": "0x6a2906ac23e4480564d34dfcf7005e26d0cc0d530a1b5029dfc2152f14b97841cbcb738a03a407d4104ced929ce6474501da24e7e1e5267ea0e1b2ace137c28a053febcf1fa039f5f964c2ed7f82ca582574f761af8c2541a6991d85190450c02131539f03747b06260cd8bff401728a923fc6f980c7fa8bed4a9de3c9821f62328c243e003d00cd3b8eb153f1df4e5e9f7fbfa9b81ac4f03d3bbbfdb8204ec9e25b520016d69ba1c93b90d86da73111123388195d65ed14c8241cf8a4390c416bdabffd165b92debad53ca3db689e06e533131364e1d9652aba537d689321fac966d32e1d2e7714067217b2cd5a3d1df81ece476eec70bf682164102de5e8d652221d3d"
"result": 1,
"vkey": "0x00d5975e3e6e42e90de71f036dc4cf7027b79e3d96ee5302a2d9debfb584f36c",
"publicValues": "0x0000000000000000000000000000000000000000000000000000000000000001",
"proof": "0x6a2906ac0bdd22aa619ff4bfb1ff2edcd29e5c5cc8a7258002a29e7cc33e245aef436a28119de9acb1bb1beb65c769adb55cfd4e6d7d034a9ac6c29251c36536e326b53027ff2a4283ad71c2f299c095dfd4326fce553915357cf285c36f16c55d8281232ca3e0b612f14c58be500a18213d96c31d4e502bffec7e11719f09e0f9c6bac42dd64ce2cf4387e646f1c47c7264d13437cb07bb27f561efefa0adc66d0829bb0d53ff0ef529b170303ecfc7945d68fe9b7a1dca48f8c78f2d79b177f762f11f27cc4c335cf5201c7cff9b5e3f5f5ca8bb683c69f3def89b6e5f82bc7cb2fda7196ff6fe1babcf28d62ef919a5d7d4cc0fb9b583f050c33c213b9306fa1ae5f6"
}
Binary file modified elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
1 change: 1 addition & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ p256 = "0.13.2"
hex = "0.4.3"
serde = { version = "1.0",features = ["derive"] }
base64 = "0.22.1"
serde_json = "1.0.128"

[patch.crates-io]
sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-v0.10.8" }
10 changes: 7 additions & 3 deletions script/src/bin/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use clap::{Parser, ValueEnum};
use lib::{sxg::SXGInput, PublicValuesStruct};
use serde::{Deserialize, Serialize};
use sp1_sdk::{HashableKey, ProverClient, SP1ProofWithPublicValues, SP1Stdin, SP1VerifyingKey};
use std::path::PathBuf;
use std::{fs, path::PathBuf};

/// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM.
pub const SXG_ELF: &[u8] = include_bytes!("../../../elf/riscv32im-succinct-zkvm-elf");
Expand All @@ -26,6 +26,9 @@ pub const SXG_ELF: &[u8] = include_bytes!("../../../elf/riscv32im-succinct-zkvm-
struct EVMArgs {
#[clap(long, value_enum, default_value = "groth16")]
system: ProofSystem,

#[clap(long, value_parser)]
input_file: PathBuf,
}

/// Enum representing the available proof systems
Expand Down Expand Up @@ -61,8 +64,9 @@ fn main() {
// Setup the inputs.
let mut stdin = SP1Stdin::new();

// TestCase from crema.sh
let sxg_input = SXGInput::default_testcase();
let file_content = fs::read_to_string(&args.input_file).unwrap();
let sxg_input: SXGInput = serde_json::from_str(&file_content).unwrap();

stdin.write(&sxg_input);

println!("Proof System: {:?}", args.system);
Expand Down
9 changes: 7 additions & 2 deletions script/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
//! RUST_LOG=info cargo run --release -- --prove
//! ```
use std::{fs, path::PathBuf};

use alloy_sol_types::SolType;
use clap::Parser;
use lib::{sxg::SXGInput, PublicValuesStruct};
Expand All @@ -26,6 +28,9 @@ struct Args {

#[clap(long)]
prove: bool,

#[clap(long, value_parser)]
input_file: PathBuf,
}

fn main() {
Expand All @@ -43,8 +48,8 @@ fn main() {

let mut stdin = SP1Stdin::new();

// TestCase from crema.sh
let sxg_input = SXGInput::default_testcase();
let file_content = fs::read_to_string(&args.input_file).unwrap();
let sxg_input: SXGInput = serde_json::from_str(&file_content).unwrap();

stdin.write(&sxg_input);

Expand Down
Loading

0 comments on commit 1a1d91b

Please sign in to comment.