Skip to main content

ethrex_l2_common/
prover.rs

1use ethrex_common::types::{
2    Block, blobs_bundle, block_execution_witness::ExecutionWitness, fee_config::FeeConfig,
3};
4use rkyv::{Archive, Deserialize as RDeserialize, Serialize as RSerialize};
5use serde::{Deserialize, Serialize};
6use serde_with::serde_as;
7
8// Re-export prover types from ethrex-common so existing `ethrex_l2_common::prover::X` paths
9// continue to work for all downstream crates.
10pub use ethrex_common::types::prover::{
11    ProofBytes, ProofData, ProofFormat, ProverOutput, ProverType,
12};
13
14/// Returns the on-chain getter name for checking whether this proof type
15/// is required by the OnChainProposer contract, or `None` for types that
16/// don't have an on-chain verifier.
17pub fn verifier_getter(prover_type: ProverType) -> Option<&'static str> {
18    match prover_type {
19        ProverType::RISC0 => Some("REQUIRE_RISC0_PROOF()"),
20        ProverType::SP1 => Some("REQUIRE_SP1_PROOF()"),
21        ProverType::TDX => Some("REQUIRE_TDX_PROOF()"),
22        ProverType::Exec => None,
23    }
24}
25
26#[serde_as]
27#[derive(Serialize, Deserialize, RDeserialize, RSerialize, Archive)]
28pub struct ProverInputData {
29    pub blocks: Vec<Block>,
30    pub execution_witness: ExecutionWitness,
31    pub elasticity_multiplier: u64,
32    #[serde_as(as = "[_; 48]")]
33    pub blob_commitment: blobs_bundle::Commitment,
34    #[serde_as(as = "[_; 48]")]
35    pub blob_proof: blobs_bundle::Proof,
36    pub fee_configs: Vec<FeeConfig>,
37}