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

Added additional tests to cover HexaryTrie MPT proofs. #650

Merged
merged 2 commits into from
Dec 22, 2023

Conversation

bhartnett
Copy link
Contributor

No description provided.

@bhartnett bhartnett requested a review from kdeme December 21, 2023 08:13

check:
trie.rootHash == keccakHash(emptyRlp)
proof.len() == 1 # Maybe this should return an empty list?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense that it is len() == 1 considering it drops in the empty rlp value?

The fact that the result is InvalidProof is however inconsistent for when you would add a "not-exist` into a not empty trie. The emptry trie thing is quite the edge case though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it is an edge case so probably not worth spending too much time on. I raised it because I noticed that this library behaves differently than the Rust implementation which returns an empty proof when the trie is empty.

Copy link
Contributor

@kdeme kdeme Dec 21, 2023

Choose a reason for hiding this comment

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

I'd suggest to add a Note in comment that explains this and perhaps also link to this rust library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do

let db = newMemoryDB()
var trie = initHexaryTrie(db)

let
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed quite some trailing whitespace in this and previous PR. You might want to setup up some marking and/or trimming of that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean at the bottom of the file? Or spaces after the let?

Copy link
Contributor

Choose a reason for hiding this comment

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

spaces after the let and some other locations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok thanks

@bhartnett
Copy link
Contributor Author

@kdeme I've updated the code as you suggested. Ready for the final review. Thanks

@bhartnett bhartnett merged commit 5aaeb67 into master Dec 22, 2023
4 of 8 checks passed
@bhartnett bhartnett deleted the additional-hexary-proof-tests branch December 22, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants