Skip to content

[Feature] Remove associated constant from RlpEcdsaDecodableTx #2171

@mattsse

Description

@mattsse

Component

consensus, eips, genesis

Describe the feature you would like

the RlpEcdsaDecodableTx trait currently uses associated constants for some decoding functions

pub trait RlpEcdsaDecodableTx: RlpEcdsaEncodableTx {

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

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:

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

c-consensusPertaining to the consensus cratediscussneeds discussionenhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions