Skip to content

feat: implement rate limiting and anti-spam for bets and events #259

@greatest0fallt1me

Description

@greatest0fallt1me

Description:

Implement configurable rate limiting (e.g., max bets per user per time window, max events per admin) to reduce spam and abuse.

Requirements and Context:

  • Must be secure, tested, and documented
  • Should allow admin to set rate limits (e.g., per user per event or global)
  • Should enforce limits in place_bet and optionally in create_event
  • Should use time windows (e.g., last N ledger closes or seconds)
  • Should emit clear error when limit exceeded
  • Must not block legitimate high-volume use with reasonable limits

Suggested Execution:

  1. Fork the repo and create a branch

    git checkout -b feature/rate-limiting
  2. Implement changes

    • Write contract: src/lib.rs (rate limit checks)
    • Add rate_limiter module: src/rate_limiter.rs
    • Update storage and validation; add documentation and NatSpec-style comments
  3. Test and commit

    • Run tests; cover at limit, over limit, window expiry
    • Include test output and security notes

Example Commit Message:

feat: implement rate limiting and anti-spam for bets and events

Guidelines:

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 72 hours

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions