Skip to content

Add cross-contract token transfer failure handling tests asserting TransferFailed and no partial state #378

@thlpkee20-wq

Description

@thlpkee20-wq

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
    • cargo test
  • 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

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions