Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,235 changes: 817 additions & 418 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ toml = "0.8.12"
reqwest = { version = "0.11", features = ["blocking"] }

# Sp1
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v3.4.0" }
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v4.0.1" }

# Risc 0
risc0-zkvm = { git = "https://github.com/risc0/risc0.git", tag = "v1.2.0" }
Expand Down
2 changes: 1 addition & 1 deletion install_zkrust_from_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if ! command -v sp1up &> /dev/null; then
echo "Installing SP1 toolchain..."
curl -L https://sp1.succinct.xyz | bash
export PATH="$PATH:$HOME/.sp1/bin"
sp1up -v v3.4.0
sp1up -v v4.0.1
else
echo "SP1 toolchain already installed"
fi
Expand Down
3 changes: 2 additions & 1 deletion src/sp1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub const SP1_METRICS_PATH: &str = "./proof_data/sp1/sp1_metrics.json";
pub const SP1_GUEST_PROGRAM_HEADER: &str = "#![no_main]\nsp1_zkvm::entrypoint!(main);\n";

/// SP1 Cargo patch for accelerated SHA-256, K256, and bigint-multiplication circuits
pub const SP1_ACCELERATION_IMPORT: &str = "\n[patch.crates-io]\nsha2 = { git = \"https://github.com/sp1-patches/RustCrypto-hashes\", package = \"sha2\", branch = \"patch-sha2-v0.10.6\" }\nsha3 = { git = \"https://github.com/sp1-patches/RustCrypto-hashes\", package = \"sha3\", branch = \"patch-sha3-v0.10.8\" }\ncrypto-bigint = { git = \"https://github.com/sp1-patches/RustCrypto-bigint\", branch = \"patch-v0.5.5\" }\ntiny-keccak = { git = \"https://github.com/sp1-patches/tiny-keccak\", branch = \"patch-v2.0.2\" }\ned25519-consensus = { git = \"https://github.com/sp1-patches/ed25519-consensus\", branch = \"patch-v2.1.0\" }\necdsa-core = { git = \"https://github.com/sp1-patches/signatures\", package = \"ecdsa\", branch = \"patch-ecdsa-v0.16.9\" }\n";
pub const SP1_ACCELERATION_IMPORT: &str = "\n[patch.crates-io]\nsha2 = { git = \"https://github.com/sp1-patches/RustCrypto-hashes\", package = \"sha2\", branch = \"patch-sha2-v0.10.8\" }\nsha3 = { git = \"https://github.com/sp1-patches/RustCrypto-hashes\", package = \"sha3\", branch = \"patch-sha3-v0.10.8\" }\ncrypto-bigint = { git = \"https://github.com/sp1-patches/RustCrypto-bigint\", branch = \"patch-v0.5.5\" }\ntiny-keccak = { git = \"https://github.com/sp1-patches/tiny-keccak\", branch = \"patch-v2.0.2\" }\ned25519-consensus = { git = \"https://github.com/sp1-patches/ed25519-consensus\", branch = \"patch-v2.1.0\" }\necdsa-core = { git = \"https://github.com/sp1-patches/signatures\", package = \"ecdsa\", branch = \"patch-ecdsa-v0.16.9\" }\n";

/// SP1 User I/O
// Host
Expand Down Expand Up @@ -101,6 +101,7 @@ pub fn generate_sp1_proof(

if use_gpu {
cmd.arg("--features").arg("cuda");
cmd.env("SP1_PROVER", "cuda");
}

cmd.arg("--")
Expand Down
2 changes: 1 addition & 1 deletion workspaces/base_files/sp1/cargo_guest
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ name = "method"
edition = "2021"

[dependencies]
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v3.4.0" }
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v4.0.1" }
11 changes: 3 additions & 8 deletions workspaces/base_files/sp1/cargo_host
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@ name = "method"
edition = "2021"

[build-dependencies]
sp1-helper = "3.4.0"
sp1-helper = "4.0.1"

[features]
default = []
cuda = ["dep:sp1-cuda", "sp1-sdk/cuda"]
cuda = ["sp1-sdk/cuda"]

[dependencies]
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v3.4.0" }
sp1-prover = { git = "https://github.com/succinctlabs/sp1.git", tag = "v3.4.0" }
sp1-cuda = { git = "https://github.com/succinctlabs/sp1.git", tag = "v3.4.0", optional = true }
sp1-stark = { git = "https://github.com/succinctlabs/sp1.git", tag = "v3.4.0" }
sp1-core-executor = { git = "https://github.com/succinctlabs/sp1.git", tag = "v3.4.0" }
sp1-core-machine = { git = "https://github.com/succinctlabs/sp1.git", tag = "v3.4.0" }
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v4.0.1" }

serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
12 changes: 7 additions & 5 deletions workspaces/base_files/sp1/host
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use tracing::{error, info};
/// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM.
///
/// This file is generated by running `cargo prove build` inside the `program` directory.
pub const METHOD_ELF: &[u8] = include_bytes!("../../program/elf/riscv32im-succinct-zkvm-elf");
pub const METHOD_ELF: &[u8] = include_bytes!(
"../../program/target/elf-compilation/riscv32im-succinct-zkvm-elf/release/method"
);

fn main() {
let args: Vec<String> = std::env::args().collect();
Expand All @@ -23,11 +25,11 @@ fn main() {

// INPUT //

let client = ProverClient::new();
let client = ProverClient::from_env();
let (pk, vk) = client.setup(METHOD_ELF);

// First run executor to get cycle count
let (_, report) = client.execute(METHOD_ELF, stdin.clone()).run().unwrap();
let (_, report) = client.execute(METHOD_ELF, &stdin.clone()).run().unwrap();
// Get total cycles from cycle tracker
metrics.cycles = report.cycle_tracker.iter().map(|(_, cycles)| *cycles).sum();
// Number of segments is the number of cycle tracking entries
Expand All @@ -36,7 +38,7 @@ fn main() {
// Generate uncompressed proof
core_timer.start_timing();
// Set as mutable to allow for template code to access it if needed
let mut proof = client.prove(&pk, stdin.clone()).run().unwrap();
let mut proof = client.prove(&pk, &stdin.clone()).run().unwrap();
metrics.core_prove_duration = core_timer.elapsed().unwrap();

// Get uncompressed proof size
Expand All @@ -53,7 +55,7 @@ fn main() {
// Generate compressed proof
compress_timer.start_timing();
let compressed = client
.prove(&pk, stdin)
.prove(&pk, &stdin)
.compressed() // Enable compression
.run()
.unwrap();
Expand Down
Loading
Loading