Skip to content

Add deposit_revenue payment-token locking tests for PaymentTokenMismatch enforcement #375

@thlpkee20-wq

Description

@thlpkee20-wq

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

Metadata

Metadata

Assignees

No one assigned

    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