mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
fix: check encoded size (#16473)
This commit is contained in:
@@ -1151,7 +1151,6 @@ impl PoolTransaction for EthPooledTransaction {
|
||||
}
|
||||
|
||||
fn from_pooled(tx: Recovered<Self::Pooled>) -> Self {
|
||||
let encoded_length = tx.encode_2718_len();
|
||||
let (tx, signer) = tx.into_parts();
|
||||
match tx {
|
||||
PooledTransactionVariant::Eip4844(tx) => {
|
||||
@@ -1161,11 +1160,14 @@ impl PoolTransaction for EthPooledTransaction {
|
||||
let tx = Signed::new_unchecked(tx, sig, hash);
|
||||
let tx = TransactionSigned::from(tx);
|
||||
let tx = Recovered::new_unchecked(tx, signer);
|
||||
// we only need the encoded length of the transaction, excluding the blob sidecar
|
||||
let encoded_length = tx.encode_2718_len();
|
||||
let mut pooled = Self::new(tx, encoded_length);
|
||||
pooled.blob_sidecar = EthBlobTransactionSidecar::Present(blob);
|
||||
pooled
|
||||
}
|
||||
tx => {
|
||||
let encoded_length = tx.encode_2718_len();
|
||||
// no blob sidecar
|
||||
let tx = Recovered::new_unchecked(tx.into(), signer);
|
||||
Self::new(tx, encoded_length)
|
||||
|
||||
@@ -318,11 +318,11 @@ where
|
||||
};
|
||||
|
||||
// Reject transactions over defined size to prevent DOS attacks
|
||||
let tx_input_len = transaction.input().len();
|
||||
if tx_input_len > self.max_tx_input_bytes {
|
||||
let tx_len = transaction.encoded_length();
|
||||
if tx_len > self.max_tx_input_bytes {
|
||||
return Err(TransactionValidationOutcome::Invalid(
|
||||
transaction,
|
||||
InvalidPoolTransactionError::OversizedData(tx_input_len, self.max_tx_input_bytes),
|
||||
InvalidPoolTransactionError::OversizedData(tx_len, self.max_tx_input_bytes),
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user