Description
RevoraError::BlacklistSizeLimitExceeded exists but blacklist_add does not appear to enforce a per-offering cap, risking unbounded blacklist growth that degrades gas for get_blacklist and report_revenue (which snapshots the blacklist into events). Add a configurable per-offering maximum and enforce it in blacklist_add.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs (blacklist_add, get_blacklist, get_blacklist_size)
blacklist_add must remain idempotent and only callable by the current issuer
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/blacklist-size-cap
- Implement changes
- Add a
set_blacklist_size_limit issuer setter and a MAX_BLACKLIST_SIZE ceiling
- Return
BlacklistSizeLimitExceeded from blacklist_add when the cap is reached
- Skip the count for re-adds (idempotent) so the cap is not falsely triggered
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Adding at cap, idempotent re-add at cap, removing then re-adding
- Include test output and security notes
Example commit message
feat: enforce per-offering blacklist size cap in blacklist_add
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
RevoraError::BlacklistSizeLimitExceededexists butblacklist_adddoes not appear to enforce a per-offering cap, risking unbounded blacklist growth that degrades gas forget_blacklistandreport_revenue(which snapshots the blacklist into events). Add a configurable per-offering maximum and enforce it inblacklist_add.Requirements and context
src/lib.rs(blacklist_add,get_blacklist,get_blacklist_size)blacklist_addmust remain idempotent and only callable by the current issuerSuggested execution
git checkout -b feat/blacklist-size-capset_blacklist_size_limitissuer setter and aMAX_BLACKLIST_SIZEceilingBlacklistSizeLimitExceededfromblacklist_addwhen the cap is reachedTest and commit
cargo testExample commit message
feat: enforce per-offering blacklist size cap in blacklist_addGuidelines