diff --git a/crates/scroll/node/src/builder/pool.rs b/crates/scroll/node/src/builder/pool.rs index e40b5a08084..8fead3e4c3f 100644 --- a/crates/scroll/node/src/builder/pool.rs +++ b/crates/scroll/node/src/builder/pool.rs @@ -13,6 +13,7 @@ use reth_transaction_pool::{ blobstore::DiskFileBlobStore, CoinbaseTipOrdering, EthPoolTransaction, TransactionValidationTaskExecutor, }; +use scroll_alloy_consensus::ScrollTransaction; use scroll_alloy_hardforks::ScrollHardforks; /// A basic scroll transaction pool. @@ -52,7 +53,7 @@ where ChainSpec: EthChainSpec + ScrollHardforks + ChainConfig, >, >, - T: EthPoolTransaction>, + T: EthPoolTransaction> + ScrollTransaction, { type Pool = ScrollTransactionPool; @@ -138,7 +139,7 @@ mod tests { use crate::ScrollNode; use alloy_consensus::{transaction::Recovered, Header, Signed, TxLegacy}; - use alloy_primitives::{private::rand::random_iter, Bytes, Signature, B256, U256}; + use alloy_primitives::{private::rand::random_iter, Bytes, Sealed, Signature, B256, U256}; use reth_chainspec::Head; use reth_db::mock::DatabaseMock; use reth_node_api::FullNodeTypesAdapter; @@ -160,7 +161,7 @@ mod tests { error::{InvalidPoolTransactionError, PoolErrorKind}, PoolConfig, TransactionOrigin, TransactionPool, }; - use scroll_alloy_consensus::ScrollTxEnvelope; + use scroll_alloy_consensus::{ScrollTxEnvelope, TxL1Message}; use scroll_alloy_evm::curie::L1_GAS_PRICE_ORACLE_ADDRESS; async fn pool() -> ( @@ -351,4 +352,31 @@ mod tests { // drop all validation tasks. drop(manager); } + + #[tokio::test] + async fn test_validate_one_disallow_l1_messages() { + // create the pool. + let (pool, manager) = pool().await; + let tx = ScrollTxEnvelope::L1Message(Sealed::new_unchecked( + TxL1Message::default(), + B256::default(), + )); + + // Create a pool transaction with the L1 message. + let pool_tx = + ScrollPooledTransaction::new(Recovered::new_unchecked(tx, Default::default()), 0); + + // add the transaction to the pool and expect an `OversizedData` error. + let err = pool.add_transaction(TransactionOrigin::Local, pool_tx).await.unwrap_err(); + assert!(matches!( + err.kind, + PoolErrorKind::InvalidTransaction(InvalidPoolTransactionError::Consensus( + InvalidTransactionError::TxTypeNotSupported + )) + )); + + // explicitly drop the manager here otherwise the `TransactionValidationTaskExecutor` will + // drop all validation tasks. + drop(manager); + } } diff --git a/crates/scroll/txpool/src/transaction.rs b/crates/scroll/txpool/src/transaction.rs index bee30961949..e0fdf7b66c1 100644 --- a/crates/scroll/txpool/src/transaction.rs +++ b/crates/scroll/txpool/src/transaction.rs @@ -10,6 +10,7 @@ use reth_scroll_primitives::ScrollTransactionSigned; use reth_transaction_pool::{ EthBlobTransactionSidecar, EthPoolTransaction, EthPooledTransaction, PoolTransaction, }; +use scroll_alloy_consensus::ScrollTransaction; use std::sync::{Arc, OnceLock}; /// Pool transaction for Scroll. @@ -209,6 +210,16 @@ where } } +impl ScrollTransaction for ScrollPooledTransaction { + fn is_l1_message(&self) -> bool { + self.transaction.is_l1_message() + } + + fn queue_index(&self) -> Option { + self.transaction.queue_index() + } +} + #[cfg(test)] mod tests { use crate::{ScrollPooledTransaction, ScrollTransactionValidator}; diff --git a/crates/scroll/txpool/src/validator.rs b/crates/scroll/txpool/src/validator.rs index 0f7ea42f582..24a4d76dede 100644 --- a/crates/scroll/txpool/src/validator.rs +++ b/crates/scroll/txpool/src/validator.rs @@ -17,6 +17,7 @@ use reth_transaction_pool::{ TransactionValidator, }; use revm_scroll::l1block::L1BlockInfo; +use scroll_alloy_consensus::ScrollTransaction; use std::sync::{ atomic::{AtomicU64, Ordering}, Arc, @@ -85,7 +86,7 @@ impl ScrollTransactionValidator { impl ScrollTransactionValidator where Client: ChainSpecProvider + StateProviderFactory + BlockReaderIdExt, - Tx: EthPoolTransaction, + Tx: EthPoolTransaction + ScrollTransaction, { /// Create a new [`ScrollTransactionValidator`]. pub fn new(inner: EthTransactionValidator) -> Self { @@ -139,6 +140,12 @@ where transaction: Tx, ) -> TransactionValidationOutcome { if transaction.is_eip4844() { + return TransactionValidationOutcome::Invalid( + transaction, + InvalidTransactionError::Eip4844Disabled.into(), + ) + } + if transaction.is_l1_message() { return TransactionValidationOutcome::Invalid( transaction, InvalidTransactionError::TxTypeNotSupported.into(), @@ -232,7 +239,7 @@ where impl TransactionValidator for ScrollTransactionValidator where Client: ChainSpecProvider + StateProviderFactory + BlockReaderIdExt, - Tx: EthPoolTransaction, + Tx: EthPoolTransaction + ScrollTransaction, { type Transaction = Tx;