Skip to content

Commit

Permalink
chore: rm more optimism features (#6981)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Mar 5, 2024
1 parent 6725d43 commit ff91824
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 30 deletions.
4 changes: 2 additions & 2 deletions crates/node-optimism/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ where
origin: TransactionOrigin,
transaction: Tx,
) -> TransactionValidationOutcome<Tx> {
if transaction.is_deposit() || transaction.is_eip4844() {
if transaction.is_eip4844() {
return TransactionValidationOutcome::Invalid(
transaction,
InvalidTransactionError::TxTypeNotSupported.into(),
Expand Down Expand Up @@ -115,7 +115,7 @@ where
&self.chain_spec(),
self.block_timestamp(),
encoded.as_ref(),
valid_tx.transaction().is_deposit(),
false,
) {
Ok(cost) => cost,
Err(err) => {
Expand Down
8 changes: 0 additions & 8 deletions crates/transaction-pool/src/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,6 @@ impl<T: PoolTransaction> TransactionValidator for MockTransactionValidator<T> {
origin: TransactionOrigin,
transaction: Self::Transaction,
) -> TransactionValidationOutcome<Self::Transaction> {
#[cfg(feature = "optimism")]
if transaction.is_deposit() {
return TransactionValidationOutcome::Invalid(
transaction,
reth_primitives::InvalidTransactionError::TxTypeNotSupported.into(),
)
}

// we return `balance: U256::MAX` to simulate a valid transaction which will never go into
// overdraft
TransactionValidationOutcome::Valid {
Expand Down
16 changes: 6 additions & 10 deletions crates/transaction-pool/src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,14 @@ impl MockTransaction {
/// * [MockTransaction::eip1559]
/// * [MockTransaction::eip4844]
pub fn new_from_type(tx_type: TxType) -> Self {
#[allow(unreachable_patterns)]
match tx_type {
TxType::Legacy => Self::legacy(),
TxType::EIP2930 => Self::eip2930(),
TxType::EIP1559 => Self::eip1559(),
TxType::EIP4844 => Self::eip4844(),
#[cfg(feature = "optimism")]
TxType::DEPOSIT => todo!(), // not handled in mock tx

_ => unreachable!("Invalid transaction type"),
}
}

Expand Down Expand Up @@ -717,12 +718,6 @@ impl PoolTransaction for MockTransaction {
fn chain_id(&self) -> Option<u64> {
Some(1)
}

/// Returns true if the transaction is a deposit transaction.
#[cfg(feature = "optimism")]
fn is_deposit(&self) -> bool {
false
}
}

impl FromRecoveredTransaction for MockTransaction {
Expand All @@ -731,6 +726,8 @@ impl FromRecoveredTransaction for MockTransaction {
let transaction = tx.into_signed();
let hash = transaction.hash();
let size = transaction.size();

#[allow(unreachable_patterns)]
match transaction.transaction {
Transaction::Legacy(TxLegacy {
chain_id: _,
Expand Down Expand Up @@ -822,8 +819,7 @@ impl FromRecoveredTransaction for MockTransaction {
accesslist: access_list,
size,
},
#[cfg(feature = "optimism")]
Transaction::Deposit(_) => todo!(), // not handled in mock tx
_ => unreachable!("Invalid transaction type"),
}
}
}
Expand Down
10 changes: 0 additions & 10 deletions crates/transaction-pool/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,6 @@ pub trait PoolTransaction:

/// Returns chain_id
fn chain_id(&self) -> Option<u64>;

/// Returns whether or not the transaction is an Optimism Deposited transaction.
#[cfg(feature = "optimism")]
fn is_deposit(&self) -> bool;
}

/// An extension trait that provides additional interfaces for the
Expand Down Expand Up @@ -1089,12 +1085,6 @@ impl PoolTransaction for EthPooledTransaction {
fn chain_id(&self) -> Option<u64> {
self.transaction.chain_id()
}

/// Returns whether or not the transaction is an Optimism Deposited transaction.
#[cfg(feature = "optimism")]
fn is_deposit(&self) -> bool {
matches!(self.transaction.transaction, Transaction::Deposit(_))
}
}

impl EthPoolTransaction for EthPooledTransaction {
Expand Down

0 comments on commit ff91824

Please sign in to comment.