Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consensus: impl recover_signers for BlockBody<TxEnvelope> #1541

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tcoratger
Copy link
Contributor

Related paradigmxyz/reth#11208

The ideal for the reth issue is to restrict the functions to be implemented as much as possible to the alloy Transaction trait however it doesn't make much sense to add a recover_signer or recover_signers method to the Transaction trait because we can only fetch the signer in the Signed<Tx> case, which is almost never the case when trying to implement Transaction.

So I think the simplest approach to replace https://github.com/paradigmxyz/reth/blob/0270128d4f7a9f6fad27dff69273095abdfa7452/crates/primitives/src/block.rs#L564-L566 is to do the similar implementation here in alloy using what already exists in TxEnvelope to recover the signers from an iterator of transactions TxEnvelope.

Copy link
Contributor

@emhane emhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure if it makes sense to wrap the signed tx via TxEnvelope in the block body. the semantics are more straight forward if the sender recovery methods end up in a new trait SignedTransaction alongside SignableTransaction

@tcoratger
Copy link
Contributor Author

tcoratger commented Oct 21, 2024

@emhane Maybe we should keep this for a follow up PR right? My reasoning was as follows:

  • Currently in reth, the BlockBody contains a vector of TransactionSigned
  • In alloy we don't have a TransactionSigned type but we have the TxEnvelope type which is equivalent because it is an enum that contains all the Signed variants.
    • In addition we already have the recover_signer method which is already implemented for TxEnvelope.
    • So I thought it would be rather logical to make an implementation of BlockBody<TxEnvelope> to use it in reth. But maybe if we want to be even more generic we could open a follow up issue to move the recover_signer and recover_signers methods to the appropriate traits right?

cc @mattsse

@mattsse mattsse requested a review from klkvr as a code owner December 27, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants