diff --git a/crates/optimism/src/api/exec_op.rs b/crates/optimism/src/api/exec_op.rs index 8c7a187c2e..536cf91c24 100644 --- a/crates/optimism/src/api/exec_op.rs +++ b/crates/optimism/src/api/exec_op.rs @@ -11,14 +11,14 @@ use revm::{ use crate::{ handler::{precompiles::OpPrecompileProvider, OpHandler}, transaction::abstraction::OpTxGetter, - L1BlockInfoGetter, OpSpec, OpTransactionError, OptimismHaltReason, + L1BlockInfoGetter, OpHaltReason, OpSpec, OpTransactionError, }; /// Helper function that executed a transaction and commits the state. pub fn transact_op( ctx: &mut CTX, ) -> Result< - ResultAndState, + ResultAndState, EVMError<<::Database as Database>::Error, OpTransactionError>, > where @@ -37,7 +37,7 @@ where pub fn transact_op_commit( ctx: &mut CTX, ) -> Result< - ExecutionResult, + ExecutionResult, EVMError<<::Database as Database>::Error, OpTransactionError>, > where diff --git a/crates/optimism/src/api/inspect.rs b/crates/optimism/src/api/inspect.rs index 172911b96c..7b60db8f65 100644 --- a/crates/optimism/src/api/inspect.rs +++ b/crates/optimism/src/api/inspect.rs @@ -2,7 +2,7 @@ use crate::{ context::OpContext, handler::{precompiles::OpPrecompileProvider, OpHandler}, transaction::{abstraction::OpTxGetter, OpTxTrait}, - L1BlockInfoGetter, OpSpec, OpTransactionError, OptimismHaltReason, + L1BlockInfoGetter, OpHaltReason, OpSpec, OpTransactionError, }; use inspector::{ exec::InspectEvm, @@ -83,7 +83,7 @@ impl< pub fn inspect_op( ctx: &mut CTX, -) -> Result, EVMError<::Error, OpTransactionError>> +) -> Result, EVMError<::Error, OpTransactionError>> where DB: Database, CTX: EthContext @@ -119,10 +119,7 @@ where pub fn inspect_op_commit( ctx: &mut CTX, -) -> Result< - ExecutionResult, - EVMError<::Error, OpTransactionError>, -> +) -> Result, EVMError<::Error, OpTransactionError>> where CTX: EthContext + OpTxGetter diff --git a/crates/optimism/src/context.rs b/crates/optimism/src/context.rs index 000131b6ec..f13ccb3ae6 100644 --- a/crates/optimism/src/context.rs +++ b/crates/optimism/src/context.rs @@ -1,8 +1,8 @@ use crate::{ api::exec_op::transact_op, transaction::{abstraction::OpTxGetter, OpTxTrait}, - L1BlockInfo, L1BlockInfoGetter, OpSpec, OpSpecId, OpTransaction, OpTransactionError, - OptimismHaltReason, + L1BlockInfo, L1BlockInfoGetter, OpHaltReason, OpSpec, OpSpecId, OpTransaction, + OpTransactionError, }; use derive_more::derive::{AsMut, AsRef, Deref, DerefMut}; use inspector::journal::{JournalExt, JournalExtGetter}; @@ -240,10 +240,8 @@ where DB: Database, JOURNAL: Journal)>, { - type Output = Result< - ResultAndState, - EVMError<::Error, OpTransactionError>, - >; + type Output = + Result, EVMError<::Error, OpTransactionError>>; fn exec_previous(&mut self) -> Self::Output { transact_op(self) @@ -259,7 +257,7 @@ where JOURNAL: Journal)>, { type CommitOutput = Result< - ExecutionResult, + ExecutionResult, EVMError<::Error, OpTransactionError>, >; diff --git a/crates/optimism/src/handler.rs b/crates/optimism/src/handler.rs index 5a2127759c..0301a189a7 100644 --- a/crates/optimism/src/handler.rs +++ b/crates/optimism/src/handler.rs @@ -8,7 +8,7 @@ use crate::{ deposit::{DepositTransaction, DEPOSIT_TRANSACTION_TYPE}, OpTransactionError, OpTxTrait, }, - L1BlockInfoGetter, OpSpec, OpSpecId, OptimismHaltReason, BASE_FEE_RECIPIENT, L1_FEE_RECIPIENT, + L1BlockInfoGetter, OpHaltReason, OpSpec, OpSpecId, BASE_FEE_RECIPIENT, L1_FEE_RECIPIENT, }; use precompiles::OpPrecompileProvider; use revm::{ @@ -89,7 +89,7 @@ where type Frame = FRAME; type Precompiles = OpPrecompileProvider; type Instructions = INSTRUCTIONS; - type HaltReason = OptimismHaltReason; + type HaltReason = OpHaltReason; fn precompile(&self, _context: &mut Self::Context) -> Self::Precompiles { OpPrecompileProvider::default() @@ -310,7 +310,7 @@ where result: ::FrameResult, ) -> Result, Self::Error> { let result = self.main.output(context, result)?; - let result = result.map_haltreason(OptimismHaltReason::Base); + let result = result.map_haltreason(OpHaltReason::Base); if result.result.is_halt() { // Post-regolith, if the transaction is a deposit transaction and it halts, // we bubble up to the global return handler. The mint value will be persisted @@ -378,7 +378,7 @@ where Ok(ResultAndState { result: ExecutionResult::Halt { - reason: OptimismHaltReason::FailedDeposit, + reason: OpHaltReason::FailedDeposit, gas_used, }, state, diff --git a/crates/optimism/src/lib.rs b/crates/optimism/src/lib.rs index d3706700b0..72f74867f8 100644 --- a/crates/optimism/src/lib.rs +++ b/crates/optimism/src/lib.rs @@ -18,6 +18,6 @@ pub mod transaction; pub use l1block::{ L1BlockInfo, L1BlockInfoGetter, BASE_FEE_RECIPIENT, L1_BLOCK_CONTRACT, L1_FEE_RECIPIENT, }; -pub use result::OptimismHaltReason; +pub use result::OpHaltReason; pub use spec::*; pub use transaction::{error::OpTransactionError, estimate_tx_compressed_size, OpTransaction}; diff --git a/crates/optimism/src/result.rs b/crates/optimism/src/result.rs index 90f526e468..449a7ccb54 100644 --- a/crates/optimism/src/result.rs +++ b/crates/optimism/src/result.rs @@ -2,12 +2,12 @@ use revm::context_interface::result::HaltReason; #[derive(Clone, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum OptimismHaltReason { +pub enum OpHaltReason { Base(HaltReason), FailedDeposit, } -impl From for OptimismHaltReason { +impl From for OpHaltReason { fn from(value: HaltReason) -> Self { Self::Base(value) } diff --git a/crates/optimism/src/transaction/error.rs b/crates/optimism/src/transaction/error.rs index 6ea61a69f9..a7e2301e86 100644 --- a/crates/optimism/src/transaction/error.rs +++ b/crates/optimism/src/transaction/error.rs @@ -16,27 +16,27 @@ pub enum OpTransactionError { /// was deprecated in the Regolith hardfork, and this error is thrown if a `Deposit` transaction /// is found with this field set to `true` after the hardfork activation. /// - /// In addition, this error is internal, and bubbles up into a [OptimismHaltReason::FailedDeposit][crate::OptimismHaltReason::FailedDeposit] error + /// In addition, this error is internal, and bubbles up into a [OpHaltReason::FailedDeposit][crate::OpHaltReason::FailedDeposit] error /// in the `revm` handler for the consumer to easily handle. This is due to a state transition /// rule on OP Stack chains where, if for any reason a deposit transaction fails, the transaction /// must still be included in the block, the sender nonce is bumped, the `mint` value persists, and /// special gas accounting rules are applied. Normally on L1, [EVMError::Transaction] errors - /// are cause for non-inclusion, so a special [OptimismHaltReason][crate::OptimismHaltReason] variant was introduced to handle this + /// are cause for non-inclusion, so a special [OpHaltReason][crate::OpHaltReason] variant was introduced to handle this /// case for failed deposit transactions. DepositSystemTxPostRegolith, /// Deposit transaction haults bubble up to the global main return handler, wiping state and /// only increasing the nonce + persisting the mint value. /// - /// This is a catch-all error for any deposit transaction that is results in a [OptimismHaltReason][crate::OptimismHaltReason] error + /// This is a catch-all error for any deposit transaction that is results in a [OpHaltReason][crate::OpHaltReason] error /// post-regolith hardfork. This allows for a consumer to easily handle special cases where /// a deposit transaction fails during validation, but must still be included in the block. /// - /// In addition, this error is internal, and bubbles up into a [OptimismHaltReason::FailedDeposit][crate::OptimismHaltReason::FailedDeposit] error + /// In addition, this error is internal, and bubbles up into a [OpHaltReason::FailedDeposit][crate::OpHaltReason::FailedDeposit] error /// in the `revm` handler for the consumer to easily handle. This is due to a state transition /// rule on OP Stack chains where, if for any reason a deposit transaction fails, the transaction /// must still be included in the block, the sender nonce is bumped, the `mint` value persists, and /// special gas accounting rules are applied. Normally on L1, [EVMError::Transaction] errors - /// are cause for non-inclusion, so a special [OptimismHaltReason][crate::OptimismHaltReason] variant was introduced to handle this + /// are cause for non-inclusion, so a special [OpHaltReason][crate::OpHaltReason] variant was introduced to handle this /// case for failed deposit transactions. HaltedDepositPostRegolith, }