alloy icon indicating copy to clipboard operation
alloy copied to clipboard

[Feature] Move `Withdrawal` struct

Open tcoratger opened this issue 1 year ago • 0 comments

Component

rpc

Describe the feature you would like

At the moment, especially in Reth, we need Withdrawal structure generally beyond the rpc crate. This requires defining a Withdrawal type in the Reth primitives and then using either this structure in the other crates or the structure coming from alloy as defined here:

https://github.com/alloy-rs/alloy/blob/48f1c0fbf6e22f09c1b3f297955f5acea0b0f99d/crates/rpc-types/src/eth/withdrawal.rs#L26-L38

But these structures are exactly equivalent and therefore their dual use creates confusion and type incompatibilities.

Recently, a Withdrawals structure which represents a vector of Withdrawal was also created in Reth primitives:

https://github.com/paradigmxyz/reth/blob/2bcdec94abcbe61fcf8fbae5a3ef62a52360f548/crates/primitives/src/withdrawal.rs#L42

In conclusion why not:

  • Move the definition of the Withdrawal structure to the core of alloy or to a more appropriate crate
  • Include the latest advances in Reth withdrawal primitives to complete the structure, add Withdrawals and possibly some unit tests
  • Completely remove Withdrawal from Reth primitives and only use the definition of alloy

cc @mattsse

Additional context

No response

tcoratger avatar Feb 07 '24 14:02 tcoratger