Description
The testnet faucet must throttle per-address requests to prevent abuse. Enforce a configurable cooldown between requests and reject early requests with a structured error.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/test_faucet_seed.rs
- Cooldown persisted per address
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/faucet-rate-limit
- Implement changes
- Persist
last_request_ts per address
- Reject with
FaucetCooldownActive if within cooldown
- Emit
faucet_cooldown_reject event
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Include test output and security notes
Example commit message
feat: add faucet per-address cooldown
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
The testnet faucet must throttle per-address requests to prevent abuse. Enforce a configurable cooldown between requests and reject early requests with a structured error.
Requirements and context
src/test_faucet_seed.rsSuggested execution
git checkout -b feat/faucet-rate-limitlast_request_tsper addressFaucetCooldownActiveif within cooldownfaucet_cooldown_rejecteventTest and commit
cargo test --allExample commit message
feat: add faucet per-address cooldownGuidelines