Description
get_blacklist returns the entire blacklist for a token in one call, which can exceed gas limits for large lists and is also embedded into report_revenue events. Promote get_blacklist_page as the primary read path with a documented deterministic cursor and a hard cap, and have internal snapshots use a bounded form.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs (get_blacklist, get_blacklist_page, get_blacklist_size, report_revenue)
- Ordering must remain insertion order and deterministic
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/blacklist-pagination-hardening
- Implement changes
- Cap
get_blacklist_page limit at MAX_PAGE_LIMIT and return next_cursor
- Document that
get_blacklist is bounded/legacy and prefer the paged form off-chain
- Ensure
report_revenue snapshot uses a bounded read to avoid unbounded event payloads
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Empty blacklist, single page, multi-page, cursor exhaustion, over-cap limit
- Include test output and security notes
Example commit message
feat: harden blacklist pagination and bound event snapshots
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
get_blacklistreturns the entire blacklist for a token in one call, which can exceed gas limits for large lists and is also embedded intoreport_revenueevents. Promoteget_blacklist_pageas the primary read path with a documented deterministic cursor and a hard cap, and have internal snapshots use a bounded form.Requirements and context
src/lib.rs(get_blacklist,get_blacklist_page,get_blacklist_size,report_revenue)Suggested execution
git checkout -b feat/blacklist-pagination-hardeningget_blacklist_pagelimitatMAX_PAGE_LIMITand returnnext_cursorget_blacklistis bounded/legacy and prefer the paged form off-chainreport_revenuesnapshot uses a bounded read to avoid unbounded event payloadsTest and commit
cargo testExample commit message
feat: harden blacklist pagination and bound event snapshotsGuidelines