-
Notifications
You must be signed in to change notification settings - Fork 181
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
Implement BitArray
and replace trie.Key
#2322
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2322 +/- ##
==========================================
+ Coverage 74.49% 74.85% +0.36%
==========================================
Files 110 110
Lines 11771 11888 +117
==========================================
+ Hits 8769 8899 +130
+ Misses 2323 2317 -6
+ Partials 679 672 -7 ☔ View full report in Codecov by Sentry. |
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.
Just some comments. Let. me know what you think. Thanks for detailing the implementation!
ad6a3ba
to
41fc99c
Compare
beef941
to
c7fd009
Compare
c7fd009
to
2692494
Compare
This PR implements a new data structure
BitArray
to replacetrie.Key
. The reasons being:Misleading representation
trie.Key
doesn't actually just represent a Trie key in our use case. But rather, it’s a special data type that we use to just represent a fixed size of bit array with the number of bits used specified.Inefficient operations
The current implementation of the bitwise operations is scattered all around the place. We implement ourselves for some, and for others, we rely on conversion.
BitArray
implements everything from scratch without unnecessary conversion.Regarding
BitArray
:trie.Key
Credits: some implementation details are inspired by
https://github.com/holiman/uint256