mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rm more optimism features (#6981)
This commit is contained in:
@ -84,7 +84,7 @@ where
|
|||||||
origin: TransactionOrigin,
|
origin: TransactionOrigin,
|
||||||
transaction: Tx,
|
transaction: Tx,
|
||||||
) -> TransactionValidationOutcome<Tx> {
|
) -> TransactionValidationOutcome<Tx> {
|
||||||
if transaction.is_deposit() || transaction.is_eip4844() {
|
if transaction.is_eip4844() {
|
||||||
return TransactionValidationOutcome::Invalid(
|
return TransactionValidationOutcome::Invalid(
|
||||||
transaction,
|
transaction,
|
||||||
InvalidTransactionError::TxTypeNotSupported.into(),
|
InvalidTransactionError::TxTypeNotSupported.into(),
|
||||||
@ -115,7 +115,7 @@ where
|
|||||||
&self.chain_spec(),
|
&self.chain_spec(),
|
||||||
self.block_timestamp(),
|
self.block_timestamp(),
|
||||||
encoded.as_ref(),
|
encoded.as_ref(),
|
||||||
valid_tx.transaction().is_deposit(),
|
false,
|
||||||
) {
|
) {
|
||||||
Ok(cost) => cost,
|
Ok(cost) => cost,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|||||||
@ -260,14 +260,6 @@ impl<T: PoolTransaction> TransactionValidator for MockTransactionValidator<T> {
|
|||||||
origin: TransactionOrigin,
|
origin: TransactionOrigin,
|
||||||
transaction: Self::Transaction,
|
transaction: Self::Transaction,
|
||||||
) -> TransactionValidationOutcome<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
|
// we return `balance: U256::MAX` to simulate a valid transaction which will never go into
|
||||||
// overdraft
|
// overdraft
|
||||||
TransactionValidationOutcome::Valid {
|
TransactionValidationOutcome::Valid {
|
||||||
|
|||||||
@ -290,13 +290,14 @@ impl MockTransaction {
|
|||||||
/// * [MockTransaction::eip1559]
|
/// * [MockTransaction::eip1559]
|
||||||
/// * [MockTransaction::eip4844]
|
/// * [MockTransaction::eip4844]
|
||||||
pub fn new_from_type(tx_type: TxType) -> Self {
|
pub fn new_from_type(tx_type: TxType) -> Self {
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
match tx_type {
|
match tx_type {
|
||||||
TxType::Legacy => Self::legacy(),
|
TxType::Legacy => Self::legacy(),
|
||||||
TxType::EIP2930 => Self::eip2930(),
|
TxType::EIP2930 => Self::eip2930(),
|
||||||
TxType::EIP1559 => Self::eip1559(),
|
TxType::EIP1559 => Self::eip1559(),
|
||||||
TxType::EIP4844 => Self::eip4844(),
|
TxType::EIP4844 => Self::eip4844(),
|
||||||
#[cfg(feature = "optimism")]
|
|
||||||
TxType::DEPOSIT => todo!(), // not handled in mock tx
|
_ => unreachable!("Invalid transaction type"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,12 +718,6 @@ impl PoolTransaction for MockTransaction {
|
|||||||
fn chain_id(&self) -> Option<u64> {
|
fn chain_id(&self) -> Option<u64> {
|
||||||
Some(1)
|
Some(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the transaction is a deposit transaction.
|
|
||||||
#[cfg(feature = "optimism")]
|
|
||||||
fn is_deposit(&self) -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromRecoveredTransaction for MockTransaction {
|
impl FromRecoveredTransaction for MockTransaction {
|
||||||
@ -731,6 +726,8 @@ impl FromRecoveredTransaction for MockTransaction {
|
|||||||
let transaction = tx.into_signed();
|
let transaction = tx.into_signed();
|
||||||
let hash = transaction.hash();
|
let hash = transaction.hash();
|
||||||
let size = transaction.size();
|
let size = transaction.size();
|
||||||
|
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
match transaction.transaction {
|
match transaction.transaction {
|
||||||
Transaction::Legacy(TxLegacy {
|
Transaction::Legacy(TxLegacy {
|
||||||
chain_id: _,
|
chain_id: _,
|
||||||
@ -822,8 +819,7 @@ impl FromRecoveredTransaction for MockTransaction {
|
|||||||
accesslist: access_list,
|
accesslist: access_list,
|
||||||
size,
|
size,
|
||||||
},
|
},
|
||||||
#[cfg(feature = "optimism")]
|
_ => unreachable!("Invalid transaction type"),
|
||||||
Transaction::Deposit(_) => todo!(), // not handled in mock tx
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -848,10 +848,6 @@ pub trait PoolTransaction:
|
|||||||
|
|
||||||
/// Returns chain_id
|
/// Returns chain_id
|
||||||
fn chain_id(&self) -> Option<u64>;
|
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
|
/// An extension trait that provides additional interfaces for the
|
||||||
@ -1089,12 +1085,6 @@ impl PoolTransaction for EthPooledTransaction {
|
|||||||
fn chain_id(&self) -> Option<u64> {
|
fn chain_id(&self) -> Option<u64> {
|
||||||
self.transaction.chain_id()
|
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 {
|
impl EthPoolTransaction for EthPooledTransaction {
|
||||||
|
|||||||
Reference in New Issue
Block a user