1use auto_impl::auto_impl;
2use revm::context_interface::cfg::{GasId, GasParams};
3use tempo_chainspec::hardfork::TempoHardfork;
4
5#[auto_impl(&, Arc, Box, &mut)]
7pub trait TempoGasParams {
8 fn gas_params(&self) -> &GasParams;
9
10 fn tx_tip1000_auth_account_creation_cost(&self) -> u64 {
11 self.gas_params().get(GasId::new(255))
12 }
13}
14
15impl TempoGasParams for GasParams {
16 fn gas_params(&self) -> &GasParams {
17 self
18 }
19}
20
21#[inline]
23pub fn tempo_gas_params(spec: TempoHardfork) -> GasParams {
24 let mut gas_params = GasParams::new_spec(spec.into());
25 let mut overrides = vec![];
26 if spec.is_t1() {
27 overrides.extend([
28 (GasId::sstore_set_without_load_cost(), 250_000),
30 (GasId::tx_create_cost(), 500_000),
32 (GasId::create(), 500_000),
34 (GasId::new_account_cost(), 250_000),
36 (GasId::new_account_cost_for_selfdestruct(), 250_000),
39 (GasId::code_deposit_cost(), 1_000),
41 (GasId::tx_eip7702_per_empty_account_cost(), 12500),
43 (GasId::new(255), 250_000),
45 ]);
46 }
47
48 gas_params.override_gas(overrides);
49 gas_params
50}