Repository navigation
feat(contracts): add milestone deadlines and time-locked escrow protections to escrow contract - #232
devkylian-tech wants to merge 3 commits into
Conversation
|
@devkylian-tech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Resolves merge conflicts with Lumina-eX/TaskChain@main (base d623865) so the pull request can be merged. Auto-merged via the GitHub API.
|
Merge conflict with Pushed merge commit Conflicting file(s) resolved:
The pull request is mergeable again — CI will re-run on the new head. @SudiptaPaul-31 ready for review and merge when you have a moment. |
Resolves merge conflicts with Lumina-eX/TaskChain@main (base d623865) so the pull request can be merged. Auto-merged via the GitHub API.
|
@devkylian-tech ci failing |
|
@SudiptaPaul-31 CI fixed — What was red: Fixed in
Verification (Rust toolchain, on the branch tree): The workflow run for the new head may sit as |
Overview
Adds time-locked escrow protections to the Soroban
escrowcontract. Each milestone already carried adeadlinefield; this change completes the lifecycle around it — authorized deadline set/extend, on-chain expiry detection, client-initiated refunds after expiry, dispute lock-out, and guards that block submission/approval/release once a deadline has elapsed. New deadline events are published:DeadlineSet,DeadlineExtended,DeadlineExpired(alongside the existingRefundIssued).Related Issue
#221 — [Feature]: Time-Locked Escrow & Milestone Deadlines
Changes
Escrow contract (
contracts/contracts/escrow/src/lib.rs)set_deadline(milestone_id, caller, deadline)require_auth+ role check restricts it to the client or arbiter; past deadlines are rejected (InvalidDeadline) and the call emitsDeadlineSet.extend_deadline(milestone_id, caller, new_deadline)Expired -> Extendedtransition and emitsDeadlineExtended.claim_expired_refund(milestone_id, caller)env.ledger().timestamp() > milestone.deadline. RefundsFunded/Submittedmilestones and emitsDeadlineExpired+RefundIssued. Milestones with an open dispute stay locked (MilestoneDisputed) pending arbitration.approveandreleaseDeadlineExceededwhen the milestone deadline has elapsed, so expired work can no longer be approved or paid out.auto_expireDeadlineExpirednext to the existingMilestoneExpiredevent.DeadlineNotExpired (13),InvalidDeadline (14),DeadlineAlreadySet (15),MilestoneDisputed (16), plus theDeadlineSet,DeadlineExtended, andDeadlineExpiredevents.Tests (
contracts/contracts/escrow/src/test.rs)DeadlineExpiredemission.contracts/contracts/escrow/test_snapshots/test/*.jsonfiles for the new tests.Verification Results
Ran the repo's real Rust test command in a local checkout (REST tarball of
main):All 42 tests pass — the 21 pre-existing tests (unchanged behaviour, since milestones with
deadline == 0skip the new guards) plus the 21 new tests. No compiler warnings were produced.Also ran the repo's real contract build (
stellar contract build, stellar-cli 27.0.0), which produced an optimized wasm exposing the new entrypoints:approve/releasereturnDeadlineExceeded(#11);test_approve_after_deadline_expired_fails,test_release_after_deadline_expired_failsset_deadline/extend_deadlinerequire auth and check the caller role, elseUnauthorized(#7)claim_expired_refundrefunds Funded/Submitted;Disputedstays locked (#16)test_multiple_milestones_expiring_simultaneouslytest_dispute_can_be_raised_after_expiry,test_claim_refund_locked_when_disputed_after_expiry,test_arbiter_resolves_dispute_raised_after_expirytest_client_refund_after_expiry_when_funded_no_submissionDeadlineSet,DeadlineExpired,DeadlineExtended,RefundIssuedset_deadline,auto_expire/claim_expired_refund,extend_deadline, andclaim_expired_refundCloses #221