Skip to content

Commit

Permalink
chore: only fetch deposit info for deposit tx (paradigmxyz#12474)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 12, 2024
1 parent 0cd34f9 commit e6a6fc4
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions crates/optimism/rpc/src/eth/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ where
) -> Result<Self::Transaction, Self::Error> {
let from = tx.signer();
let TransactionSigned { transaction, signature, hash } = tx.into_signed();
let mut deposit_receipt_version = None;

let inner = match transaction {
reth_primitives::Transaction::Legacy(tx) => {
Expand All @@ -100,16 +101,23 @@ where
reth_primitives::Transaction::Eip7702(tx) => {
Signed::new_unchecked(tx, signature, hash).into()
}
reth_primitives::Transaction::Deposit(tx) => OpTxEnvelope::Deposit(tx),
reth_primitives::Transaction::Deposit(tx) => {
let deposit_info = self
.inner
.provider()
.receipt_by_hash(hash)
.map_err(Self::Error::from_eth_err)?
.and_then(|receipt| receipt.deposit_receipt_version.zip(receipt.deposit_nonce));

if let Some((version, _)) = deposit_info {
deposit_receipt_version = Some(version);
// TODO: set nonce
}

OpTxEnvelope::Deposit(tx)
}
};

let deposit_receipt_version = self
.inner
.provider()
.receipt_by_hash(hash)
.map_err(Self::Error::from_eth_err)?
.and_then(|receipt| receipt.deposit_receipt_version);

let TransactionInfo {
block_hash, block_number, index: transaction_index, base_fee, ..
} = tx_info;
Expand Down

0 comments on commit e6a6fc4

Please sign in to comment.