Repository: lambdaclass/ethrex
Pull request #2670: chore(levm, l1, l2): remove code specific to unsupported forks
Author: login: SDartayet
Created: 2025-05-05T21:29:07Z | Merged: 2025-05-08T20:05:41Z

**Motivation**

Keep the codebase clean and as simple as possible by removing code we don't really need.

**Description**

All the code that was only relevant to forks prior to Paris was removed. This includes constants, ifs, etc. 

Resolves issue [#2659](https://github.com/lambdaclass/ethrex/issues/2659) 




Diff:
diff --git a/cmd/ef_tests/state/report.rs b/cmd/ef_tests/state/report.rs
index 428c638fa35..c6ba33e5f00 100644
--- a/cmd/ef_tests/state/report.rs
+++ b/cmd/ef_tests/state/report.rs
@@ -127,7 +127,7 @@ pub fn summary_for_slack(reports: &[EFTestReport]) -> String {
             "type": "section",
             "text": {{
                 "type": "mrkdwn",
-                "text": "*Summary*: {total_passed}/{total_run} ({success_percentage:.2}%)\n\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n"
+                "text": "*Summary*: {total_passed}/{total_run} ({success_percentage:.2}%)\n\n{}\n{}\n{}\n{}\n"
             }}
         }}
     ]
@@ -135,15 +135,7 @@ pub fn summary_for_slack(reports: &[EFTestReport]) -> String {
         fork_summary_for_slack(reports, Fork::Prague),
         fork_summary_for_slack(reports, Fork::Cancun),
         fork_summary_for_slack(reports, Fork::Shanghai),
-        fork_summary_for_slack(reports, Fork::Byzantium),
-        fork_summary_for_slack(reports, Fork::Berlin),
-        fork_summary_for_slack(reports, Fork::Constantinople),
-        fork_summary_for_slack(reports, Fork::Petersburg),
         fork_summary_for_slack(reports, Fork::Paris),
-        fork_summary_for_slack(reports, Fork::Homestead),
-        fork_summary_for_slack(reports, Fork::Istanbul),
-        fork_summary_for_slack(reports, Fork::London),
-        fork_summary_for_slack(reports, Fork::Frontier),
     )
 }
 
@@ -172,19 +164,11 @@ pub fn summary_for_github(reports: &[EFTestReport]) -> String {
     let total_run = total_fork_test_run(reports);
     let success_percentage = (total_passed as f64 / total_run as f64) * 100.0;
     format!(
-        r#"Summary: {total_passed}/{total_run} ({success_percentage:.2}%)\n\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n"#,
+        r#"Summary: {total_passed}/{total_run} ({success_percentage:.2}%)\n\n{}\n{}\n{}\n{}\n"#,
         fork_summary_for_github(reports, Fork::Prague),
         fork_summary_for_github(reports, Fork::Cancun),
         fork_summary_for_github(reports, Fork::Shanghai),
-        fork_summary_for_github(reports, Fork::Byzantium),
-        fork_summary_for_github(reports, Fork::Berlin),
-        fork_summary_for_github(reports, Fork::Constantinople),
-        fork_summary_for_github(reports, Fork::Petersburg),
         fork_summary_for_github(reports, Fork::Paris),
-        fork_summary_for_github(reports, Fork::Homestead),
-        fork_summary_for_github(reports, Fork::Istanbul),
-        fork_summary_for_github(reports, Fork::London),
-        fork_summary_for_github(reports, Fork::Frontier),
     )
 }
 
@@ -213,7 +197,7 @@ pub fn summary_for_shell(reports: &[EFTestReport]) -> String {
     let total_run = total_fork_test_run(reports);
     let success_percentage = (total_passed as f64 / total_run as f64) * 100.0;
     format!(
-        "{} {}/{total_run} ({success_percentage:.2}%)\n\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n\n\n{}\n",
+        "{} {}/{total_run} ({success_percentage:.2}%)\n\n{}\n{}\n{}\n{}\n\n\n{}\n",
         "Summary:".bold(),
         if total_passed == total_run {
             format!("{}", total_passed).green()
@@ -222,7 +206,6 @@ pub fn summary_for_shell(reports: &[EFTestReport]) -> String {
         } else {
             format!("{}", total_passed).red()
         },
-
         // NOTE: Keep in order, see the Fork Enum to check
         // NOTE: Uncomment the summaries if EF tests for those specific forks exist.
 
@@ -231,22 +214,6 @@ pub fn summary_for_shell(reports: &[EFTestReport]) -> String {
         fork_summary_shell(reports, Fork::Cancun),
         fork_summary_shell(reports, Fork::Shanghai),
         fork_summary_shell(reports, Fork::Paris),
-        // fork_summary_shell(reports, Fork::GrayGlacier),
-        // fork_summary_shell(reports, Fork::ArrowGlacier),
-        fork_summary_shell(reports, Fork::London),
-        fork_summary_shell(reports, Fork::Berlin),
-        // fork_summary_shell(reports, Fork::MuirGlacier),
-        fork_summary_shell(reports, Fork::Istanbul),
-        fork_summary_shell(reports, Fork::Petersburg),
-        fork_summary_shell(reports, Fork::Constantinople),
-        fork_summary_shell(reports, Fork::Byzantium),
-        fork_summary_shell(reports, Fork::SpuriousDragon),
-        fork_summary_shell(reports, Fork::Tangerine),
-        // fork_summary_shell(reports, Fork::DaoFork),
-        fork_summary_shell(reports, Fork::Homestead),
-        // fork_summary_shell(reports, Fork::FrontierThawing),
-        fork_summary_shell(reports, Fork::Frontier),
-
         test_dir_summary_for_shell(reports),
     )
 }
@@ -360,17 +327,7 @@ impl Display for EFTestsReport {
         writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Prague))?;
         writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Cancun))?;
         writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Shanghai))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Byzantium))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Berlin))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Constantinople))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Petersburg))?;
         writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Paris))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Homestead))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Istanbul))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::London))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Frontier))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::SpuriousDragon))?;
-        writeln!(f, "{}", fork_summary_shell(&self.0, Fork::Tangerine))?;
         writeln!(f)?;
         writeln!(f, "Failed tests:")?;
         writeln!(f)?;
diff --git a/cmd/ef_tests/state/runner/levm_runner.rs b/cmd/ef_tests/state/runner/levm_runner.rs
index 2cffbb02dbb..556275812dc 100644
--- a/cmd/ef_tests/state/runner/levm_runner.rs
+++ b/cmd/ef_tests/state/runner/levm_runner.rs
@@ -340,8 +340,8 @@ pub async fn ensure_post_state(
                 }
                 // Execution result was successful and no exception was expected.
                 None => {
-                    let levm_account_updates =
-                        backends::levm::LEVM::get_state_transitions(db, *fork).map_err(|_| {
+                    let levm_account_updates = backends::levm::LEVM::get_state_transitions(db)
+                        .map_err(|_| {
                             InternalError::Custom(
                                 "Error at LEVM::get_state_transitions in ensure_post_state()"
                                     .to_owned(),
diff --git a/cmd/ef_tests/state/runner/revm_runner.rs b/cmd/ef_tests/state/runner/revm_runner.rs
index ad2418ab86c..7be44f17f80 100644
--- a/cmd/ef_tests/state/runner/revm_runner.rs
+++ b/cmd/ef_tests/state/runner/revm_runner.rs
@@ -322,7 +322,7 @@ pub async fn ensure_post_state(
         None => {
             let mut db = load_initial_state_levm(test).await;
             db.cache = levm_cache;
-            let levm_account_updates = backends::levm::LEVM::get_state_transitions(&mut db, *fork)
+            let levm_account_updates = backends::levm::LEVM::get_state_transitions(&mut db)
                 .map_err(|_| {
                     InternalError::Custom("Error at LEVM::get_state_transitions()".to_owned())
                 })?;
diff --git a/crates/blockchain/blockchain.rs b/crates/blockchain/blockchain.rs
index 094c71df63c..6854bc09320 100644
--- a/crates/blockchain/blockchain.rs
+++ b/crates/blockchain/blockchain.rs
@@ -73,7 +73,6 @@ impl Blockchain {
             return Err(ChainError::ParentNotFound);
         };
         let chain_config = self.storage.get_chain_config()?;
-        let fork = chain_config.fork(block.header.timestamp);
 
         // Validate the block pre-execution
         validate_block(block, &parent_header, &chain_config)?;
@@ -84,7 +83,7 @@ impl Blockchain {
             block.header.parent_hash,
         );
         let execution_result = vm.execute_block(block)?;
-        let account_updates = vm.get_state_transitions(fork)?;
+        let account_updates = vm.get_state_transitions()?;
 
         // Validate execution went alright
         validate_gas_used(&execution_result.receipts, &block.header)?;
@@ -269,7 +268,7 @@ impl Blockchain {
         }
 
         let account_updates = vm
-            .get_state_transitions(fork)
+            .get_state_transitions()
             .map_err(|err| (ChainError::EvmError(err), None))?;
 
         let Some(last_block) = blocks.last() else {
diff --git a/crates/blockchain/payload.rs b/crates/blockchain/payload.rs
index 50507033f12..f817194bccf 100644
--- a/crates/blockchain/payload.rs
+++ b/crates/blockchain/payload.rs
@@ -531,9 +531,7 @@ impl Blockchain {
         &self,
         context: &mut PayloadBuildContext,
     ) -> Result<(), ChainError> {
-        let chain_config = &context.store.get_chain_config()?;
-        let fork = chain_config.fork(context.payload.header.timestamp);
-        let account_updates = context.vm.get_state_transitions(fork)?;
+        let account_updates = context.vm.get_state_transitions()?;
 
         context.payload.header.state_root = context
             .store
diff --git a/crates/l2/prover/src/backends/exec.rs b/crates/l2/prover/src/backends/exec.rs
index 351151a8c1f..c717d1d4551 100644
--- a/crates/l2/prover/src/backends/exec.rs
+++ b/crates/l2/prover/src/backends/exec.rs
@@ -62,7 +62,6 @@ fn execution_program(input: ProgramInput) -> Result<ProgramOutput, Box<dyn std::
     let mut acc_account_updates: HashMap<Address, AccountUpdate> = HashMap::new();
 
     for block in blocks {
-        let fork = db.chain_config.fork(block.header.timestamp);
         // Validate the block
         validate_block(&block, &parent_header, &db.chain_config)?;
 
@@ -70,7 +69,7 @@ fn execution_program(input: ProgramInput) -> Result<ProgramOutput, Box<dyn std::
         let mut vm = Evm::from_execution_db(db.clone());
         let result = vm.execute_block(&block)?;
         let receipts = result.receipts;
-        let account_updates = vm.get_state_transitions(fork)?;
+        let account_updates = vm.get_state_transitions()?;
 
         // Update db for the next block
         db.apply_account_updates(&account_updates);
diff --git a/crates/l2/prover/zkvm/interface/sp1/src/main.rs b/crates/l2/prover/zkvm/interface/sp1/src/main.rs
index 32ba3875317..c72af8f3a8c 100644
--- a/crates/l2/prover/zkvm/interface/sp1/src/main.rs
+++ b/crates/l2/prover/zkvm/interface/sp1/src/main.rs
@@ -49,7 +49,7 @@ pub fn main() {
         let result = vm.execute_block(&block).expect("failed to execute block");
         let receipts = result.receipts;
         let account_updates = vm
-            .get_state_transitions(fork)
+            .get_state_transitions()
             .expect("failed to get state transitions");
 
         cumulative_gas_used += receipts
diff --git a/crates/l2/sequencer/block_producer/payload_builder.rs b/crates/l2/sequencer/block_producer/payload_builder.rs
index a12546a2336..a2fa062b30e 100644
--- a/crates/l2/sequencer/block_producer/payload_builder.rs
+++ b/crates/l2/sequencer/block_producer/payload_builder.rs
@@ -270,9 +270,7 @@ async fn calc_modified_accounts_size(
     // We use a temporary_context because `get_state_transitions` mutates it.
     let mut temporary_context = context.clone();
 
-    let chain_config = &context.store.get_chain_config()?;
-    let fork = chain_config.fork(context.payload.header.timestamp);
-    let account_updates = temporary_context.vm.get_state_transitions(fork)?;
+    let account_updates = temporary_context.vm.get_state_transitions()?;
     for account_update in account_updates {
         modified_accounts_size += 1 + 20; // 1byte + 20bytes | r#type(u8) + address(H160)
         if account_update.info.is_some() {
diff --git a/crates/l2/sequencer/l1_committer.rs b/crates/l2/sequencer/l1_committer.rs
index 7ae86d59bea..23d1aaabff3 100644
--- a/crates/l2/sequencer/l1_committer.rs
+++ b/crates/l2/sequencer/l1_committer.rs
@@ -230,11 +230,7 @@ impl Committer {
                     let mut vm =
                         Evm::default(self.store.clone(), block_to_commit.header.parent_hash);
                     vm.execute_block(&block_to_commit)?;
-                    let fork = self
-                        .store
-                        .get_chain_config()?
-                        .fork(block_to_commit.header.timestamp);
-                    vm.get_state_transitions(fork)?
+                    vm.get_state_transitions()?
                 }
             };
 
diff --git a/crates/l2/utils/prover/save_state.rs b/crates/l2/utils/prover/save_state.rs
index 04d6e56296c..94ca867da3c 100644
--- a/crates/l2/utils/prover/save_state.rs
+++ b/crates/l2/utils/prover/save_state.rs
@@ -461,8 +461,7 @@ mod tests {
             };
             let mut db = GeneralizedDatabase::new(Arc::new(store.clone()), CacheDB::new());
             LEVM::execute_block(blocks.last().unwrap(), &mut db)?;
-            let fork = db.store.get_chain_config().fork(block.header.timestamp);
-            let account_updates = LEVM::get_state_transitions(&mut db, fork)?;
+            let account_updates = LEVM::get_state_transitions(&mut db)?;
 
             account_updates_vec.push(account_updates.clone());
 
diff --git a/crates/vm/backends/levm/mod.rs b/crates/vm/backends/levm/mod.rs
index c1ae18b3099..1e4c1c3bc62 100644
--- a/crates/vm/backends/levm/mod.rs
+++ b/crates/vm/backends/levm/mod.rs
@@ -164,7 +164,6 @@ impl LEVM {
 
     pub fn get_state_transitions(
         db: &mut GeneralizedDatabase,
-        fork: Fork,
     ) -> Result<Vec<AccountUpdate>, EvmError> {
         let mut account_updates: Vec<AccountUpdate> = vec![];
         for (address, new_state_account) in db.cache.drain() {
@@ -209,17 +208,14 @@ impl LEVM {
             let mut removed = !initial_state_account.is_empty() && new_state_account.is_empty();
 
             // https://eips.ethereum.org/EIPS/eip-161
-            if fork >= Fork::SpuriousDragon {
-                // "No account may change state from non-existent to existent-but-_empty_. If an operation would do this, the account SHALL instead remain non-existent."
-                if !account_existed && new_state_account.is_empty() {
-                    continue;
-                }
-
-                // "At the end of the transaction, any account touched by the execution of that transaction which is now empty SHALL instead become non-existent (i.e. deleted)."
-                // Note: An account can be empty but still exist in the trie (if that's the case we remove it)
-                if new_state_account.is_empty() {
-                    removed = true;
-                }
+            // "No account may change state from non-existent to existent-but-_empty_. If an operation would do this, the account SHALL instead remain non-existent."
+            if !account_existed && new_state_account.is_empty() {
+                continue;
+            }
+            // "At the end of the transaction, any account touched by the execution of that transaction which is now empty SHALL instead become non-existent (i.e. deleted)."
+            // Note: An account can be empty but still exist in the trie (if that's the case we remove it)
+            if new_state_account.is_empty() {
+                removed = true;
             }
 
             if !removed && !acc_info_updated && !storage_updated {
@@ -381,11 +377,10 @@ impl LEVM {
 
         let mut execution_updates: HashMap<Address, AccountUpdate> = HashMap::new();
         for block in blocks {
-            let fork = chain_config.fork(block.header.timestamp);
             let mut db = GeneralizedDatabase::new(logger.clone(), CacheDB::new());
             // pre-execute and get all state changes
             let _ = Self::execute_block(block, &mut db);
-            let account_updates = Self::get_state_transitions(&mut db, fork).map_err(Box::new)?;
+            let account_updates = Self::get_state_transitions(&mut db).map_err(Box::new)?;
             for update in account_updates {
                 execution_updates
                     .entry(update.address)
diff --git a/crates/vm/backends/mod.rs b/crates/vm/backends/mod.rs
index 2f3a7a72c0e..ecdcc3696f9 100644
--- a/crates/vm/backends/mod.rs
+++ b/crates/vm/backends/mod.rs
@@ -192,10 +192,10 @@ impl Evm {
     /// [LEVM::get_state_transitions] gathers the information from a [CacheDB].
     ///
     /// They may have the same name, but they serve for different purposes.
-    pub fn get_state_transitions(&mut self, fork: Fork) -> Result<Vec<AccountUpdate>, EvmError> {
+    pub fn get_state_transitions(&mut self) -> Result<Vec<AccountUpdate>, EvmError> {
         match self {
             Evm::REVM { state } => Ok(REVM::get_state_transitions(state)),
-            Evm::LEVM { db } => LEVM::get_state_transitions(db, fork),
+            Evm::LEVM { db } => LEVM::get_state_transitions(db),
         }
     }
 
diff --git a/crates/vm/levm/README.md b/crates/vm/levm/README.md
index 73ad8a0e7a5..1515ef3daef 100644
--- a/crates/vm/levm/README.md
+++ b/crates/vm/levm/README.md
@@ -134,19 +134,12 @@ We'll run flamegraph or Samply over the VM to identify bottlenecks and improve t
 > [!NOTE]
 > This is updated as of this README's last update. For the most up-to-date status, please run the tests locally.
 
-**Total**: 11322/14408 (78.58%)
+**Total**: 6235/6235 (100.00%)
 
 **Prague**: 2373/2373 (100.00%)
 **Cancun**: 3579/3579 (100.00%)
 **Shanghai**: 221/221 (100.00%)
-**Byzantium**: 1795/2330 (77.04%)
-**Berlin**: 2/35 (5.71%)
-**Constantinople**: 1689/2439 (69.25%)
 **Paris**: 62/62 (100.00%)
-**Homestead**: 612/1324 (46.22%)
-**Istanbul**: 34/35 (97.14%)
-**London**: 39/39 (100.00%)
-**Frontier**: 149/742 (20.08%)
 
 ### How to run EF tests locally
 
diff --git a/crates/vm/levm/src/db/gen_db.rs b/crates/vm/levm/src/db/gen_db.rs
index 6143e34bc47..049b52ae4b8 100644
--- a/crates/vm/levm/src/db/gen_db.rs
+++ b/crates/vm/levm/src/db/gen_db.rs
@@ -2,7 +2,6 @@ use std::sync::Arc;
 
 use bytes::Bytes;
 use ethrex_common::types::Account;
-use ethrex_common::types::Fork;
 use ethrex_common::Address;
 use ethrex_common::U256;
 use keccak_hash::H256;
@@ -191,15 +190,12 @@ impl<'a> VM<'a> {
         key: H256,
     ) -> Result<(U256, bool), VMError> {
         // [EIP-2929] - Introduced conditional tracking of accessed storage slots for Berlin and later specs.
-        let mut storage_slot_was_cold = false;
-        if self.env.config.fork >= Fork::Berlin {
-            storage_slot_was_cold = self
-                .accrued_substate
-                .touched_storage_slots
-                .entry(address)
-                .or_default()
-                .insert(key);
-        }
+        let storage_slot_was_cold = self
+            .accrued_substate
+            .touched_storage_slots
+            .entry(address)
+            .or_default()
+            .insert(key);
 
         let storage_slot = self.get_storage_value(address, key)?;
 
diff --git a/crates/vm/levm/src/execution_handlers.rs b/crates/vm/levm/src/execution_handlers.rs
index a6032a6ef26..f35d363323c 100644
--- a/crates/vm/levm/src/execution_handlers.rs
+++ b/crates/vm/levm/src/execution_handlers.rs
@@ -8,8 +8,6 @@ use crate::{
     vm::{StateBackup, VM},
 };
 
-use ethrex_common::types::Fork;
-
 use bytes::Bytes;
 
 impl<'a> VM<'a> {
@@ -180,19 +178,18 @@ impl<'a> VM<'a> {
             // If the first byte of code is 0xef
             // If the code_length > MAX_CODE_SIZE
             // If current_consumed_gas + code_deposit_cost > gas_limit
-            let validate_create =
-                if code_length > MAX_CODE_SIZE && self.env.config.fork >= Fork::SpuriousDragon {
-                    Err(VMError::ContractOutputTooBig)
-                } else if contract_code.first().unwrap_or(&0) == &INVALID_CONTRACT_PREFIX {
-                    Err(VMError::InvalidContractPrefix)
-                } else if current_call_frame
-                    .increase_consumed_gas(code_deposit_cost)
-                    .is_err()
-                {
-                    Err(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded))
-                } else {
-                    Ok(current_call_frame.to)
-                };
+            let validate_create = if code_length > MAX_CODE_SIZE {
+                Err(VMError::ContractOutputTooBig)
+            } else if contract_code.first().unwrap_or(&0) == &INVALID_CONTRACT_PREFIX {
+                Err(VMError::InvalidContractPrefix)
+            } else if current_call_frame
+                .increase_consumed_gas(code_deposit_cost)
+                .is_err()
+            {
+                Err(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded))
+            } else {
+                Ok(current_call_frame.to)
+            };
 
             match validate_create {
                 Ok(new_address) => {
diff --git a/crates/vm/levm/src/gas_cost.rs b/crates/vm/levm/src/gas_cost.rs
index 5a1212ab0e1..af1b15abae5 100644
--- a/crates/vm/levm/src/gas_cost.rs
+++ b/crates/vm/levm/src/gas_cost.rs
@@ -21,7 +21,6 @@ pub const SMOD: u64 = 5;
 pub const ADDMOD: u64 = 8;
 pub const MULMOD: u64 = 8;
 pub const EXP_STATIC: u64 = 10;
-pub const EXP_DYNAMIC_BASE_PRE_SPURIOUS_DRAGON: u64 = 10;
 pub const EXP_DYNAMIC_BASE: u64 = 50;
 pub const SIGNEXTEND: u64 = 5;
 pub const LT: u64 = 3;
@@ -88,7 +87,6 @@ pub const CODECOPY_STATIC: u64 = 3;
 pub const CODECOPY_DYNAMIC_BASE: u64 = 3;
 pub const GASPRICE: u64 = 2;
 
-pub const SELFDESTRUCT_STATIC_PRE_TANGERINE: u64 = 0;
 pub const SELFDESTRUCT_STATIC: u64 = 5000;
 pub const SELFDESTRUCT_DYNAMIC: u64 = 25000;
 pub const SELFDESTRUCT_REFUND: u64 = 24000;
@@ -97,8 +95,6 @@ pub const DEFAULT_STATIC: u64 = 0;
 pub const DEFAULT_COLD_DYNAMIC: u64 = 2600;
 pub const DEFAULT_WARM_DYNAMIC: u64 = 100;
 
-pub const SLOAD_COST_PRE_BERLIN: u64 = 200;
-pub const SLOAD_COST_PRE_TANGERINE: u64 = 50;
 pub const SLOAD_STATIC: u64 = 0;
 pub const SLOAD_COLD_DYNAMIC: u64 = 2100;
 pub const SLOAD_WARM_DYNAMIC: u64 = 100;
@@ -106,22 +102,14 @@ pub const SLOAD_WARM_DYNAMIC: u64 = 100;
 pub const SSTORE_STATIC: u64 = 0;
 pub const SSTORE_COLD_DYNAMIC: u64 = 2100;
 pub const SSTORE_DEFAULT_DYNAMIC: u64 = 100;
-pub const SSTORE_DEFAULT_ISTANBUL_MUIR_GLACIER: u64 = 800;
-pub const SSTORE_DEFAULT_CONSTANTINOPLE: u64 = 200;
 pub const SSTORE_STORAGE_CREATION: u64 = 20000;
 pub const SSTORE_STORAGE_MODIFICATION: u64 = 2900;
 pub const SSTORE_STIPEND: u64 = 2300;
-pub const SSTORE_PRE_BERLIN_NON_ZERO: u64 = 20000;
-pub const SSTORE_PRE_BERLIN: u64 = 5000;
 
-pub const BALANCE_PRE_TANGERINE: u64 = 20;
-pub const BALANCE_TANGERINE: u64 = 400;
 pub const BALANCE_STATIC: u64 = DEFAULT_STATIC;
 pub const BALANCE_COLD_DYNAMIC: u64 = DEFAULT_COLD_DYNAMIC;
 pub const BALANCE_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
 
-pub const EXTCODESIZE_PRE_TANGERINE: u64 = 20;
-pub const EXTCODESIZE_TANGERINE: u64 = 700;
 pub const EXTCODESIZE_STATIC: u64 = DEFAULT_STATIC;
 pub const EXTCODESIZE_COLD_DYNAMIC: u64 = DEFAULT_COLD_DYNAMIC;
 pub const EXTCODESIZE_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
@@ -129,51 +117,34 @@ pub const EXTCODESIZE_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
 pub const EXTCODEHASH_STATIC: u64 = DEFAULT_STATIC;
 pub const EXTCODEHASH_COLD_DYNAMIC: u64 = DEFAULT_COLD_DYNAMIC;
 pub const EXTCODEHASH_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
-pub const EXTCODEHASH_STATIC_PRE_ISTANBUL: u64 = 400;
-pub const EXTCODEHASH_STATIC_PRE_BERLIN: u64 = 700;
 
-pub const EXTCODECOPY_STATIC_PRE_TANGERINE: u64 = 20;
-pub const EXTCODECOPY_STATIC_PRE_BERLIN: u64 = 700;
 pub const EXTCODECOPY_STATIC: u64 = 0;
 pub const EXTCODECOPY_DYNAMIC_BASE: u64 = 3;
 pub const EXTCODECOPY_COLD_DYNAMIC: u64 = DEFAULT_COLD_DYNAMIC;
 pub const EXTCODECOPY_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
 
-pub const DEFAULT_CALL_STATIC_PRE_TANGERINE: u64 = 40;
-pub const DEFAULT_CALL_STATIC_PRE_BERLIN: u64 = 700;
-
-pub const CALL_STATIC_PRE_TANGERINE: u64 = DEFAULT_CALL_STATIC_PRE_TANGERINE;
-pub const CALL_STATIC_PRE_BERLIN: u64 = DEFAULT_CALL_STATIC_PRE_BERLIN;
 pub const CALL_STATIC: u64 = DEFAULT_STATIC;
 pub const CALL_COLD_DYNAMIC: u64 = DEFAULT_COLD_DYNAMIC;
 pub const CALL_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
-pub const CALL_PRE_BERLIN: u64 = 700;
 pub const CALL_POSITIVE_VALUE: u64 = 9000;
 pub const CALL_POSITIVE_VALUE_STIPEND: u64 = 2300;
 pub const CALL_TO_EMPTY_ACCOUNT: u64 = 25000;
 
-pub const CALLCODE_STATIC_PRE_TANGERINE: u64 = DEFAULT_CALL_STATIC_PRE_TANGERINE;
-pub const CALLCODE_STATIC_PRE_BERLIN: u64 = DEFAULT_CALL_STATIC_PRE_BERLIN;
 pub const CALLCODE_STATIC: u64 = DEFAULT_STATIC;
 pub const CALLCODE_COLD_DYNAMIC: u64 = DEFAULT_COLD_DYNAMIC;
 pub const CALLCODE_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
 pub const CALLCODE_POSITIVE_VALUE: u64 = 9000;
 pub const CALLCODE_POSITIVE_VALUE_STIPEND: u64 = 2300;
 
-pub const DELEGATECALL_STATIC_PRE_TANGERINE: u64 = DEFAULT_CALL_STATIC_PRE_TANGERINE;
-pub const DELEGATECALL_STATIC_PRE_BERLIN: u64 = DEFAULT_CALL_STATIC_PRE_BERLIN;
 pub const DELEGATECALL_STATIC: u64 = DEFAULT_STATIC;
 pub const DELEGATECALL_COLD_DYNAMIC: u64 = DEFAULT_COLD_DYNAMIC;
 pub const DELEGATECALL_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
 
-pub const STATICCALLCALL_STATIC_PRE_TANGERINE: u64 = DEFAULT_CALL_STATIC_PRE_TANGERINE;
-pub const STATICCALLCALL_STATIC_PRE_BERLIN: u64 = DEFAULT_CALL_STATIC_PRE_BERLIN;
 pub const STATICCALL_STATIC: u64 = DEFAULT_STATIC;
 pub const STATICCALL_COLD_DYNAMIC: u64 = DEFAULT_COLD_DYNAMIC;
 pub const STATICCALL_WARM_DYNAMIC: u64 = DEFAULT_WARM_DYNAMIC;
 
 // Costs in gas for call opcodes
-pub const ADDRESS_COST_PRE_BERLIN: u64 = 700;
 pub const WARM_ADDRESS_ACCESS_COST: u64 = 100;
 pub const COLD_ADDRESS_ACCESS_COST: u64 = 2600;
 pub const NON_ZERO_VALUE_COST: u64 = 9000;
@@ -188,7 +159,6 @@ pub const CREATE_BASE_COST: u64 = 32000;
 // Calldata costs
 pub const CALLDATA_COST_ZERO_BYTE: u64 = 4;
 pub const CALLDATA_COST_NON_ZERO_BYTE: u64 = 16;
-pub const CALLDATA_COST_NON_ZERO_BYTE_PRE_ISTANBUL: u64 = 68;
 pub const STANDARD_TOKEN_COST: u64 = 4;
 
 // Blob gas costs
@@ -225,17 +195,11 @@ pub const MODEXP_STATIC_COST: u64 = 200;
 pub const MODEXP_DYNAMIC_BASE: u64 = 200;
 pub const MODEXP_DYNAMIC_QUOTIENT: u64 = 3;
 
-pub const MODEXP_DYNAMIC_QUOTIENT_PRE_BERLIN: u64 = 20;
-
 pub const ECADD_COST: u64 = 150;
-pub const ECADD_COST_PRE_ISTANBUL: u64 = 500;
 pub const ECMUL_COST: u64 = 6000;
-pub const ECMUL_COST_PRE_ISTANBUL: u64 = 40000;
 
 pub const ECPAIRING_BASE_COST: u64 = 45000;
 pub const ECPAIRING_GROUP_COST: u64 = 34000;
-pub const ECPAIRING_BASE_COST_PRE_ISTANBUL: u64 = 100000;
-pub const ECPAIRING_GROUP_COST_PRE_ISTANBUL: u64 = 80000;
 
 pub const POINT_EVALUATION_COST: u64 = 50000;
 
@@ -263,7 +227,7 @@ pub const BLS12_381_G2_K_DISCOUNT: [u64; 128] = [
 ];
 pub const G2_MUL_COST: u64 = 22500;
 
-pub fn exp(exponent: U256, fork: Fork) -> Result<u64, VMError> {
+pub fn exp(exponent: U256) -> Result<u64, VMError> {
     let exponent_byte_size = (exponent
         .bits()
         .checked_add(7)
@@ -274,14 +238,7 @@ pub fn exp(exponent: U256, fork: Fork) -> Result<u64, VMError> {
         .try_into()
         .map_err(|_| VMError::VeryLargeNumber)?;
 
-    // https://eips.ethereum.org/EIPS/eip-160
-    let dynamic_base = if fork < Fork::SpuriousDragon {
-        EXP_DYNAMIC_BASE_PRE_SPURIOUS_DRAGON
-    } else {
-        EXP_DYNAMIC_BASE
-    };
-
-    let exponent_byte_size_cost = dynamic_base
+    let exponent_byte_size_cost = EXP_DYNAMIC_BASE
         .checked_mul(exponent_byte_size)
         .ok_or(VMError::OutOfGas(OutOfGasError::GasCostOverflow))?;
 
@@ -430,27 +387,16 @@ fn mem_expansion_behavior(
         .ok_or(OutOfGasError::GasCostOverflow)?)
 }
 
-pub fn sload(storage_slot_was_cold: bool, fork: Fork) -> Result<u64, VMError> {
-    match fork {
-        f if f < Fork::Tangerine => Ok(SLOAD_COST_PRE_TANGERINE),
-        f if f >= Fork::Tangerine && f < Fork::Berlin => {
-            // EIP https://eips.ethereum.org/EIPS/eip-2929
-            Ok(SLOAD_COST_PRE_BERLIN)
-        }
-        _ => {
-            let static_gas = SLOAD_STATIC;
-
-            let dynamic_cost = if storage_slot_was_cold {
-                SLOAD_COLD_DYNAMIC
-            } else {
-                SLOAD_WARM_DYNAMIC
-            };
-
-            Ok(static_gas
-                .checked_add(dynamic_cost)
-                .ok_or(OutOfGasError::GasCostOverflow)?)
-        }
-    }
+pub fn sload(storage_slot_was_cold: bool) -> Result<u64, VMError> {
+    let static_gas = SLOAD_STATIC;
+    let dynamic_cost = if storage_slot_was_cold {
+        SLOAD_COLD_DYNAMIC
+    } else {
+        SLOAD_WARM_DYNAMIC
+    };
+    Ok(static_gas
+        .checked_add(dynamic_cost)
+        .ok_or(OutOfGasError::GasCostOverflow)?)
 }
 
 pub fn sstore(
@@ -458,61 +404,29 @@ pub fn sstore(
     current_value: U256,
     new_value: U256,
     storage_slot_was_cold: bool,
-    fork: Fork,
 ) -> Result<u64, VMError> {
-    // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1087.md
-    // Petersburg removes EIP-1283
-    // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1716.md
-    if fork <= Fork::Byzantium || fork == Fork::Petersburg {
-        if current_value.is_zero() && !new_value.is_zero() {
-            Ok(SSTORE_PRE_BERLIN_NON_ZERO)
-        } else {
-            Ok(SSTORE_PRE_BERLIN)
-        }
-    } else {
-        let static_gas = SSTORE_STATIC;
-
-        let default_dynamic = match fork {
-            // https://eips.ethereum.org/EIPS/eip-1283
-            Fork::Constantinople => SSTORE_DEFAULT_CONSTANTINOPLE,
-            // https://eips.ethereum.org/EIPS/eip-2200
-            f if f == Fork::Istanbul || f == Fork::MuirGlacier => {
-                SSTORE_DEFAULT_ISTANBUL_MUIR_GLACIER
-            }
-            // https://eips.ethereum.org/EIPS/eip-2929
-            _ => SSTORE_DEFAULT_DYNAMIC,
-        };
-
-        let dynamic_gas_modification = if fork < Fork::Berlin {
-            SSTORE_PRE_BERLIN
+    let static_gas = SSTORE_STATIC;
+
+    let mut base_dynamic_gas = if new_value == current_value {
+        SSTORE_DEFAULT_DYNAMIC
+    } else if current_value == original_value {
+        if original_value.is_zero() {
+            SSTORE_STORAGE_CREATION
         } else {
-            // https://eips.ethereum.org/EIPS/eip-3529
             SSTORE_STORAGE_MODIFICATION
-        };
-
-        let mut base_dynamic_gas = if new_value == current_value {
-            default_dynamic
-        } else if current_value == original_value {
-            if original_value.is_zero() {
-                SSTORE_STORAGE_CREATION
-            } else {
-                dynamic_gas_modification
-            }
-        } else {
-            default_dynamic
-        };
-
-        // https://eips.ethereum.org/EIPS/eip-2929
-        if storage_slot_was_cold && fork >= Fork::Berlin {
-            base_dynamic_gas = base_dynamic_gas
-                .checked_add(SSTORE_COLD_DYNAMIC)
-                .ok_or(OutOfGasError::GasCostOverflow)?;
         }
-
-        Ok(static_gas
-            .checked_add(base_dynamic_gas)
-            .ok_or(OutOfGasError::GasCostOverflow)?)
+    } else {
+        SSTORE_DEFAULT_DYNAMIC
+    };
+    // https://eips.ethereum.org/EIPS/eip-2929
+    if storage_slot_was_cold {
+        base_dynamic_gas = base_dynamic_gas
+            .checked_add(SSTORE_COLD_DYNAMIC)
+            .ok_or(OutOfGasError::GasCostOverflow)?;
     }
+    Ok(static_gas
+        .checked_add(base_dynamic_gas)
+        .ok_or(OutOfGasError::GasCostOverflow)?)
 }
 
 pub fn mcopy(
@@ -624,64 +538,34 @@ pub fn selfdestruct(
     address_was_cold: bool,
     account_is_empty: bool,
     balance_to_transfer: U256,
-    fork: Fork,
 ) -> Result<u64, OutOfGasError> {
-    let (static_cost, dynamic_cost) = match fork {
-        f if f <= Fork::DaoFork => (SELFDESTRUCT_STATIC_PRE_TANGERINE, 0),
-        Fork::Tangerine => {
-            let dynamic_cost = if account_is_empty {
-                SELFDESTRUCT_DYNAMIC
-            } else {
-                0
-            };
-            (SELFDESTRUCT_STATIC, dynamic_cost)
-        }
-        f if f > Fork::Tangerine && f < Fork::Berlin => {
-            let dynamic_cost = if account_is_empty && balance_to_transfer > U256::zero() {
-                SELFDESTRUCT_DYNAMIC
-            } else {
-                0
-            };
-
-            (SELFDESTRUCT_STATIC, dynamic_cost)
-        }
-        _ => {
-            let mut dynamic_cost = if address_was_cold {
-                COLD_ADDRESS_ACCESS_COST
-            } else {
-                0
-            };
-
-            // If a positive balance is sent to an empty account, the dynamic gas is 25000
-            if account_is_empty && balance_to_transfer > U256::zero() {
-                dynamic_cost = dynamic_cost
-                    .checked_add(SELFDESTRUCT_DYNAMIC)
-                    .ok_or(OutOfGasError::GasCostOverflow)?;
-            }
-            (SELFDESTRUCT_STATIC, dynamic_cost)
-        }
+    let mut dynamic_cost = if address_was_cold {
+        COLD_ADDRESS_ACCESS_COST
+    } else {
+        0
     };
-    static_cost
+
+    // If a positive balance is sent to an empty account, the dynamic gas is 25000
+    if account_is_empty && balance_to_transfer > U256::zero() {
+        dynamic_cost = dynamic_cost
+            .checked_add(SELFDESTRUCT_DYNAMIC)
+            .ok_or(OutOfGasError::GasCostOverflow)?;
+    }
+
+    SELFDESTRUCT_STATIC
         .checked_add(dynamic_cost)
         .ok_or(OutOfGasError::GasCostOverflow)
 }
 
-pub fn tx_calldata(calldata: &Bytes, fork: Fork) -> Result<u64, OutOfGasError> {
+pub fn tx_calldata(calldata: &Bytes) -> Result<u64, OutOfGasError> {
     // This cost applies both for call and create
     // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction.
     let mut calldata_cost: u64 = 0;
     for byte in calldata {
         calldata_cost = if *byte != 0 {
-            if fork >= Fork::Istanbul {
-                calldata_cost
-                    .checked_add(CALLDATA_COST_NON_ZERO_BYTE)
-                    .ok_or(OutOfGasError::GasUsedOverflow)?
-            } else {
-                // EIP-2028
-                calldata_cost
-                    .checked_add(CALLDATA_COST_NON_ZERO_BYTE_PRE_ISTANBUL)
-                    .ok_or(OutOfGasError::GasUsedOverflow)?
-            }
+            calldata_cost
+                .checked_add(CALLDATA_COST_NON_ZERO_BYTE)
+                .ok_or(OutOfGasError::GasUsedOverflow)?
         } else {
             calldata_cost
                 .checked_add(CALLDATA_COST_ZERO_BYTE)
@@ -727,13 +611,9 @@ fn address_access_cost(
         .ok_or(OutOfGasError::GasCostOverflow)?)
 }
 
-pub fn balance(address_was_cold: bool, fork: Fork) -> Result<u64, VMError> {
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (BALANCE_PRE_TANGERINE, 0, 0),
-        // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2929.md#storage-read-changes
-        f if f >= Fork::Tangerine && fork < Fork::Berlin => (BALANCE_TANGERINE, 0, 0),
-        _ => (BALANCE_STATIC, BALANCE_COLD_DYNAMIC, BALANCE_WARM_DYNAMIC),
-    };
+pub fn balance(address_was_cold: bool) -> Result<u64, VMError> {
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) =
+        (BALANCE_STATIC, BALANCE_COLD_DYNAMIC, BALANCE_WARM_DYNAMIC);
 
     address_access_cost(
         address_was_cold,
@@ -743,17 +623,12 @@ pub fn balance(address_was_cold: bool, fork: Fork) -> Result<u64, VMError> {
     )
 }
 
-pub fn extcodesize(address_was_cold: bool, fork: Fork) -> Result<u64, VMError> {
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (EXTCODESIZE_PRE_TANGERINE, 0, 0),
-        // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2929.md#storage-read-changes
-        f if f >= Fork::Tangerine && fork < Fork::Berlin => (EXTCODESIZE_TANGERINE, 0, 0),
-        _ => (
-            EXTCODESIZE_STATIC,
-            EXTCODESIZE_COLD_DYNAMIC,
-            EXTCODESIZE_WARM_DYNAMIC,
-        ),
-    };
+pub fn extcodesize(address_was_cold: bool) -> Result<u64, VMError> {
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        EXTCODESIZE_STATIC,
+        EXTCODESIZE_COLD_DYNAMIC,
+        EXTCODESIZE_WARM_DYNAMIC,
+    );
 
     address_access_cost(
         address_was_cold,
@@ -768,31 +643,20 @@ pub fn extcodecopy(
     new_memory_size: usize,
     current_memory_size: usize,
     address_was_cold: bool,
-    fork: Fork,
 ) -> Result<u64, VMError> {
-    let base_cost = match fork {
-        f if f < Fork::Tangerine => EXTCODECOPY_STATIC_PRE_TANGERINE,
-        f if f >= Fork::Tangerine && fork < Fork::Berlin => EXTCODECOPY_STATIC_PRE_BERLIN,
-        _ => EXTCODECOPY_STATIC,
-    };
-
     let base_access_cost = copy_behavior(
         new_memory_size,
         current_memory_size,
         size,
         EXTCODECOPY_DYNAMIC_BASE,
-        base_cost,
+        EXTCODECOPY_STATIC,
     )?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (0, 0, 0),
-        f if f >= Fork::Tangerine && fork < Fork::Berlin => (0, 0, 0),
-        _ => (
-            EXTCODECOPY_STATIC,
-            EXTCODECOPY_COLD_DYNAMIC,
-            EXTCODECOPY_WARM_DYNAMIC,
-        ),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        EXTCODECOPY_STATIC,
+        EXTCODECOPY_COLD_DYNAMIC,
+        EXTCODECOPY_WARM_DYNAMIC,
+    );
 
     let expansion_access_cost = address_access_cost(
         address_was_cold,
@@ -806,17 +670,12 @@ pub fn extcodecopy(
         .ok_or(OutOfGasError::GasCostOverflow)?)
 }
 
-pub fn extcodehash(address_was_cold: bool, fork: Fork) -> Result<u64, VMError> {
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Constantinople => return Err(VMError::InvalidOpcode),
-        f if f < Fork::Istanbul => (EXTCODEHASH_STATIC_PRE_ISTANBUL, 0, 0),
-        f if f < Fork::Berlin => (EXTCODEHASH_STATIC_PRE_BERLIN, 0, 0),
-        _ => (
-            EXTCODEHASH_STATIC,
-            EXTCODEHASH_COLD_DYNAMIC,
-            EXTCODEHASH_WARM_DYNAMIC,
-        ),
-    };
+pub fn extcodehash(address_was_cold: bool) -> Result<u64, VMError> {
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        EXTCODEHASH_STATIC,
+        EXTCODEHASH_COLD_DYNAMIC,
+        EXTCODEHASH_WARM_DYNAMIC,
+    );
 
     address_access_cost(
         address_was_cold,
@@ -835,16 +694,11 @@ pub fn call(
     value_to_transfer: U256,
     gas_from_stack: U256,
     gas_left: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let memory_expansion_cost = memory::expansion_cost(new_memory_size, current_memory_size)?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (CALL_STATIC_PRE_TANGERINE, 0, 0),
-        f if f < Fork::Berlin => (CALL_STATIC_PRE_BERLIN, 0, 0),
-        f if f < Fork::Berlin => (0, 0, 0),
-        _ => (CALL_STATIC, CALL_COLD_DYNAMIC, CALL_WARM_DYNAMIC),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) =
+        (CALL_STATIC, CALL_COLD_DYNAMIC, CALL_WARM_DYNAMIC);
 
     let address_access_cost = address_access_cost(
         address_was_cold,
@@ -878,7 +732,6 @@ pub fn call(
         gas_left,
         call_gas_costs,
         CALL_POSITIVE_VALUE_STIPEND,
-        fork,
     )
 }
 
@@ -889,20 +742,14 @@ pub fn callcode(
     value_to_transfer: U256,
     gas_from_stack: U256,
     gas_left: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let memory_expansion_cost = memory::expansion_cost(new_memory_size, current_memory_size)?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (CALLCODE_STATIC_PRE_TANGERINE, 0, 0),
-        f if f < Fork::Berlin => (CALLCODE_STATIC_PRE_BERLIN, 0, 0),
-        f if f < Fork::Berlin => (0, 0, 0),
-        _ => (
-            DELEGATECALL_STATIC,
-            DELEGATECALL_COLD_DYNAMIC,
-            DELEGATECALL_WARM_DYNAMIC,
-        ),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        DELEGATECALL_STATIC,
+        DELEGATECALL_COLD_DYNAMIC,
+        DELEGATECALL_WARM_DYNAMIC,
+    );
 
     let address_access_cost = address_access_cost(
         address_was_cold,
@@ -928,7 +775,6 @@ pub fn callcode(
         gas_left,
         call_gas_costs,
         CALLCODE_POSITIVE_VALUE_STIPEND,
-        fork,
     )
 }
 
@@ -938,20 +784,14 @@ pub fn delegatecall(
     address_was_cold: bool,
     gas_from_stack: U256,
     gas_left: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let memory_expansion_cost = memory::expansion_cost(new_memory_size, current_memory_size)?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (DELEGATECALL_STATIC_PRE_TANGERINE, 0, 0),
-        f if f < Fork::Berlin => (DELEGATECALL_STATIC_PRE_BERLIN, 0, 0),
-        f if f < Fork::Berlin => (0, 0, 0),
-        _ => (
-            DELEGATECALL_STATIC,
-            DELEGATECALL_COLD_DYNAMIC,
-            DELEGATECALL_WARM_DYNAMIC,
-        ),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        DELEGATECALL_STATIC,
+        DELEGATECALL_COLD_DYNAMIC,
+        DELEGATECALL_WARM_DYNAMIC,
+    );
 
     let address_access_cost = address_access_cost(
         address_was_cold,
@@ -964,7 +804,7 @@ pub fn delegatecall(
         .checked_add(address_access_cost)
         .ok_or(OutOfGasError::GasCostOverflow)?;
 
-    calculate_cost_and_gas_limit_call(true, gas_from_stack, gas_left, call_gas_costs, 0, fork)
+    calculate_cost_and_gas_limit_call(true, gas_from_stack, gas_left, call_gas_costs, 0)
 }
 
 pub fn staticcall(
@@ -973,20 +813,14 @@ pub fn staticcall(
     address_was_cold: bool,
     gas_from_stack: U256,
     gas_left: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let memory_expansion_cost = memory::expansion_cost(new_memory_size, current_memory_size)?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (STATICCALLCALL_STATIC_PRE_TANGERINE, 0, 0),
-        f if f < Fork::Berlin => (STATICCALLCALL_STATIC_PRE_BERLIN, 0, 0),
-        f if f < Fork::Berlin => (0, 0, 0),
-        _ => (
-            STATICCALL_STATIC,
-            STATICCALL_COLD_DYNAMIC,
-            STATICCALL_WARM_DYNAMIC,
-        ),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        STATICCALL_STATIC,
+        STATICCALL_COLD_DYNAMIC,
+        STATICCALL_WARM_DYNAMIC,
+    );
 
     let address_access_cost = address_access_cost(
         address_was_cold,
@@ -999,7 +833,7 @@ pub fn staticcall(
         .checked_add(address_access_cost)
         .ok_or(OutOfGasError::GasCostOverflow)?;
 
-    calculate_cost_and_gas_limit_call(true, gas_from_stack, gas_left, call_gas_costs, 0, fork)
+    calculate_cost_and_gas_limit_call(true, gas_from_stack, gas_left, call_gas_costs, 0)
 }
 
 pub fn fake_exponential(factor: U256, numerator: U256, denominator: U256) -> Result<U256, VMError> {
@@ -1052,12 +886,26 @@ pub fn identity(data_size: usize) -> Result<u64, VMError> {
     precompile(data_size, IDENTITY_STATIC_COST, IDENTITY_DYNAMIC_BASE)
 }
 
-//https://eips.ethereum.org/EIPS/eip-2565
-pub fn modexp_eip2565(
-    max_length: u64,
+pub fn modexp(
     exponent_first_32_bytes: &BigUint,
-    exponent_size: u64,
+    base_size: usize,
+    exponent_size: usize,
+    modulus_size: usize,
 ) -> Result<u64, VMError> {
+    let base_size: u64 = base_size
+        .try_into()
+        .map_err(|_| PrecompileError::ParsingInputError)?;
+    let exponent_size: u64 = exponent_size
+        .try_into()
+        .map_err(|_| PrecompileError::ParsingInputError)?;
+    let modulus_size: u64 = modulus_size
+        .try_into()
+        .map_err(|_| PrecompileError::ParsingInputError)?;
+
+    let max_length = base_size.max(modulus_size);
+
+    //https://eips.ethereum.org/EIPS/eip-2565
+
     let words = (max_length
         .checked_add(7)
         .ok_or(OutOfGasError::GasCostOverflow)?)
@@ -1096,96 +944,6 @@ pub fn modexp_eip2565(
     Ok(cost)
 }
 
-//https://eips.ethereum.org/EIPS/eip-198
-pub fn modexp_eip198(
-    max_length: u64,
-    exponent_first_32_bytes: &BigUint,
-    exponent_size: u64,
-) -> Result<u64, VMError> {
-    let multiplication_complexity = if max_length <= 64 {
-        max_length
-            .checked_pow(2)
-            .ok_or(OutOfGasError::GasCostOverflow)?
-    } else if max_length <= 1024 {
-        max_length
-            .checked_pow(2)
-            .ok_or(OutOfGasError::GasCostOverflow)?
-            .checked_div(4)
-            .ok_or(OutOfGasError::GasCostOverflow)?
-            .checked_add(
-                max_length
-                    .checked_mul(96)
-                    .ok_or(OutOfGasError::GasCostOverflow)?,
-            )
-            .ok_or(OutOfGasError::GasCostOverflow)?
-            .checked_sub(3072)
-            .ok_or(OutOfGasError::GasCostOverflow)?
-    } else {
-        max_length
-            .checked_pow(2)
-            .ok_or(OutOfGasError::GasCostOverflow)?
-            .checked_div(16)
-            .ok_or(OutOfGasError::GasCostOverflow)?
-            .checked_add(
-                max_length
-                    .checked_mul(480)
-                    .ok_or(OutOfGasError::GasCostOverflow)?,
-            )
-            .ok_or(OutOfGasError::GasCostOverflow)?
-            .checked_sub(199680)
-            .ok_or(OutOfGasError::GasCostOverflow)?
-    };
-
-    let calculate_iteration_count = if exponent_size < 32 {
-        exponent_first_32_bytes.bits().saturating_sub(1)
-    } else {
-        let extra_size = (exponent_size
-            .checked_sub(32)
-            .ok_or(InternalError::ArithmeticOperationUnderflow)?)
-        .checked_mul(8)
-        .ok_or(OutOfGasError::GasCostOverflow)?;
-
-        let bits_part = exponent_first_32_bytes.bits().saturating_sub(1);
-
-        extra_size
-            .checked_add(bits_part)
-            .ok_or(OutOfGasError::GasCostOverflow)?
-    }
-    .max(1);
-
-    let cost = multiplication_complexity
-        .checked_mul(calculate_iteration_count)
-        .ok_or(OutOfGasError::GasCostOverflow)?
-        / MODEXP_DYNAMIC_QUOTIENT_PRE_BERLIN;
-    Ok(cost)
-}
-
-pub fn modexp(
-    exponent_first_32_bytes: &BigUint,
-    base_size: usize,
-    exponent_size: usize,
-    modulus_size: usize,
-    fork: Fork,
-) -> Result<u64, VMError> {
-    let base_size: u64 = base_size
-        .try_into()
-        .map_err(|_| PrecompileError::ParsingInputError)?;
-    let exponent_size: u64 = exponent_size
-        .try_into()
-        .map_err(|_| PrecompileError::ParsingInputError)?;
-    let modulus_size: u64 = modulus_size
-        .try_into()
-        .map_err(|_| PrecompileError::ParsingInputError)?;
-
-    let max_length = base_size.max(modulus_size);
-
-    if fork >= Fork::Berlin {
-        modexp_eip2565(max_length, exponent_first_32_bytes, exponent_size)
-    } else {
-        modexp_eip198(max_length, exponent_first_32_bytes, exponent_size)
-    }
-}
-
 fn precompile(data_size: usize, static_cost: u64, dynamic_base: u64) -> Result<u64, VMError> {
     let data_size: u64 = data_size
         .try_into()
@@ -1206,23 +964,14 @@ fn precompile(data_size: usize, static_cost: u64, dynamic_base: u64) -> Result<u
         .ok_or(OutOfGasError::GasCostOverflow)?)
 }
 
-pub fn ecpairing(groups_number: usize, fork: Fork) -> Result<u64, VMError> {
+pub fn ecpairing(groups_number: usize) -> Result<u64, VMError> {
     let groups_number = u64::try_from(groups_number).map_err(|_| InternalError::ConversionError)?;
-    // https://eips.ethereum.org/EIPS/eip-1108
-    let (group_cost_scalar, base_cost) = if fork < Fork::Istanbul {
-        (
-            ECPAIRING_GROUP_COST_PRE_ISTANBUL,
-            ECPAIRING_GROUP_COST_PRE_ISTANBUL,
-        )
-    } else {
-        (ECPAIRING_GROUP_COST, ECPAIRING_BASE_COST)
-    };
 
     let groups_cost = groups_number
-        .checked_mul(group_cost_scalar)
+        .checked_mul(ECPAIRING_GROUP_COST)
         .ok_or(OutOfGasError::GasCostOverflow)?;
     groups_cost
-        .checked_add(base_cost)
+        .checked_add(ECPAIRING_BASE_COST)
         .ok_or(VMError::OutOfGas(OutOfGasError::GasCostOverflow))
 }
 
@@ -1247,24 +996,21 @@ fn calculate_cost_and_gas_limit_call(
     gas_left: u64,
     call_gas_costs: u64,
     stipend: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let gas_stipend = if value_is_zero { 0 } else { stipend };
     let gas_left = gas_left
         .checked_sub(call_gas_costs)
         .ok_or(OutOfGasError::GasUsedOverflow)?;
 
-    let gas: u64 = if fork < Fork::Tangerine {
-        gas_from_stack
-    } else {
-        // EIP 150, https://eips.ethereum.org/EIPS/eip-150
-        let max_gas_for_call = gas_left
-            .checked_sub(gas_left / 64)
-            .ok_or(OutOfGasError::GasUsedOverflow)?;
-        gas_from_stack.min(max_gas_for_call.into())
-    }
-    .try_into()
-    .map_err(|_err| OutOfGasError::MaxGasLimitExceeded)?;
+    // EIP 150, https://eips.ethereum.org/EIPS/eip-150
+    let max_gas_for_call = gas_left
+        .checked_sub(gas_left / 64)
+        .ok_or(OutOfGasError::GasUsedOverflow)?;
+
+    let gas: u64 = gas_from_stack
+        .min(max_gas_for_call.into())
+        .try_into()
+        .map_err(|_err| OutOfGasError::MaxGasLimitExceeded)?;
 
     Ok((
         gas.checked_add(call_gas_costs)
diff --git a/crates/vm/levm/src/hooks/default_hook.rs b/crates/vm/levm/src/hooks/default_hook.rs
index 880d186161a..8c87516ed34 100644
--- a/crates/vm/levm/src/hooks/default_hook.rs
+++ b/crates/vm/levm/src/hooks/default_hook.rs
@@ -15,7 +15,6 @@ use ethrex_common::{
 use std::cmp::max;
 
 pub const MAX_REFUND_QUOTIENT: u64 = 5;
-pub const MAX_REFUND_QUOTIENT_PRE_LONDON: u64 = 2;
 
 pub struct DefaultHook;
 
@@ -135,7 +134,7 @@ impl Hook for DefaultHook {
             undo_value_transfer(vm)?;
         }
 
-        let gas_refunded: u64 = compute_gas_refunded(vm, report)?;
+        let gas_refunded: u64 = compute_gas_refunded(report)?;
         let actual_gas_used = compute_actual_gas_used(vm, gas_refunded, report.gas_used)?;
         refund_sender(vm, report, gas_refunded, actual_gas_used)?;
 
@@ -186,16 +185,11 @@ pub fn refund_sender(
 }
 
 // [EIP-3529](https://eips.ethereum.org/EIPS/eip-3529)
-pub fn compute_gas_refunded(vm: &mut VM<'_>, report: &ExecutionReport) -> Result<u64, VMError> {
-    let refund_quotient = if vm.env.config.fork < Fork::London {
-        MAX_REFUND_QUOTIENT_PRE_LONDON
-    } else {
-        MAX_REFUND_QUOTIENT
-    };
+pub fn compute_gas_refunded(report: &ExecutionReport) -> Result<u64, VMError> {
     Ok(report.gas_refunded.min(
         report
             .gas_used
-            .checked_div(refund_quotient)
+            .checked_div(MAX_REFUND_QUOTIENT)
             .ok_or(VMError::Internal(InternalError::UndefinedState(-1)))?,
     ))
 }
@@ -247,8 +241,7 @@ pub fn validate_min_gas_limit(vm: &mut VM<'_>) -> Result<(), VMError> {
     let intrinsic_gas: u64 = vm.get_intrinsic_gas()?;
 
     // calldata_cost = tokens_in_calldata * 4
-    let calldata_cost: u64 =
-        gas_cost::tx_calldata(&calldata, vm.env.config.fork).map_err(VMError::OutOfGas)?;
+    let calldata_cost: u64 = gas_cost::tx_calldata(&calldata).map_err(VMError::OutOfGas)?;
 
     // same as calculated in gas_used()
     let tokens_in_calldata: u64 = calldata_cost
diff --git a/crates/vm/levm/src/hooks/l2_hook.rs b/crates/vm/levm/src/hooks/l2_hook.rs
index 5f9107a616c..1d041b428f2 100644
--- a/crates/vm/levm/src/hooks/l2_hook.rs
+++ b/crates/vm/levm/src/hooks/l2_hook.rs
@@ -131,11 +131,13 @@ impl Hook for L2Hook {
             vm.increase_account_balance(vm.env.origin, vm.current_call_frame()?.msg_value)?;
         }
 
+        // 2. Return unused gas + gas refunds to the sender.
+
         if vm.env.is_privileged {
             let gas_to_pay_coinbase = compute_coinbase_fee(vm, report)?;
             default_hook::pay_coinbase(vm, gas_to_pay_coinbase)?;
         } else {
-            let gas_refunded = default_hook::compute_gas_refunded(vm, report)?;
+            let gas_refunded = default_hook::compute_gas_refunded(report)?;
             let actual_gas_used =
                 default_hook::compute_actual_gas_used(vm, gas_refunded, report.gas_used)?;
             default_hook::refund_sender(vm, report, gas_refunded, actual_gas_used)?;
@@ -159,7 +161,7 @@ pub fn undo_value_transfer(vm: &mut VM<'_>) -> Result<(), VMError> {
 }
 
 pub fn compute_coinbase_fee(vm: &mut VM<'_>, report: &mut ExecutionReport) -> Result<u64, VMError> {
-    let mut gas_refunded = default_hook::compute_gas_refunded(vm, report)?;
+    let mut gas_refunded = default_hook::compute_gas_refunded(report)?;
     let mut gas_consumed = report.gas_used;
 
     report.gas_refunded = gas_refunded;
diff --git a/crates/vm/levm/src/opcode_handlers/arithmetic.rs b/crates/vm/levm/src/opcode_handlers/arithmetic.rs
index df37318efc3..7657f124cf6 100644
--- a/crates/vm/levm/src/opcode_handlers/arithmetic.rs
+++ b/crates/vm/levm/src/opcode_handlers/arithmetic.rs
@@ -220,12 +220,11 @@ impl<'a> VM<'a> {
 
     // EXP operation
     pub fn op_exp(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let current_call_frame = self.current_call_frame_mut()?;
         let base = current_call_frame.stack.pop()?;
         let exponent = current_call_frame.stack.pop()?;
 
-        let gas_cost = gas_cost::exp(exponent, fork)?;
+        let gas_cost = gas_cost::exp(exponent)?;
 
         current_call_frame.increase_consumed_gas(gas_cost)?;
 
diff --git a/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs b/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs
index f5fd23af206..900f729d946 100644
--- a/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs
+++ b/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs
@@ -4,7 +4,7 @@ use crate::{
     gas_cost,
     vm::VM,
 };
-use ethrex_common::{types::Fork, U256};
+use ethrex_common::U256;
 use std::collections::HashMap;
 use std::sync::LazyLock;
 
@@ -203,12 +203,7 @@ impl<'a> VM<'a> {
 
     // SHL operation (shift left)
     pub fn op_shl(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let current_call_frame = self.current_call_frame_mut()?;
-        // Shift opcodes introduced in Constantinople https://eips.ethereum.org/EIPS/eip-145
-        if fork < Fork::Constantinople {
-            return Err(VMError::InvalidOpcode);
-        }
         current_call_frame.increase_consumed_gas(gas_cost::SHL)?;
         let shift = current_call_frame.stack.pop()?;
         let value = current_call_frame.stack.pop()?;
@@ -253,12 +248,7 @@ impl<'a> VM<'a> {
 
     // SHR operation (shift right)
     pub fn op_shr(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let current_call_frame = self.current_call_frame_mut()?;
-        // Shift opcodes introduced in Constantinople https://eips.ethereum.org/EIPS/eip-145
-        if fork < Fork::Constantinople {
-            return Err(VMError::InvalidOpcode);
-        }
         current_call_frame.increase_consumed_gas(gas_cost::SHR)?;
         let shift = current_call_frame.stack.pop()?;
         let value = current_call_frame.stack.pop()?;
@@ -276,12 +266,7 @@ impl<'a> VM<'a> {
 
     // SAR operation (arithmetic shift right)
     pub fn op_sar(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let current_call_frame = self.current_call_frame_mut()?;
-        // Shift opcodes introduced in Constantinople https://eips.ethereum.org/EIPS/eip-145
-        if fork < Fork::Constantinople {
-            return Err(VMError::InvalidOpcode);
-        }
         current_call_frame.increase_consumed_gas(gas_cost::SAR)?;
         let shift = current_call_frame.stack.pop()?;
         let value = current_call_frame.stack.pop()?;
diff --git a/crates/vm/levm/src/opcode_handlers/block.rs b/crates/vm/levm/src/opcode_handlers/block.rs
index 668fc40509f..545d27d4a9a 100644
--- a/crates/vm/levm/src/opcode_handlers/block.rs
+++ b/crates/vm/levm/src/opcode_handlers/block.rs
@@ -79,12 +79,8 @@ impl<'a> VM<'a> {
     pub fn op_prevrandao(&mut self) -> Result<OpcodeResult, VMError> {
         // https://eips.ethereum.org/EIPS/eip-4399
         // After Paris the prev randao is the prev_randao (or current_random) field
-        let randao = if self.env.config.fork >= Fork::Paris {
-            let randao = self.env.prev_randao.unwrap_or_default(); // Assuming prev_randao has been integrated
-            U256::from_big_endian(randao.0.as_slice())
-        } else {
-            self.env.difficulty
-        };
+        let randao = U256::from_big_endian(self.env.prev_randao.unwrap_or_default().0.as_slice());
+
         let current_call_frame = self.current_call_frame_mut()?;
         current_call_frame.increase_consumed_gas(gas_cost::PREVRANDAO)?;
         current_call_frame.stack.push(randao)?;
@@ -105,10 +101,6 @@ impl<'a> VM<'a> {
 
     // CHAINID operation
     pub fn op_chainid(&mut self) -> Result<OpcodeResult, VMError> {
-        // https://eips.ethereum.org/EIPS/eip-1344
-        if self.env.config.fork < Fork::Istanbul {
-            return Err(VMError::InvalidOpcode);
-        }
         let chain_id = self.env.chain_id;
         let current_call_frame = self.current_call_frame_mut()?;
         current_call_frame.increase_consumed_gas(gas_cost::CHAINID)?;
@@ -120,11 +112,6 @@ impl<'a> VM<'a> {
 
     // SELFBALANCE operation
     pub fn op_selfbalance(&mut self) -> Result<OpcodeResult, VMError> {
-        // https://eips.ethereum.org/EIPS/eip-1884
-        if self.env.config.fork < Fork::London {
-            return Err(VMError::InvalidOpcode);
-        }
-
         self.current_call_frame_mut()?
             .increase_consumed_gas(gas_cost::SELFBALANCE)?;
 
@@ -141,9 +128,6 @@ impl<'a> VM<'a> {
     // BASEFEE operation
     pub fn op_basefee(&mut self) -> Result<OpcodeResult, VMError> {
         // https://eips.ethereum.org/EIPS/eip-3198
-        if self.env.config.fork < Fork::London {
-            return Err(VMError::InvalidOpcode);
-        }
         let base_fee_per_gas = self.env.base_fee_per_gas;
         let current_call_frame = self.current_call_frame_mut()?;
         current_call_frame.increase_consumed_gas(gas_cost::BASEFEE)?;
diff --git a/crates/vm/levm/src/opcode_handlers/environment.rs b/crates/vm/levm/src/opcode_handlers/environment.rs
index 204caf84db7..6889bb1b44f 100644
--- a/crates/vm/levm/src/opcode_handlers/environment.rs
+++ b/crates/vm/levm/src/opcode_handlers/environment.rs
@@ -5,7 +5,7 @@ use crate::{
     utils::word_to_address,
     vm::VM,
 };
-use ethrex_common::{types::Fork, U256};
+use ethrex_common::U256;
 
 // Environmental Information (16)
 // Opcodes: ADDRESS, BALANCE, ORIGIN, CALLER, CALLVALUE, CALLDATALOAD, CALLDATASIZE, CALLDATACOPY, CODESIZE, CODECOPY, GASPRICE, EXTCODESIZE, EXTCODECOPY, RETURNDATASIZE, RETURNDATACOPY, EXTCODEHASH
@@ -27,7 +27,6 @@ impl<'a> VM<'a> {
 
     // BALANCE operation
     pub fn op_balance(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let address = word_to_address(self.current_call_frame_mut()?.stack.pop()?);
 
         let (account, address_was_cold) = self
@@ -36,7 +35,7 @@ impl<'a> VM<'a> {
 
         let current_call_frame = self.current_call_frame_mut()?;
 
-        current_call_frame.increase_consumed_gas(gas_cost::balance(address_was_cold, fork)?)?;
+        current_call_frame.increase_consumed_gas(gas_cost::balance(address_was_cold)?)?;
 
         current_call_frame.stack.push(account.info.balance)?;
 
@@ -255,7 +254,6 @@ impl<'a> VM<'a> {
 
     // EXTCODESIZE operation
     pub fn op_extcodesize(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let address = word_to_address(self.current_call_frame_mut()?.stack.pop()?);
 
         let (account, address_was_cold) = self
@@ -264,7 +262,7 @@ impl<'a> VM<'a> {
 
         let current_call_frame = self.current_call_frame_mut()?;
 
-        current_call_frame.increase_consumed_gas(gas_cost::extcodesize(address_was_cold, fork)?)?;
+        current_call_frame.increase_consumed_gas(gas_cost::extcodesize(address_was_cold)?)?;
 
         current_call_frame.stack.push(account.code.len().into())?;
 
@@ -273,7 +271,6 @@ impl<'a> VM<'a> {
 
     // EXTCODECOPY operation
     pub fn op_extcodecopy(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let address = word_to_address(self.current_call_frame_mut()?.stack.pop()?);
         let dest_offset = self.current_call_frame_mut()?.stack.pop()?;
         let offset = self.current_call_frame_mut()?.stack.pop()?;
@@ -297,7 +294,6 @@ impl<'a> VM<'a> {
                 new_memory_size,
                 current_memory_size,
                 address_was_cold,
-                fork,
             )?)?;
 
         if size == 0 {
@@ -331,10 +327,6 @@ impl<'a> VM<'a> {
 
     // RETURNDATASIZE operation
     pub fn op_returndatasize(&mut self) -> Result<OpcodeResult, VMError> {
-        // https://eips.ethereum.org/EIPS/eip-211
-        if self.env.config.fork < Fork::Byzantium {
-            return Err(VMError::InvalidOpcode);
-        };
         let current_call_frame = self.current_call_frame_mut()?;
         current_call_frame.increase_consumed_gas(gas_cost::RETURNDATASIZE)?;
 
@@ -347,10 +339,6 @@ impl<'a> VM<'a> {
 
     // RETURNDATACOPY operation
     pub fn op_returndatacopy(&mut self) -> Result<OpcodeResult, VMError> {
-        // https://eips.ethereum.org/EIPS/eip-211
-        if self.env.config.fork < Fork::Byzantium {
-            return Err(VMError::InvalidOpcode);
-        };
         let current_call_frame = self.current_call_frame_mut()?;
         let dest_offset = current_call_frame.stack.pop()?;
         let returndata_offset: usize = current_call_frame
@@ -408,7 +396,6 @@ impl<'a> VM<'a> {
 
     // EXTCODEHASH operation
     pub fn op_extcodehash(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let address = word_to_address(self.current_call_frame_mut()?.stack.pop()?);
 
         let (account, address_was_cold) = self
@@ -417,7 +404,7 @@ impl<'a> VM<'a> {
 
         let current_call_frame = self.current_call_frame_mut()?;
 
-        current_call_frame.increase_consumed_gas(gas_cost::extcodehash(address_was_cold, fork)?)?;
+        current_call_frame.increase_consumed_gas(gas_cost::extcodehash(address_was_cold)?)?;
 
         // An account is considered empty when it has no code and zero nonce and zero balance. [EIP-161]
         if account.is_empty() {
diff --git a/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs b/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs
index f51882a8795..10d67665d5b 100644
--- a/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs
+++ b/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs
@@ -136,7 +136,6 @@ impl<'a> VM<'a> {
 
     // SLOAD operation
     pub fn op_sload(&mut self) -> Result<OpcodeResult, VMError> {
-        let fork = self.env.config.fork;
         let (storage_slot_key, address) = {
             let current_call_frame = self.current_call_frame_mut()?;
             let storage_slot_key = current_call_frame.stack.pop()?;
@@ -150,7 +149,7 @@ impl<'a> VM<'a> {
 
         let current_call_frame = self.current_call_frame_mut()?;
 
-        current_call_frame.increase_consumed_gas(gas_cost::sload(storage_slot_was_cold, fork)?)?;
+        current_call_frame.increase_consumed_gas(gas_cost::sload(storage_slot_was_cold)?)?;
 
         current_call_frame.stack.push(value)?;
         Ok(OpcodeResult::Continue { pc_increment: 1 })
@@ -188,26 +187,11 @@ impl<'a> VM<'a> {
         // Gas Refunds
         // Sync gas refund with global env, ensuring consistency accross contexts.
         let mut gas_refunds = self.env.refunded_gas;
-        let (remove_slot_cost, restore_empty_slot_cost, restore_slot_cost) =
-            match self.env.config.fork {
-                // https://eips.ethereum.org/EIPS/eip-1283#specification
-                Fork::Constantinople => (15000, 19800, 4800),
-                // https://eips.ethereum.org/EIPS/eip-2200
-                f if f >= Fork::Istanbul && f < Fork::Berlin => (15000, 19200, 4200),
-                // https://eips.ethereum.org/EIPS/eip-2929
-                _ => (4800, 19900, 2800),
-            };
-
-        if self.env.config.fork < Fork::Istanbul && self.env.config.fork != Fork::Constantinople {
-            if !current_value.is_zero() && new_storage_slot_value.is_zero() {
-                gas_refunds = gas_refunds
-                    .checked_add(15000)
-                    .ok_or(VMError::GasRefundsOverflow)?;
-            }
-        } else if (self.env.config.fork == Fork::Constantinople
-            || self.env.config.fork >= Fork::Istanbul)
-            && new_storage_slot_value != current_value
-        {
+
+        // https://eips.ethereum.org/EIPS/eip-2929
+        let (remove_slot_cost, restore_empty_slot_cost, restore_slot_cost) = (4800, 19900, 2800);
+
+        if new_storage_slot_value != current_value {
             if current_value == original_value {
                 if original_value != U256::zero() && new_storage_slot_value == U256::zero() {
                     gas_refunds = gas_refunds
@@ -241,7 +225,6 @@ impl<'a> VM<'a> {
         }
 
         self.env.refunded_gas = gas_refunds;
-        let fork = self.env.config.fork;
 
         self.current_call_frame_mut()?
             .increase_consumed_gas(gas_cost::sstore(
@@ -249,7 +232,6 @@ impl<'a> VM<'a> {
                 current_value,
                 new_storage_slot_value,
                 storage_slot_was_cold,
-                fork,
             )?)?;
 
         self.update_account_storage(to, key, new_storage_slot_value)?;
diff --git a/crates/vm/levm/src/opcode_handlers/system.rs b/crates/vm/levm/src/opcode_handlers/system.rs
index 4ca842dc23e..bce2f953a9c 100644
--- a/crates/vm/levm/src/opcode_handlers/system.rs
+++ b/crates/vm/levm/src/opcode_handlers/system.rs
@@ -3,7 +3,7 @@ use crate::{
     constants::{CREATE_DEPLOYMENT_FAIL, INIT_CODE_MAX_SIZE, REVERT_FOR_CALL, SUCCESS_FOR_CALL},
     db::cache,
     errors::{ExecutionReport, InternalError, OpcodeResult, OutOfGasError, TxResult, VMError},
-    gas_cost::{self, max_message_call_gas, SELFDESTRUCT_REFUND},
+    gas_cost::{self, max_message_call_gas},
     memory::{self, calculate_memory_size},
     precompiles::is_precompile,
     utils::{address_to_word, word_to_address, *},
@@ -93,7 +93,6 @@ impl<'a> VM<'a> {
             value_to_transfer,
             gas,
             gas_left,
-            self.env.config.fork,
         )?;
 
         self.current_call_frame_mut()?.increase_consumed_gas(cost)?;
@@ -195,7 +194,6 @@ impl<'a> VM<'a> {
             value_to_transfer,
             gas,
             gas_left,
-            self.env.config.fork,
         )?;
 
         self.current_call_frame_mut()?.increase_consumed_gas(cost)?;
@@ -256,10 +254,6 @@ impl<'a> VM<'a> {
 
     // DELEGATECALL operation
     pub fn op_delegatecall(&mut self) -> Result<OpcodeResult, VMError> {
-        // https://eips.ethereum.org/EIPS/eip-7
-        if self.env.config.fork < Fork::Homestead {
-            return Err(VMError::InvalidOpcode);
-        }
         // STACK
         let (
             gas,
@@ -324,7 +318,6 @@ impl<'a> VM<'a> {
             address_was_cold,
             gas,
             gas_left,
-            self.env.config.fork,
         )?;
 
         self.current_call_frame_mut()?.increase_consumed_gas(cost)?;
@@ -358,10 +351,6 @@ impl<'a> VM<'a> {
 
     // STATICCALL operation
     pub fn op_staticcall(&mut self) -> Result<OpcodeResult, VMError> {
-        // https://eips.ethereum.org/EIPS/eip-214
-        if self.env.config.fork < Fork::Byzantium {
-            return Err(VMError::InvalidOpcode);
-        };
         // STACK
         let (
             gas,
@@ -426,7 +415,6 @@ impl<'a> VM<'a> {
             address_was_cold,
             gas,
             gas_left,
-            self.env.config.fork,
         )?;
 
         self.current_call_frame_mut()?.increase_consumed_gas(cost)?;
@@ -486,10 +474,6 @@ impl<'a> VM<'a> {
 
     // CREATE2 operation
     pub fn op_create2(&mut self) -> Result<OpcodeResult, VMError> {
-        // https://eips.ethereum.org/EIPS/eip-1014
-        if self.env.config.fork < Fork::Constantinople {
-            return Err(VMError::InvalidOpcode);
-        }
         let fork = self.env.config.fork;
         let current_call_frame = self.current_call_frame_mut()?;
         let value_in_wei_to_send = current_call_frame.stack.pop()?;
@@ -524,9 +508,6 @@ impl<'a> VM<'a> {
         // Returns: VMError RevertOpcode if executed correctly.
         // Notes:
         //      The actual reversion of changes is made in the execute() function.
-        if self.env.config.fork < Fork::Byzantium {
-            return Err(VMError::InvalidOpcode);
-        }
         let current_call_frame = self.current_call_frame_mut()?;
 
         let offset = current_call_frame.stack.pop()?;
@@ -578,7 +559,6 @@ impl<'a> VM<'a> {
             let to = current_call_frame.to;
             (target_address, to)
         };
-        let fork = self.env.config.fork;
 
         let (target_account, target_account_is_cold) = self
             .db
@@ -593,7 +573,6 @@ impl<'a> VM<'a> {
                 target_account_is_cold,
                 target_account.is_empty(),
                 balance_to_transfer,
-                fork,
             )?)?;
 
         // [EIP-6780] - SELFDESTRUCT only in same transaction from CANCUN
@@ -612,18 +591,6 @@ impl<'a> VM<'a> {
             self.increase_account_balance(target_address, balance_to_transfer)?;
             self.get_account_mut(to)?.info.balance = U256::zero();
 
-            // [EIP-3529](https://eips.ethereum.org/EIPS/eip-3529)
-            // https://github.com/ethereum/execution-specs/blob/master/src/ethereum/constantinople/vm/instructions/system.py#L471
-            if self.env.config.fork < Fork::London
-                && !self.accrued_substate.selfdestruct_set.contains(&to)
-            {
-                self.env.refunded_gas = self
-                    .env
-                    .refunded_gas
-                    .checked_add(SELFDESTRUCT_REFUND)
-                    .ok_or(VMError::GasRefundsOverflow)?;
-            }
-
             self.accrued_substate.selfdestruct_set.insert(to);
         }
 
@@ -729,11 +696,8 @@ impl<'a> VM<'a> {
             .ok_or(VMError::BalanceOverflow)?;
 
         // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md
-        let new_account = if self.env.config.fork < Fork::SpuriousDragon {
-            Account::new(new_balance, Bytes::new(), 0, Default::default())
-        } else {
-            Account::new(new_balance, Bytes::new(), 1, Default::default())
-        };
+        let new_account = Account::new(new_balance, Bytes::new(), 1, Default::default());
+
         self.insert_account(new_address, new_account)?;
 
         // 2. Increment sender's nonce.
diff --git a/crates/vm/levm/src/precompiles.rs b/crates/vm/levm/src/precompiles.rs
index 9b4cbab8e80..ccc53120ce7 100644
--- a/crates/vm/levm/src/precompiles.rs
+++ b/crates/vm/levm/src/precompiles.rs
@@ -67,9 +67,8 @@ use crate::{
     gas_cost::{
         self, BLAKE2F_ROUND_COST, BLS12_381_G1ADD_COST, BLS12_381_G1_K_DISCOUNT,
         BLS12_381_G2ADD_COST, BLS12_381_G2_K_DISCOUNT, BLS12_381_MAP_FP2_TO_G2_COST,
-        BLS12_381_MAP_FP_TO_G1_COST, ECADD_COST, ECADD_COST_PRE_ISTANBUL, ECMUL_COST,
-        ECMUL_COST_PRE_ISTANBUL, ECRECOVER_COST, G1_MUL_COST, G2_MUL_COST, MODEXP_STATIC_COST,
-        POINT_EVALUATION_COST,
+        BLS12_381_MAP_FP_TO_G1_COST, ECADD_COST, ECMUL_COST, ECRECOVER_COST, G1_MUL_COST,
+        G2_MUL_COST, MODEXP_STATIC_COST, POINT_EVALUATION_COST,
     },
 };
 
@@ -211,16 +210,6 @@ pub const G1_POINT_AT_INFINITY: [u8; 128] = [0_u8; 128];
 pub const G2_POINT_AT_INFINITY: [u8; 256] = [0_u8; 256];
 
 pub fn is_precompile(callee_address: &Address, fork: Fork) -> bool {
-    // precompiles introduced in Byzantium https://eips.ethereum.org/EIPS/eip-609
-    if (*callee_address == MODEXP_ADDRESS
-        || *callee_address == ECADD_ADDRESS
-        || *callee_address == ECMUL_ADDRESS
-        || *callee_address == ECPAIRING_ADDRESS)
-        && fork < Fork::Byzantium
-    {
-        return false;
-    }
-
     // Cancun specs is the only one that allows point evaluation precompile
     if *callee_address == POINT_EVALUATION_ADDRESS && fork < Fork::Cancun {
         return false;
@@ -239,10 +228,7 @@ pub fn is_precompile(callee_address: &Address, fork: Fork) -> bool {
     PRECOMPILES.contains(callee_address) || PRECOMPILES_POST_CANCUN.contains(callee_address)
 }
 
-pub fn execute_precompile(
-    current_call_frame: &mut CallFrame,
-    fork: Fork,
-) -> Result<Bytes, VMError> {
+pub fn execute_precompile(current_call_frame: &mut CallFrame) -> Result<Bytes, VMError> {
     let callee_address = current_call_frame.code_address;
     let gas_for_call = current_call_frame
         .gas_limit
@@ -263,30 +249,18 @@ pub fn execute_precompile(
         address if address == RIPEMD_160_ADDRESS => {
             ripemd_160(&current_call_frame.calldata, gas_for_call, consumed_gas)?
         }
-        address if address == MODEXP_ADDRESS => modexp(
-            &current_call_frame.calldata,
-            gas_for_call,
-            consumed_gas,
-            fork,
-        )?,
-        address if address == ECADD_ADDRESS => ecadd(
-            &current_call_frame.calldata,
-            gas_for_call,
-            consumed_gas,
-            fork,
-        )?,
-        address if address == ECMUL_ADDRESS => ecmul(
-            &current_call_frame.calldata,
-            gas_for_call,
-            consumed_gas,
-            fork,
-        )?,
-        address if address == ECPAIRING_ADDRESS => ecpairing(
-            &current_call_frame.calldata,
-            gas_for_call,
-            consumed_gas,
-            fork,
-        )?,
+        address if address == MODEXP_ADDRESS => {
+            modexp(&current_call_frame.calldata, gas_for_call, consumed_gas)?
+        }
+        address if address == ECADD_ADDRESS => {
+            ecadd(&current_call_frame.calldata, gas_for_call, consumed_gas)?
+        }
+        address if address == ECMUL_ADDRESS => {
+            ecmul(&current_call_frame.calldata, gas_for_call, consumed_gas)?
+        }
+        address if address == ECPAIRING_ADDRESS => {
+            ecpairing(&current_call_frame.calldata, gas_for_call, consumed_gas)?
+        }
         address if address == BLAKE2F_ADDRESS => {
             blake2f(&current_call_frame.calldata, gas_for_call, consumed_gas)?
         }
@@ -459,7 +433,6 @@ pub fn modexp(
     calldata: &Bytes,
     gas_for_call: u64,
     consumed_gas: &mut u64,
-    fork: Fork,
 ) -> Result<Bytes, VMError> {
     // If calldata does not reach the required length, we should fill the rest with zeros
     let calldata = fill_with_zeros(calldata, 96);
@@ -484,10 +457,8 @@ pub fn modexp(
 
     if base_size == U256::zero() && modulus_size == U256::zero() {
         // On Berlin or newer there is a floor cost for the modexp precompile
-        // On older versions in this return there is no cost added, see more https://eips.ethereum.org/EIPS/eip-2565
-        if fork >= Fork::Berlin {
-            increase_precompile_consumed_gas(gas_for_call, MODEXP_STATIC_COST, consumed_gas)?;
-        }
+        increase_precompile_consumed_gas(gas_for_call, MODEXP_STATIC_COST, consumed_gas)?;
+
         return Ok(Bytes::new());
     }
 
@@ -524,7 +495,7 @@ pub fn modexp(
     // Use of unwrap_or_default because if e == 0 get_slice_or_default returns an empty vec
     let exp_first_32 = BigUint::from_bytes_be(e.get(0..bytes_to_take).unwrap_or_default());
 
-    let gas_cost = gas_cost::modexp(&exp_first_32, base_size, exponent_size, modulus_size, fork)?;
+    let gas_cost = gas_cost::modexp(&exp_first_32, base_size, exponent_size, modulus_size)?;
 
     increase_precompile_consumed_gas(gas_for_call, gas_cost, consumed_gas)?;
 
@@ -593,17 +564,11 @@ pub fn ecadd(
     calldata: &Bytes,
     gas_for_call: u64,
     consumed_gas: &mut u64,
-    fork: Fork,
 ) -> Result<Bytes, VMError> {
     // If calldata does not reach the required length, we should fill the rest with zeros
     let calldata = fill_with_zeros(calldata, 128);
-    // https://eips.ethereum.org/EIPS/eip-1108
-    let gas_cost = if fork < Fork::Istanbul {
-        ECADD_COST_PRE_ISTANBUL
-    } else {
-        ECADD_COST
-    };
-    increase_precompile_consumed_gas(gas_for_call, gas_cost, consumed_gas)?;
+
+    increase_precompile_consumed_gas(gas_for_call, ECADD_COST, consumed_gas)?;
     let first_point_x = calldata
         .get(0..32)
         .ok_or(PrecompileError::ParsingInputError)?;
@@ -679,18 +644,11 @@ pub fn ecmul(
     calldata: &Bytes,
     gas_for_call: u64,
     consumed_gas: &mut u64,
-    fork: Fork,
 ) -> Result<Bytes, VMError> {
     // If calldata does not reach the required length, we should fill the rest with zeros
     let calldata = fill_with_zeros(calldata, 96);
-    // https://eips.ethereum.org/EIPS/eip-1108
-    let gas_cost = if fork < Fork::Istanbul {
-        ECMUL_COST_PRE_ISTANBUL
-    } else {
-        ECMUL_COST
-    };
 
-    increase_precompile_consumed_gas(gas_for_call, gas_cost, consumed_gas)?;
+    increase_precompile_consumed_gas(gas_for_call, ECMUL_COST, consumed_gas)?;
 
     let point_x = calldata
         .get(0..32)
@@ -894,7 +852,6 @@ pub fn ecpairing(
     calldata: &Bytes,
     gas_for_call: u64,
     consumed_gas: &mut u64,
-    fork: Fork,
 ) -> Result<Bytes, VMError> {
     // The input must always be a multiple of 192 (6 32-byte values)
     if calldata.len() % 192 != 0 {
@@ -904,7 +861,7 @@ pub fn ecpairing(
     let inputs_amount = calldata.len() / 192;
 
     // Consume gas
-    let gas_cost = gas_cost::ecpairing(inputs_amount, fork)?;
+    let gas_cost = gas_cost::ecpairing(inputs_amount)?;
     increase_precompile_consumed_gas(gas_for_call, gas_cost, consumed_gas)?;
 
     let mut mul: FieldElement<Degree12ExtensionField> = QuadraticExtensionFieldElement::one();
diff --git a/crates/vm/levm/src/utils.rs b/crates/vm/levm/src/utils.rs
index 10757974da5..40250a1513f 100644
--- a/crates/vm/levm/src/utils.rs
+++ b/crates/vm/levm/src/utils.rs
@@ -483,9 +483,8 @@ impl<'a> VM<'a> {
 
         // Calldata Cost
         // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction.
-        let calldata_cost =
-            gas_cost::tx_calldata(&self.current_call_frame()?.calldata, self.env.config.fork)
-                .map_err(VMError::OutOfGas)?;
+        let calldata_cost = gas_cost::tx_calldata(&self.current_call_frame()?.calldata)
+            .map_err(VMError::OutOfGas)?;
 
         intrinsic_gas = intrinsic_gas
             .checked_add(calldata_cost)
@@ -499,11 +498,9 @@ impl<'a> VM<'a> {
         // Create Cost
         if self.is_create() {
             // https://eips.ethereum.org/EIPS/eip-2#specification
-            if self.env.config.fork >= Fork::Homestead {
-                intrinsic_gas = intrinsic_gas
-                    .checked_add(CREATE_BASE_COST)
-                    .ok_or(OutOfGasError::ConsumedGasOverflow)?;
-            }
+            intrinsic_gas = intrinsic_gas
+                .checked_add(CREATE_BASE_COST)
+                .ok_or(OutOfGasError::ConsumedGasOverflow)?;
 
             // https://eips.ethereum.org/EIPS/eip-3860
             if self.env.config.fork >= Fork::Shanghai {
@@ -575,7 +572,7 @@ impl<'a> VM<'a> {
         // tx_calldata = nonzero_bytes_in_calldata * 16 + zero_bytes_in_calldata * 4
         // this is actually tokens_in_calldata * STANDARD_TOKEN_COST
         // see it in https://eips.ethereum.org/EIPS/eip-7623
-        let tokens_in_calldata: u64 = gas_cost::tx_calldata(calldata, self.env.config.fork)
+        let tokens_in_calldata: u64 = gas_cost::tx_calldata(calldata)
             .map_err(VMError::OutOfGas)?
             .checked_div(STANDARD_TOKEN_COST)
             .ok_or(VMError::Internal(InternalError::DivisionError))?;
diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs
index c62eaa2f9d3..93cfa186a8d 100644
--- a/crates/vm/levm/src/vm.rs
+++ b/crates/vm/levm/src/vm.rs
@@ -319,7 +319,7 @@ impl<'a> VM<'a> {
                 .call_frames
                 .pop()
                 .ok_or(VMError::Internal(InternalError::CouldNotPopCallframe))?;
-            let precompile_result = execute_precompile(&mut current_call_frame, fork);
+            let precompile_result = execute_precompile(&mut current_call_frame);
             let backup = self
                 .backups
                 .pop()
@@ -423,9 +423,7 @@ impl<'a> VM<'a> {
             )?;
 
             // https://eips.ethereum.org/EIPS/eip-161
-            if self.env.config.fork >= Fork::SpuriousDragon {
-                self.increment_account_nonce(new_contract_address)?;
-            };
+            self.increment_account_nonce(new_contract_address)?;
         }
 
         // Backup of Substate, Gas Refunds and Transient Storage if sub-context is reverted


Reviews:
user: login: JereSalo
body: Amazing job. We can merge after making the requested changes :)
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-07T21:59:38Z
user: login: SDartayet
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T14:29:29Z
user: login: JereSalo
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T18:12:30Z
user: login: JereSalo
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T18:12:37Z
user: login: SDartayet
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T18:14:19Z
user: login: SDartayet
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T18:20:57Z
user: login: SDartayet
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T18:21:56Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:08:27Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:10:51Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:14:26Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:17:09Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:17:31Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:18:18Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:18:45Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:19:28Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:19:45Z
user: login: fmoletta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:24:06Z
user: login: fmoletta
body: Left some suggestions, but looks good!
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T19:32:04Z

Review comments:
diff_hunk: @@ -33,6 +32,30 @@ impl Hook for DefaultHook {
         let sender_account = vm.db.get_account(sender_address)?;
 
         if vm.env.config.fork >= Fork::Prague {
+            // check for gas limit is grater or equal than the minimum required
+            let calldata = vm.current_call_frame()?.calldata.clone();
+            let intrinsic_gas: u64 = vm.get_intrinsic_gas()?;
+
+            // calldata_cost = tokens_in_calldata * 4
+            let calldata_cost: u64 = gas_cost::tx_calldata(&calldata).map_err(VMError::OutOfGas)?;
+
+            // same as calculated in gas_used()
+            let tokens_in_calldata: u64 = calldata_cost
+                .checked_div(STANDARD_TOKEN_COST)
+                .ok_or(VMError::Internal(InternalError::DivisionError))?;
+
+            // floor_cost_by_tokens = TX_BASE_COST + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata
+            let floor_cost_by_tokens = tokens_in_calldata
+                .checked_mul(TOTAL_COST_FLOOR_PER_TOKEN)
+                .ok_or(VMError::Internal(InternalError::GasOverflow))?
+                .checked_add(TX_BASE_COST)
+                .ok_or(VMError::Internal(InternalError::GasOverflow))?;
+
+            let min_gas_limit = max(intrinsic_gas, floor_cost_by_tokens);
+            if vm.current_call_frame()?.gas_limit < min_gas_limit {
+                return Err(VMError::TxValidation(TxValidationError::IntrinsicGasTooLow));
path: crates/vm/levm/src/hooks/default_hook.rs
user: login: JereSalo
body: Isn't all this the same as what's in `validate_min_gas_limit`?
created_at: 2025-05-07T21:52:58Z
author_association: CONTRIBUTOR
diff_hunk: @@ -33,6 +32,30 @@ impl Hook for DefaultHook {
         let sender_account = vm.db.get_account(sender_address)?;
 
         if vm.env.config.fork >= Fork::Prague {
+            // check for gas limit is grater or equal than the minimum required
+            let calldata = vm.current_call_frame()?.calldata.clone();
+            let intrinsic_gas: u64 = vm.get_intrinsic_gas()?;
+
+            // calldata_cost = tokens_in_calldata * 4
+            let calldata_cost: u64 = gas_cost::tx_calldata(&calldata).map_err(VMError::OutOfGas)?;
+
+            // same as calculated in gas_used()
+            let tokens_in_calldata: u64 = calldata_cost
+                .checked_div(STANDARD_TOKEN_COST)
+                .ok_or(VMError::Internal(InternalError::DivisionError))?;
+
+            // floor_cost_by_tokens = TX_BASE_COST + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata
+            let floor_cost_by_tokens = tokens_in_calldata
+                .checked_mul(TOTAL_COST_FLOOR_PER_TOKEN)
+                .ok_or(VMError::Internal(InternalError::GasOverflow))?
+                .checked_add(TX_BASE_COST)
+                .ok_or(VMError::Internal(InternalError::GasOverflow))?;
+
+            let min_gas_limit = max(intrinsic_gas, floor_cost_by_tokens);
+            if vm.current_call_frame()?.gas_limit < min_gas_limit {
+                return Err(VMError::TxValidation(TxValidationError::IntrinsicGasTooLow));
path: crates/vm/levm/src/hooks/default_hook.rs
user: login: JereSalo
body: If so, we can remove it
created_at: 2025-05-07T21:53:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -131,11 +131,13 @@ impl Hook for L2Hook {
             vm.increase_account_balance(vm.env.origin, vm.current_call_frame()?.msg_value)?;
         }
 
+        // 2. Return unused gas + gas refunds to the sender.
path: crates/vm/levm/src/hooks/l2_hook.rs
user: login: JereSalo
body: Why add a comment in this PR?
created_at: 2025-05-07T21:55:13Z
author_association: CONTRIBUTOR
diff_hunk: @@ -131,11 +131,13 @@ impl Hook for L2Hook {
             vm.increase_account_balance(vm.env.origin, vm.current_call_frame()?.msg_value)?;
         }
 
+        // 2. Return unused gas + gas refunds to the sender.
path: crates/vm/levm/src/hooks/l2_hook.rs
user: login: SDartayet
body: Idk why the diff marked it as a comment added, but pretty sure that one was already there! Just moved it when I moved some other stuff while removing references to the older forks
created_at: 2025-05-08T14:29:29Z
author_association: CONTRIBUTOR
path: crates/vm/levm/README.md
user: login: JereSalo
body: You can update this with new values if you want. I think we are running a lot more tests
created_at: 2025-05-08T18:12:30Z
author_association: CONTRIBUTOR
path: crates/vm/levm/README.md
user: login: SDartayet
body: Sure!
created_at: 2025-05-08T18:14:18Z
author_association: CONTRIBUTOR
diff_hunk: @@ -33,6 +32,30 @@ impl Hook for DefaultHook {
         let sender_account = vm.db.get_account(sender_address)?;
 
         if vm.env.config.fork >= Fork::Prague {
+            // check for gas limit is grater or equal than the minimum required
+            let calldata = vm.current_call_frame()?.calldata.clone();
+            let intrinsic_gas: u64 = vm.get_intrinsic_gas()?;
+
+            // calldata_cost = tokens_in_calldata * 4
+            let calldata_cost: u64 = gas_cost::tx_calldata(&calldata).map_err(VMError::OutOfGas)?;
+
+            // same as calculated in gas_used()
+            let tokens_in_calldata: u64 = calldata_cost
+                .checked_div(STANDARD_TOKEN_COST)
+                .ok_or(VMError::Internal(InternalError::DivisionError))?;
+
+            // floor_cost_by_tokens = TX_BASE_COST + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata
+            let floor_cost_by_tokens = tokens_in_calldata
+                .checked_mul(TOTAL_COST_FLOOR_PER_TOKEN)
+                .ok_or(VMError::Internal(InternalError::GasOverflow))?
+                .checked_add(TX_BASE_COST)
+                .ok_or(VMError::Internal(InternalError::GasOverflow))?;
+
+            let min_gas_limit = max(intrinsic_gas, floor_cost_by_tokens);
+            if vm.current_call_frame()?.gas_limit < min_gas_limit {
+                return Err(VMError::TxValidation(TxValidationError::IntrinsicGasTooLow));
path: crates/vm/levm/src/hooks/default_hook.rs
user: login: SDartayet
body: Idk how I missed that, but you're right. Just fixed it
https://github.com/lambdaclass/ethrex/pull/2670/commits/9bd640c2de3c886044a5f52c5822501d3a361d66
created_at: 2025-05-08T18:20:57Z
author_association: CONTRIBUTOR
path: crates/vm/levm/README.md
user: login: SDartayet
body: I already created an issue to update the readme, so I'll do the update there!
created_at: 2025-05-08T18:21:55Z
author_association: CONTRIBUTOR
diff_hunk: @@ -180,19 +178,18 @@ impl<'a> VM<'a> {
             // If the first byte of code is 0xef
             // If the code_length > MAX_CODE_SIZE
             // If current_consumed_gas + code_deposit_cost > gas_limit
-            let validate_create =
-                if code_length > MAX_CODE_SIZE && self.env.config.fork >= Fork::SpuriousDragon {
-                    Err(VMError::ContractOutputTooBig)
-                } else if contract_code.first().unwrap_or(&0) == &INVALID_CONTRACT_PREFIX {
-                    Err(VMError::InvalidContractPrefix)
-                } else if current_call_frame
-                    .increase_consumed_gas(code_deposit_cost)
-                    .is_err()
-                {
-                    Err(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded))
-                } else {
-                    Ok(current_call_frame.to)
-                };
+            let validate_create = if code_length > MAX_CODE_SIZE {
+                Err(VMError::ContractOutputTooBig)
+            } else if contract_code.first().unwrap_or(&0) == &INVALID_CONTRACT_PREFIX {
path: crates/vm/levm/src/execution_handlers.rs
user: login: fmoletta
body: This is out of scope for the purpose of this PR, but we could probably use `is_some_and` here instead
created_at: 2025-05-08T19:08:27Z
author_association: CONTRIBUTOR
diff_hunk: @@ -180,19 +178,18 @@ impl<'a> VM<'a> {
             // If the first byte of code is 0xef
             // If the code_length > MAX_CODE_SIZE
             // If current_consumed_gas + code_deposit_cost > gas_limit
-            let validate_create =
-                if code_length > MAX_CODE_SIZE && self.env.config.fork >= Fork::SpuriousDragon {
-                    Err(VMError::ContractOutputTooBig)
-                } else if contract_code.first().unwrap_or(&0) == &INVALID_CONTRACT_PREFIX {
-                    Err(VMError::InvalidContractPrefix)
-                } else if current_call_frame
-                    .increase_consumed_gas(code_deposit_cost)
-                    .is_err()
-                {
-                    Err(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded))
-                } else {
-                    Ok(current_call_frame.to)
-                };
+            let validate_create = if code_length > MAX_CODE_SIZE {
+                Err(VMError::ContractOutputTooBig)
+            } else if contract_code.first().unwrap_or(&0) == &INVALID_CONTRACT_PREFIX {
+                Err(VMError::InvalidContractPrefix)
+            } else if current_call_frame
+                .increase_consumed_gas(code_deposit_cost)
+                .is_err()
path: crates/vm/levm/src/execution_handlers.rs
user: login: fmoletta
body: Also out of scope, but I think we can propagate the error here
created_at: 2025-05-08T19:10:50Z
author_association: CONTRIBUTOR
diff_hunk: @@ -743,17 +623,12 @@ pub fn balance(address_was_cold: bool, fork: Fork) -> Result<u64, VMError> {
     )
 }
 
-pub fn extcodesize(address_was_cold: bool, fork: Fork) -> Result<u64, VMError> {
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (EXTCODESIZE_PRE_TANGERINE, 0, 0),
-        // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2929.md#storage-read-changes
-        f if f >= Fork::Tangerine && fork < Fork::Berlin => (EXTCODESIZE_TANGERINE, 0, 0),
-        _ => (
-            EXTCODESIZE_STATIC,
-            EXTCODESIZE_COLD_DYNAMIC,
-            EXTCODESIZE_WARM_DYNAMIC,
-        ),
-    };
+pub fn extcodesize(address_was_cold: bool) -> Result<u64, VMError> {
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        EXTCODESIZE_STATIC,
+        EXTCODESIZE_COLD_DYNAMIC,
+        EXTCODESIZE_WARM_DYNAMIC,
+    );
path: crates/vm/levm/src/gas_cost.rs
user: login: fmoletta
body: Could we use the constants directly instead of creating these variables?
created_at: 2025-05-08T19:14:26Z
author_association: CONTRIBUTOR
diff_hunk: @@ -768,31 +643,20 @@ pub fn extcodecopy(
     new_memory_size: usize,
     current_memory_size: usize,
     address_was_cold: bool,
-    fork: Fork,
 ) -> Result<u64, VMError> {
-    let base_cost = match fork {
-        f if f < Fork::Tangerine => EXTCODECOPY_STATIC_PRE_TANGERINE,
-        f if f >= Fork::Tangerine && fork < Fork::Berlin => EXTCODECOPY_STATIC_PRE_BERLIN,
-        _ => EXTCODECOPY_STATIC,
-    };
-
     let base_access_cost = copy_behavior(
         new_memory_size,
         current_memory_size,
         size,
         EXTCODECOPY_DYNAMIC_BASE,
-        base_cost,
+        EXTCODECOPY_STATIC,
     )?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (0, 0, 0),
-        f if f >= Fork::Tangerine && fork < Fork::Berlin => (0, 0, 0),
-        _ => (
-            EXTCODECOPY_STATIC,
-            EXTCODECOPY_COLD_DYNAMIC,
-            EXTCODECOPY_WARM_DYNAMIC,
-        ),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        EXTCODECOPY_STATIC,
+        EXTCODECOPY_COLD_DYNAMIC,
+        EXTCODECOPY_WARM_DYNAMIC,
+    );
path: crates/vm/levm/src/gas_cost.rs
user: login: fmoletta
body: Same here
created_at: 2025-05-08T19:17:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -806,17 +670,12 @@ pub fn extcodecopy(
         .ok_or(OutOfGasError::GasCostOverflow)?)
 }
 
-pub fn extcodehash(address_was_cold: bool, fork: Fork) -> Result<u64, VMError> {
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Constantinople => return Err(VMError::InvalidOpcode),
-        f if f < Fork::Istanbul => (EXTCODEHASH_STATIC_PRE_ISTANBUL, 0, 0),
-        f if f < Fork::Berlin => (EXTCODEHASH_STATIC_PRE_BERLIN, 0, 0),
-        _ => (
-            EXTCODEHASH_STATIC,
-            EXTCODEHASH_COLD_DYNAMIC,
-            EXTCODEHASH_WARM_DYNAMIC,
-        ),
-    };
+pub fn extcodehash(address_was_cold: bool) -> Result<u64, VMError> {
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        EXTCODEHASH_STATIC,
+        EXTCODEHASH_COLD_DYNAMIC,
+        EXTCODEHASH_WARM_DYNAMIC,
+    );
path: crates/vm/levm/src/gas_cost.rs
user: login: fmoletta
body: Same here
created_at: 2025-05-08T19:17:31Z
author_association: CONTRIBUTOR
diff_hunk: @@ -835,16 +694,11 @@ pub fn call(
     value_to_transfer: U256,
     gas_from_stack: U256,
     gas_left: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let memory_expansion_cost = memory::expansion_cost(new_memory_size, current_memory_size)?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (CALL_STATIC_PRE_TANGERINE, 0, 0),
-        f if f < Fork::Berlin => (CALL_STATIC_PRE_BERLIN, 0, 0),
-        f if f < Fork::Berlin => (0, 0, 0),
-        _ => (CALL_STATIC, CALL_COLD_DYNAMIC, CALL_WARM_DYNAMIC),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) =
+        (CALL_STATIC, CALL_COLD_DYNAMIC, CALL_WARM_DYNAMIC);
path: crates/vm/levm/src/gas_cost.rs
user: login: fmoletta
body: Same here
created_at: 2025-05-08T19:18:18Z
author_association: CONTRIBUTOR
diff_hunk: @@ -889,20 +742,14 @@ pub fn callcode(
     value_to_transfer: U256,
     gas_from_stack: U256,
     gas_left: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let memory_expansion_cost = memory::expansion_cost(new_memory_size, current_memory_size)?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (CALLCODE_STATIC_PRE_TANGERINE, 0, 0),
-        f if f < Fork::Berlin => (CALLCODE_STATIC_PRE_BERLIN, 0, 0),
-        f if f < Fork::Berlin => (0, 0, 0),
-        _ => (
-            DELEGATECALL_STATIC,
-            DELEGATECALL_COLD_DYNAMIC,
-            DELEGATECALL_WARM_DYNAMIC,
-        ),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        DELEGATECALL_STATIC,
+        DELEGATECALL_COLD_DYNAMIC,
+        DELEGATECALL_WARM_DYNAMIC,
+    );
path: crates/vm/levm/src/gas_cost.rs
user: login: fmoletta
body: Same here
created_at: 2025-05-08T19:18:45Z
author_association: CONTRIBUTOR
diff_hunk: @@ -938,20 +784,14 @@ pub fn delegatecall(
     address_was_cold: bool,
     gas_from_stack: U256,
     gas_left: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let memory_expansion_cost = memory::expansion_cost(new_memory_size, current_memory_size)?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (DELEGATECALL_STATIC_PRE_TANGERINE, 0, 0),
-        f if f < Fork::Berlin => (DELEGATECALL_STATIC_PRE_BERLIN, 0, 0),
-        f if f < Fork::Berlin => (0, 0, 0),
-        _ => (
-            DELEGATECALL_STATIC,
-            DELEGATECALL_COLD_DYNAMIC,
-            DELEGATECALL_WARM_DYNAMIC,
-        ),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        DELEGATECALL_STATIC,
+        DELEGATECALL_COLD_DYNAMIC,
+        DELEGATECALL_WARM_DYNAMIC,
+    );
path: crates/vm/levm/src/gas_cost.rs
user: login: fmoletta
body: Same here
created_at: 2025-05-08T19:19:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -973,20 +813,14 @@ pub fn staticcall(
     address_was_cold: bool,
     gas_from_stack: U256,
     gas_left: u64,
-    fork: Fork,
 ) -> Result<(u64, u64), VMError> {
     let memory_expansion_cost = memory::expansion_cost(new_memory_size, current_memory_size)?;
 
-    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = match fork {
-        f if f < Fork::Tangerine => (STATICCALLCALL_STATIC_PRE_TANGERINE, 0, 0),
-        f if f < Fork::Berlin => (STATICCALLCALL_STATIC_PRE_BERLIN, 0, 0),
-        f if f < Fork::Berlin => (0, 0, 0),
-        _ => (
-            STATICCALL_STATIC,
-            STATICCALL_COLD_DYNAMIC,
-            STATICCALL_WARM_DYNAMIC,
-        ),
-    };
+    let (static_cost, cold_dynamic_cost, warm_dynamic_cost) = (
+        STATICCALL_STATIC,
+        STATICCALL_COLD_DYNAMIC,
+        STATICCALL_WARM_DYNAMIC,
+    );
path: crates/vm/levm/src/gas_cost.rs
user: login: fmoletta
body: Same here
created_at: 2025-05-08T19:19:45Z
author_association: CONTRIBUTOR
diff_hunk: @@ -188,26 +187,11 @@ impl<'a> VM<'a> {
         // Gas Refunds
         // Sync gas refund with global env, ensuring consistency accross contexts.
         let mut gas_refunds = self.env.refunded_gas;
-        let (remove_slot_cost, restore_empty_slot_cost, restore_slot_cost) =
-            match self.env.config.fork {
-                // https://eips.ethereum.org/EIPS/eip-1283#specification
-                Fork::Constantinople => (15000, 19800, 4800),
-                // https://eips.ethereum.org/EIPS/eip-2200
-                f if f >= Fork::Istanbul && f < Fork::Berlin => (15000, 19200, 4200),
-                // https://eips.ethereum.org/EIPS/eip-2929
-                _ => (4800, 19900, 2800),
-            };
-
-        if self.env.config.fork < Fork::Istanbul && self.env.config.fork != Fork::Constantinople {
-            if !current_value.is_zero() && new_storage_slot_value.is_zero() {
-                gas_refunds = gas_refunds
-                    .checked_add(15000)
-                    .ok_or(VMError::GasRefundsOverflow)?;
-            }
-        } else if (self.env.config.fork == Fork::Constantinople
-            || self.env.config.fork >= Fork::Istanbul)
-            && new_storage_slot_value != current_value
-        {
+
+        // https://eips.ethereum.org/EIPS/eip-2929
+        let (remove_slot_cost, restore_empty_slot_cost, restore_slot_cost) = (4800, 19900, 2800);
path: crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs
user: login: fmoletta
body: Could we create constants for these values?
created_at: 2025-05-08T19:24:06Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-05-05T21:37:55Z
body: <h2>Lines of code report</h2>

Total lines added: `0`
Total lines removed: `421`
Total lines changed: `421`

<details>
<summary>Detailed view</summary>

```
+------------------------------------------------------------------------+-------+------+
| File                                                                   | Lines | Diff |
+------------------------------------------------------------------------+-------+------+
| ethrex/cmd/ef_tests/state/report.rs                                    | 786   | -36  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/blockchain.rs                                 | 493   | -1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/payload.rs                                    | 550   | -2   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/backends/exec.rs                           | 80    | -1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/block_producer/payload_builder.rs           | 225   | -2   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_committer.rs                             | 505   | -4   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/prover/save_state.rs                            | 424   | -1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs                                  | 639   | -4   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/db/gen_db.rs                                 | 178   | -4   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/execution_handlers.rs                        | 231   | -2   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/gas_cost.rs                                  | 902   | -226 |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/hooks/default_hook.rs                        | 332   | -7   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/arithmetic.rs                | 217   | -1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs        | 289   | -12  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/block.rs                     | 126   | -14  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/environment.rs               | 304   | -11  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs | 270   | -17  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/system.rs                    | 800   | -31  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/precompiles.rs                               | 1367  | -40  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/utils.rs                                     | 411   | -3   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/vm.rs                                        | 384   | -2   |
+------------------------------------------------------------------------+-------+------+

```
</details>

author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-05T22:09:02Z
body: # Benchmark Results Comparison
## PR Results
#### Benchmark Results: Factorial
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_Factorial` | 240.6 ± 2.1 | 238.4 | 245.3 | 1.00 |
| `levm_Factorial` | 874.0 ± 3.4 | 871.4 | 880.3 | 3.63 ± 0.03 |
#### Benchmark Results: Factorial - Recursive
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `revm_FactorialRecursive` | 1.516 ± 0.073 | 1.407 | 1.614 | 1.00 |
| `levm_FactorialRecursive` | 13.199 ± 0.205 | 12.974 | 13.453 | 8.71 ± 0.44 |
#### Benchmark Results: Fibonacci
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_Fibonacci` | 210.8 ± 1.1 | 209.8 | 213.5 | 1.00 |
| `levm_Fibonacci` | 872.0 ± 5.4 | 868.6 | 886.6 | 4.14 ± 0.03 |
#### Benchmark Results: ManyHashes
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_ManyHashes` | 8.9 ± 0.1 | 8.7 | 9.1 | 1.00 |
| `levm_ManyHashes` | 18.2 ± 0.6 | 17.7 | 19.6 | 2.05 ± 0.07 |
#### Benchmark Results: BubbleSort
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `revm_BubbleSort` | 3.302 ± 0.015 | 3.284 | 3.328 | 1.00 |
| `levm_BubbleSort` | 5.786 ± 0.041 | 5.728 | 5.860 | 1.75 ± 0.01 |
#### Benchmark Results: ERC20 - Transfer
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_ERC20Transfer` | 254.0 ± 1.9 | 251.7 | 257.9 | 1.00 |
| `levm_ERC20Transfer` | 510.2 ± 5.3 | 502.0 | 519.4 | 2.01 ± 0.03 |
#### Benchmark Results: ERC20 - Mint
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_ERC20Mint` | 146.4 ± 1.3 | 143.8 | 148.2 | 1.00 |
| `levm_ERC20Mint` | 317.0 ± 1.9 | 313.9 | 319.9 | 2.17 ± 0.02 |
#### Benchmark Results: ERC20 - Approval
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `revm_ERC20Approval` | 1.049 ± 0.011 | 1.042 | 1.072 | 1.00 |
| `levm_ERC20Approval` | 1.924 ± 0.010 | 1.911 | 1.937 | 1.83 ± 0.02 |
## Main Results
#### Benchmark Results: Factorial
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_Factorial` | 257.0 ± 1.5 | 254.1 | 259.9 | 1.00 |
| `levm_Factorial` | 872.3 ± 5.2 | 867.7 | 884.0 | 3.39 ± 0.03 |
#### Benchmark Results: Factorial - Recursive
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `revm_FactorialRecursive` | 1.567 ± 0.076 | 1.448 | 1.685 | 1.00 |
| `levm_FactorialRecursive` | 13.310 ± 0.174 | 13.082 | 13.485 | 8.49 ± 0.43 |
#### Benchmark Results: Fibonacci
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_Fibonacci` | 237.9 ± 0.3 | 237.6 | 238.6 | 1.00 |
| `levm_Fibonacci` | 870.6 ± 6.3 | 866.0 | 885.1 | 3.66 ± 0.03 |
#### Benchmark Results: ManyHashes
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_ManyHashes` | 9.0 ± 0.1 | 8.8 | 9.1 | 1.00 |
| `levm_ManyHashes` | 17.8 ± 0.6 | 17.5 | 19.5 | 1.99 ± 0.07 |
#### Benchmark Results: BubbleSort
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `revm_BubbleSort` | 3.339 ± 0.029 | 3.314 | 3.404 | 1.00 |
| `levm_BubbleSort` | 5.781 ± 0.138 | 5.694 | 6.166 | 1.73 ± 0.04 |
#### Benchmark Results: ERC20 - Transfer
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_ERC20Transfer` | 252.4 ± 2.8 | 249.6 | 257.3 | 1.00 |
| `levm_ERC20Transfer` | 510.8 ± 10.5 | 502.4 | 539.2 | 2.02 ± 0.05 |
#### Benchmark Results: ERC20 - Mint
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `revm_ERC20Mint` | 143.9 ± 2.3 | 142.2 | 150.1 | 1.00 |
| `levm_ERC20Mint` | 325.0 ± 4.1 | 320.4 | 332.2 | 2.26 ± 0.05 |
#### Benchmark Results: ERC20 - Approval
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `revm_ERC20Approval` | 1.042 ± 0.002 | 1.038 | 1.046 | 1.00 |
| `levm_ERC20Approval` | 1.935 ± 0.021 | 1.906 | 1.969 | 1.86 ± 0.02 |

author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-05T22:14:22Z
body: # EF Tests Comparison
|Test Name | MAIN     | PR | DIFF | 
|----------|----------|----|------|
|Summary:|18909/18909 (100.00%) |18909/18909 (100.00%)| ➖️  |
|Prague:|5201/5201 (100.00%) |5201/5201 (100.00%)| ➖️  |
|Cancun:|7608/7608 (100.00%) |7608/7608 (100.00%)| ➖️  |
|Shanghai:|3214/3214 (100.00%) |3214/3214 (100.00%)| ➖️  |
|Paris:|2886/2886 (100.00%) |2886/2886 (100.00%)| ➖️  |
|London:|0/0 (NaN%) | | ➖️  |
|Berlin:|0/0 (NaN%) | | ➖️  |
|Istanbul:|0/0 (NaN%) | | ➖️  |
|Petersburg:|0/0 (NaN%) | | ➖️  |
|Constantinople:|0/0 (NaN%) | | ➖️  |
|Byzantium:|0/0 (NaN%) | | ➖️  |
|SpuriousDragon:|0/0 (NaN%) | | ➖️  |
|Tangerine:|0/0 (NaN%) | | ➖️  |
|Homestead:|0/0 (NaN%) | | ➖️  |
|Frontier:|0/0 (NaN%) | | ➖️  |

author_association: NONE
user: login: JereSalo
created_at: 2025-05-07T21:37:28Z
body: There is an unnecessary check of Paris fork in `src/opcode_handlers/block.rs`. We can remove that one too
author_association: CONTRIBUTOR
user: login: JereSalo
created_at: 2025-05-08T12:13:27Z
body: Every `fork_summary` call previous to Paris can be deleted. Summary for slack, for github, etc.
I think that we talked about that and I said not to delete them but I didn't mean to, I thought that we were talking about other part of the code.
author_association: CONTRIBUTOR
user: login: SDartayet
created_at: 2025-05-08T18:15:59Z
body: > Every `fork_summary` call previous to Paris can be deleted. Summary for slack, for github, etc. I think that we talked about that and I said not to delete them but I didn't mean to, I thought that we were talking about other part of the code.

Just did, here!
https://github.com/lambdaclass/ethrex/pull/2670/commits/3bf9975f8f3c2e405fa76921ff416f6d31da4722
author_association: CONTRIBUTOR
user: login: JereSalo
created_at: 2025-05-08T19:37:36Z
body: Queued to merge now because the PR is big but I agree with @fmoletta's comments
author_association: CONTRIBUTOR