-
Notifications
You must be signed in to change notification settings - Fork 11
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
(De)serialization of Merkle Nodes #98
Conversation
- Add 'ToString' too
- Use leftover - Rename size to 'MaxByteLength' for consistency
- The constructor is pedantic on the actual size of the Span
All writes return the leftover, so we change the name for consistency
- Returns a `Span<byte>` to the exact encoding
All nodes now have both a |
All serialization tests now work like this, and they also validate 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.
One comment about the leftover. Let me know what you think
public Span<byte> WriteTo(Span<byte> output) | ||
{ | ||
Bytes.CopyTo(output); | ||
return output.Slice(Size); |
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.
If they write with Leftover
it's up to the caller to get the actual payload? I'd provide just WriteTo
(the usual case will be the caller serializing and playing with the payload) or the two. If needed, later we can refactor towards a struct that handles both cases;
- Includes a better 'ToString'
Included support for optional Keccaks on |
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 GO!
Add a new namespace
Merkle
which describes Merkle constructs. For now, we describe Merkle Nodes and their corresponding (de)serialization methods. The current nodes are:Test suite is included (98% coverage).