Reconcile the deposit-to-release state gap that leaves Funded contracts unreleasable
Description
deposit::deposit_funds_impl in contracts/escrow/src/deposit.rs promotes a contract to ContractStatus::Funded once funded_amount >= total_amount. But release_milestone in contracts/escrow/src/lib.rs guards with if contract.status != ContractStatus::Accepted { panic InvalidState }. There is no entrypoint anywhere in the contract that transitions a contract from Funded to Accepted. The consequence is a hard dead-end: a fully funded contract can never have any milestone released, because the only status release_milestone accepts is unreachable through the normal lifecycle.
This issue reconciles the two ends of the state machine so that a funded contract is releasable. Pick one canonical contract: either have release_milestone accept Funded (and Accepted) contracts, or wire a real Funded → Accepted transition into the lifecycle and document it as the required pre-release step.
Requirements and context
- Repository scope: Talenttrust/Talenttrust-Contracts only.
- Audit which statuses each money-flow entrypoint expects (
deposit_funds, release_milestone, raise_dispute, refund_unreleased_milestones) and converge on a single documented progression.
- If
release_milestone is changed to accept Funded, keep all other gates (approvals, per-milestone funding, pause/emergency, finalization) intact.
- Ensure the chosen path does not silently allow releases on
Created, Disputed, Cancelled, Refunded, or Completed contracts.
- Update the
ContractStatus doc comments and any README/docs state-machine description to match the reconciled flow.
Suggested execution
- Fork the repo and create a branch
git checkout -b enhancement/contracts-deposit-release-state-gap
- Implement changes
- Write code in:
contracts/escrow/src/lib.rs — adjust the release_milestone status gate (and/or add the missing transition) so funded contracts are releasable.
- Write comprehensive tests in:
contracts/escrow/src/test/release.rs — assert a deposit-then-release happy path end to end, and that disallowed statuses still reject.
- Add documentation: update the
ContractStatus state-machine docs to show the canonical funded-to-release path.
- Include NatSpec-style doc comments (
///) describing the accepted statuses on release_milestone.
- Validate security assumptions: no release from a never-funded or terminal contract, no bypass of approval checks.
- Test and commit
Test and commit
- Run
cargo fmt --all -- --check, cargo build, and cargo test.
- Cover edge cases and failure paths: release attempt on
Created, Disputed, Cancelled, and Completed contracts.
- Include the full
cargo test output and a short security notes section in the PR description.
Example commit message
fix: reconcile deposit-to-release status gate so funded contracts are releasable
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the TalentTrust community on Discord for questions, reviews, and faster merges: https://discord.gg/WqnGpcPx
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Reconcile the deposit-to-release state gap that leaves Funded contracts unreleasable
Description
deposit::deposit_funds_implincontracts/escrow/src/deposit.rspromotes a contract toContractStatus::Fundedoncefunded_amount >= total_amount. Butrelease_milestoneincontracts/escrow/src/lib.rsguards withif contract.status != ContractStatus::Accepted { panic InvalidState }. There is no entrypoint anywhere in the contract that transitions a contract fromFundedtoAccepted. The consequence is a hard dead-end: a fully funded contract can never have any milestone released, because the only statusrelease_milestoneaccepts is unreachable through the normal lifecycle.This issue reconciles the two ends of the state machine so that a funded contract is releasable. Pick one canonical contract: either have
release_milestoneacceptFunded(andAccepted) contracts, or wire a realFunded → Acceptedtransition into the lifecycle and document it as the required pre-release step.Requirements and context
deposit_funds,release_milestone,raise_dispute,refund_unreleased_milestones) and converge on a single documented progression.release_milestoneis changed to acceptFunded, keep all other gates (approvals, per-milestone funding, pause/emergency, finalization) intact.Created,Disputed,Cancelled,Refunded, orCompletedcontracts.ContractStatusdoc comments and any README/docs state-machine description to match the reconciled flow.Suggested execution
git checkout -b enhancement/contracts-deposit-release-state-gapcontracts/escrow/src/lib.rs— adjust therelease_milestonestatus gate (and/or add the missing transition) so funded contracts are releasable.contracts/escrow/src/test/release.rs— assert a deposit-then-release happy path end to end, and that disallowed statuses still reject.ContractStatusstate-machine docs to show the canonical funded-to-release path.///) describing the accepted statuses onrelease_milestone.Test and commit
cargo fmt --all -- --check,cargo build, andcargo test.Created,Disputed,Cancelled, andCompletedcontracts.cargo testoutput and a short security notes section in the PR description.Example commit message
fix: reconcile deposit-to-release status gate so funded contracts are releasableGuidelines
Community & contribution rewards