Skip to content

Commit

Permalink
fix: return error on type 0 enveloped decoding (#7339)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Mar 26, 2024
1 parent 8e1d781 commit bdca722
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,13 +1333,14 @@ impl TransactionSigned {
let Ok(tx_type) = TxType::try_from(tx_type) else {
return Err(RlpError::Custom("unsupported typed transaction type"))
};

let transaction = match tx_type {
TxType::Eip2930 => Transaction::Eip2930(TxEip2930::decode_inner(data)?),
TxType::Eip1559 => Transaction::Eip1559(TxEip1559::decode_inner(data)?),
TxType::Eip4844 => Transaction::Eip4844(TxEip4844::decode_inner(data)?),
#[cfg(feature = "optimism")]
TxType::Deposit => Transaction::Deposit(TxDeposit::decode_inner(data)?),
TxType::Legacy => unreachable!("path for legacy tx has diverged before this method"),
TxType::Legacy => return Err(RlpError::Custom("unexpected legacy tx type")),
};

#[cfg(not(feature = "optimism"))]
Expand Down

0 comments on commit bdca722

Please sign in to comment.