Description
RevenuePool::batch_distribute (contracts/revenue_pool/src/lib.rs) sums and transfers each (Address, i128) leg but never checks for duplicate recipients within the same batch. A malformed off-chain payload listing the same developer twice silently double-pays. Add optional duplicate detection and clear semantics.
Requirements and Context
- Detect duplicate
to addresses within a single payments vector and either reject or document/merge per agreed policy.
- Keep the existing total-then-transfer atomicity and
MAX_BATCH_SIZE cap.
- Emit events reflecting the final per-recipient amount.
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/revenue-pool-dedup-recipients
- Implement changes
contracts/revenue_pool/src/lib.rs — duplicate handling in batch_distribute
contracts/revenue_pool/BATCH_TRANSFER_IMPLEMENTATION.md — document policy
- Test and commit
cargo test -p callora-revenue-pool
- Test duplicate-recipient batches behave per policy
- Include test output and notes in the PR
Example commit message
feat: handle duplicate recipients in revenue pool batch_distribute
Acceptance Criteria
Guidelines
.rs under contracts/revenue_pool/src/, cargo test, /// docs, minimum 95% line coverage, no unwrap() in prod paths
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
RevenuePool::batch_distribute(contracts/revenue_pool/src/lib.rs) sums and transfers each(Address, i128)leg but never checks for duplicate recipients within the same batch. A malformed off-chain payload listing the same developer twice silently double-pays. Add optional duplicate detection and clear semantics.Requirements and Context
toaddresses within a singlepaymentsvector and either reject or document/merge per agreed policy.MAX_BATCH_SIZEcap.Suggested Execution
contracts/revenue_pool/src/lib.rs— duplicate handling inbatch_distributecontracts/revenue_pool/BATCH_TRANSFER_IMPLEMENTATION.md— document policycargo test -p callora-revenue-poolExample commit message
Acceptance Criteria
Guidelines
.rsundercontracts/revenue_pool/src/,cargo test,///docs, minimum 95% line coverage, nounwrap()in prod paths