Description
blacklist_add and blacklist_remove are documented as idempotent and issuer-only, and the blacklist is snapshotted into report_revenue events. Tests should confirm double-add does not duplicate, double-remove is a no-op, and that the blacklist vector embedded in rev_init/rev_ovrd events reflects the current set. Add this coverage including blacklist-over-whitelist precedence.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs (blacklist_add, blacklist_remove, is_blacklisted, get_blacklist, report_revenue)
- Confirm a non-issuer caller cannot mutate the blacklist
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/blacklist-idempotency-tests
- Implement changes
- Add same investor twice, assert
get_blacklist length unchanged
- Remove a non-present investor, assert no panic and no event drift
- Report revenue and assert event blacklist payload matches current set
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Empty blacklist snapshot, blacklist after transfer, blacklist+whitelist same address
- Include test output and security notes
Example commit message
test: cover blacklist idempotency and event snapshot fidelity
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
blacklist_addandblacklist_removeare documented as idempotent and issuer-only, and the blacklist is snapshotted intoreport_revenueevents. Tests should confirm double-add does not duplicate, double-remove is a no-op, and that the blacklist vector embedded inrev_init/rev_ovrdevents reflects the current set. Add this coverage including blacklist-over-whitelist precedence.Requirements and context
src/lib.rs(blacklist_add,blacklist_remove,is_blacklisted,get_blacklist,report_revenue)Suggested execution
git checkout -b feat/blacklist-idempotency-testsget_blacklistlength unchangedTest and commit
cargo testExample commit message
test: cover blacklist idempotency and event snapshot fidelityGuidelines