-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
core/types: add MarshalBinary, UnmarshalBinary for Receipt #22806
core/types: add MarshalBinary, UnmarshalBinary for Receipt #22806
Conversation
afa2589
to
1338110
Compare
The idea is pretty nice. Not sure if I like the verbosity in comments, especially for |
Would you prefer I remove the comment changes? It was not immediately clear why my receipt and transaction encodings (using Some of confusion around the The This makes sense from the definition of Transaction in EIP-2718: "Transaction is either TransactionType || TransactionPayload or LegacyTransaction" So the RLP encoding of Transaction is either But EIP-2718 also states "LegacyTransaction is rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])" So strictly following the same logic that is being used for a 2718 Transaction would suggest the output of |
@i-norden During the process of adding typed transactions, everyone got very confused about RLP, and there were very long pointless debates about the exact notation that would express the intent correctly. Looks like they got it wrong in the end. In practice it is really simple: legacy transactions are encoded exactly the same they always were, as an RLP list.
You shouldn't do this anyway, the documentation of |
1338110
to
df7ac83
Compare
That makes sense @fjl, thanks! I'll look into opening a PR against the EIP doc to clarify things. I rolled back the verbose comments. |
We can merge this after EIP-1559 is in. |
EIP-1559 (tx type 2) has landed, so this needs a rebase. |
3eb017f
to
de87f34
Compare
@fjl done, apologies for the delay! |
de87f34
to
0f5208b
Compare
0f5208b
to
bc52622
Compare
5cd9c3d
to
40d644c
Compare
These are analogous to the methods of the same name on the
Transaction
type. I think it is helpful to include methods for serializing/deserializing an individualReceipt
to/from the expected consensus encoding whether it is a legacy or a 2718/2930 type receipt, since Encode/DecodeRLP no longer does this for 2718/2930 receipts. Also added to the comments to help clarify the subtle difference in output between these serialization methods.