This document provides a comprehensive summary of the exhaustive authorization matrix test suite for milestone operations in the TalentTrust Escrow Soroban contract (Issue #21).
The test suite systematically verifies that all milestone-related actions enforce strict role-based authorization rules across all 4 release authorization modes (ClientOnly, ArbiterOnly, ClientAndArbiter, and MultiSig), validate contract state transitions, respect administrative pause controls, and permit unauthenticated access for read-only queries.
| Action | Admin | Client | Freelancer | Arbiter | Stranger | Deny Error Code |
|---|---|---|---|---|---|---|
approve_milestone_release (ClientOnly) |
❌ | ✅ | ❌ | ❌ | ❌ | EscrowError::UnauthorizedRole |
approve_milestone_release (ArbiterOnly) |
❌ | ❌ | ❌ | ✅ | ❌ | EscrowError::UnauthorizedRole |
approve_milestone_release (ClientAndArbiter) |
❌ | ✅ | ❌ | ✅ | ❌ | EscrowError::UnauthorizedRole |
approve_milestone_release (MultiSig) |
❌ | ✅ | ✅ | ❌ | ❌ | EscrowError::UnauthorizedRole |
release_milestone (ClientOnly) |
❌ | ✅ | ❌ | ❌ | ❌ | EscrowError::UnauthorizedRole |
release_milestone (ArbiterOnly) |
❌ | ❌ | ❌ | ✅ | ❌ | EscrowError::UnauthorizedRole |
release_milestone (ClientAndArbiter) |
❌ | ✅ | ❌ | ✅ | ❌ | EscrowError::UnauthorizedRole |
release_milestone (MultiSig) |
❌ | ✅ | ✅ | ❌ | ❌ | EscrowError::UnauthorizedRole |
submit_work_evidence |
❌ | ❌ | ✅ | ❌ | ❌ | EscrowError::UnauthorizedRole |
refund_unreleased_milestones |
❌ | ✅ | ❌ | ❌ | ❌ | EscrowError::UnauthorizedRole |
get_milestones |
✅ | ✅ | ✅ | ✅ | ✅ | (Read-only query, no auth required) |
get_milestone |
✅ | ✅ | ✅ | ✅ | ✅ | (Read-only query, no auth required) |
get_milestone_approvals |
✅ | ✅ | ✅ | ✅ | ✅ | (Read-only query, no auth required) |
get_approval_deadline |
✅ | ✅ | ✅ | ✅ | ✅ | (Read-only query, no auth required) |
get_work_evidence |
✅ | ✅ | ✅ | ✅ | ✅ | (Read-only query, no auth required) |
is_milestone_overdue |
✅ | ✅ | ✅ | ✅ | ✅ | (Read-only query, no auth required) |
Located in contracts/escrow/src/test/milestones_auth_matrix.rs, the test suite is structured into 6 distinct sections:
test_approve_milestone_release_matrix_client_only: Confirms onlyClientcan approve inClientOnlymode;Freelancer,Arbiter,Admin, andStrangerare denied withEscrowError::UnauthorizedRole.test_approve_milestone_release_matrix_arbiter_only: Confirms onlyArbitercan approve inArbiterOnlymode; all other roles are denied.test_approve_milestone_release_matrix_client_and_arbiter: Confirms bothClientandArbitercan approve; non-signers are denied.test_approve_milestone_release_matrix_multisig: Confirms bothClientandFreelancercan approve; non-participants are denied.
test_release_milestone_matrix_client_only: Validates release byClientafter approval, verifying unauthorized execution attempts by other roles are rejected.test_release_milestone_matrix_arbiter_only: Validates release byArbiterafter approval.test_release_milestone_matrix_client_and_arbiter: Validates release by eitherClientorArbiterafter requisite approval.test_release_milestone_matrix_multisig: Validates release by eitherClientorFreelancerafter dual approvals are recorded.
test_submit_work_evidence_matrix: Asserts that only the designatedFreelancercan submit deliverable evidence links;Client,Arbiter,Admin, andStrangercalls fail withEscrowError::UnauthorizedRole.
test_refund_unreleased_milestones_matrix: Asserts that only theClientcan trigger unreleased milestone refunds.
test_read_only_milestone_queries_auth_free: Iterates over all 5 roles (includingStranger) and asserts unauthenticated read access to:get_milestonesget_milestoneget_milestone_approvalsget_approval_deadlineget_work_evidenceis_milestone_overdue
test_milestone_actions_invalid_state_gates: Asserts that invoking milestone actions (approve_milestone_release,release_milestone,submit_work_evidence,refund_unreleased_milestones) on contracts inCreated(unfunded) orCompletedstates returnsError::InvalidStateorEscrowError::InvalidState.test_milestone_actions_blocked_when_paused: Verifies that when the contract is paused by the admin (escrow.pause(&admin)), all state-modifying milestone actions returnEscrowError::ContractPaused, and resume normal operations uponunpause(&admin).
contracts/escrow/src/test/milestones_auth_matrix.rs[NEW]- 530 lines of clean, modular Soroban Rust test code.
contracts/escrow/src/test/mod.rs[MODIFY]- Registered
mod milestones_auth_matrix;module declaration.
- Registered
- Branch:
test/milestones-21-authmatrix - Commit Message:
test(escrow): add exhaustive milestone authorization matrix test suite (#21)