diff --git a/crates/common/types/transaction.rs b/crates/common/types/transaction.rs index ffa2400e426..c3bc9243944 100644 --- a/crates/common/types/transaction.rs +++ b/crates/common/types/transaction.rs @@ -42,6 +42,7 @@ pub enum Transaction { /// The same as a Transaction enum, only that blob transactions are in wrapped format, including /// the blobs bundle. +/// PrivilegedL2Transaction is not included as it is not expected to be sent over P2P. #[derive(Clone, Debug, PartialEq, Eq)] pub enum P2PTransaction { LegacyTransaction(LegacyTransaction), @@ -49,7 +50,6 @@ pub enum P2PTransaction { EIP1559Transaction(EIP1559Transaction), EIP4844TransactionWithBlobs(WrappedEIP4844Transaction), EIP7702Transaction(EIP7702Transaction), - PrivilegedL2Transaction(PrivilegedL2Transaction), } impl TryInto for P2PTransaction { @@ -61,9 +61,6 @@ impl TryInto for P2PTransaction { P2PTransaction::EIP2930Transaction(itx) => Ok(Transaction::EIP2930Transaction(itx)), P2PTransaction::EIP1559Transaction(itx) => Ok(Transaction::EIP1559Transaction(itx)), P2PTransaction::EIP7702Transaction(itx) => Ok(Transaction::EIP7702Transaction(itx)), - P2PTransaction::PrivilegedL2Transaction(itx) => { - Ok(Transaction::PrivilegedL2Transaction(itx)) - } _ => Err("Can't convert blob p2p transaction into regular transaction. Blob bundle would be lost.".to_string()), } } @@ -102,9 +99,6 @@ impl RLPDecode for P2PTransaction { // EIP7702 0x4 => EIP7702Transaction::decode_unfinished(tx_encoding) .map(|(tx, rem)| (P2PTransaction::EIP7702Transaction(tx), rem)), - // PrivilegedL2 - 0x7e => PrivilegedL2Transaction::decode_unfinished(tx_encoding) - .map(|(tx, rem)| (P2PTransaction::PrivilegedL2Transaction(tx), rem)), ty => Err(RLPDecodeError::Custom(format!( "Invalid transaction type: {ty}" ))), @@ -1439,7 +1433,6 @@ mod canonic_encoding { P2PTransaction::EIP1559Transaction(_) => TxType::EIP1559, P2PTransaction::EIP4844TransactionWithBlobs(_) => TxType::EIP4844, P2PTransaction::EIP7702Transaction(_) => TxType::EIP7702, - P2PTransaction::PrivilegedL2Transaction(_) => TxType::Privileged, } } @@ -1455,7 +1448,6 @@ mod canonic_encoding { P2PTransaction::EIP1559Transaction(t) => t.encode(buf), P2PTransaction::EIP4844TransactionWithBlobs(t) => t.encode(buf), P2PTransaction::EIP7702Transaction(t) => t.encode(buf), - P2PTransaction::PrivilegedL2Transaction(t) => t.encode(buf), }; } @@ -1482,9 +1474,6 @@ mod canonic_encoding { P2PTransaction::EIP7702Transaction(t) => { Transaction::EIP7702Transaction(t.clone()).compute_hash() } - P2PTransaction::PrivilegedL2Transaction(t) => { - Transaction::PrivilegedL2Transaction(t.clone()).compute_hash() - } } } } diff --git a/crates/networking/p2p/rlpx/connection/server.rs b/crates/networking/p2p/rlpx/connection/server.rs index 03c01c2c84f..6576a922b3f 100644 --- a/crates/networking/p2p/rlpx/connection/server.rs +++ b/crates/networking/p2p/rlpx/connection/server.rs @@ -589,6 +589,7 @@ async fn send_all_pooled_tx_hashes( .get_all_txs_by_sender()? .into_values() .flatten() + .filter(|tx| !tx.is_privileged()) .collect(); if !txs.is_empty() { state @@ -933,8 +934,11 @@ async fn handle_incoming_message( for tx in &txs.transactions { // Reject blob transactions in L2 mode #[cfg(feature = "l2")] - if is_l2_mode && matches!(tx, Transaction::EIP4844Transaction(_)) { - debug!(peer=%state.node, "Rejecting blob transaction in L2 mode - blob transactions are not supported in L2"); + if (is_l2_mode && matches!(tx, Transaction::EIP4844Transaction(_))) + || tx.is_privileged() + { + let tx_type = tx.tx_type(); + debug!(peer=%state.node, "Rejecting transaction in L2 mode - {tx_type} transactions are not broadcasted in L2"); continue; } diff --git a/crates/networking/p2p/tx_broadcaster.rs b/crates/networking/p2p/tx_broadcaster.rs index 0c9a219386d..f174c36be8a 100644 --- a/crates/networking/p2p/tx_broadcaster.rs +++ b/crates/networking/p2p/tx_broadcaster.rs @@ -193,7 +193,9 @@ impl TxBroadcaster { let full_txs = txs_to_broadcast .iter() .map(|tx| tx.transaction().clone()) - .filter(|tx| !matches!(tx, Transaction::EIP4844Transaction { .. })) + .filter(|tx| { + !matches!(tx, Transaction::EIP4844Transaction { .. }) && !tx.is_privileged() + }) .collect::>(); let blob_txs = txs_to_broadcast @@ -262,6 +264,7 @@ impl TxBroadcaster { .known_txs .get(&hash) .is_some_and(|record| record.peers.is_set(peer_idx)) + && !tx.is_privileged() }) .cloned() .collect::>();