Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/context/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "revm-context"
description = "Revm context crates"
version = "9.1.0"
version = "9.1.1"
authors.workspace = true
edition.workspace = true
keywords.workspace = true
Expand Down Expand Up @@ -79,3 +79,4 @@ optional_priority_fee_check = []
optional_fee_charge = []
enable_eip7702 = []
enable_eip7623 = []
enable_eip7939 = []
3 changes: 3 additions & 0 deletions crates/context/interface/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ pub trait Cfg {

/// Returns whether the EIP-7623 is enabled.
fn is_eip7623_enabled(&self) -> bool;

/// Returns whether the EIP-7939 is enabled.
fn is_eip7939_enabled(&self) -> bool;
}

/// What bytecode analysis to perform
Expand Down
27 changes: 27 additions & 0 deletions crates/context/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ pub struct CfgEnv<SPEC = SpecId> {
/// By default, it is set to `false`.
#[cfg(feature = "enable_eip7623")]
pub enable_eip7623: bool,

/// Enables EIP-7939, regardless of the current spec.
///
/// By default, it is set to `false`.
#[cfg(feature = "enable_eip7939")]
pub enable_eip7939: bool,
}

impl CfgEnv {
Expand Down Expand Up @@ -181,6 +187,8 @@ impl<SPEC> CfgEnv<SPEC> {
enable_eip7702: false,
#[cfg(feature = "enable_eip7623")]
enable_eip7623: false,
#[cfg(feature = "enable_eip7939")]
enable_eip7939: false,
}
}

Expand Down Expand Up @@ -234,6 +242,8 @@ impl<SPEC> CfgEnv<SPEC> {
enable_eip7702: self.enable_eip7702,
#[cfg(feature = "enable_eip7623")]
enable_eip7623: self.enable_eip7623,
#[cfg(feature = "enable_eip7939")]
enable_eip7939: self.enable_eip7939,
}
}

Expand Down Expand Up @@ -280,6 +290,13 @@ impl<SPEC> CfgEnv<SPEC> {
self.enable_eip7623 = true;
self
}

/// Enables EIP-7939.
#[cfg(feature = "enable_eip7939")]
pub fn enable_eip_7939(mut self) -> CfgEnv<SPEC> {
self.enable_eip7939 = true;
self
}
}

impl<SPEC: Into<SpecId> + Copy> Cfg for CfgEnv<SPEC> {
Expand Down Expand Up @@ -423,6 +440,16 @@ impl<SPEC: Into<SpecId> + Copy> Cfg for CfgEnv<SPEC> {
}
}
}

fn is_eip7939_enabled(&self) -> bool {
cfg_if::cfg_if! {
if #[cfg(feature = "enable_eip7939")] {
self.enable_eip7623 || (self.spec.into() >= SpecId::OSAKA)
} else {
self.spec.into() >= SpecId::OSAKA
}
}
}
}

impl<SPEC: Default> Default for CfgEnv<SPEC> {
Expand Down
1 change: 1 addition & 0 deletions crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ optional_eip3607 = ["context/optional_eip3607"]
optional_no_base_fee = ["context/optional_no_base_fee"]
enable_eip7702 = ["context/enable_eip7702"]
enable_eip7623 = ["context/enable_eip7623"]
enable_eip7939 = ["context/enable_eip7939"]

# Precompiles features: Please look at the comments in `precompile` crate for more information.

Expand Down
Loading