Skip to content

[BOUNTY] Expand Contract Integration Test Coverage #14

@ANAVHEOBA

Description

@ANAVHEOBA

[BOUNTY] Expand Contract Integration Test Coverage

Description

Expand integration tests to cover all deposit/withdraw scenarios including error cases, edge cases, and concurrent operations. Ensure contract behaves correctly under all conditions.

Scope

Test Scenarios

Add to contracts/privacy_pool/src/integration_test.rs:

Deposit Tests:

  • Concurrent deposits from multiple users
  • Deposit with maximum commitment value
  • Deposit while paused (should fail)
  • Deposit before initialization (should fail)
  • Deposit with zero commitment (should fail)
  • Sequential deposits produce sequential indices
  • Merkle tree updates correctly after each deposit

Withdrawal Tests:

  • Withdrawal with valid proof
  • Withdrawal with stale root (old but still in history)
  • Withdrawal with unknown root (should fail)
  • Withdrawal with already-spent nullifier (should fail)
  • Withdrawal with invalid proof (should fail)
  • Withdrawal while paused (should fail)
  • Concurrent withdrawals with different notes

Admin Tests:

  • Initialize contract (success)
  • Double initialization (should fail)
  • Update verification key (admin only)
  • Pause/unpause (admin only)
  • Non-admin attempts admin operations (should fail)

State Tests:

  • Root history circular buffer behavior
  • Stale roots evicted after overflow
  • Nullifier tracking across deposits/withdrawals
  • View functions return correct state

Acceptance Criteria

  • At least 30 new integration test cases
  • All tests pass: cargo test
  • Test concurrent operations
  • Test all error conditions
  • Test state transitions
  • Document test scenarios
  • Code coverage >85%

Technical Notes

  • Use Soroban test environment
  • Test with realistic gas limits
  • Verify events are emitted correctly
  • Test storage efficiency

Labels: bounty,contracts,testing,priority: high

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions