diff --git a/src/engine/builder.rs b/src/engine/builder.rs index 07013417..03ddd45f 100644 --- a/src/engine/builder.rs +++ b/src/engine/builder.rs @@ -4,11 +4,15 @@ use crate::{ BerachainBuiltPayload, BerachainPayloadAttributes, BerachainPayloadBuilderAttributes, }, hardforks::BerachainHardforks, - node::evm::config::{BerachainEvmConfig, BerachainNextBlockEnvAttributes}, + node::evm::{ + config::{BerachainEvmConfig, BerachainNextBlockEnvAttributes}, + error::BerachainExecutionError, + }, primitives::{BerachainHeader, BerachainPrimitives}, - transaction::BerachainTxEnvelope, + transaction::{BerachainTxEnvelope, pol::create_pol_transaction}, }; use alloy_consensus::Transaction; +use alloy_eips::eip7002::SYSTEM_ADDRESS; use alloy_primitives::U256; use alloy_rlp::Encodable; use reth::{ @@ -234,6 +238,26 @@ where PayloadBuilderError::Internal(err.into()) })?; + // Execute PoL as tx #0 post-Prague1. + if chain_spec.is_prague1_active_at_timestamp(attributes.timestamp()) { + let prev_proposer_pubkey = attributes.prev_proposer_pubkey.ok_or_else(|| { + PayloadBuilderError::Internal( + BlockExecutionError::from(BerachainExecutionError::MissingProposerPubkey).into(), + ) + })?; + let pol_envelope = create_pol_transaction( + chain_spec.clone(), + prev_proposer_pubkey, + builder.evm_mut().block().number(), + builder.evm_mut().block().basefee(), + ) + .map_err(|err| PayloadBuilderError::Internal(err.into()))?; + builder.execute_transaction(pol_envelope.with_signer(SYSTEM_ADDRESS)).map_err(|err| { + warn!(target: "payload_builder", %err, "failed to execute PoL transaction"); + PayloadBuilderError::evm(err) + })?; + } + // initialize empty blob sidecars at first. If cancun is active then this will be populated by // blob sidecars if any. let mut blob_sidecars = BlobSidecars::Empty; diff --git a/src/evm/mod.rs b/src/evm/mod.rs index 9eed29a5..fc7c346f 100644 --- a/src/evm/mod.rs +++ b/src/evm/mod.rs @@ -212,7 +212,8 @@ where } TxKind::Call(to) => { let mut result = self.transact_system_call(tx.caller, to, tx.data)?; - // Set gas_used to 0 for POL transactions + // POL transactions are system calls that always consume zero gas, regardless + // of whether they succeed, revert, or halt. result.result = match result.result { ExecutionResult::Success { reason, gas_refunded, logs, output, .. } => { ExecutionResult::Success { @@ -223,7 +224,12 @@ where output, } } - other => other, + ExecutionResult::Revert { output, .. } => { + ExecutionResult::Revert { gas_used: 0, output } + } + ExecutionResult::Halt { reason, .. } => { + ExecutionResult::Halt { reason, gas_used: 0 } + } }; Ok(result) } diff --git a/src/node/evm/assembler.rs b/src/node/evm/assembler.rs index 19993c89..4bf13566 100644 --- a/src/node/evm/assembler.rs +++ b/src/node/evm/assembler.rs @@ -4,7 +4,7 @@ use crate::{ hardforks::BerachainHardforks, node::evm::{block_context::BerachainBlockExecutionCtx, error::BerachainExecutionError}, primitives::{BerachainBlock, BerachainHeader}, - transaction::{BerachainTxEnvelope, BerachainTxType, pol::create_pol_transaction}, + transaction::{BerachainTxEnvelope, BerachainTxType}, }; use alloy_consensus::{Block, BlockBody, BlockHeader, EMPTY_OMMER_ROOT_HASH, TxReceipt, proofs}; use alloy_eips::merge::BEACON_NONCE; @@ -53,7 +53,7 @@ where evm_env, execution_ctx: ctx, parent, - mut transactions, + transactions, output: BlockExecutionResult { receipts, requests, gas_used, blob_gas_used }, state_root, .. @@ -64,27 +64,14 @@ where // Validate proposer pubkey presence for Prague1 validate_proposer_pubkey_prague1(&*self.chain_spec, timestamp, ctx.prev_proposer_pubkey)?; - // Check if Prague1 is active and we need to inject POL transaction + // Post-Prague1, PoL is executed as tx #0, so the block must have a PoL + // transaction at index 0 and at least one receipt. if self.chain_spec.is_prague1_active_at_timestamp(timestamp) { - let prev_proposer_pubkey = ctx.prev_proposer_pubkey.unwrap(); - - // Synthesize POL transaction and prepend to transactions list - let base_fee = evm_env.block_env.basefee(); - let pol_transaction = create_pol_transaction( - self.chain_spec.clone(), - prev_proposer_pubkey, - evm_env.block_env.number(), - base_fee, - )?; - - transactions.insert(0, pol_transaction); - - // Validate that we have receipts after POL transaction execution if receipts.is_empty() { return Err(BerachainExecutionError::MissingPolReceipts.into()); } - // Validate that the first transaction in the list is indeed a POL transaction + // Validate that the first transaction is a PoL transaction if let Some(first_tx) = transactions.first() { if !matches!(first_tx, BerachainTxEnvelope::Berachain(_)) { return Err(BerachainExecutionError::MissingPolTransactionAtIndex0.into()); diff --git a/src/node/evm/builder.rs b/src/node/evm/builder.rs deleted file mode 100644 index 228e0553..00000000 --- a/src/node/evm/builder.rs +++ /dev/null @@ -1,320 +0,0 @@ -use crate::{ - chainspec::BerachainChainSpec, hardforks::BerachainHardforks, primitives::BerachainPrimitives, - transaction::BerachainTxEnvelope, -}; -use alloy_consensus::BlockHeader; -use reth::revm::context::result::ExecutionResult; -use reth_evm::{ - Evm, - block::{BlockExecutionError, BlockExecutor, CommitChanges}, - execute::{BlockBuilder, BlockBuilderOutcome, ExecutorTx}, -}; -use reth_primitives_traits::RecoveredBlock; -use reth_storage_api::StateProvider; -use std::sync::Arc; - -type EResult = ExecutionResult<<::Evm as Evm>::HaltReason>; - -/// Berachain block builder wrapper that fixes sender/transaction mismatch from PoL injection. -/// -/// # Problem (see ) -/// -/// `BasicBlockBuilder::finish()` tracks executed transactions in `self.transactions` and -/// creates senders via `unzip()`. However, `BerachainBlockAssembler::assemble_block()` -/// injects PoL transactions at position 0 that were never in that list, causing: -/// -/// - `transactions`: `[PoL, Tx1, Tx2, ...]` (from assembler) -/// - `senders`: `[Sender1, Sender2, ...]` (from unzip - missing PoL sender) -/// - `receipts`: `[PoL_receipt, Receipt1, ...]` (from execution) -/// -/// This mismatch breaks receipt lookups for pending blocks. -/// -/// # Solution -/// -/// This wrapper overrides `finish()` to detect the mismatch and reconstruct the -/// senders list by extracting the `from` field from injected PoL transactions. -/// -/// # Invariants (strictly enforced) -/// -/// - Pre-Prague1: `num_transactions == num_senders` (no PoL injection) -/// - Post-Prague1: `num_transactions > num_senders` (PoL always injected at position 0) -/// -/// Violations in either direction indicate a bug in block assembly. -pub struct BerachainBlockBuilder -where - B: BlockBuilder, -{ - inner: B, - chain_spec: Arc, -} - -impl BerachainBlockBuilder -where - B: BlockBuilder, -{ - pub fn new(inner: B, chain_spec: Arc) -> Self { - Self { inner, chain_spec } - } -} - -fn fix_pol_senders( - outcome: &mut BlockBuilderOutcome, - chain_spec: &BerachainChainSpec, -) -> Result<(), BlockExecutionError> { - let num_txs = outcome.block.body().transactions.len(); - let num_senders = outcome.block.senders().len(); - let timestamp = outcome.block.header().timestamp(); - let is_prague1 = chain_spec.is_prague1_active_at_timestamp(timestamp); - - if num_senders > num_txs { - return Err(BlockExecutionError::msg(format!( - "more senders ({num_senders}) than transactions ({num_txs}) at timestamp \ - {timestamp}" - ))); - } - - if !is_prague1 { - if num_txs != num_senders { - return Err(BlockExecutionError::msg(format!( - "transaction/sender mismatch pre-Prague1: {num_txs} txs vs {num_senders} \ - senders at timestamp {timestamp}" - ))); - } - return Ok(()); - } - - if num_txs == num_senders { - return Err(BlockExecutionError::msg(format!( - "no transaction/sender mismatch post-Prague1: {num_txs} txs vs {num_senders} \ - senders at timestamp {timestamp}. PoL injection should always occur" - ))); - } - - let num_injected = num_txs - num_senders; - if num_injected != 1 { - return Err(BlockExecutionError::msg(format!( - "expected exactly 1 injected PoL transaction, found {num_injected}" - ))); - } - - let pol_tx = &outcome.block.body().transactions[0]; - let pol_sender = match pol_tx { - BerachainTxEnvelope::Berachain(pol) => pol.from, - _ => { - return Err(BlockExecutionError::msg(format!( - "first transaction is not PoL (type {:?})", - pol_tx.tx_type() - ))); - } - }; - - let mut fixed_senders = Vec::with_capacity(num_txs); - fixed_senders.push(pol_sender); - fixed_senders.extend(outcome.block.senders().iter().copied()); - - outcome.block = RecoveredBlock::new_unhashed(outcome.block.clone_block(), fixed_senders); - - Ok(()) -} - -impl BlockBuilder for BerachainBlockBuilder -where - B: BlockBuilder, -{ - type Primitives = BerachainPrimitives; - type Executor = B::Executor; - - fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError> { - self.inner.apply_pre_execution_changes() - } - - fn execute_transaction_with_commit_condition( - &mut self, - tx: impl ExecutorTx, - f: impl FnOnce(&EResult) -> CommitChanges, - ) -> Result, BlockExecutionError> { - self.inner.execute_transaction_with_commit_condition(tx, f) - } - - /// Finishes block building and fixes the sender/transaction mismatch from PoL injection. - /// - /// See struct-level docs for the full problem description. This override: - /// 1. Calls `inner.finish()` which produces misaligned senders when PoL was injected - /// 2. Enforces invariants based on Prague1 activation - /// 3. Extracts senders from the injected PoL transactions at block start - /// 4. Reconstructs the block with the corrected sender list - fn finish( - self, - state_provider: impl StateProvider, - ) -> Result, BlockExecutionError> { - let mut outcome = self.inner.finish(state_provider)?; - fix_pol_senders(&mut outcome, &self.chain_spec)?; - Ok(outcome) - } - - fn executor_mut(&mut self) -> &mut Self::Executor { - self.inner.executor_mut() - } - - fn executor(&self) -> &Self::Executor { - self.inner.executor() - } - - fn into_executor(self) -> Self::Executor { - self.inner.into_executor() - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::{ - primitives::{BerachainBlock, BerachainBlockBody, BerachainHeader}, - test_utils::bepolia_chainspec, - transaction::PoLTx, - }; - use alloy_consensus::{BlockBody, Signed, TxLegacy}; - use alloy_evm::block::BlockExecutionResult; - use alloy_primitives::{Address, Bytes, Sealed, Signature, address}; - use reth_trie_common::{HashedPostState, updates::TrieUpdates}; - - const SYSTEM_ADDR: Address = address!("fffffffffffffffffffffffffffffffffffffffe"); - const USER_ADDR: Address = address!("1111111111111111111111111111111111111111"); - - fn make_pol_tx(from: Address) -> BerachainTxEnvelope { - BerachainTxEnvelope::Berachain(Sealed::new(PoLTx { - chain_id: 1, - from, - to: Address::ZERO, - nonce: 0, - gas_limit: 30_000_000, - gas_price: 1000, - input: Bytes::new(), - })) - } - - fn make_eth_tx() -> BerachainTxEnvelope { - use alloy_consensus::EthereumTxEnvelope; - let signed = Signed::new_unhashed(TxLegacy::default(), Signature::test_signature()); - BerachainTxEnvelope::Ethereum(EthereumTxEnvelope::Legacy(signed)) - } - - fn make_outcome( - txs: Vec, - senders: Vec
, - timestamp: u64, - ) -> BlockBuilderOutcome { - let header = BerachainHeader { timestamp, ..Default::default() }; - let body = BerachainBlockBody { transactions: txs, ..BlockBody::default() }; - let block = BerachainBlock { header, body }; - let recovered = RecoveredBlock::new_unhashed(block, senders); - - BlockBuilderOutcome { - execution_result: BlockExecutionResult::default(), - hashed_state: HashedPostState::default(), - trie_updates: TrieUpdates::default(), - block: recovered, - } - } - - fn pre_prague1_timestamp() -> u64 { - 0 - } - - fn post_prague1_timestamp(chain_spec: &BerachainChainSpec) -> u64 { - use crate::hardforks::BerachainHardfork; - chain_spec - .inner - .hardforks - .fork(BerachainHardfork::Prague1) - .as_timestamp() - .expect("Prague1 must have a timestamp on bepolia") - } - - #[test] - fn pre_prague1_equal_counts_ok() { - let chain_spec = bepolia_chainspec(); - let ts = pre_prague1_timestamp(); - assert!(!chain_spec.is_prague1_active_at_timestamp(ts)); - - let mut outcome = make_outcome(vec![], vec![], ts); - assert!(fix_pol_senders(&mut outcome, &chain_spec).is_ok()); - - let eth_tx = make_eth_tx(); - let mut outcome = make_outcome(vec![eth_tx], vec![USER_ADDR], ts); - assert!(fix_pol_senders(&mut outcome, &chain_spec).is_ok()); - } - - #[test] - fn pre_prague1_mismatch_errors() { - let chain_spec = bepolia_chainspec(); - let ts = pre_prague1_timestamp(); - - let eth_tx = make_eth_tx(); - let mut outcome = make_outcome(vec![eth_tx], vec![], ts); - let err = fix_pol_senders(&mut outcome, &chain_spec).unwrap_err(); - assert!(err.to_string().contains("transaction/sender mismatch pre-Prague1")); - } - - #[test] - fn post_prague1_one_injection_fixes_senders() { - let chain_spec = bepolia_chainspec(); - let ts = post_prague1_timestamp(&chain_spec); - - let pol_tx = make_pol_tx(SYSTEM_ADDR); - let eth_tx = make_eth_tx(); - let mut outcome = make_outcome(vec![pol_tx, eth_tx], vec![USER_ADDR], ts); - - assert!(fix_pol_senders(&mut outcome, &chain_spec).is_ok()); - assert_eq!(outcome.block.senders().len(), 2); - assert_eq!(outcome.block.senders()[0], SYSTEM_ADDR); - assert_eq!(outcome.block.senders()[1], USER_ADDR); - } - - #[test] - fn post_prague1_no_mismatch_errors() { - let chain_spec = bepolia_chainspec(); - let ts = post_prague1_timestamp(&chain_spec); - - let eth_tx = make_eth_tx(); - let mut outcome = make_outcome(vec![eth_tx], vec![USER_ADDR], ts); - let err = fix_pol_senders(&mut outcome, &chain_spec).unwrap_err(); - assert!(err.to_string().contains("no transaction/sender mismatch post-Prague1")); - } - - #[test] - fn post_prague1_multiple_injections_errors() { - let chain_spec = bepolia_chainspec(); - let ts = post_prague1_timestamp(&chain_spec); - - let pol1 = make_pol_tx(SYSTEM_ADDR); - let pol2 = make_pol_tx(SYSTEM_ADDR); - let eth_tx = make_eth_tx(); - let mut outcome = make_outcome(vec![pol1, pol2, eth_tx], vec![USER_ADDR], ts); - let err = fix_pol_senders(&mut outcome, &chain_spec).unwrap_err(); - assert!(err.to_string().contains("expected exactly 1 injected PoL transaction, found 2")); - } - - #[test] - fn post_prague1_non_pol_at_index_zero_errors() { - let chain_spec = bepolia_chainspec(); - let ts = post_prague1_timestamp(&chain_spec); - - let eth_tx = make_eth_tx(); - let mut outcome = make_outcome(vec![eth_tx], vec![], ts); - let err = fix_pol_senders(&mut outcome, &chain_spec).unwrap_err(); - assert!(err.to_string().contains("first transaction is not PoL")); - } - - #[test] - fn post_prague1_pol_only_block() { - let chain_spec = bepolia_chainspec(); - let ts = post_prague1_timestamp(&chain_spec); - - let pol_tx = make_pol_tx(SYSTEM_ADDR); - let mut outcome = make_outcome(vec![pol_tx], vec![], ts); - assert!(fix_pol_senders(&mut outcome, &chain_spec).is_ok()); - assert_eq!(outcome.block.senders().len(), 1); - assert_eq!(outcome.block.senders()[0], SYSTEM_ADDR); - } -} diff --git a/src/node/evm/config.rs b/src/node/evm/config.rs index 4af2e155..a69d59ed 100644 --- a/src/node/evm/config.rs +++ b/src/node/evm/config.rs @@ -4,7 +4,7 @@ use crate::{ evm::BerachainEvmFactory, node::evm::{ assembler::BerachainBlockAssembler, block_context::BerachainBlockExecutionCtx, - builder::BerachainBlockBuilder, receipt::BerachainReceiptBuilder, + receipt::BerachainReceiptBuilder, }, primitives::{BerachainHeader, BerachainPrimitives, header::BlsPublicKey}, }; @@ -272,7 +272,7 @@ impl ConfigureEvm for BerachainEvmConfig { DB: Database, I: InspectorFor> + 'a, { - let inner: BasicBlockBuilder<'a, Self, _, BerachainBlockAssembler, BerachainPrimitives> = + let builder: BasicBlockBuilder<'a, Self, _, BerachainBlockAssembler, BerachainPrimitives> = BasicBlockBuilder { executor: BlockExecutorFactory::create_executor(self, evm, ctx.clone()), ctx, @@ -280,7 +280,7 @@ impl ConfigureEvm for BerachainEvmConfig { parent, transactions: Vec::new(), }; - BerachainBlockBuilder::new(inner, self.spec.clone()) + builder } } diff --git a/src/node/evm/error.rs b/src/node/evm/error.rs index a67bda17..9f98b66b 100644 --- a/src/node/evm/error.rs +++ b/src/node/evm/error.rs @@ -10,9 +10,6 @@ pub enum BerachainExecutionError { /// Previous proposer public key is not allowed before Prague1 hardfork. #[error("Previous proposer public key is not allowed before Prague1 hardfork")] ProposerPubkeyNotAllowed, - /// Invalid POL transaction type. - #[error("Invalid POL transaction type, expected BerachainTxEnvelope::Berachain")] - InvalidPolTransactionType, /// POL transaction found before Prague1 hardfork activation. #[error("POL transaction found before Prague1 hardfork activation")] PolTransactionBeforePragueOne, diff --git a/src/node/evm/executor.rs b/src/node/evm/executor.rs index 63b28a6c..d7270a30 100644 --- a/src/node/evm/executor.rs +++ b/src/node/evm/executor.rs @@ -2,12 +2,11 @@ use crate::{ chainspec::BerachainChainSpec, engine::validate_proposer_pubkey_prague1, evm::BerachainEvmFactory, - hardforks::BerachainHardforks, node::evm::{ block_context::BerachainBlockExecutionCtx, config::BerachainEvmConfig, - error::BerachainExecutionError, receipt::BerachainReceiptBuilder, + receipt::BerachainReceiptBuilder, }, - transaction::{BerachainTxEnvelope, BerachainTxType, pol::create_pol_transaction}, + transaction::{BerachainTxEnvelope, BerachainTxType}, }; use alloy_consensus::Transaction; use alloy_eips::{Encodable2718, eip7685::Requests}; @@ -15,16 +14,12 @@ use alloy_evm::{ RecoveredTx, block::state_changes::{balance_increment_state, post_block_balance_increments}, }; -use alloy_primitives::Bytes; use reth::{ chainspec::{EthereumHardfork, EthereumHardforks}, providers::BlockExecutionResult, revm::{ DatabaseCommit, Inspector, State, - context::{ - Block as _, - result::{ExecutionResult, Output, ResultAndState, SuccessReason}, - }, + context::{Block as _, result::ResultAndState}, database_interface::DatabaseCommitExt, }, }; @@ -41,7 +36,7 @@ use reth_evm::{ spec::EthExecutorSpec, }, }; -use std::{borrow::Cow, collections::HashMap, sync::Arc}; +use std::{borrow::Cow, sync::Arc}; #[derive(Debug)] pub struct BerachainTxResult { @@ -96,82 +91,6 @@ impl<'a, Evm> BerachainBlockExecutor<'a, Evm> { receipt_builder, } } - - /// Execute POL transaction as system call and manually capture receipt - fn execute_pol_transaction_with_receipt(&mut self) -> Result<(), BlockExecutionError> - where - Evm: reth_evm::Evm, - ::DB: DatabaseCommit, - { - let timestamp = self.evm.block().timestamp().saturating_to(); - - // Validate proposer pubkey presence for Prague1 - validate_proposer_pubkey_prague1(&*self.spec, timestamp, self.ctx.prev_proposer_pubkey)?; - - // Check if Prague1 hardfork is active (after validation) - if !self.spec.is_prague1_active_at_timestamp(timestamp) { - return Ok(()); - } - - // This panic should never occur due to the above validation - let prev_proposer_pubkey = self.ctx.prev_proposer_pubkey.unwrap(); - - // Use shared POL transaction creation logic - let base_fee = self.evm.block().basefee(); - let pol_envelope = create_pol_transaction( - self.spec.clone(), - prev_proposer_pubkey, - self.evm.block().number(), - base_fee, - )?; - let (caller_address, calldata, pol_distributor_address) = - if let BerachainTxEnvelope::Berachain(pol_tx) = &pol_envelope { - (pol_tx.from, pol_tx.input.clone(), pol_tx.to) - } else { - return Err(BerachainExecutionError::InvalidPolTransactionType.into()); - }; - - // Execute as system call (maintains zero gas cost and unlimited gas) - match self.evm.transact_system_call( - caller_address, - pol_distributor_address, - calldata.clone(), - ) { - Ok(result_and_state) => { - tracing::debug!(target: "executor", ?result_and_state, "POL transaction executed successfully"); - - // Build receipt manually for the system call - let receipt = self.receipt_builder.build_receipt(ReceiptBuilderCtx { - tx_type: BerachainTxType::Berachain, - evm: &self.evm, - result: result_and_state.result, - state: &result_and_state.state, - cumulative_gas_used: self.gas_used, // No gas consumed by system call - }); - - // Add receipt to block - self.receipts.push(receipt); - - // Notify system caller of state changes from system call - self.system_caller.on_state( - StateChangeSource::Transaction(0), /* POL is always the first transaction - * (index 0) */ - &result_and_state.state, - ); - - // Commit the POL transaction state changes to the database - self.evm.db_mut().commit(result_and_state.state); - - tracing::debug!(target: "executor", "POL transaction state changes committed to database"); - - Ok(()) - } - Err(e) => { - tracing::error!(target: "executor", %e, "POL system call execution failed"); - Err(BlockExecutionError::other(e)) - } - } - } } impl<'db, DB, E> BlockExecutor for BerachainBlockExecutor<'_, E> @@ -197,8 +116,9 @@ where self.system_caller .apply_beacon_root_contract_call(self.ctx.parent_beacon_block_root, &mut self.evm)?; - // Execute POL transaction and capture receipt - self.execute_pol_transaction_with_receipt()?; + // Enforce prev_proposer_pubkey presence rules for Prague1. + let timestamp = self.evm.block().timestamp().saturating_to(); + validate_proposer_pubkey_prague1(&*self.spec, timestamp, self.ctx.prev_proposer_pubkey)?; Ok(()) } @@ -209,25 +129,6 @@ where let (tx_env, recovered) = tx.into_parts(); let consensus_tx = recovered.tx(); - // For PoL txs, we simply populate a dummy result and state as it is ultimately ignored - // during commit_transaction. - if let BerachainTxEnvelope::Berachain(_) = consensus_tx { - return Ok(BerachainTxResult { - result: ResultAndState { - result: ExecutionResult::Success { - reason: SuccessReason::Stop, - gas_used: 0, - gas_refunded: 0, - logs: Vec::new(), - output: Output::Call(Bytes::default()), - }, - state: HashMap::default(), - }, - blob_gas_used: 0, - tx_type: BerachainTxType::Berachain, - }); - } - // The sum of the transaction's gas limit, Tg, and the gas utilized in this block prior, // must be no greater than the block's gasLimit. let block_available_gas = self.evm.block().gas_limit() - self.gas_used; @@ -252,12 +153,6 @@ where } fn commit_transaction(&mut self, output: Self::Result) -> Result { - // Skip commit for POL transactions as it's already been applied in - // apply_pre_execution_changes - if output.tx_type == BerachainTxType::Berachain { - return Ok(0); - } - let BerachainTxResult { result: ResultAndState { result, state }, blob_gas_used, tx_type } = output; diff --git a/src/node/evm/mod.rs b/src/node/evm/mod.rs index afe8e57d..465d9263 100644 --- a/src/node/evm/mod.rs +++ b/src/node/evm/mod.rs @@ -2,7 +2,6 @@ mod assembler; mod block_context; -mod builder; pub mod config; pub mod error; pub mod executor; diff --git a/src/transaction/pol.rs b/src/transaction/pol.rs index b3fc5e62..789f55c6 100644 --- a/src/transaction/pol.rs +++ b/src/transaction/pol.rs @@ -3,10 +3,11 @@ use crate::{ primitives::header::BlsPublicKey, transaction::{BerachainTxEnvelope, PoLTx}, }; +use alloy_eips::eip7002::SYSTEM_ADDRESS; use alloy_primitives::{Bytes, Sealed, U256}; use alloy_sol_macro::sol; use alloy_sol_types::SolCall; -use reth::{consensus::ConsensusError, revm::handler::SYSTEM_ADDRESS}; +use reth::consensus::ConsensusError; use reth_chainspec::EthChainSpec; use reth_evm::block::{BlockExecutionError, InternalBlockExecutionError}; use std::sync::Arc; @@ -83,7 +84,6 @@ pub fn validate_pol_transaction( #[cfg(test)] mod tests { use super::*; - use alloy_eips::eip7002::SYSTEM_ADDRESS; use alloy_primitives::{U256, address}; use crate::test_utils::bepolia_chainspec;