bankai_types/fetch/
mod.rs

1//! Types for fetching and wrapping proofs
2//!
3//! This module contains types used when fetching proofs from the Bankai API
4//! and preparing them for verification. The main type is [`ProofWrapper`],
5//! which bundles together all proofs needed for batch verification.
6
7use cairo_air::CairoProof;
8use serde::{Deserialize, Serialize};
9use stwo::core::vcs::blake2_merkle::Blake2sMerkleHasher;
10
11use crate::{
12    fetch::evm::{EvmProofs, EvmProofsRequest},
13    proofs::HashingFunctionDto,
14};
15
16pub mod evm;
17
18/// Complete proof bundle ready for verification
19///
20/// Contains everything needed for stateless batch verification:
21/// - STWO block proof (establishes trust in MMR roots)
22/// - Optional EVM proofs (headers, accounts, transactions with their MMR proofs)
23///
24/// This is the output from the SDK's batch builder and input to the verifier.
25#[derive(Serialize, Deserialize)]
26pub struct ProofWrapper {
27    /// Hash function used for MMR construction
28    pub hashing_function: HashingFunctionDto,
29    /// STWO zero-knowledge proof for the Bankai block
30    pub block_proof: CairoProof<Blake2sMerkleHasher>,
31    /// EVM-specific proofs (headers, accounts, transactions)
32    pub evm_proofs: Option<EvmProofs>,
33}
34
35// #[cfg(feature = "std")]
36// impl core::fmt::Debug for ProofWrapper {
37//     fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
38//         f.debug_struct("ProofWrapper")
39//             .field("hashing_function", &self.hashing_function)
40//             .field("block_proof", &"<CairoProof>")
41//             .field("evm_proofs", &self.evm_proofs)
42//             .finish()
43//     }
44// }
45
46/// Request for a batch of proofs
47///
48/// Specifies what proofs to fetch from the Bankai API.
49#[derive(Debug)]
50pub struct ProofRequest {
51    /// Optional EVM-specific proof requests
52    pub evm_proofs: Option<EvmProofsRequest>,
53}