Skip to content

Commit

Permalink
chore: upgrade sp1 to v4 (#15)
Browse files Browse the repository at this point in the history
* chore: upgrade sp1 to 4.0.0-rc.11

* fix: update fibonacci_proof.bin

* fix: update groth16_vk

* add

* add

---------

Co-authored-by: Ratan Kaliani <[email protected]>
  • Loading branch information
leruaa and ratankaliani authored Jan 15, 2025
1 parent 9e9a29c commit ca2730c
Show file tree
Hide file tree
Showing 8 changed files with 792 additions and 873 deletions.
1,639 changes: 777 additions & 862 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
[workspace]
members = ["verifier", "example/script", "example/program", "example/sp1-program"]
members = [
"verifier",
"example/script",
"example/program",
"example/sp1-program",
]
resolver = "2"

[workspace.dependencies]
Expand All @@ -24,8 +29,6 @@ tokio = "1.40.0"
sha2 = "0.10.8"

# sp1
sp1-sdk = { version = "3.0.0" }
sp1-zkvm = { version = "3.0.0" }
sp1-build = { version = "3.0.0" }


sp1-sdk = "4.0.0"
sp1-zkvm = "4.0.0"
sp1-build = "4.0.0"
2 changes: 1 addition & 1 deletion example/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn process_instruction(
.map_err(|_| ProgramError::InvalidInstructionData)?;

// Get the SP1 Groth16 verification key from the `sp1-solana` crate.
let vk = sp1_solana::GROTH16_VK_3_0_0_BYTES;
let vk = sp1_solana::GROTH16_VK_4_0_0_RC3_BYTES;

// Verify the proof.
verify_proof(
Expand Down
4 changes: 2 additions & 2 deletions example/script/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async fn main() {
// Only generate a proof if the prove flag is set.
if args.prove {
// Initialize the prover client
let client = ProverClient::new();
let client = ProverClient::from_env();
let (pk, vk) = client.setup(ELF);

println!(
Expand All @@ -77,7 +77,7 @@ async fn main() {

// Generate a proof for the fibonacci program.
let proof = client
.prove(&pk, stdin)
.prove(&pk, &stdin)
.groth16()
.run()
.expect("Groth16 proof generation failed");
Expand Down
Binary file modified proofs/fibonacci_proof.bin
Binary file not shown.
1 change: 1 addition & 0 deletions verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mod utils;
use utils::*;

/// Groth16 verification keys for different SP1 versions.
pub const GROTH16_VK_4_0_0_RC3_BYTES: &[u8] = include_bytes!("../vk/v4.0.0-rc.3/groth16_vk.bin");
pub const GROTH16_VK_3_0_0_BYTES: &[u8] = include_bytes!("../vk/v3.0.0/groth16_vk.bin");
pub const GROTH16_VK_3_0_0_RC4_BYTES: &[u8] = include_bytes!("../vk/v3.0.0rc4/groth16_vk.bin");
pub const GROTH16_VK_2_0_0_BYTES: &[u8] = include_bytes!("../vk/v2.0.0/groth16_vk.bin");
Expand Down
4 changes: 2 additions & 2 deletions verifier/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use sp1_sdk::SP1ProofWithPublicValues;

#[test]
fn test_verify_from_sp1() {
use crate::{verify_proof, GROTH16_VK_3_0_0_BYTES};
use crate::{verify_proof, GROTH16_VK_4_0_0_RC3_BYTES};

// Read the serialized SP1ProofWithPublicValues from the file.
let sp1_proof_with_public_values_file = "../proofs/fibonacci_proof.bin";
Expand Down Expand Up @@ -35,7 +35,7 @@ fn test_verify_from_sp1() {
&proof_bytes,
&sp1_public_inputs,
&sp1_vkey_hash,
&GROTH16_VK_3_0_0_BYTES
&GROTH16_VK_4_0_0_RC3_BYTES
)
.is_ok());
}
Expand Down
Binary file added verifier/vk/v4.0.0-rc.3/groth16_vk.bin
Binary file not shown.

0 comments on commit ca2730c

Please sign in to comment.