Skip to content

Prevent small Bloom filters from matching every entry - #330

Open
Harshil-1603 wants to merge 2 commits into
petertodd:masterfrom
Harshil-1603:fix/minimum-bloom-filter
Open

Harshil-1603 wants to merge 2 commits into
petertodd:masterfrom
Harshil-1603:fix/minimum-bloom-filter

Conversation

@Harshil-1603

Copy link
Copy Markdown

For a small element count or a high false-positive rate, rounding can produce a zero-byte filter or zero hash functions. An empty filter then reports every entry as present. Clamp newly constructed filters to at least one byte and one hash function.

Closes #253.

The regression covers small element counts and multiple false-positive rates, verifies empty and inserted entries, checks protocol bounds, and round-trips serialization. Existing wire test vectors retain their values.

Validation: all 150 tests, Python compilation and diff checks passed. The regression failed before the fix and passed afterward.

AI assistance: OpenAI Codex, gpt-6.1-sol.

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.

Bloom filter problem when number of elements are low and FPRate is high

1 participant