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

fix: remove signature assoc type from tx response trait #1451

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

prestwich
Copy link
Member

Motivation

#1328 broke network abstraction by adding a signature assoc type to tx response. Some networks have multiple (or missing like in Optimism) signature types. Adding an assoc type here would require adding a signature abstraction enum on a per-network basis (e.g. optimism would require enum OpSigs { Ecdsa(Signature), Deposit }

In general, not all transactions on a network will have the same signature type, so mandating a specific associated type prevents accurately representing Optimism. The current fn signature(&self) -> Option<Self::Signature> (which handles the OP representation effectively), doesn't accurately model Ethereum in which all txns must have a signature.

Solution

Remove the signature associated type, which is unused within the library

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@prestwich prestwich force-pushed the prestwich/remove-sig-assoc-type branch from a098792 to ca9ba8e Compare October 13, 2024 15:08
Copy link
Member

@klkvr klkvr left a comment

Choose a reason for hiding this comment

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

agreed that Option here is not great

going from TransactionResponse to signature would be trivial once we enforce AsRef<TxEnvelope> in #1460, so this should be fine

cc @emhane wondering if we're already using this in reth?

@prestwich
Copy link
Member Author

cc @emhane wondering if we're already using this in reth?

grep shows it's unused in reth. checked all files that import or reference TransactionResponse

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.

should be fine to get the signature via new reth trait SignedTransaction::Signature. Op needs a specific transaction to remove optimism feature gated code, see paradigmxyz/reth#11573

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

makes sense, this was perhaps premature

@mattsse mattsse merged commit cfd2cc9 into main Oct 14, 2024
26 checks passed
@mattsse mattsse deleted the prestwich/remove-sig-assoc-type branch October 14, 2024 13:48
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.

4 participants