bankai_types/api/
blocks.rs

1use serde::{Deserialize, Serialize};
2use utoipa::ToSchema;
3
4#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
5pub struct BlockDetailDto {
6    pub height: u64,
7    pub status: BlockStatusDto,
8    pub ethereum: Option<EthereumConsensusSummaryDto>,
9    pub zk_proof_available: bool,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
13#[serde(rename_all = "snake_case")]
14pub enum BlockStatusDto {
15    Initial,
16    FetchedInputs,
17    GeneratingTrace,
18    ProveTrace,
19    ProvingInProgress,
20    RetrievingProof,
21    TraceGenerated,
22    Proven,
23    InputConstructionFailed,
24    TraceGenerationFailed,
25    ProofSubmissionFailed,
26    ProvingFailed,
27    ProofRetrievalFailed,
28    Completed,
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
32pub struct BlockSummaryDto {
33    pub height: u64,
34    pub status: BlockStatusDto,
35    pub ethereum: Option<EthereumConsensusSummaryDto>,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
39pub struct EthereumConsensusSummaryDto {
40    pub epoch_number: u64,
41    pub epochs_count: u16,
42    pub num_signers: u64,
43    pub beacon: Option<ChainSnapshotSummaryDto>,
44    pub execution: Option<ChainSnapshotSummaryDto>,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
48pub struct ChainSnapshotSummaryDto {
49    pub chain_id: u64,
50    pub start_height: u64,
51    pub end_height: u64,
52    pub justified_height: u64,
53    pub finalized_height: u64,
54    pub mmr_roots: MmrRootsDto,
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
58pub struct MmrRootsDto {
59    pub keccak_root: String,   // 0x…32
60    pub poseidon_root: String, // 0x…32
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
64pub struct LatestBlockQueryDto {
65    pub status: Option<BlockStatusDto>,
66}