Skip to content

Commit 554abb1

Browse files
committed
feat: verify supported proofs
1 parent bb7f7d2 commit 554abb1

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

aggregation-mode/src/zk/backends/sp1.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ impl SP1Proof {
2727
}
2828

2929
pub struct SP1AggregationInput {
30-
proofs: Vec<SP1Proof>,
31-
merkle_root: [u8; 32],
30+
pub proofs: Vec<SP1Proof>,
31+
pub merkle_root: [u8; 32],
3232
}
3333

3434
pub(crate) fn aggregate_proofs(
@@ -86,15 +86,22 @@ pub(crate) fn aggregate_proofs(
8686
Ok(output)
8787
}
8888

89+
#[derive(Debug)]
8990
pub enum SP1VerificationError {
9091
Verification(sp1_sdk::SP1VerificationError),
92+
UnsupportedProof,
9193
}
9294

93-
pub(crate) fn verify(proof: &SP1Proof, elf: &[u8]) -> Result<(), SP1VerificationError> {
95+
pub(crate) fn verify(sp1_proof: &SP1Proof, elf: &[u8]) -> Result<(), SP1VerificationError> {
9496
let client = ProverClient::from_env();
9597

9698
let (_pk, vk) = client.setup(elf);
97-
client
98-
.verify(&proof.proof, &vk)
99-
.map_err(SP1VerificationError::Verification)
99+
100+
// only sp1 compressed proofs are supported for aggregation now
101+
match sp1_proof.proof.proof {
102+
sp1_sdk::SP1Proof::Compressed(_) => client
103+
.verify(&sp1_proof.proof, &vk)
104+
.map_err(SP1VerificationError::Verification),
105+
_ => Err(SP1VerificationError::UnsupportedProof),
106+
}
100107
}

aggregation-mode/src/zk/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub mod aggregator;
2-
mod backends;
2+
pub mod backends;
33

44
use backends::sp1::{self, SP1Proof, SP1VerificationError};
55

@@ -19,6 +19,7 @@ impl Proof {
1919
}
2020
}
2121

22+
#[derive(Debug)]
2223
pub enum VerificationError {
2324
SP1(SP1VerificationError),
2425
}

0 commit comments

Comments
 (0)