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

core/bloombits: handle non 8-bit boundary section matches #15489

Merged
merged 1 commit into from
Nov 15, 2017

Conversation

karalabe
Copy link
Member

In our bloombits matcher, we maintain matched blocks via a []byte bitset. After filtering the blocks and generating the final bitset, we iterate over the block interval and check whether they match according to the bitset.

Since the bitset contains bytes, if a bitset element is zero, we can skip ahead 8 blocks, since none of them will match. This has a subtlety that we got wrong. If we start filtering from a block number that's not a multiple of 8, then we can't skip ahead 8 blocks when finding a zero bitset element, only 8 - number % 8 elements, since skipping 8 would overlap with the next byte in the bitset.

This PR fixes it by only skipping 8 blocks if we're at a bitset byte boundary, otherwise just increment blocks 1-by-1 until we do reach a byte boundary.

Fixes #15309.

@karalabe karalabe added this to the 1.7.3 milestone Nov 15, 2017
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@slavik0329
Copy link

Thank god for this fix. Should be released. It's a pretty big issue

@karalabe
Copy link
Member Author

Will be on Monday.

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.

Log filtering doesn't work sometimes when fromBlock is specified
3 participants