It seems like From<ExportedCuckooFilter> for CuckooFilter<H> is assuming FINGERPRINT_SIZE is 1 byte, or that BUCKET_SIZE is referring to byte-count rather than fingerprint-count. This does not panic but deserializes the data incorrectly when FINGERPRINT_SIZE is changed.
To reproduce just change FINGERPRINT_SIZE to 2 and run cargo test.
Changing that line to .chunks(BUCKET_SIZE*FINGERPRINT_SIZE) fixes the bug. Or maybe introduce a separate constant that refers to the bucket size measured in byes. I'll be submitting a small PR if that's fine 🙂
It seems like
From<ExportedCuckooFilter> for CuckooFilter<H>
is assumingFINGERPRINT_SIZE
is 1 byte, or thatBUCKET_SIZE
is referring to byte-count rather than fingerprint-count. This does not panic but deserializes the data incorrectly whenFINGERPRINT_SIZE
is changed.https://github.com/axiomhq/rust-cuckoofilter/blob/67c9a4e266c4cdfc974226e5427d0a6912d73242/src/lib.rs#L296
To reproduce just change
FINGERPRINT_SIZE
to2
and runcargo test
.Changing that line to
.chunks(BUCKET_SIZE*FINGERPRINT_SIZE)
fixes the bug. Or maybe introduce a separate constant that refers to the bucket size measured in byes. I'll be submitting a small PR if that's fine 🙂