revm_context_interface/
cfg.rs

1use auto_impl::auto_impl;
2use core::fmt::Debug;
3use core::hash::Hash;
4use primitives::{hardfork::SpecId, Address, TxKind, U256};
5
6#[auto_impl(&, &mut, Box, Arc)]
7pub trait Cfg {
8    type Spec: Into<SpecId> + Clone;
9
10    fn chain_id(&self) -> u64;
11
12    // Specification id that is set.
13    fn spec(&self) -> Self::Spec;
14
15    /// Returns the blob target and max count for the given spec id.
16    /// If it is None, check for max count will be skipped.
17    ///
18    /// EIP-7840: Add blob schedule to execution client configuration files
19    fn blob_max_count(&self) -> Option<u64>;
20
21    fn max_code_size(&self) -> usize;
22
23    fn is_eip3607_disabled(&self) -> bool;
24
25    fn is_balance_check_disabled(&self) -> bool;
26
27    fn is_block_gas_limit_disabled(&self) -> bool;
28
29    fn is_nonce_check_disabled(&self) -> bool;
30
31    fn is_base_fee_check_disabled(&self) -> bool;
32}
33
34/// What bytecode analysis to perform
35#[derive(Clone, Default, Debug, Eq, PartialEq, Hash)]
36#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
37pub enum AnalysisKind {
38    /// Do not perform bytecode analysis
39    Raw,
40    /// Perform bytecode analysis
41    #[default]
42    Analyse,
43}
44
45/// Transaction destination
46pub type TransactTo = TxKind;
47
48/// Create scheme
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
50#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
51pub enum CreateScheme {
52    /// Legacy create scheme of `CREATE`
53    Create,
54    /// Create scheme of `CREATE2`
55    Create2 {
56        /// Salt
57        salt: U256,
58    },
59    /// Custom scheme where we set up the original address
60    Custom { address: Address },
61}