Skip to content
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

feat: add a few usability functions to the interface #169

Merged
merged 9 commits into from
May 9, 2024

Conversation

vladimir-trifonov
Copy link
Contributor

feat: add a few usability functions to the interface

Issue: #67

@github-actions github-actions bot added the crate: mpt_trie Anything related to the mpt_trie crate. label Apr 18, 2024
Copy link
Contributor

@BGluth BGluth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

#[test]
fn nibbles_as_byte_slice_works() -> Result<(), StrToNibblesError> {
let cases = [
(0x0, vec![]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this is good. Just reviewed what to_nibbles does for unsigned integers, and the 0x0 case also goes to an empty Nibbles and not the zero key.

Just an aside, but do you think this is good default behavior? Is this what you would expect, or should 0x0 map to the key 0x0 instead of empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specifically in the context of nibbles empty makes more sense to me instead of 0x0, but it is debatable

mpt_trie/src/nibbles.rs Show resolved Hide resolved
Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :)

@Nashtare Nashtare added this to the Cleanups and Misc. milestone Apr 24, 2024
@muursh
Copy link
Contributor

muursh commented Apr 29, 2024

Can we update the changelog and we'll merge

@muursh muursh merged commit b7e1774 into develop May 9, 2024
6 checks passed
@muursh muursh deleted the add-fns-to-the-interface branch May 9, 2024 16:58
Nashtare pushed a commit that referenced this pull request May 20, 2024
* feat: add a few usability functions to the interface

* fix: fix clippy issue

* feat: add usize to nibbles

* docs: update changelog.md

---------

Co-authored-by: Vladimir Trifonov <[email protected]>
Co-authored-by: Ben <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: mpt_trie Anything related to the mpt_trie crate.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants