signet_bundle/call/
trevm.rs

1use crate::SignetCallBundle;
2use alloy::primitives::U256;
3use trevm::{revm::context::BlockEnv, Block};
4
5impl Block for SignetCallBundle {
6    fn fill_block_env(&self, block_env: &mut BlockEnv) {
7        let BlockEnv {
8            number,
9            beneficiary,
10            timestamp,
11            gas_limit,
12            basefee,
13            difficulty,
14            prevrandao: _,
15            blob_excess_gas_and_price: _,
16        } = block_env;
17
18        *number = self.bundle.state_block_number.as_number().map(U256::from).unwrap_or(*number);
19        *beneficiary = self.bundle.coinbase.unwrap_or(*beneficiary);
20        *timestamp = self.bundle.timestamp.map(U256::from).unwrap_or(*timestamp);
21        *gas_limit = self.bundle.gas_limit.unwrap_or(*gas_limit);
22        *difficulty = self.bundle.difficulty.unwrap_or(*difficulty);
23        *basefee =
24            self.bundle.base_fee.map(|n| n.try_into().unwrap_or(u64::MAX)).unwrap_or(*basefee);
25    }
26}