-
Notifications
You must be signed in to change notification settings - Fork 234
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
[wip] feat: embed TxEnvelope
into rpc_types::Transaction
#1169
Conversation
@@ -205,7 +204,7 @@ mod tests { | |||
"type": "0x2", | |||
"accessList": [], | |||
"chainId": "0x1", | |||
"v": "0x0", | |||
"yParity": "0x0", |
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.
breaking change?
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.
v
on non-legacy transactions is deprecated, so that's a serialization change, deser should be fine
though we've decided to test this before merging
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.
bc7b4d5
to
3fb8b53
Compare
The only breaking change this PR adds is for serde roundrip for This might only result in incorrect payload for legacy transactions as for them
Which likely means that it is safe to expect I've changed test fixtures because they contained |
Closing in favor of #1460 |
Motivation
Closes #1165
Solution
Envelope
generic for rpc transaction which isconsensus::TxEnvelope
by default. ForAnyNetwork
we need a catch-all envelope, so I've extracted currentrpc_types_eth::Transaction
without block-related fields intoAnyTxEnvelope
type.Serialize
andDeserialize
forTxType
. It deserializes asOption<U8>
withNone
representing legacy and serializes asU8
.TxEnvelope
to use custom deserialize impl to handle case of missingtype
field as legacy tx.After this PR,
Transaction
will only implement arbitrary ifk256
feature is enabled because of similar requirement onSignedAuthorization
. I think this makes sense and believe we also want to add similar restriction forArbitrary
impl onSigned<T>
which will only produce valid transactions.At this point we are maintaining 6 very similar serde schemes + rlp encoding implementations for different tx holding types (5 tx types +
AnyTxEnvelope
). Wondering if we should add a macro for generating those so that serde attrs for e.g.gas
are only defined once?PR Checklist