-
Notifications
You must be signed in to change notification settings - Fork 765
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 11-bit mask in Bloom.check #311
Conversation
Is there a way to include tests for this? |
@gkaemmer I am also realizing though, that I am not the super-bloom filter expert. From reading up on this, I would says this is correct, but could you provide at least one (here in the comments) working code example where a value is not checked correctly before and checked correctly with the PR? |
@gkaemmer Would also be good if you could rebase on this occasion. |
ae5bcf6
to
22e5b2f
Compare
@holgerd77 Rebased on master. Here's a quick check:
|
@gkaemmer Ah, sorry, wasn't aware that this can be tested so easily and initialized without passing any value, this really needs better documentation. |
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.
Looks good, tested this locally, will merge.
I would have merged this after #315, so that unit tests can cover it. |
This is so obviously wrong and can very easily be tested manually. #315 may very well take 3-4 more weeks. |
I had the feeling #315 was kind of ready 😉 |
Fixes #303.
Page 5-6 of the Ethereum Yellow Paper specifies that the bloom filter take the low-order 11 bits from each of the first 3 pair of bytes of the hash. The proper bitmask for the low 11 bits is
2^11 - 1 = 2047
.For some reason the
check
function inbloom.js
only takes the low-order 9 bits using a mask of 511, socheck
always returns false.I think the
check
method is not used anywhere in this library (I only found this by trying to usebloom.js
in my own code), but probably still worth fixing.