Skip to content

Add comprehensive unit and integration test coverage for all contracts #489

Description

@devJaja

Summary

Test coverage varies across contracts. agent_registry has extensive snapshot-backed tests, but other contracts have minimal or no test coverage. All contracts need comprehensive unit tests and integration tests before mainnet deployment.

Priority

P1 — Required for mainnet deployment confidence.

Files to work on

smart-contracts/contracts/*/src/tests.rs
smart-contracts/tests/integration/

Requirements

  • Audit test coverage for each contract using cargo tarpaulin or similar
  • Add unit tests for all public functions in:
    • agent_bidding: bid submission, reveal phase, winner selection, reputation weighting
    • agent_marketplace: listing, search, purchase, delivery confirmation
    • dispute_resolution: filing, evidence, voting, resolution
    • task_store: create, status transitions, history queries
    • upgrade-manager: proposal, approval, execution, rollback
  • Add integration tests that exercise cross-contract interactions
  • Add edge case tests: zero amounts, maximum batch sizes, unauthorized access, duplicate operations
  • Add snapshot tests for event emissions
  • Ensure all tests pass with cargo test --workspace

Acceptance Criteria

  • Every public function has at least 2 unit tests (happy path + error case)
  • Test coverage ≥ 80% for all contracts (line coverage)
  • Integration tests cover cross-contract flows (registry + bidding + payment)
  • Edge cases tested: zero amounts, empty vectors, duplicate IDs, unauthorized calls
  • All tests pass with cargo test --workspace
  • No #[ ignore ] tests without a documented reason and tracking issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions