Skip to content

Advanced Caching: Bloom Filter for Known-Bad Address Lookup #243

@0xVida

Description

@0xVida

Description:
Use a Bloom filter for constant-time lookups of known-bad Stellar addresses in the blocklist.

Requirements and Context:
Checking a DB table for every incoming address lookup under high TPS is too slow. A Bloom filter reduces this to O(1) with near-zero memory.

Acceptance Criteria:

  • Bloom filter built from the blocklist on server startup
  • Updated incrementally when new addresses are added to the blocklist
  • False positive rate < 0.1% (configured via filter size)
  • Benchmarks comparing filter vs DB lookup latency

Deliverables:

  • Implementation of the above criteria
  • Tests or proof of correct behaviour

NOTE: This issue will NOT be reviewed or approved without evidence (screenshot, log, or test output) demonstrating the feature works as described.

Suggested Execution:

  1. Use the bloom-filters npm package
  2. Pre-populate from the DB blocklist on startup
  3. Subscribe to blocklist update events to rebuild the filter

Guidelines:

  • Follow the existing project coding conventions
  • All new environment variables must be documented in .env.example
  • Phase: Phase 14: Performance

Example Commit Message:

perf: bloom filter for constant-time blocklist address lookup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions