bankai_types/verify/evm/
beacon.rs

1use alloy_primitives::FixedBytes;
2use serde::{Deserialize, Serialize};
3use tree_hash_derive::TreeHash;
4
5#[cfg(feature = "verifier-types")]
6use alloy_rpc_types_beacon::header::HeaderResponse;
7
8#[derive(TreeHash, Clone, Debug, Serialize, Deserialize)]
9pub struct BeaconHeader {
10    pub slot: u64,
11    pub proposer_index: u64,
12    pub parent_root: FixedBytes<32>,
13    pub state_root: FixedBytes<32>,
14    pub body_root: FixedBytes<32>,
15}
16
17#[cfg(feature = "verifier-types")]
18impl From<HeaderResponse> for BeaconHeader {
19    fn from(header: HeaderResponse) -> Self {
20        Self {
21            slot: header.data.header.message.slot,
22            proposer_index: header.data.header.message.proposer_index,
23            parent_root: header.data.header.message.parent_root,
24            state_root: header.data.header.message.state_root,
25            body_root: header.data.header.message.body_root,
26        }
27    }
28}