-
Notifications
You must be signed in to change notification settings - Fork 129
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
chore(trie): merge leaf and branch in single node struct #2504
Conversation
91ffe79
to
8a9aeaa
Compare
Codecov Report
@@ Coverage Diff @@
## development #2504 +/- ##
===============================================
- Coverage 57.60% 57.30% -0.30%
===============================================
Files 218 215 -3
Lines 28662 28417 -245
===============================================
- Hits 16511 16285 -226
+ Misses 10464 10455 -9
+ Partials 1687 1677 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
8a9aeaa
to
c2af35d
Compare
56069ef
to
7312da8
Compare
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 wonder if this was possible by keeping node interface, moving common function into one struct and build leaf and branch using that common struct with the help of composition.
But, now that you have made this change, as long as all previous tests cases are covered it should be fine. Will revisit this in one more review!
I thought about this, but I really wanted to get rid of all the type assertions and have a 'dumb' single node 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.
Thanks for the review @kishansagathiya !
All your comments should be addressed now 😉
ea0b6ed
to
fddd63f
Compare
fddd63f
to
9308954
Compare
Co-authored-by: Eclésio Junior <[email protected]>
9308954
to
ae17eb0
Compare
ae17eb0
to
a509c65
Compare
Changes
ℹ️ the aim of this PR was to simplify and streamline encoding and decoding of nodes before moving to implement additional encoding/decoding for the v1 trie.
🆘 this is a substantial amount of changes, but most of it is just regex replacements in unit tests. All tests pass with the existing values, so it is quite safe 😉
Node
interfaceNode
structGetHash()
)Children
field from an array to a slice so it can be nil for leavesTests
go test -race ./internal/trie/... ./lib/trie/...
Issues
#2187
Primary Reviewer