Skip to content

Commit a3d78b0

Browse files
authored
chore(primitives): simplify TxEnv conversions + bump alloy-evm (#12805)
- Bump versions for `alloy-evm` and `alloy-op-evm` to 0.25.1 - Update `op-alloy-consensus` and `op-alloy-rpc-types` to 0.23.1 - Use conversion sugar intrduced in latest alloy-evm version
1 parent c6e4783 commit a3d78b0

File tree

3 files changed

+42
-46
lines changed

3 files changed

+42
-46
lines changed

Cargo.lock

Lines changed: 27 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ alloy-rlp = "0.3"
284284
alloy-trie = "0.9"
285285

286286
## op-alloy
287-
op-alloy-consensus = "0.22.0"
288-
op-alloy-rpc-types = "0.22.0"
287+
op-alloy-consensus = "0.23.1"
288+
op-alloy-rpc-types = "0.23.1"
289289
op-alloy-flz = "0.13.1"
290290

291291
## alloy-evm
292-
alloy-evm = "0.24.1"
293-
alloy-op-evm = "0.24.1"
292+
alloy-evm = "0.25.1"
293+
alloy-op-evm = "0.25.1"
294294

295295
# revm
296296
revm = { version = "33.1.0", default-features = false }

crates/primitives/src/transaction/envelope.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use alloy_rlp::Encodable;
1212
use alloy_rpc_types::ConversionError;
1313
use alloy_serde::WithOtherFields;
1414
use op_alloy_consensus::{DEPOSIT_TX_TYPE_ID, OpTransaction as OpTransactionTrait, TxDeposit};
15-
use op_revm::{OpTransaction, transaction::deposit::DepositTransactionParts};
15+
use op_revm::OpTransaction;
1616
use revm::context::TxEnv;
1717

1818
/// Container type for signed, typed transactions.
@@ -174,9 +174,7 @@ impl FromRecoveredTx<FoundryTxEnvelope> for TxEnv {
174174
FoundryTxEnvelope::Legacy(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
175175
FoundryTxEnvelope::Eip2930(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
176176
FoundryTxEnvelope::Eip1559(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
177-
FoundryTxEnvelope::Eip4844(signed_tx) => {
178-
Self::from_recovered_tx(signed_tx.tx().tx(), caller)
179-
}
177+
FoundryTxEnvelope::Eip4844(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
180178
FoundryTxEnvelope::Eip7702(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
181179
FoundryTxEnvelope::Deposit(sealed_tx) => {
182180
Self::from_recovered_tx(sealed_tx.inner(), caller)
@@ -187,19 +185,16 @@ impl FromRecoveredTx<FoundryTxEnvelope> for TxEnv {
187185

188186
impl FromRecoveredTx<FoundryTxEnvelope> for OpTransaction<TxEnv> {
189187
fn from_recovered_tx(tx: &FoundryTxEnvelope, caller: Address) -> Self {
190-
let base = TxEnv::from_recovered_tx(tx, caller);
191-
192-
let deposit = if let FoundryTxEnvelope::Deposit(deposit_tx) = tx {
193-
DepositTransactionParts {
194-
source_hash: deposit_tx.source_hash,
195-
mint: Some(deposit_tx.mint),
196-
is_system_transaction: deposit_tx.is_system_transaction,
188+
match tx {
189+
FoundryTxEnvelope::Legacy(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
190+
FoundryTxEnvelope::Eip2930(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
191+
FoundryTxEnvelope::Eip1559(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
192+
FoundryTxEnvelope::Eip4844(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
193+
FoundryTxEnvelope::Eip7702(signed_tx) => Self::from_recovered_tx(signed_tx, caller),
194+
FoundryTxEnvelope::Deposit(sealed_tx) => {
195+
Self::from_recovered_tx(sealed_tx.inner(), caller)
197196
}
198-
} else {
199-
Default::default()
200-
};
201-
202-
Self { base, deposit, enveloped_tx: None }
197+
}
203198
}
204199
}
205200

0 commit comments

Comments
 (0)