forked from privacy-scaling-explorations/zkevm-circuits
-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chunk prover error and refactor * layer-2 compress only (sp1 chunk proof) * more refactoring and better inline docs * refactor prover::aggregator module * return BatchProverError instead of using anyhow * tidy up lib.rs of prover crate * refactor prover::types and minor changes * more refactoring * move more modules into prover::utils * proof v2 * use bundle proof v2 * chore: fmt + clippy * fix building * fix building * test: bundle proof v2 can be serialised * fix: bundle proof calldata * chore: remove unused util methods * fix: dump YUL code for verifier --------- Co-authored-by: Zhang Zhuo <[email protected]>
- Loading branch information
1 parent
940d55f
commit 7fd6b6d
Showing
59 changed files
with
2,206 additions
and
1,287 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/// Errors encountered in the proof generation pipeline for batch and bundle proving. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum BatchProverError { | ||
/// Represents a mismatch in the verifying key at the specified proof layer. | ||
#[error("verifying key mismatch: layer={0}, expected={1}, found={2}")] | ||
VerifyingKeyMismatch(crate::config::LayerId, String, String), | ||
/// Verifying key for the specified layer was not found in the prover. | ||
#[error("verifying key not found: layer={0}, expected={1}")] | ||
VerifyingKeyNotFound(crate::config::LayerId, String), | ||
/// Sanity check failure indicating that the [`Snark`][snark_verifier_sdk::Snark] | ||
/// [`protocol`][snark_verifier::Protocol] did not match the expected protocols. | ||
#[error("SNARK protocol mismatch: index={0}, expected={1}, found={2}")] | ||
ChunkProtocolMismatch(usize, String, String), | ||
/// Indicates that after generating an EVM verifier contract, the proof itself could not be | ||
/// verified successfully, implying that this sanity check failed. | ||
#[error("EVM verifier contract could not verify proof")] | ||
SanityEVMVerifier, | ||
/// Error indicating that the verification of batch proof failed. | ||
#[error("proof verification failure")] | ||
Verification, | ||
/// Error indicating that the verifier contract's deployment code is not found. | ||
#[error("EVM verifier deployment code not found!")] | ||
VerifierCodeMissing, | ||
/// Error indicating that in the final [`BundleProof`][crate::BundleProofV2] the number of | ||
/// instances found does not match the number of instances expected. | ||
#[error("number of instances in bundle proof mismatch! expected={0}, got={1}")] | ||
PublicInputsMismatch(usize, usize), | ||
/// This variant represents other errors. | ||
#[error("custom: {0}")] | ||
Custom(String), | ||
} | ||
|
||
impl From<String> for BatchProverError { | ||
fn from(value: String) -> Self { | ||
Self::Custom(value) | ||
} | ||
} | ||
|
||
impl From<anyhow::Error> for BatchProverError { | ||
fn from(value: anyhow::Error) -> Self { | ||
Self::Custom(value.to_string()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
mod error; | ||
pub use error::BatchProverError; | ||
|
||
mod prover; | ||
pub use prover::{check_chunk_hashes, Prover}; | ||
|
||
mod recursion; | ||
pub use recursion::RecursionTask; | ||
|
||
mod verifier; | ||
pub use verifier::Verifier; | ||
|
||
/// Re-export some types from the [`aggregator`] crate. | ||
pub use aggregator::{get_blob_bytes, BatchData, BatchHash, BatchHeader, MAX_AGG_SNARKS}; | ||
|
||
/// Alias for convenience. | ||
pub type BatchProver<'a> = Prover<'a>; | ||
|
||
/// Alias for convenience. | ||
pub type BatchVerifier<'a> = Verifier<'a>; |
Oops, something went wrong.