Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 handshake codec #762
base: master
Are you sure you want to change the base?
Add handshake codec #762
Changes from 34 commits
0f72644
89bf82c
19e0d18
30b8aaa
4a59b8a
acc8195
a0ceae8
c5d86a4
b6f8a33
453c84d
7c507ac
9c954d5
a27ecc8
771d511
c261ce2
6fff967
e3601b0
cade28f
6b96e44
a2848d7
d996f99
758441f
634e9b5
d1b37c4
eef61dd
541acd7
2309af5
74e25d5
f1d3d07
55f4b95
d9851ca
1946de4
2efae3d
6785dd9
32486fe
8bc4f87
2de9095
3a1bd28
b2020cb
beb7ab8
8192cb2
b86226d
8935259
5c88c08
1819327
e079719
17bf11e
91bdff5
a593a68
987017b
19b3073
e8ffb13
550f7c0
a08d746
e0b4b61
1bf4664
ac0e945
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 add some comments here why these are important, how these can be implemented etc?
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.
what is this used for? this look a bit weird.
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.
It will return a list of fields to be serialized, in that order. This list is being used to deserialize and serialize. It is just less error prone this way I think.
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.
@aaronbuchwald Is this kinda of code not desired? It is a canonical list of numbers and how they are marshal and unmarshal. It is way error prone and it takes advantage of the pointer to a pointer.
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 see this is trying to make the code simpler by passing a list of pointers to pointers so we can serialize and de-serialize with a for loop instead of one by one.
It's not valid for any of these to be nil, so would it be possible to remove the double pointer and enforce that all of them are non-nil instead of allowing a boolean to indicate whether or not it's nil?
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.
Fixed in 2de9095
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 add the following test cases for the serialization of
FeeConfig
: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.
Do we need these headers? I believe these are typically used to signal what type of data they include, but we should know that when serializing/de-serializing, so I don't think these should be necessary.
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.
Fixed in 8935259, instead I'm having a deterministic serialization
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 should probably move all of these to a separate
upgrade_config
file in the same package.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.
Let's switch to packing the number of elements of each type, so that we can proceed through field by field and unpack the number of elements, all of the elements of that type, and then proceed to the next field.
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.
Fixed in 8935259
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.
Could you re-phrase this comment, it seems like some variable names have changed
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 think I made it way better in 1819327
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.
Requiring this function from params package in precompiles will create a cyclic dependency most likely. I think this assertion can be reduced as suggested. So we can just readd these assertions in relevant test files without requiring to import from params package.
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.
When will this fail because we do it three times instead of two?
If
newBytes
is the same asbytes
(which should be confirmed by checking that the hashes match), then I don't think thattwiceDeserialized
provides additional coverage. Afaict this will fail ifUnmarshalBinary
is itself non-deterministic on the SAME bytes.