paradigmxyz / reth

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

Make txpool independent of primitive tx types #8668

Closed mattsse closed 1 month ago

mattsse commented 3 months ago

Describe the feature

we need a tx trait abstraction for these conversions:

https://github.com/paradigmxyz/reth/blob/c7338593aa898b1cc82ca5a467997f6962139305/crates/transaction-pool/src/traits.rs#L756-L764

https://github.com/paradigmxyz/reth/blob/c7338593aa898b1cc82ca5a467997f6962139305/crates/primitives/src/transaction/mod.rs#L1606-L1618

this likely requires additional associated types on the pool trait, where we use it, for example when returning the pooled variant. like type PooledTx; which then have the conversions

https://github.com/paradigmxyz/reth/blob/c7338593aa898b1cc82ca5a467997f6962139305/crates/transaction-pool/src/traits.rs#L44-L45

Update

after ##9916 we can continue with trying to gradually remove the bounds:

https://github.com/paradigmxyz/reth/blob/c71c8130329596990b9597958daef8b9773d1bdd/crates/transaction-pool/src/traits.rs#L761-L763

we can approach this by identifying where these are used, and trying to enforce these bounds there, for example T: Trasactionpool < Consensus = TransactionSignedEcRecovered> etc...

and also remove these types from the Transactionpool trait and use the AT instead, this likely requires some additional bounds or traits on the impl:

https://github.com/paradigmxyz/reth/blob/c71c8130329596990b9597958daef8b9773d1bdd/crates/transaction-pool/src/traits.rs#L223-L237

FYI @tcoratger in case you want to continue

Additional context

No response

JackG-eth commented 3 months ago

Will take this

JackG-eth commented 2 months ago

@mattsse Sorry for the delay, will be picking this up again now.