1use std::collections::HashMap;
2
3use alloy_evm::eth::EthBlockExecutionCtx;
4use alloy_primitives::{Address, B256, Bytes};
5use reth_evm::NextBlockEnvAttributes;
6use tempo_primitives::subblock::PartialValidatorKey;
7
8#[derive(Debug, Clone, derive_more::Deref)]
10pub struct TempoBlockExecutionCtx<'a> {
11 #[deref]
13 pub inner: EthBlockExecutionCtx<'a>,
14 pub general_gas_limit: u64,
16 pub extra_data: Bytes,
18 pub shared_gas_limit: u64,
20 pub validator_set: Option<Vec<B256>>,
27 pub subblock_fee_recipients: HashMap<PartialValidatorKey, Address>,
31}
32
33#[derive(Debug, Clone, derive_more::Deref)]
35pub struct TempoNextBlockEnvAttributes {
36 #[deref]
38 pub inner: NextBlockEnvAttributes,
39 pub general_gas_limit: u64,
41 pub shared_gas_limit: u64,
43 pub timestamp_millis_part: u64,
45 pub extra_data: Bytes,
47 pub subblock_fee_recipients: HashMap<PartialValidatorKey, Address>,
49}
50
51#[cfg(feature = "rpc")]
52impl reth_rpc_eth_api::helpers::pending_block::BuildPendingEnv<tempo_primitives::TempoHeader>
53 for TempoNextBlockEnvAttributes
54{
55 fn build_pending_env(parent: &crate::SealedHeader<tempo_primitives::TempoHeader>) -> Self {
56 use alloy_consensus::BlockHeader as _;
57
58 let shared_gas_limit = parent.gas_limit() / tempo_consensus::TEMPO_SHARED_GAS_DIVISOR;
59 let general_gas_limit =
60 (parent.gas_limit() - shared_gas_limit) / tempo_consensus::TEMPO_GENERAL_GAS_DIVISOR;
61
62 Self {
63 inner: NextBlockEnvAttributes::build_pending_env(parent),
64 general_gas_limit,
65 shared_gas_limit,
66 timestamp_millis_part: parent.timestamp_millis_part,
67 extra_data: Bytes::default(),
68 subblock_fee_recipients: Default::default(),
69 }
70 }
71}