Description
CalloraSettlement tracks a GlobalPool.total_balance and per-developer balances independently. There is no invariant test proving that the sum of all receive_payment amounts equals pool total + sum of developer balances. Add a randomized/property-style test in contracts/settlement/src/test.rs to catch accounting drift.
Requirements and Context
- Drive many randomized
receive_payment calls (mix of to_pool=true/false) and assert the conservation invariant.
- Include overflow-boundary credits near
i128::MAX.
- Add the invariant to
INVARIANTS.md.
- 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 task/settlement-conservation-invariant
- Implement changes
contracts/settlement/src/test.rs — invariant/property test
INVARIANTS.md — document the conservation invariant
- Test and commit
cargo test -p callora-settlement
- Cover overflow boundary
- Include test output and notes in the PR
Example commit message
test: assert settlement credit conservation invariant
Acceptance Criteria
Guidelines
.rs under contracts/settlement/src/, cargo test, /// docs, minimum 95% line coverage, no unwrap() in prod paths
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
CalloraSettlementtracks aGlobalPool.total_balanceand per-developer balances independently. There is no invariant test proving that the sum of allreceive_paymentamounts equalspool total + sum of developer balances. Add a randomized/property-style test incontracts/settlement/src/test.rsto catch accounting drift.Requirements and Context
receive_paymentcalls (mix ofto_pool=true/false) and assert the conservation invariant.i128::MAX.INVARIANTS.md.Suggested Execution
contracts/settlement/src/test.rs— invariant/property testINVARIANTS.md— document the conservation invariantcargo test -p callora-settlementExample commit message
Acceptance Criteria
INVARIANTS.mdGuidelines
.rsundercontracts/settlement/src/,cargo test,///docs, minimum 95% line coverage, nounwrap()in prod paths