Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 78 additions & 66 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,13 @@ alloy-rlp = "0.3"
alloy-trie = "0.9"

## op-alloy
op-alloy-consensus = "0.24.0"
op-alloy-rpc-types = "0.24.0"
op-alloy-consensus = "0.23.0"
op-alloy-rpc-types = "0.23.0"
op-alloy-flz = "0.13.1"

## alloy-evm
alloy-evm = "0.29"
alloy-op-evm = "0.28"
alloy-evm = "0.30"
alloy-op-evm = "0.30"

# revm
revm = { version = "36.0.0", default-features = false }
Expand Down Expand Up @@ -450,18 +450,18 @@ flate2 = "1.1"
ethereum_ssz = "0.10"

# Tempo
tempo-alloy = { git = "https://github.com/tempoxyz/tempo", rev = "ac8075725b25bce310444a4ed800d64194f9557a" }
tempo-alloy = { git = "https://github.com/tempoxyz/tempo", rev = "99a748b" }
mpp = { git = "https://github.com/tempoxyz/mpp-rs", default-features = false, features = [
"tempo",
"client",
"reqwest-rustls-tls",
] }
tempo-contracts = { git = "https://github.com/tempoxyz/tempo", rev = "ac8075725b25bce310444a4ed800d64194f9557a" }
tempo-revm = { git = "https://github.com/tempoxyz/tempo", rev = "ac8075725b25bce310444a4ed800d64194f9557a" }
tempo-evm = { git = "https://github.com/tempoxyz/tempo", rev = "ac8075725b25bce310444a4ed800d64194f9557a", default-features = false }
tempo-chainspec = { git = "https://github.com/tempoxyz/tempo", rev = "ac8075725b25bce310444a4ed800d64194f9557a", default-features = false }
tempo-primitives = { git = "https://github.com/tempoxyz/tempo", rev = "ac8075725b25bce310444a4ed800d64194f9557a", default-features = false }
tempo-precompiles = { git = "https://github.com/tempoxyz/tempo", rev = "ac8075725b25bce310444a4ed800d64194f9557a" }
tempo-contracts = { git = "https://github.com/tempoxyz/tempo", rev = "99a748b" }
tempo-revm = { git = "https://github.com/tempoxyz/tempo", rev = "99a748b" }
tempo-evm = { git = "https://github.com/tempoxyz/tempo", rev = "99a748b", default-features = false }
tempo-chainspec = { git = "https://github.com/tempoxyz/tempo", rev = "99a748b", default-features = false }
tempo-primitives = { git = "https://github.com/tempoxyz/tempo", rev = "99a748b", default-features = false }
tempo-precompiles = { git = "https://github.com/tempoxyz/tempo", rev = "99a748b" }

## Pinned dependencies. Enabled for the workspace in crates/test-utils.

Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/backend/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use alloy_evm::{
eth::EthEvmContext,
precompiles::{DynPrecompile, Precompile, PrecompilesMap},
};
use alloy_op_evm::OpEvmFactory;
use alloy_op_evm::{OpEvmFactory, OpTxError};
use alloy_primitives::{B256, Bloom, BloomInput, Log};
use anvil_core::eth::{
block::{BlockInfo, create_block},
Expand Down Expand Up @@ -402,7 +402,7 @@ impl<DB: Db + ?Sized, V: TransactionValidator> Iterator for &mut TransactionExec
err,
));
}
EVMError::Transaction(err) => {
EVMError::Transaction(OpTxError(err)) => {
return Some(TransactionExecutionOutcome::Invalid(
transaction,
err.into(),
Expand Down
9 changes: 5 additions & 4 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ use alloy_network::{
AnyHeader, AnyRpcBlock, AnyRpcHeader, AnyRpcTransaction, AnyTxEnvelope, AnyTxType,
ReceiptResponse, TransactionBuilder, UnknownTxEnvelope, UnknownTypedTransaction,
};
use alloy_op_evm::OpTx;
use alloy_primitives::{
Address, B256, Bytes, TxHash, TxKind, U64, U256, address, hex, keccak256, logs_bloom,
map::{AddressMap, HashMap, HashSet},
Expand Down Expand Up @@ -107,7 +108,7 @@ use foundry_primitives::{
};
use futures::channel::mpsc::{UnboundedSender, unbounded};
use op_alloy_consensus::DEPOSIT_TX_TYPE_ID;
use op_revm::{OpContext, OpHaltReason, OpTransaction};
use op_revm::{OpContext, OpHaltReason};
use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};
use revm::{
DatabaseCommit, Inspector,
Expand Down Expand Up @@ -2870,7 +2871,7 @@ impl Backend {

let target_tx = block.body.transactions[index].clone();
let target_tx = PendingTransaction::from_maybe_impersonated(target_tx)?;
let mut tx_env: OpTransaction<TxEnv> = FromRecoveredTx::from_recovered_tx(
let mut tx_env: OpTx = FromRecoveredTx::from_recovered_tx(
target_tx.transaction.as_ref(),
*target_tx.sender(),
);
Expand All @@ -2884,7 +2885,7 @@ impl Backend {
.transact(tx_env.clone())
.map_err(|err| BlockchainError::Message(err.to_string()))?;

Ok(f(result, cache_db, inspector, tx_env.base, env))
Ok(f(result, cache_db, inspector, tx_env.0.base, env))
};

let read_guard = self.states.upgradable_read();
Expand Down Expand Up @@ -3179,7 +3180,7 @@ impl Backend {
// Prepare transaction environment
let pending_tx =
PendingTransaction::from_maybe_impersonated(tx_envelope.clone()).ok()?;
let mut tx_env: OpTransaction<TxEnv> = FromRecoveredTx::from_recovered_tx(
let mut tx_env: OpTx = FromRecoveredTx::from_recovered_tx(
pending_tx.transaction.as_ref(),
*pending_tx.sender(),
);
Expand Down
7 changes: 4 additions & 3 deletions crates/anvil/src/eth/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use crate::eth::pool::transactions::PoolTransaction;
use alloy_consensus::crypto::RecoveryError;
use alloy_evm::overrides::StateOverrideError;
use alloy_op_evm::OpTxError;
use alloy_primitives::{B256, Bytes, SignatureError, U256};
use alloy_rpc_types::BlockNumberOrTag;
use alloy_signer::Error as SignerError;
Expand Down Expand Up @@ -160,13 +161,13 @@ where
}
}

impl<T> From<EVMError<T, OpTransactionError>> for BlockchainError
impl<T> From<EVMError<T, OpTxError>> for BlockchainError
where
T: Into<Self>,
{
fn from(err: EVMError<T, OpTransactionError>) -> Self {
fn from(err: EVMError<T, OpTxError>) -> Self {
match err {
EVMError::Transaction(err) => match err {
EVMError::Transaction(OpTxError(err)) => match err {
OpTransactionError::Base(err) => InvalidTransactionError::from(err).into(),
OpTransactionError::DepositSystemTxPostRegolith => {
Self::DepositTransactionUnsupported
Expand Down
34 changes: 17 additions & 17 deletions crates/evm/core/src/either_evm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_evm::{Database, EthEvm, Evm, EvmEnv, eth::EthEvmContext, precompiles::PrecompilesMap};
use alloy_op_evm::OpEvm;
use alloy_op_evm::{OpEvm, OpTxError};
use alloy_primitives::{Address, Bytes};
use op_revm::{OpContext, OpHaltReason, OpSpecId, OpTransactionError};
use revm::{
Expand Down Expand Up @@ -62,7 +62,7 @@ where
fn map_eth_result(
&self,
result: Result<ExecResultAndState<ExecutionResult>, EVMError<DB::Error>>,
) -> EitherEvmResult<DB::Error, OpHaltReason, OpTransactionError> {
) -> EitherEvmResult<DB::Error, OpHaltReason, OpTxError> {
match result {
Ok(result) => Ok(ResultAndState {
result: result.result.map_haltreason(OpHaltReason::Base),
Expand All @@ -76,7 +76,7 @@ where
fn map_exec_result(
&self,
result: Result<ExecutionResult, EVMError<DB::Error>>,
) -> EitherExecResult<DB::Error, OpHaltReason, OpTransactionError> {
) -> EitherExecResult<DB::Error, OpHaltReason, OpTxError> {
match result {
Ok(result) => {
// Map the halt reason
Expand All @@ -86,11 +86,11 @@ where
}
}

/// Maps [`EVMError<DBError>`] to [`EVMError<DBError, OpTransactionError>`].
fn map_eth_err(&self, err: EVMError<DB::Error>) -> EVMError<DB::Error, OpTransactionError> {
/// Maps [`EVMError<DBError>`] to [`EVMError<DBError, OpTxError>`].
fn map_eth_err(&self, err: EVMError<DB::Error>) -> EVMError<DB::Error, OpTxError> {
match err {
EVMError::Transaction(invalid_tx) => {
EVMError::Transaction(OpTransactionError::Base(invalid_tx))
EVMError::Transaction(OpTxError(OpTransactionError::Base(invalid_tx)))
}
EVMError::Database(e) => EVMError::Database(e),
EVMError::Header(e) => EVMError::Header(e),
Expand All @@ -105,7 +105,7 @@ where
ResultAndState<TempoHaltReason>,
EVMError<DB::Error, TempoInvalidTransaction>,
>,
) -> EitherEvmResult<DB::Error, OpHaltReason, OpTransactionError> {
) -> EitherEvmResult<DB::Error, OpHaltReason, OpTxError> {
match result {
Ok(result) => Ok(ResultAndState {
result: result.result.map_haltreason(map_tempo_halt_to_op),
Expand All @@ -122,7 +122,7 @@ where
ExecutionResult<TempoHaltReason>,
EVMError<DB::Error, TempoInvalidTransaction>,
>,
) -> EitherExecResult<DB::Error, OpHaltReason, OpTransactionError> {
) -> EitherExecResult<DB::Error, OpHaltReason, OpTxError> {
match result {
Ok(result) => Ok(result.map_haltreason(map_tempo_halt_to_op)),
Err(e) => Err(map_tempo_err_to_op(e)),
Expand All @@ -146,11 +146,11 @@ fn map_tempo_halt_to_op(halt: TempoHaltReason) -> OpHaltReason {
/// OpTransactionError>`].
fn map_tempo_err_to_op<DBError>(
err: EVMError<DBError, TempoInvalidTransaction>,
) -> EVMError<DBError, OpTransactionError> {
) -> EVMError<DBError, OpTxError> {
match err {
EVMError::Transaction(tempo_err) => match tempo_err {
TempoInvalidTransaction::EthInvalidTransaction(eth_err) => {
EVMError::Transaction(OpTransactionError::Base(eth_err))
EVMError::Transaction(OpTxError(OpTransactionError::Base(eth_err)))
}
other => EVMError::Custom(other.to_string()),
},
Expand All @@ -169,7 +169,7 @@ where
+ From<PrecompilesMap>,
{
type DB = DB;
type Error = EVMError<DB::Error, OpTransactionError>;
type Error = EVMError<DB::Error, OpTxError>;
type HaltReason = OpHaltReason;
type Tx = EitherTx;
type Inspector = I;
Expand Down Expand Up @@ -362,15 +362,15 @@ where
let tx_env = tx.into_tx_env();
match self {
Self::Eth(evm) => {
let eth = evm.transact(tx_env.base.base);
let eth = evm.transact(tx_env.base.0.base);
self.map_eth_result(eth)
}
Self::Op(evm) => evm.transact(tx_env.base),
Self::Tempo(evm) => {
use revm::ExecuteEvm;
// Use tempo_tx if present (Tempo AA transactions), otherwise convert from base
let tempo_tx =
tx_env.tempo_tx.unwrap_or_else(|| TempoTxEnv::from(tx_env.base.base));
tx_env.tempo_tx.unwrap_or_else(|| TempoTxEnv::from(tx_env.base.0.base));
let result = evm.transact(tempo_tx);
self.map_tempo_result(result)
}
Expand All @@ -387,15 +387,15 @@ where
let tx_env = tx.into_tx_env();
match self {
Self::Eth(evm) => {
let eth = evm.transact_commit(tx_env.base.base);
let eth = evm.transact_commit(tx_env.base.0.base);
self.map_exec_result(eth)
}
Self::Op(evm) => evm.transact_commit(tx_env.base),
Self::Tempo(evm) => {
use revm::ExecuteCommitEvm;
// Use tempo_tx if present (Tempo AA transactions), otherwise convert from base
let tempo_tx =
tx_env.tempo_tx.unwrap_or_else(|| TempoTxEnv::from(tx_env.base.base));
tx_env.tempo_tx.unwrap_or_else(|| TempoTxEnv::from(tx_env.base.0.base));
tracing::warn!(target: "backend", has_tempo_tx_env = tempo_tx.tempo_tx_env.is_some(), "transact_commit tempo tx");
let result = evm.transact_commit(tempo_tx);
self.map_tempo_exec_result(result)
Expand All @@ -409,14 +409,14 @@ where
) -> Result<ResultAndState<Self::HaltReason>, Self::Error> {
match self {
Self::Eth(evm) => {
let res = evm.transact_raw(tx.base.base);
let res = evm.transact_raw(tx.base.0.base);
self.map_eth_result(res)
}
Self::Op(evm) => evm.transact_raw(tx.base),
Self::Tempo(evm) => {
use revm::ExecuteEvm;
// Use tempo_tx if present (Tempo AA transactions), otherwise convert from base
let tempo_tx = tx.tempo_tx.unwrap_or_else(|| TempoTxEnv::from(tx.base.base));
let tempo_tx = tx.tempo_tx.unwrap_or_else(|| TempoTxEnv::from(tx.base.0.base));
let result = evm.transact(tempo_tx);
self.map_tempo_result(result)
}
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ alloy-rpc-types = { workspace = true, features = ["trace"] }
alloy-rpc-types-eth.workspace = true
alloy-serde.workspace = true
alloy-signer.workspace = true
alloy-evm = { workspace = true, features = ["op"] }
alloy-evm.workspace = true
alloy-op-evm.workspace = true
op-alloy-consensus = { workspace = true, features = ["serde", "alloy-compat"] }
op-alloy-rpc-types.workspace = true
op-revm.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions crates/primitives/src/transaction/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use alloy_consensus::{
};
use alloy_evm::FromRecoveredTx;
use alloy_network::{AnyRpcTransaction, AnyTxEnvelope};
use alloy_op_evm::OpTx;
use alloy_primitives::{Address, B256};
use alloy_rlp::Encodable;
use alloy_rpc_types::ConversionError;
use alloy_serde::WithOtherFields;
use op_alloy_consensus::{DEPOSIT_TX_TYPE_ID, OpTransaction as OpTransactionTrait, TxDeposit};
use op_revm::OpTransaction;
use revm::context::TxEnv;
use tempo_primitives::{AASigned, TempoTransaction};

Expand Down Expand Up @@ -196,14 +196,14 @@ impl FromRecoveredTx<FoundryTxEnvelope> for TxEnv {
FoundryTxEnvelope::Eip4844(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
FoundryTxEnvelope::Eip7702(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
FoundryTxEnvelope::Deposit(sealed_tx) => {
Self::from_recovered_tx(sealed_tx.inner(), caller)
OpTx::from_recovered_tx(sealed_tx.inner(), caller).0.base
}
FoundryTxEnvelope::Tempo(_) => panic!("unsupported tx type on ethereum"),
}
}
}

impl FromRecoveredTx<FoundryTxEnvelope> for OpTransaction<TxEnv> {
impl FromRecoveredTx<FoundryTxEnvelope> for OpTx {
fn from_recovered_tx(tx: &FoundryTxEnvelope, caller: Address) -> Self {
match tx {
FoundryTxEnvelope::Legacy(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
Expand Down Expand Up @@ -459,7 +459,7 @@ mod tests {
assert_eq!(tx_env.gas_price, 1);

// Test OpTransaction<TxEnv> conversion via FromRecoveredTx trait
let op_tx = OpTransaction::<TxEnv>::from_recovered_tx(&typed_tx, sender);
let op_tx = OpTx::from_recovered_tx(&typed_tx, sender);
assert_eq!(op_tx.base.caller, sender);
assert_eq!(op_tx.base.gas_limit, 0x5208);
}
Expand Down
18 changes: 9 additions & 9 deletions crates/primitives/src/tx_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
//! with existing Foundry/OP-stack infrastructure.

use alloy_evm::{FromRecoveredTx, IntoTxEnv};
use alloy_op_evm::OpTx;
use alloy_primitives::{Address, Bytes};
use op_revm::{OpTransaction, transaction::deposit::DepositTransactionParts};
use revm::context::TxEnv;
use std::ops::{Deref, DerefMut};
use tempo_revm::TempoTxEnv;

Expand All @@ -19,7 +19,7 @@ use crate::FoundryTxEnvelope;
#[derive(Clone, Debug, Default)]
pub struct EitherTx {
/// Base OP transaction (used for Eth and Op EVM variants).
pub base: OpTransaction<TxEnv>,
pub base: OpTx,
/// Tempo transaction environment (used for Tempo EVM variant).
/// When present, the Tempo EVM uses this directly instead of converting from `base`.
pub tempo_tx: Option<TempoTxEnv>,
Expand All @@ -31,7 +31,7 @@ impl IntoTxEnv<Self> for EitherTx {
}
}

impl IntoTxEnv<EitherTx> for OpTransaction<TxEnv> {
impl IntoTxEnv<EitherTx> for OpTx {
fn into_tx_env(self) -> EitherTx {
EitherTx { base: self, tempo_tx: None }
}
Expand Down Expand Up @@ -105,11 +105,11 @@ impl DerefMut for FoundryTempoTxEnv {
impl IntoTxEnv<EitherTx> for FoundryTempoTxEnv {
fn into_tx_env(self) -> EitherTx {
EitherTx {
base: OpTransaction {
base: OpTx(OpTransaction {
base: self.inner.inner.clone(),
enveloped_tx: self.enveloped_tx,
deposit: self.deposit,
},
}),
// Preserve the full TempoTxEnv for Tempo EVM
tempo_tx: Some(self.inner),
}
Expand All @@ -131,11 +131,11 @@ impl FromRecoveredTx<FoundryTxEnvelope> for FoundryTempoTxEnv {
},
// For all other transaction types, convert through OpTransaction<TxEnv>
_ => {
let op_tx: OpTransaction<TxEnv> = FromRecoveredTx::from_recovered_tx(tx, caller);
let op_tx: OpTx = FromRecoveredTx::from_recovered_tx(tx, caller);
Self {
inner: TempoTxEnv { inner: op_tx.base, ..Default::default() },
enveloped_tx: op_tx.enveloped_tx,
deposit: op_tx.deposit,
inner: TempoTxEnv { inner: op_tx.0.base, ..Default::default() },
enveloped_tx: op_tx.0.enveloped_tx,
deposit: op_tx.0.deposit,
}
}
}
Expand Down
Loading