-
Notifications
You must be signed in to change notification settings - Fork 459
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
Add RLP encoding and hashing for Blob txs #5593
Conversation
29a01a3
to
bb81773
Compare
3801dd6
to
47041d1
Compare
c27b96e
to
4d89363
Compare
47041d1
to
a675858
Compare
1147355
to
6cd7555
Compare
3ccb719
to
87c9443
Compare
87c9443
to
a3bab50
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.
Looks good - great, amazing work!
1101fee
to
97fdab9
Compare
97fdab9
to
11d43c4
Compare
3c1748e
to
7ba30a6
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.
Would be great to verify unit test coverage for TxDecoder and TxValidator. Other than that I added minor comments and I did extremely cosmetic changes in one commit
int networkWrapperCheck = 0; | ||
if ((rlpBehaviors & RlpBehaviors.InNetworkForm) == RlpBehaviors.InNetworkForm && transaction.HasNetworkForm) | ||
{ | ||
int networkWrapperLength = decoderContext.ReadSequenceLength(); |
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.
I put breakpoint here and I ran TxDecoder tests - looks like it wasn't covered
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.
ShardBlobTxDecoderTests is another piece that tests decoding, however negative cases are not covered by it
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.
You're right - it is covered!
transaction.ChainId = rlpStream.DecodeULong(allowLeadingZeroBytes: false); | ||
transaction.Nonce = rlpStream.DecodeUInt256(allowLeadingZeroBytes: false); | ||
transaction.GasPrice = rlpStream.DecodeUInt256(allowLeadingZeroBytes: false); // gas premium | ||
transaction.DecodedMaxFeePerGas = rlpStream.DecodeUInt256(allowLeadingZeroBytes: false); |
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.
I put breakpoint here and I ran TxDecoder tests - looks like it wasn't covered by tests
Amazing work - approved! |
/// Mempool form: TX_TYPE || [[chain_id, nonce, ...], <mempool wrapper fields> ]. | ||
/// See https://eips.ethereum.org/EIPS/eip-4844#networking | ||
/// </summary> | ||
InMempoolForm = 64, |
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.
Wouldn't it be better to have separated TxDecoders for MemPool form? We are already too deep into parameters.
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.
You need to consider wrapping and detect tx type before the decoding, a separated decoding seems to require code duplication with no big profit. Have no better idea for now yet
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.
Can we avoid code duplication with base abstract class?
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.
We can try to #5753 Refactor transaction decoder in the future
Encoding for shard blob transactions
Changes
SSZRLP encoding and hashing for blob txTypes of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Requires Cancun to be turned on for tests, #4558 has some help for that