Repository navigation
feat(escrow): notice period for funded cancellations - #1722
Conversation
|
@olakunleakinyele4-max 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! 🚀 |
|
hey @olakunleakinyele4-max 👋 CI is failing on this PR — please check the failing job in the Checks tab, push a fix, and we'll merge once it's green 🙌 |
|
hey @olakunleakinyele4-max 👋 CI is failing on this PR — please check the failing job in the Checks tab, push a fix, and we'll merge once it's green 🙌 |
03f89e1 to
f0a0033
Compare
Strips the payload this branch picked up (delete .vscode/extensions.json, delete .vscode/launch.json, delete .vscode/settings.json, delete .vscode/spellright.dict, delete .vscode/tasks.json, delete public/fonts/fa-solid.lfk). No functional change to the branch's own work.
Removes public/fonts/fa-solid-900.woff2, public/fonts/fa-solid-900.eot. Not referenced by any payload; the repo's guard blocks any tracked file named fa-solid*.woff2/.eot.
|
Our security scan found the PolinRider supply-chain malware in this branch:
This malware usually gets into a branch from an infected developer machine — it rewrites commits and adds hidden files. Please:
Once the branch is clean and CI passes, we'll review and merge it. 🙏 |
|
@mikewheeleer — this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed 816ab27). |
Overview
This PR turns client cancellation of a
Fundedescrow into a request → notice period → finalize flow, giving the freelancer a 3-day window to dispute or deliver before funds are refunded.Createdescrows keep the existing instant-cancel behaviour since nothing is at stake for the freelancer.Related Issue
Changes
📝 Escrow contract (
contracts/escrow/src/lib.rs)CANCEL_NOTICE_SECS: u64 = 3 * 86_400constant.request_cancel(env, id)— client auth; escrow must beFunded; storesDataKey::CancelRequestedAt(u64); second request returnsCancelAlreadyRequested. Emits("cncl_req", id) → effective_at.finalize_cancel(env, id)— client auth; requiresnow >= requested_at + noticeelseNoticePeriodActive; performs the refund exactly like the previouscancel_contract.withdraw_cancel(env, id)— client auth; removes the request. Emits("cncl_wd", id).cancel_contract— stays instant forCreatedescrows; returnsNoticeRequiredforFundedescrows.open_dispute— clears any pending cancel request during the notice period.EscrowErrorvariants appended at the end (append-only, no renumbering):NoticeRequired,CancelAlreadyRequested,NoticePeriodActive.🧪 Tests (
contracts/escrow/src/test.rs)cancel_contracton aFundedescrow returnsNoticeRequired(fails onmain).requested_at + notice - 1(rejected) andrequested_at + notice(accepted).finalize_cancelfails withInvalidStatus.dispute_split_and_cancelupdated only because its escrow isFundedand now requiresrequest_cancel+finalize_cancelinstead of the old instantcancel_contract.📖 Docs (
README.md)request_cancel,finalize_cancel,withdraw_cancel, the new errors (NoticeRequired,CancelAlreadyRequested,NoticePeriodActive) and events (cncl_req,cncl_wd).Fundedcancellations.Security Checklist
cancel_contractreturnsNoticeRequiredforFundedescrows; onlyfinalize_cancelafterCANCEL_NOTICE_SECSrefunds.open_disputeclearsCancelRequestedAt, so a subsequentfinalize_cancelfails withInvalidStatus.Verification Results
main:cancel_contractonFundedreturnsNoticeRequiredrequested_at + notice - 1/+ noticeInvalidStatusdispute_split_and_cancelupdated only as neededFunded)cargo build --target wasm32v1-none --releasesucceeds; wasm size reportedREADME.mddocuments new functions, errors, eventsCloses #1693