Skip to main content

miden_block_prover/
local_block_prover.rs

1use miden_protocol::batch::OrderedBatches;
2use miden_protocol::block::{BlockHeader, BlockInputs, BlockProof};
3
4use crate::BlockProverError;
5
6// LOCAL BLOCK PROVER
7// ================================================================================================
8
9/// A local prover for blocks in the chain.
10#[derive(Clone)]
11pub struct LocalBlockProver {}
12
13impl LocalBlockProver {
14    /// Creates a new [`LocalBlockProver`] instance.
15    pub fn new(_proof_security_level: u32) -> Self {
16        // TODO: This will eventually take the security level as a parameter, but until we verify
17        // batches it is ignored.
18        Self {}
19    }
20
21    /// Generates a proof of a block in the chain based on the given header and inputs.
22    ///
23    /// NOTE: Block proving is not yet implemented. This is a placeholder struct.
24    pub fn prove(
25        &self,
26        _tx_batches: OrderedBatches,
27        _block_header: &BlockHeader,
28        _block_inputs: BlockInputs,
29    ) -> Result<BlockProof, BlockProverError> {
30        Ok(BlockProof {})
31    }
32
33    /// A mock implementation of the execution of a proof of a block in the chain based on the given
34    /// header and inputs.
35    ///
36    /// This is exposed for testing purposes.
37    #[cfg(any(feature = "testing", test))]
38    pub fn prove_dummy(
39        &self,
40        _tx_batches: OrderedBatches,
41        _block_header: BlockHeader,
42        _block_inputs: BlockInputs,
43    ) -> Result<BlockProof, BlockProverError> {
44        Ok(BlockProof {})
45    }
46}