-
Notifications
You must be signed in to change notification settings - Fork 14
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
Use more strict types in node-(de)serialization #372
Conversation
root_hash: [u8; TRIE_HASH_LEN], | ||
attrs: NodeAttributes, | ||
is_encoded_longer_than_hash_len: Option<bool>, | ||
} |
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 is 100% stack-based and can actually be (de)serialized in one shot. I didn't do that here though, that can be done later if necessary.
@@ -368,45 +369,55 @@ impl Storable for Node { | |||
match meta_raw.as_deref()[TRIE_HASH_LEN + 1].try_into()? { | |||
NodeTypeId::Branch => { | |||
// TODO: add path | |||
// TODO: figure out what this size is? |
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 figure it out later, I promise.
743cf84
to
267c95d
Compare
4232be2
to
d1650bd
Compare
267c95d
to
ab20071
Compare
d1650bd
to
fd6e3b1
Compare
(for storage, not encoding)
fd6e3b1
to
49a0e8a
Compare
Use more strict types in node (de)serialization for storage. Strict type conversions eliminate some potential bugs in logic at compile-time.
This is the precursor to a more major refactor, moving storage (de)serialization implementations into the individual node-types.