-
Notifications
You must be signed in to change notification settings - Fork 397
feat: implement TransactionEnvelope
derive macro
#2585
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
Conversation
84f8844
to
59d0743
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice,
a few nits,
before we merge this, can we prepare a patch pr to reth?
@@ -263,6 +268,187 @@ impl<'a, T: SignableTransaction<Signature> + arbitrary::Arbitrary<'a>> arbitrary | |||
} | |||
} | |||
|
|||
impl<T> Typed2718 for Signed<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah, we can easily add these trait impls, because Signed isn't deref so this shouldn't conflict
0ee585f
to
501fa10
Compare
f554ed6
to
997b6ce
Compare
997b6ce
to
7f8c746
Compare
242dd84
to
200d54c
Compare
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Motivation
We already maintain two almost identical transaction envelope implementations for
OpTxEnvelope
andEthereumTxEnvelope
which implement same traits on two different enums. Right now any user that wants to define their own transaction envelope would need to implement similar amount of boilerplate which affects ergonomics.Solution
This PR introduces
TransactionEnvelope
derive macro which allows us to deduplicate existing code and for new users to avoid writing it while also having a way to easily wrap an internal built-in type into a new envelope.The API is as following:
alloy/crates/consensus/src/transaction/mod.rs
Lines 566 to 575 in 33d20e2
Expansion for
EthereumTxEnvelope
:PR Checklist