Description
RevoraError::TransferFailed covers cross-contract token transfer failures during payout/deposit flows. The contract must not leave partial state (e.g. marking a period claimed, mutating balances) when the underlying token transfer reverts. Extend the cross-contract failure suite to assert atomicity and the typed error on a failing token.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs (deposit_revenue, claim flow, TransferFailed), src/test_cross_contract_transfer_fail.rs
- Use a mock token that fails transfer to assert rollback
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/transfer-failure-atomicity-tests
- Implement changes
- Deploy a token stub whose
transfer panics/fails
- Invoke deposit/claim and assert
TransferFailed (via try_*)
- Assert claimed flags and audit state are unchanged after failure
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Failure on first deposit, failure mid claim loop, retry after failure
- Include test output and security notes
Example commit message
test: assert atomic rollback on cross-contract transfer failure
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
RevoraError::TransferFailedcovers cross-contract token transfer failures during payout/deposit flows. The contract must not leave partial state (e.g. marking a period claimed, mutating balances) when the underlying token transfer reverts. Extend the cross-contract failure suite to assert atomicity and the typed error on a failing token.Requirements and context
src/lib.rs(deposit_revenue, claim flow,TransferFailed),src/test_cross_contract_transfer_fail.rsSuggested execution
git checkout -b feat/transfer-failure-atomicity-teststransferpanics/failsTransferFailed(viatry_*)Test and commit
cargo testExample commit message
test: assert atomic rollback on cross-contract transfer failureGuidelines