Skip to content

Implement alloy Encodable2718 and Decodable2718 for reth transaction types #11153

Closed

Description

Describe the feature

currently we use our own native functions for:

/// Returns the enveloped encoded transactions.
///
/// See also [`TransactionSigned::encode_enveloped`]
pub fn envelope_encoded(&self) -> Bytes {
let mut buf = Vec::new();
self.encode_enveloped(&mut buf);
buf.into()
}
/// Encodes the transaction into the "raw" format (e.g. `eth_sendRawTransaction`).
/// This format is also referred to as "binary" encoding.
///
/// For legacy transactions, it encodes the RLP of the transaction into the buffer:
/// `rlp(tx-data)`
/// For EIP-2718 typed it encodes the type of the transaction followed by the rlp of the
/// transaction: `tx-type || rlp(tx-data)`
pub fn encode_enveloped(&self, out: &mut dyn bytes::BufMut) {
self.encode_inner(out, false)
}

we will move more things to alloy traits and encoding is one thing so we should transition this already to alloy's traits

TODO:

  • replace reth envelope functions with trait impl

easiest way to update this across the codebase is to first rename the reth function, then impl the trait and remove reth function, then import trait where this is called

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-sdkRelated to reth's use as a libraryC-enhancementNew feature or request

Type

No type

Projects

  • Status

    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions