feat(contracts): add milestone deadlines and time-locked escrow protections to escrow contract - #232
Open
devkylian-tech wants to merge 3 commits into
Open
devkylian-tech wants to merge 3 commits into
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.
Author
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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