From 44e253827a18287b5c0876e6c753fcd849d66c62 Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Tue, 14 May 2024 17:24:33 -0700 Subject: [PATCH 01/15] mock --- sdk/src/provers/mock.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sdk/src/provers/mock.rs b/sdk/src/provers/mock.rs index 9f25eafd38..0697992b27 100644 --- a/sdk/src/provers/mock.rs +++ b/sdk/src/provers/mock.rs @@ -4,7 +4,8 @@ use crate::{ SP1ProofVerificationError, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, }; use anyhow::Result; -use sp1_prover::{SP1Prover, SP1Stdin}; +use p3_field::PrimeField; +use sp1_prover::{Groth16Proof, HashableKey, SP1Prover, SP1Stdin}; /// An implementation of [crate::ProverClient] that can generate mock proofs. pub struct MockProver { @@ -50,7 +51,19 @@ impl Prover for MockProver { } fn prove_groth16(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { - todo!() + let public_values = SP1Prover::execute(&pk.elf, &stdin)?; + Ok(SP1Groth16Proof { + proof: Groth16Proof { + public_inputs: [ + public_values.hash().to_string(), + pk.vk.hash_bn254().as_canonical_biguint().to_string(), + ], + encoded_proof: "".to_string(), + raw_proof: "".to_string(), + }, + stdin, + public_values, + }) } fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { From 7f4c81615f72ecb136d6e79e9f992f7fe34eb05a Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 11:28:15 -0700 Subject: [PATCH 02/15] add verify groth16 --- sdk/src/provers/mock.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/sdk/src/provers/mock.rs b/sdk/src/provers/mock.rs index 0697992b27..e420eb91ef 100644 --- a/sdk/src/provers/mock.rs +++ b/sdk/src/provers/mock.rs @@ -1,9 +1,12 @@ #![allow(unused_variables)] +use std::str::FromStr; + use crate::{ Prover, SP1CompressedProof, SP1Groth16Proof, SP1PlonkProof, SP1Proof, SP1ProofVerificationError, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, }; use anyhow::Result; +use num_bigint::BigUint; use p3_field::PrimeField; use sp1_prover::{Groth16Proof, HashableKey, SP1Prover, SP1Stdin}; @@ -86,7 +89,27 @@ impl Prover for MockProver { Ok(()) } - fn verify_groth16(&self, _proof: &SP1Groth16Proof, _vkey: &SP1VerifyingKey) -> Result<()> { + fn verify_groth16(&self, proof: &SP1Groth16Proof, vkey: &SP1VerifyingKey) -> Result<()> { + // Verify the public values and the vkey matches. + let public_values_hash = proof.public_values.hash(); + let vk_hash = vkey.vk.hash_bn254().as_canonical_biguint(); + + // Get the public inputs from the inner Groth16Proof. + let groth16_vkey_hash = BigUint::from_str(&proof.proof.public_inputs[0])?; + let groth16_committed_values_digest = BigUint::from_str(&proof.proof.public_inputs[1])?; + + if groth16_vkey_hash != vk_hash { + return Err(anyhow::anyhow!( + "The supplied verifying key does not match the inner Groth16 proof's verifying key." + )); + } + if groth16_committed_values_digest != public_values_hash { + return Err(anyhow::anyhow!( + "The public values in the SP1 proof do not match the public values in the inner + Groth16 proof." + )); + } + Ok(()) } From b8ce9dd887dc0778fbd896ac4e1f883abd88f305 Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 11:32:39 -0700 Subject: [PATCH 03/15] add mock verification --- sdk/src/lib.rs | 13 +++++++++++++ sdk/src/provers/mock.rs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 58ae33b989..1249fc0c88 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -525,4 +525,17 @@ mod tests { let proof = client.prove(&pk, stdin).unwrap(); client.verify(&proof, &vk).unwrap(); } + + #[test] + fn test_e2e_prove_groth16_mock() { + utils::setup_logger(); + let client = ProverClient::mock(); + let elf = + include_bytes!("../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + let (pk, vk) = client.setup(elf); + let mut stdin = SP1Stdin::new(); + stdin.write(&10usize); + let proof = client.prove_groth16(&pk, stdin).unwrap(); + client.verify_groth16(&proof, &vk).unwrap(); + } } diff --git a/sdk/src/provers/mock.rs b/sdk/src/provers/mock.rs index e420eb91ef..4974f481d6 100644 --- a/sdk/src/provers/mock.rs +++ b/sdk/src/provers/mock.rs @@ -58,8 +58,8 @@ impl Prover for MockProver { Ok(SP1Groth16Proof { proof: Groth16Proof { public_inputs: [ - public_values.hash().to_string(), pk.vk.hash_bn254().as_canonical_biguint().to_string(), + public_values.hash().to_string(), ], encoded_proof: "".to_string(), raw_proof: "".to_string(), From d0735864388dd99dd55d3e7f712982b3f306d29d Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 11:53:03 -0700 Subject: [PATCH 04/15] clean --- prover/src/verify.rs | 41 +++++++++++++++++++++++++++++++++++++---- sdk/src/provers/mock.rs | 29 +++++++++-------------------- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/prover/src/verify.rs b/prover/src/verify.rs index 8740e7ee36..99228126e7 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -6,16 +6,26 @@ use p3_baby_bear::BabyBear; use p3_field::{AbstractField, PrimeField}; use sp1_core::{ air::PublicValues, + io::SP1PublicValues, stark::{MachineProof, MachineVerificationError, StarkGenericConfig}, utils::BabyBearPoseidon2, }; use sp1_recursion_core::{air::RecursionPublicValues, stark::config::BabyBearPoseidon2Outer}; use sp1_recursion_gnark_ffi::{Groth16Proof, Groth16Prover}; +use thiserror::Error; use crate::{ CoreSC, HashableKey, OuterSC, SP1CoreProofData, SP1Prover, SP1ReduceProof, SP1VerifyingKey, }; +#[derive(Error, Debug)] +pub enum Groth16VerificationError { + #[error("The verifying key does not match the Groth16 proof's verifying key.")] + InvalidVerificationKey, + #[error("The public values in the SP1 proof do not match the public values in the inner Groth16 proof.")] + InvalidPublicValues, +} + impl SP1Prover { /// Verify a core proof by verifying the shards, verifying lookup bus, verifying that the /// shards are contiguous and complete. @@ -219,11 +229,34 @@ impl SP1Prover { prover.verify(proof, &vkey_hash, &committed_values_digest, build_dir); // Verify that the vk hash of the SP1VerifyingKey matches the vk hash specified in the proof. - let vk_hash = vk.hash_bn254().as_canonical_biguint(); - if vk_hash != vkey_hash { - return Err(anyhow::Error::msg("vk hash mismatch")); - } + // Note: If this is called from the SDK, this check is repeated. + // TODO: Should we remove this check? It's not necessary if users only need to be secure + // calling this from the SDK. + verify_vkey_hash(vk, vkey_hash)?; Ok(()) } } + +/// Verify that the hash of vk matches the expected vk hash. +pub fn verify_vkey_hash(vk: &SP1VerifyingKey, expected_vk_hash: BigUint) -> Result<()> { + let vk_hash = vk.hash_bn254().as_canonical_biguint(); + if vk_hash != expected_vk_hash { + return Err(Groth16VerificationError::InvalidVerificationKey.into()); + } + + Ok(()) +} + +/// Verify that the hash of the public values matches the expected public values hash. +pub fn verify_public_values( + public_values: &SP1PublicValues, + expected_public_values_hash: BigUint, +) -> Result<()> { + let public_values_hash = public_values.hash(); + if public_values_hash != expected_public_values_hash { + return Err(Groth16VerificationError::InvalidPublicValues.into()); + } + + Ok(()) +} diff --git a/sdk/src/provers/mock.rs b/sdk/src/provers/mock.rs index 4974f481d6..738239519e 100644 --- a/sdk/src/provers/mock.rs +++ b/sdk/src/provers/mock.rs @@ -8,7 +8,10 @@ use crate::{ use anyhow::Result; use num_bigint::BigUint; use p3_field::PrimeField; -use sp1_prover::{Groth16Proof, HashableKey, SP1Prover, SP1Stdin}; +use sp1_prover::{ + verify::{verify_public_values, verify_vkey_hash}, + Groth16Proof, HashableKey, SP1Prover, SP1Stdin, +}; /// An implementation of [crate::ProverClient] that can generate mock proofs. pub struct MockProver { @@ -90,25 +93,11 @@ impl Prover for MockProver { } fn verify_groth16(&self, proof: &SP1Groth16Proof, vkey: &SP1VerifyingKey) -> Result<()> { - // Verify the public values and the vkey matches. - let public_values_hash = proof.public_values.hash(); - let vk_hash = vkey.vk.hash_bn254().as_canonical_biguint(); - - // Get the public inputs from the inner Groth16Proof. - let groth16_vkey_hash = BigUint::from_str(&proof.proof.public_inputs[0])?; - let groth16_committed_values_digest = BigUint::from_str(&proof.proof.public_inputs[1])?; - - if groth16_vkey_hash != vk_hash { - return Err(anyhow::anyhow!( - "The supplied verifying key does not match the inner Groth16 proof's verifying key." - )); - } - if groth16_committed_values_digest != public_values_hash { - return Err(anyhow::anyhow!( - "The public values in the SP1 proof do not match the public values in the inner - Groth16 proof." - )); - } + let expected_vk_hash = BigUint::from_str(&proof.proof.public_inputs[0])?; + let expected_public_values_hash = BigUint::from_str(&proof.proof.public_inputs[1])?; + + verify_vkey_hash(vkey, expected_vk_hash)?; + verify_public_values(&proof.public_values, expected_public_values_hash)?; Ok(()) } From c2c01a200f56b55a90eaadd9c7c3c8d565f540ad Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 11:57:30 -0700 Subject: [PATCH 05/15] fix --- prover/src/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prover/src/verify.rs b/prover/src/verify.rs index 99228126e7..43e6d1acad 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -20,7 +20,7 @@ use crate::{ #[derive(Error, Debug)] pub enum Groth16VerificationError { - #[error("The verifying key does not match the Groth16 proof's verifying key.")] + #[error("The verifying key does not match the inner Groth16 proof's committed verifying key.")] InvalidVerificationKey, #[error("The public values in the SP1 proof do not match the public values in the inner Groth16 proof.")] InvalidPublicValues, From 7d55a1b458def006695c18c50dcf40e06c3171f3 Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 12:00:05 -0700 Subject: [PATCH 06/15] fix --- prover/src/verify.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/prover/src/verify.rs b/prover/src/verify.rs index 43e6d1acad..acc8718827 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -229,9 +229,7 @@ impl SP1Prover { prover.verify(proof, &vkey_hash, &committed_values_digest, build_dir); // Verify that the vk hash of the SP1VerifyingKey matches the vk hash specified in the proof. - // Note: If this is called from the SDK, this check is repeated. - // TODO: Should we remove this check? It's not necessary if users only need to be secure - // calling this from the SDK. + // TODO: To verify the proof, we don't even need to pass in the vk. Should we remove this as a parameter? verify_vkey_hash(vk, vkey_hash)?; Ok(()) From c4661a34042ce2b91653787cafd14c3ec321b7b7 Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 12:08:00 -0700 Subject: [PATCH 07/15] fix --- prover/src/lib.rs | 2 +- prover/src/verify.rs | 33 ++++++++++++++++++--------------- sdk/src/provers/mock.rs | 12 ++---------- sdk/src/provers/mod.rs | 19 +++++-------------- 4 files changed, 26 insertions(+), 40 deletions(-) diff --git a/prover/src/lib.rs b/prover/src/lib.rs index dcc3ca3071..f071dfbbfb 100644 --- a/prover/src/lib.rs +++ b/prover/src/lib.rs @@ -747,7 +747,7 @@ mod tests { let groth16_proof = prover.wrap_groth16(wrapped_bn254_proof, &artifacts_dir); println!("{:?}", groth16_proof); - prover.verify_groth16(&groth16_proof, &vk, &artifacts_dir)?; + prover.verify_groth16(&groth16_proof, &artifacts_dir)?; Ok(()) } diff --git a/prover/src/verify.rs b/prover/src/verify.rs index acc8718827..47ec4bc15c 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -212,14 +212,8 @@ impl SP1Prover { Ok(()) } - /// Verifies a Groth16 proof. Additionally, verifies that the hash of VK matches the VK hash - /// specified by the proof's public inputs. - pub fn verify_groth16( - &self, - proof: &Groth16Proof, - vk: &SP1VerifyingKey, - build_dir: &PathBuf, - ) -> Result<()> { + /// Verifies a Groth16 proof. + pub fn verify_groth16(&self, proof: &Groth16Proof, build_dir: &PathBuf) -> Result<()> { let prover = Groth16Prover::new(); let vkey_hash = BigUint::from_str(&proof.public_inputs[0])?; @@ -227,17 +221,26 @@ impl SP1Prover { // Verify the proof with the corresponding public inputs. prover.verify(proof, &vkey_hash, &committed_values_digest, build_dir); - - // Verify that the vk hash of the SP1VerifyingKey matches the vk hash specified in the proof. - // TODO: To verify the proof, we don't even need to pass in the vk. Should we remove this as a parameter? - verify_vkey_hash(vk, vkey_hash)?; - Ok(()) } } +/// Verify the vk and public_values in the public inputs of the Groth16Proof match the expected values. +pub fn verify_groth16_public_inputs( + vk: &SP1VerifyingKey, + public_values: &SP1PublicValues, + groth16_public_inputs: &[String], +) -> Result<()> { + let expected_vk_hash = BigUint::from_str(&groth16_public_inputs[0])?; + let expected_public_values_hash = BigUint::from_str(&groth16_public_inputs[1])?; + + verify_vkey_hash(vk, expected_vk_hash)?; + verify_public_values(public_values, expected_public_values_hash)?; + Ok(()) +} + /// Verify that the hash of vk matches the expected vk hash. -pub fn verify_vkey_hash(vk: &SP1VerifyingKey, expected_vk_hash: BigUint) -> Result<()> { +fn verify_vkey_hash(vk: &SP1VerifyingKey, expected_vk_hash: BigUint) -> Result<()> { let vk_hash = vk.hash_bn254().as_canonical_biguint(); if vk_hash != expected_vk_hash { return Err(Groth16VerificationError::InvalidVerificationKey.into()); @@ -247,7 +250,7 @@ pub fn verify_vkey_hash(vk: &SP1VerifyingKey, expected_vk_hash: BigUint) -> Resu } /// Verify that the hash of the public values matches the expected public values hash. -pub fn verify_public_values( +fn verify_public_values( public_values: &SP1PublicValues, expected_public_values_hash: BigUint, ) -> Result<()> { diff --git a/sdk/src/provers/mock.rs b/sdk/src/provers/mock.rs index 738239519e..49cf951cef 100644 --- a/sdk/src/provers/mock.rs +++ b/sdk/src/provers/mock.rs @@ -1,16 +1,13 @@ #![allow(unused_variables)] -use std::str::FromStr; use crate::{ Prover, SP1CompressedProof, SP1Groth16Proof, SP1PlonkProof, SP1Proof, SP1ProofVerificationError, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, }; use anyhow::Result; -use num_bigint::BigUint; use p3_field::PrimeField; use sp1_prover::{ - verify::{verify_public_values, verify_vkey_hash}, - Groth16Proof, HashableKey, SP1Prover, SP1Stdin, + verify::verify_groth16_public_inputs, Groth16Proof, HashableKey, SP1Prover, SP1Stdin, }; /// An implementation of [crate::ProverClient] that can generate mock proofs. @@ -93,12 +90,7 @@ impl Prover for MockProver { } fn verify_groth16(&self, proof: &SP1Groth16Proof, vkey: &SP1VerifyingKey) -> Result<()> { - let expected_vk_hash = BigUint::from_str(&proof.proof.public_inputs[0])?; - let expected_public_values_hash = BigUint::from_str(&proof.proof.public_inputs[1])?; - - verify_vkey_hash(vkey, expected_vk_hash)?; - verify_public_values(&proof.public_values, expected_public_values_hash)?; - + verify_groth16_public_inputs(vkey, &proof.public_values, &proof.proof.public_inputs)?; Ok(()) } diff --git a/sdk/src/provers/mod.rs b/sdk/src/provers/mod.rs index d2b9b35949..e813b9a148 100644 --- a/sdk/src/provers/mod.rs +++ b/sdk/src/provers/mod.rs @@ -2,15 +2,13 @@ mod local; mod mock; mod network; -use std::str::FromStr; - use crate::{SP1CompressedProof, SP1Groth16Proof, SP1PlonkProof, SP1Proof}; use anyhow::Result; pub use local::LocalProver; pub use mock::MockProver; pub use network::NetworkProver; -use num_bigint::BigUint; use sp1_core::stark::MachineVerificationError; +use sp1_prover::verify::verify_groth16_public_inputs; use sp1_prover::CoreSC; use sp1_prover::SP1CoreProofData; use sp1_prover::SP1Prover; @@ -59,7 +57,7 @@ pub trait Prover: Send + Sync { .map_err(|e| e.into()) } - /// Verify that a SP1 Groth16 proof is valid. Additionally, verify the public inputs of the Groth16Proof match + /// Verify that a SP1 Groth16 proof is valid. Verify that the public inputs of the Groth16Proof match /// the hash of the VK and the committed public values of the SP1ProofWithPublicValues. fn verify_groth16(&self, proof: &SP1Groth16Proof, vkey: &SP1VerifyingKey) -> Result<()> { let sp1_prover = self.sp1_prover(); @@ -69,17 +67,10 @@ pub trait Prover: Send + Sync { } else { sp1_prover::build::groth16_artifacts_dir() }; - sp1_prover.verify_groth16(&proof.proof, vkey, &groth16_aritfacts)?; - - // Verify that the public values of the SP1ProofWithPublicValues match the committed public - // values of the Groth16 proof. - let pv_biguint = proof.public_values.hash(); - let committed_values_digest = BigUint::from_str(&proof.proof.public_inputs[1])?; - - if pv_biguint != committed_values_digest { - return Err(anyhow::Error::msg("public values hash mismatch")); - } + sp1_prover.verify_groth16(&proof.proof, &groth16_aritfacts)?; + // Verify the public inputs of the inner Groth16 proof match the expected values. + verify_groth16_public_inputs(vkey, &proof.public_values, &proof.proof.public_inputs)?; Ok(()) } From 4e96ce1549c3326539163ad89cfeb1e6ef5aef8c Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 12:08:58 -0700 Subject: [PATCH 08/15] fix --- prover/src/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prover/src/verify.rs b/prover/src/verify.rs index 47ec4bc15c..64e69ea7a0 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -212,7 +212,7 @@ impl SP1Prover { Ok(()) } - /// Verifies a Groth16 proof. + /// Verifies a Groth16 proof using the circuit artifacts in the build directory. pub fn verify_groth16(&self, proof: &Groth16Proof, build_dir: &PathBuf) -> Result<()> { let prover = Groth16Prover::new(); From b20b45fb121fca94a87dd4a6f4e76415efcc7c20 Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 12:12:16 -0700 Subject: [PATCH 09/15] fix --- prover/src/verify.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/prover/src/verify.rs b/prover/src/verify.rs index 64e69ea7a0..b64a7e907b 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -208,7 +208,6 @@ impl SP1Prover { "sp1 vk hash mismatch", )); } - Ok(()) } @@ -245,7 +244,6 @@ fn verify_vkey_hash(vk: &SP1VerifyingKey, expected_vk_hash: BigUint) -> Result<( if vk_hash != expected_vk_hash { return Err(Groth16VerificationError::InvalidVerificationKey.into()); } - Ok(()) } @@ -258,6 +256,5 @@ fn verify_public_values( if public_values_hash != expected_public_values_hash { return Err(Groth16VerificationError::InvalidPublicValues.into()); } - Ok(()) } From 1ac76852173c744ad28cb6acd6768b717d23f308 Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 12:12:43 -0700 Subject: [PATCH 10/15] fix --- sdk/src/provers/mock.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/src/provers/mock.rs b/sdk/src/provers/mock.rs index 49cf951cef..390c494240 100644 --- a/sdk/src/provers/mock.rs +++ b/sdk/src/provers/mock.rs @@ -1,5 +1,4 @@ #![allow(unused_variables)] - use crate::{ Prover, SP1CompressedProof, SP1Groth16Proof, SP1PlonkProof, SP1Proof, SP1ProofVerificationError, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, From faf64fda93ffde21f36ea66223b9f2eb8922324f Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 12:14:23 -0700 Subject: [PATCH 11/15] fix" --- prover/src/verify.rs | 5 +++++ sdk/src/provers/mod.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/prover/src/verify.rs b/prover/src/verify.rs index b64a7e907b..4e0e8c2746 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -208,6 +208,7 @@ impl SP1Prover { "sp1 vk hash mismatch", )); } + Ok(()) } @@ -220,6 +221,7 @@ impl SP1Prover { // Verify the proof with the corresponding public inputs. prover.verify(proof, &vkey_hash, &committed_values_digest, build_dir); + Ok(()) } } @@ -235,6 +237,7 @@ pub fn verify_groth16_public_inputs( verify_vkey_hash(vk, expected_vk_hash)?; verify_public_values(public_values, expected_public_values_hash)?; + Ok(()) } @@ -244,6 +247,7 @@ fn verify_vkey_hash(vk: &SP1VerifyingKey, expected_vk_hash: BigUint) -> Result<( if vk_hash != expected_vk_hash { return Err(Groth16VerificationError::InvalidVerificationKey.into()); } + Ok(()) } @@ -256,5 +260,6 @@ fn verify_public_values( if public_values_hash != expected_public_values_hash { return Err(Groth16VerificationError::InvalidPublicValues.into()); } + Ok(()) } diff --git a/sdk/src/provers/mod.rs b/sdk/src/provers/mod.rs index e813b9a148..6ca67370ab 100644 --- a/sdk/src/provers/mod.rs +++ b/sdk/src/provers/mod.rs @@ -71,6 +71,7 @@ pub trait Prover: Send + Sync { // Verify the public inputs of the inner Groth16 proof match the expected values. verify_groth16_public_inputs(vkey, &proof.public_values, &proof.proof.public_inputs)?; + Ok(()) } From a78ee60e760473d83d92d639737420e90bff2de6 Mon Sep 17 00:00:00 2001 From: ratan kaliani Date: Wed, 15 May 2024 12:16:29 -0700 Subject: [PATCH 12/15] docs --- prover/src/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prover/src/verify.rs b/prover/src/verify.rs index 4e0e8c2746..ec0a5a1d24 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -226,7 +226,7 @@ impl SP1Prover { } } -/// Verify the vk and public_values in the public inputs of the Groth16Proof match the expected values. +/// Verify the vk_hash and public_values_hash in the public inputs of the Groth16Proof match the expected values. pub fn verify_groth16_public_inputs( vk: &SP1VerifyingKey, public_values: &SP1PublicValues, From 4a6ee0d7804044b276044d209d068bdf7d471750 Mon Sep 17 00:00:00 2001 From: Ratan Kaliani Date: Thu, 16 May 2024 20:50:23 -0700 Subject: [PATCH 13/15] refactor --- prover/src/lib.rs | 3 ++- prover/src/verify.rs | 26 +++++++++----------------- sdk/src/provers/mod.rs | 6 +----- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/prover/src/lib.rs b/prover/src/lib.rs index f071dfbbfb..b33a897182 100644 --- a/prover/src/lib.rs +++ b/prover/src/lib.rs @@ -699,6 +699,7 @@ mod tests { tracing::info!("prove core"); let stdin = SP1Stdin::new(); let core_proof = prover.prove_core(&pk, &stdin)?; + let public_values = core_proof.public_values.clone(); tracing::info!("verify core"); prover.verify(&core_proof.proof, &vk)?; @@ -747,7 +748,7 @@ mod tests { let groth16_proof = prover.wrap_groth16(wrapped_bn254_proof, &artifacts_dir); println!("{:?}", groth16_proof); - prover.verify_groth16(&groth16_proof, &artifacts_dir)?; + prover.verify_groth16(&groth16_proof, &vk, &public_values, &artifacts_dir)?; Ok(()) } diff --git a/prover/src/verify.rs b/prover/src/verify.rs index ec0a5a1d24..a3ebca429f 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -213,7 +213,13 @@ impl SP1Prover { } /// Verifies a Groth16 proof using the circuit artifacts in the build directory. - pub fn verify_groth16(&self, proof: &Groth16Proof, build_dir: &PathBuf) -> Result<()> { + pub fn verify_groth16( + &self, + proof: &Groth16Proof, + vk: &SP1VerifyingKey, + public_values: &SP1PublicValues, + build_dir: &PathBuf, + ) -> Result<()> { let prover = Groth16Prover::new(); let vkey_hash = BigUint::from_str(&proof.public_inputs[0])?; @@ -222,6 +228,8 @@ impl SP1Prover { // Verify the proof with the corresponding public inputs. prover.verify(proof, &vkey_hash, &committed_values_digest, build_dir); + verify_groth16_public_inputs(vk, public_values, &proof.public_inputs)?; + Ok(()) } } @@ -235,27 +243,11 @@ pub fn verify_groth16_public_inputs( let expected_vk_hash = BigUint::from_str(&groth16_public_inputs[0])?; let expected_public_values_hash = BigUint::from_str(&groth16_public_inputs[1])?; - verify_vkey_hash(vk, expected_vk_hash)?; - verify_public_values(public_values, expected_public_values_hash)?; - - Ok(()) -} - -/// Verify that the hash of vk matches the expected vk hash. -fn verify_vkey_hash(vk: &SP1VerifyingKey, expected_vk_hash: BigUint) -> Result<()> { let vk_hash = vk.hash_bn254().as_canonical_biguint(); if vk_hash != expected_vk_hash { return Err(Groth16VerificationError::InvalidVerificationKey.into()); } - Ok(()) -} - -/// Verify that the hash of the public values matches the expected public values hash. -fn verify_public_values( - public_values: &SP1PublicValues, - expected_public_values_hash: BigUint, -) -> Result<()> { let public_values_hash = public_values.hash(); if public_values_hash != expected_public_values_hash { return Err(Groth16VerificationError::InvalidPublicValues.into()); diff --git a/sdk/src/provers/mod.rs b/sdk/src/provers/mod.rs index 6ca67370ab..8475a0f7aa 100644 --- a/sdk/src/provers/mod.rs +++ b/sdk/src/provers/mod.rs @@ -8,7 +8,6 @@ pub use local::LocalProver; pub use mock::MockProver; pub use network::NetworkProver; use sp1_core::stark::MachineVerificationError; -use sp1_prover::verify::verify_groth16_public_inputs; use sp1_prover::CoreSC; use sp1_prover::SP1CoreProofData; use sp1_prover::SP1Prover; @@ -67,10 +66,7 @@ pub trait Prover: Send + Sync { } else { sp1_prover::build::groth16_artifacts_dir() }; - sp1_prover.verify_groth16(&proof.proof, &groth16_aritfacts)?; - - // Verify the public inputs of the inner Groth16 proof match the expected values. - verify_groth16_public_inputs(vkey, &proof.public_values, &proof.proof.public_inputs)?; + sp1_prover.verify_groth16(&proof.proof, vkey, &proof.public_values, &groth16_aritfacts)?; Ok(()) } From 8f67f8947fd51d80098b928bbcc9746a264009db Mon Sep 17 00:00:00 2001 From: Ratan Kaliani Date: Thu, 16 May 2024 20:51:03 -0700 Subject: [PATCH 14/15] clean --- prover/src/verify.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prover/src/verify.rs b/prover/src/verify.rs index a3ebca429f..279fb356a3 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -20,9 +20,9 @@ use crate::{ #[derive(Error, Debug)] pub enum Groth16VerificationError { - #[error("The verifying key does not match the inner Groth16 proof's committed verifying key.")] + #[error("the verifying key does not match the inner groth16 proof's committed verifying key")] InvalidVerificationKey, - #[error("The public values in the SP1 proof do not match the public values in the inner Groth16 proof.")] + #[error("the public values in the sp1 proof do not match the public values in the inner groth16 proof")] InvalidPublicValues, } From 833e41b37fbb76718571ff7924cb1ab439942f31 Mon Sep 17 00:00:00 2001 From: Ratan Kaliani Date: Thu, 16 May 2024 23:47:42 -0700 Subject: [PATCH 15/15] fix: get_random version --- Cargo.lock | 194 +++++++++++++++++++----------------- zkvm/entrypoint/Cargo.toml | 9 +- zkvm/precompiles/Cargo.toml | 8 +- 3 files changed, 113 insertions(+), 98 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7c689c088a..0cf23d961c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,9 +106,9 @@ dependencies = [ [[package]] name = "alloy-core" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e30b83573b348305b9629a094b5331093a030514cd5713433799495cb283fea1" +checksum = "f7253846c7bf55147775fd66c334abc1dd0a41e97e6155577b3dc513c6e66ef2" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545885d9b0b2c30fd344ae291439b4bfe59e48dd62fbc862f8503d98088967dc" +checksum = "8425a283510106b1a6ad25dd4bb648ecde7da3fd2baeb9400a85ad62f51ec90b" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -158,9 +158,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786689872ec4e7d354810ab0dffd48bb40b838c047522eb031cbd47d15634849" +checksum = "7e30946aa6173020259055a44971f5cf40a7d76c931d209caeb51b333263df4f" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -198,9 +198,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525448f6afc1b70dd0f9d0a8145631bf2f5e434678ab23ab18409ca264cae6b3" +checksum = "db8aa973e647ec336810a9356af8aea787249c9d00b1525359f3db29a68d231b" dependencies = [ "alloy-rlp", "bytes", @@ -263,7 +263,7 @@ checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -356,9 +356,23 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89c80a2cb97e7aa48611cbb63950336f9824a174cdf670527cc6465078a26ea1" +checksum = "7dbd17d67f3e89478c8a634416358e539e577899666c927bc3d2b1328ee9b6ca" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.64", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6da95adcf4760bb4b108fefa51d50096c5e5fdd29ee72fed3e86ee414f2e34" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -368,16 +382,16 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58894b58ac50979eeac6249661991ac40b9d541830d9a725f7714cc9ef08c23" +checksum = "32c8da04c1343871fb6ce5a489218f9c85323c8340a36e9106b5fc98d4dd59d5" dependencies = [ "alloy-json-abi", "const-hex", @@ -386,24 +400,24 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.61", + "syn 2.0.64", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8e71ea68e780cc203919e03f69f59e7afe92d2696fb1dcb6662f61e4031b6" +checksum = "368cae4dc052cad1d8f72eb2ae0c38027116933eeb49213c200a9e9875f208d7" dependencies = [ "winnow 0.6.8", ] [[package]] name = "alloy-sol-types" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399287f68d1081ed8b1f4903c49687658b95b142207d7cb4ae2f4813915343ef" +checksum = "40a64d2d2395c1ac636b62419a7b17ec39031d6b2367e66e9acbf566e6055e9c" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -692,7 +706,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -703,7 +717,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -714,7 +728,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -982,9 +996,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" dependencies = [ "serde", ] @@ -1094,7 +1108,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -1106,7 +1120,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -1136,9 +1150,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.11.3" +version = "1.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba00838774b4ab0233e355d26710fbfc8327a05c017f6dc4873f876d1f79f78" +checksum = "70ff96486ccc291d36a958107caf2c0af8c78c0af7d31ae2f35ce055130de1a6" dependencies = [ "cfg-if", "cpufeatures", @@ -1364,14 +1378,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] name = "darling" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" dependencies = [ "darling_core", "darling_macro", @@ -1379,27 +1393,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 2.0.61", + "strsim", + "syn 2.0.64", ] [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -1561,9 +1575,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "elf" @@ -1681,9 +1695,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38793c55593b33412e3ae40c2c9781ffaa6f438f6f8c10f24e71846fbd7ae01e" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "filetime" @@ -1811,7 +1825,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -1879,9 +1893,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", @@ -2452,9 +2466,9 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb8515fff80ed850aea4a1595f2e519c003e2a00a82fe168ebf5269196caf444" +checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -2471,9 +2485,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.154" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libgit2-sys" @@ -2505,9 +2519,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.16" +version = "1.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" +checksum = "0078520875cbd94735b332bca766d640ca0754e5419dce654dcee9115c4239f0" dependencies = [ "cc", "libc", @@ -2517,9 +2531,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -2816,7 +2830,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3223,7 +3237,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3401,15 +3415,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.5" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9554e3ab233f0a932403704f1a1d08c30d5ccd931adfdfa1e8b5a19b52c1d55a" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3828,7 +3842,7 @@ dependencies = [ "log", "ring", "rustls-pki-types", - "rustls-webpki 0.102.3", + "rustls-webpki 0.102.4", "subtle", "zeroize", ] @@ -3870,9 +3884,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.3" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ "ring", "rustls-pki-types", @@ -3881,9 +3895,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rusty-fork" @@ -4042,22 +4056,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.201" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.201" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4120,7 +4134,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4145,7 +4159,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4171,9 +4185,9 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac61da6b35ad76b195eb4771210f947734321a8d81d7738e1580d953bc7a15e" +checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" dependencies = [ "cc", "cfg-if", @@ -4673,12 +4687,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -4701,7 +4709,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4732,9 +4740,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f" dependencies = [ "proc-macro2", "quote", @@ -4743,14 +4751,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa0cefd02f532035d83cfec82647c6eb53140b0485220760e669f4bad489e36" +checksum = "b8db114c44cf843a8bacd37a146e37987a0b823a0e8bc4fdc610c9c72ab397a5" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4838,7 +4846,7 @@ checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4954,7 +4962,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -5015,9 +5023,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" [[package]] name = "toml_edit" @@ -5101,7 +5109,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -5350,7 +5358,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", "wasm-bindgen-shared", ] @@ -5384,7 +5392,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5703,7 +5711,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -5723,7 +5731,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] diff --git a/zkvm/entrypoint/Cargo.toml b/zkvm/entrypoint/Cargo.toml index e111a881ea..422a49dade 100644 --- a/zkvm/entrypoint/Cargo.toml +++ b/zkvm/entrypoint/Cargo.toml @@ -10,7 +10,7 @@ p3-baby-bear = { workspace = true, optional = true } p3-field = { workspace = true, optional = true } bincode = "1.3.3" cfg-if = "1.0.0" -getrandom = { version = "0.2.15", features = ["custom"] } +getrandom = { version = "0.2.14", features = ["custom"] } k256 = { version = "0.13.3", features = ["ecdsa", "std", "bits"] } once_cell = "1.19.0" rand = "0.8.5" @@ -21,4 +21,9 @@ sha2 = { version = "0.10.8" } [features] default = ["libm"] libm = ["dep:libm"] -verify = ["dep:sp1-primitives", "dep:p3-baby-bear", "dep:p3-field", "sp1-precompiles/verify"] +verify = [ + "dep:sp1-primitives", + "dep:p3-baby-bear", + "dep:p3-field", + "sp1-precompiles/verify", +] diff --git a/zkvm/precompiles/Cargo.toml b/zkvm/precompiles/Cargo.toml index e38ba017a3..cbd3c254ed 100644 --- a/zkvm/precompiles/Cargo.toml +++ b/zkvm/precompiles/Cargo.toml @@ -4,16 +4,18 @@ version = "0.1.0" edition = "2021" [dependencies] -amcl = { package = "snowbridge-amcl", version="1.0.2", default-features = false, features = ["bls381"]} +amcl = { package = "snowbridge-amcl", version = "1.0.2", default-features = false, features = [ + "bls381", +] } anyhow = "1.0.83" bincode = "1.3.3" cfg-if = "1.0.0" -getrandom = { version = "0.2.15", features = ["custom"] } +getrandom = { version = "0.2.14", features = ["custom"] } hex = "0.4.3" k256 = { version = "0.13.3", features = ["ecdsa", "std", "bits"] } rand = "0.8.5" serde = { version = "1.0.201", features = ["derive"] } -num = {version = "0.4.3"} +num = { version = "0.4.3" } [features] verify = []