-
Notifications
You must be signed in to change notification settings - Fork 599
[Feature] Remove associated constant from RlpEcdsaDecodableTx #2171
Description
Component
consensus, eips, genesis
Describe the feature you would like
the RlpEcdsaDecodableTx trait currently uses associated constants for some decoding functions
alloy/crates/consensus/src/transaction/rlp.rs
Line 119 in 852f046
| pub trait RlpEcdsaDecodableTx: RlpEcdsaEncodableTx { |
alloy/crates/consensus/src/transaction/rlp.rs
Lines 198 to 200 in 852f046
| fn eip2718_decode(buf: &mut &[u8]) -> Eip2718Result<Signed<Self>> { | |
| Self::eip2718_decode_with_type(buf, Self::DEFAULT_TX_TYPE) | |
| } |
this does not work for enum types.
while we can replace this const for encoding with Typed2718
alloy/crates/consensus/src/transaction/rlp.rs
Lines 11 to 13 in 852f046
| pub trait RlpEcdsaEncodableTx: Sized { | |
| /// The default transaction type for this transaction. | |
| const DEFAULT_TX_TYPE: u8; |
this does not work for decoding.
so we need to change the functions so that they don't use the constant.
the problematic functions are:
alloy/crates/consensus/src/transaction/rlp.rs
Lines 123 to 126 in 852f046
| fn rlp_decode_fields(buf: &mut &[u8]) -> alloy_rlp::Result<Self>; | |
| /// Decodes the transaction from RLP bytes. | |
| fn rlp_decode(buf: &mut &[u8]) -> alloy_rlp::Result<Self> { |
because the assume we can decode the fields. but this isn't enough for enums, which require 2718 byte
so we likely need to split this
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status