paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
3.85k stars 1.11k forks source link

Migrate from `TransactionSigned` to `alloy_consensus::Signed<T>` #11510

Open emhane opened 22 hours ago

emhane commented 22 hours ago

Describe the feature

Remove reth type

https://github.com/paradigmxyz/reth/blob/36de90fdc346bc3aacbfb311fa20b623d48ef867/crates/primitives/src/transaction/mod.rs#L1035-L1047

in favour of alloy_consensus::Signed<T, S>. In order to limit scope, it's recommended to introduce type alias

pub type TransactionSigned = Signed<reth_primitives::Transaction, alloy_primitives::Signature>;

blocked by https://github.com/paradigmxyz/reth/issues/11253

Additional context

No response

emhane commented 22 hours ago

Starting with turning TransactionSigned into a wrapper of alloy type should unblock this

#[derive(derive_more::Deref)]
pub struct TransactionSigned {
    #[deref]
    inner: Signed<Transaction, Signature>
}
klkvr commented 17 hours ago

current TransactionSigned is a bit different from how alloy handles transaction enums: https://github.com/alloy-rs/alloy/blob/de2a13340303db6dde1296f68df57078a5b1fdd8/crates/consensus/src/transaction/envelope.rs#L93-L115

there might be valid transactions with no signatures, eg right now we keep a dummy signature for deposit tx which is never encoded

should we consider refactoring TransactionSigned into an enum or embedding alloy's envelope right away?