Description
The README states the payment token is locked at the first successful deposit and all later deposits must match, returning PaymentTokenMismatch otherwise, with get_payment_token returning None before the first deposit. These invariants need direct tests: first-deposit locking, mismatch rejection, and pre-deposit None. Add a focused suite.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs (deposit_revenue, get_payment_token), src/payout_test.rs
- Use
try_* clients to assert PaymentTokenMismatch
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/payment-token-locking-tests
- Implement changes
- Assert
get_payment_token is None before any deposit
- Deposit with token A, then assert deposit with token B fails with
PaymentTokenMismatch
- Assert
get_payment_token returns A after the first successful deposit
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Deposit on unknown offering, repeated same-token deposits, mismatch on first override
- Include test output and security notes
Example commit message
test: cover payment token locking and mismatch enforcement
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
The README states the payment token is locked at the first successful deposit and all later deposits must match, returning
PaymentTokenMismatchotherwise, withget_payment_tokenreturningNonebefore the first deposit. These invariants need direct tests: first-deposit locking, mismatch rejection, and pre-depositNone. Add a focused suite.Requirements and context
src/lib.rs(deposit_revenue,get_payment_token),src/payout_test.rstry_*clients to assertPaymentTokenMismatchSuggested execution
git checkout -b feat/payment-token-locking-testsget_payment_tokenisNonebefore any depositPaymentTokenMismatchget_payment_tokenreturns A after the first successful depositTest and commit
cargo testExample commit message
test: cover payment token locking and mismatch enforcementGuidelines