Skip to content

Commit 943b83d

Browse files
committed
refactor: folder structure
1 parent 69db30c commit 943b83d

File tree

8 files changed

+26
-23
lines changed

8 files changed

+26
-23
lines changed

aggregation-mode/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ serde = { version = "1.0.203", features = ["derive"] }
1111
serde_json = "1.0.117"
1212
tracing = { version = "0.1", features = ["log"] }
1313
tracing-subscriber = { version = "0.3.0", features = ["env-filter"] }
14+
bincode = "1.3.3"
1415

1516
[build-dependencies]
1617
sp1-build = { version = "4.1.3" }

aggregation-mode/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
mod aggregator;
2-
3-
pub use aggregator::interface::{
4-
aggregate_proofs, AggregatedVerificationError, InputProofs, ProgramInput, ProgramOutput,
5-
};
1+
pub mod zk;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod sp1;
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use sp1_sdk::{Prover, ProverClient, SP1ProofWithPublicValues, SP1Stdin, SP1VerifyingKey};
22

3-
use super::interface::{AggregatedProof, AggregatedVerificationError, ProgramOutput};
3+
use crate::zk::interface::aggregator::{
4+
AggregatedProof, AggregatedVerificationError, ProgramOutput,
5+
};
46

5-
const PROGRAM_ELF: &[u8] = include_bytes!("../../zkvm/sp1/elf/sp1_aggregator_program");
7+
const PROGRAM_ELF: &[u8] = include_bytes!("../../../zkvm/sp1/elf/sp1_aggregator_program");
68

79
// TODO lock prover
810

aggregation-mode/src/aggregator/interface.rs renamed to aggregation-mode/src/zk/interface/aggregator.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::sp1::{self, SP1AggregatedProof, SP1Proof, SP1VerificationError};
1+
use crate::zk::backends::sp1::{self, SP1AggregatedProof};
22
use serde::{Deserialize, Serialize};
33

44
#[derive(Serialize, Deserialize)]
@@ -36,17 +36,3 @@ pub fn aggregate_proofs(input: ProgramInput) -> Result<ProgramOutput, Aggregated
3636
ProgramInput::SP1(input) => sp1::aggregate_proofs(input),
3737
}
3838
}
39-
40-
enum Proof {
41-
SP1(SP1Proof),
42-
}
43-
44-
enum VerificationError {
45-
SP1(SP1VerificationError),
46-
}
47-
48-
pub fn verify_proof(proof: &Proof) -> Result<(), VerificationError> {
49-
match proof {
50-
Proof::SP1(proof) => sp1::verify(proof).map_err(VerificationError::SP1),
51-
}
52-
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod aggregator;
2+
pub mod verifier;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use crate::zk::backends::sp1::{self, SP1Proof, SP1VerificationError};
2+
3+
pub enum Proof {
4+
SP1(SP1Proof),
5+
}
6+
7+
pub enum VerificationError {
8+
SP1(SP1VerificationError),
9+
}
10+
11+
pub fn verify_proof(proof: &Proof) -> Result<(), VerificationError> {
12+
match proof {
13+
Proof::SP1(proof) => sp1::verify(proof).map_err(VerificationError::SP1),
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1+
mod backends;
12
pub mod interface;
2-
pub mod sp1;

0 commit comments

Comments
 (0)