Skip to content

Commit d684c06

Browse files
committed
refactor prover::aggregator module
1 parent a8c2733 commit d684c06

File tree

14 files changed

+362
-191
lines changed

14 files changed

+362
-191
lines changed

prover/src/aggregator.rs

-6
This file was deleted.

prover/src/aggregator/error.rs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/// Errors encountered in the proof generation pipeline for batch and bundle proving.
2+
#[derive(thiserror::Error, Debug)]
3+
pub enum BatchProverError {
4+
/// Represents a mismatch in the verifying key at the specified proof layer.
5+
#[error("verifying key mismatch: layer={0}, expected={1}, found={2}")]
6+
VerifyingKeyMismatch(crate::config::LayerId, String, String),
7+
/// Verifying key for the specified layer was not found in the prover.
8+
#[error("verifying key not found: layer={0}, expected={1}")]
9+
VerifyingKeyNotFound(crate::config::LayerId, String),
10+
/// Sanity check failure indicating that the [`Snark`][snark_verifier_sdk::Snark]
11+
/// [`protocol`][snark_verifier::Protocol] did not match the expected protocols.
12+
#[error("SNARK protocol mismatch: index={0}, expected={1}, found={2}")]
13+
ChunkProtocolMismatch(usize, String, String),
14+
/// This variant represents other errors.
15+
#[error("custom: {0}")]
16+
Custom(String),
17+
}
18+
19+
impl From<String> for BatchProverError {
20+
fn from(value: String) -> Self {
21+
Self::Custom(value)
22+
}
23+
}
24+
25+
impl From<anyhow::Error> for BatchProverError {
26+
fn from(value: anyhow::Error) -> Self {
27+
Self::Custom(value.to_string())
28+
}
29+
}

prover/src/aggregator/mod.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
mod error;
2+
pub use error::BatchProverError;
3+
4+
mod prover;
5+
pub use prover::{check_chunk_hashes, Prover};
6+
7+
mod verifier;
8+
pub use verifier::Verifier;
9+
10+
/// Re-export some types from the [`aggregator`] crate.
11+
pub use aggregator::{eip4844, BatchData, BatchHash, BatchHeader, MAX_AGG_SNARKS};
12+
13+
/// Alias for convenience.
14+
pub type BatchProver<'a> = Prover<'a>;
15+
16+
/// Alias for convenience.
17+
pub type BatchVerifier<'a> = Verifier<'a>;

0 commit comments

Comments
 (0)