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 26 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.
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.
This seems to test the json marshal/unmarshal, but does not test the new marshal / unmarshal binary code.
We should add test coverage for the binary marshal / unmarshal as well.
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 use the same logic as we do it in
mandatoryForkOrder
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.
The expected output of
optionalForkOrder
is the same asmandatoryForkOrder
. However, to make things less error-proneOptionalFork
has a methodToFork
that will return the expected struct.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.
why is this returning
*params.UpgradeConfig
instead ofUpgradeConfigMessage
?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.
UpgradeConfigMessage
is the struct to represent the bytes, it is an intermediary struct. The real struct that is used everywhere else in the code isparams .UpgradeConfig
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 rename the function to reflect that?
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.
up?
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.
Is the name better now @ceyonur ?
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.
@ceyonur I think now it is better. I dropped all the intermediary types and I added MarshalBinary, UnmarshalBinary and Hash to the
UpgradeConfig
struct. That way it is cleaner and much simpler.I'm working now to re-structure the tests and add more coverage.