1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//! Configuration for the EVM. Containing [`SpecId`].
pub mod gas;
pub mod gas_params;
pub use gas_params::{GasId, GasParams};
use auto_impl::auto_impl;
use core::{fmt::Debug, hash::Hash};
use primitives::{hardfork::SpecId, Address, TxKind, U256};
/// Configuration for the EVM.
#[auto_impl(&, &mut, Box, Arc)]
pub trait Cfg {
/// Specification id type, it requires to be convertible to `SpecId` so it can be used
/// by default in mainnet.
type Spec: Into<SpecId> + Clone;
/// Returns the chain ID of the EVM that is compared with the transaction's chain ID.
fn chain_id(&self) -> u64;
/// Returns whether the transaction's chain ID check is enabled.
fn tx_chain_id_check(&self) -> bool;
/// Returns the gas limit cap for the transaction.
///
/// Cap is introduced in [`EIP-7825: Transaction Gas Limit Cap`](https://eips.ethereum.org/EIPS/eip-7825)
/// with initial cap of 30M gas.
///
/// Value before EIP-7825 is `u64::MAX`.
fn tx_gas_limit_cap(&self) -> u64;
/// Specification id
fn spec(&self) -> Self::Spec;
/// Returns the maximum number of blobs allowed per transaction.
/// If it is None, check for max count will be skipped.
fn max_blobs_per_tx(&self) -> Option<u64>;
/// Returns the maximum code size for the given spec id.
fn max_code_size(&self) -> usize;
/// Returns the max initcode size for the given spec id.
fn max_initcode_size(&self) -> usize;
/// Returns whether the EIP-3607 (account clearing) is disabled.
fn is_eip3607_disabled(&self) -> bool;
/// Returns whether the EIP-3541 (disallowing new contracts with 0xEF prefix) is disabled.
fn is_eip3541_disabled(&self) -> bool;
/// Returns whether the EIP-7623 (increased calldata cost) is disabled.
fn is_eip7623_disabled(&self) -> bool;
/// Returns whether the balance check is disabled.
fn is_balance_check_disabled(&self) -> bool;
/// Returns whether the block gas limit check is disabled.
fn is_block_gas_limit_disabled(&self) -> bool;
/// Returns whether the nonce check is disabled.
fn is_nonce_check_disabled(&self) -> bool;
/// Returns whether the base fee check is disabled.
fn is_base_fee_check_disabled(&self) -> bool;
/// Returns whether the priority fee check is disabled.
fn is_priority_fee_check_disabled(&self) -> bool;
/// Returns whether the fee charge is disabled.
fn is_fee_charge_disabled(&self) -> bool;
/// Returns whether EIP-7708 (ETH transfers emit logs) is disabled.
fn is_eip7708_disabled(&self) -> bool;
/// Returns whether EIP-7708 delayed burn logging is disabled.
///
/// When enabled, revm tracks all self-destructed addresses and emits logs for
/// accounts that still have remaining balance at the end of the transaction.
/// This can be disabled for performance reasons as it requires storing and
/// iterating over all self-destructed accounts. When disabled, the logging
/// can be done outside of revm when applying accounts to database state.
fn is_eip7708_delayed_burn_disabled(&self) -> bool;
/// Returns the limit in bytes for the memory buffer.
fn memory_limit(&self) -> u64;
/// Returns the gas params for the EVM.
fn gas_params(&self) -> &GasParams;
/// Returns whether EIP-8037 (Amsterdam) state creation gas cost increase is enabled.
///
/// When enabled, storage creation gas is tracked separately from regular gas
/// via the reservoir model. EIP-8037 specifies concrete gas values based on
/// `cost_per_state_byte` and adds a hash cost for deployed bytecode.
fn is_amsterdam_eip8037_enabled(&self) -> bool;
}
/// What bytecode analysis to perform
#[derive(Clone, Default, Debug, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum AnalysisKind {
/// Do not perform bytecode analysis
Raw,
/// Perform bytecode analysis
#[default]
Analyse,
}
/// Transaction destination
pub type TransactTo = TxKind;
/// Create scheme
#[derive(Clone, Copy, Default, Debug, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum CreateScheme {
/// Legacy create scheme of `CREATE`
#[default]
Create,
/// Create scheme of `CREATE2`
Create2 {
/// Salt
salt: U256,
},
/// Custom scheme where we set up the original address
Custom {
/// Custom contract creation address.
address: Address,
},
}