revm_context_interface/
cfg.rs

1use auto_impl::auto_impl;
2use core::fmt::Debug;
3use core::hash::Hash;
4use primitives::{hardfork::SpecId, 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    ///
17    /// EIP-7840: Add blob schedule to execution client configuration files
18    fn blob_max_count(&self, spec_id: SpecId) -> u8;
19
20    fn max_code_size(&self) -> usize;
21
22    fn is_eip3607_disabled(&self) -> bool;
23
24    fn is_balance_check_disabled(&self) -> bool;
25
26    fn is_block_gas_limit_disabled(&self) -> bool;
27
28    fn is_nonce_check_disabled(&self) -> bool;
29
30    fn is_base_fee_check_disabled(&self) -> bool;
31}
32
33/// What bytecode analysis to perform
34#[derive(Clone, Default, Debug, Eq, PartialEq, Hash)]
35#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
36pub enum AnalysisKind {
37    /// Do not perform bytecode analysis
38    Raw,
39    /// Perform bytecode analysis
40    #[default]
41    Analyse,
42}
43
44/// Transaction destination
45pub type TransactTo = TxKind;
46
47/// Create scheme
48#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
49#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
50pub enum CreateScheme {
51    /// Legacy create scheme of `CREATE`
52    Create,
53    /// Create scheme of `CREATE2`
54    Create2 {
55        /// Salt
56        salt: U256,
57    },
58}