Repository navigation
feat(escrow): per-milestone deadlines with overdue reclaim - #1744
abiolatousin-design wants to merge 8 commits into
Conversation
|
@abiolatousin-design 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 @abiolatousin-design 👋 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 @abiolatousin-design 👋 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 🙌 |
c7bb1ec to
59a0a86
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.
5e38243 to
020ff21
Compare
020ff21 to
c0c272f
Compare
|
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 bcee8f9). |
Overview
This PR adds optional per-milestone due dates to the escrow contract and lets the client reclaim the funds of a single overdue milestone after a grace period — without cancelling the rest of the engagement. Deadlines are stored in a separate
DataKey::Deadlines(u64)entry so the existingMilestonestruct is untouched, and reclaimed milestones are tracked inDataKey::Reclaimed(u64)so they can no longer be released.Related Issue
Closes #
Changes
📅 Per-milestone deadlines
contracts/escrow/src/lib.rsDataKey::Deadlines(u64) -> Vec<u64>(0 = no deadline) andDataKey::Reclaimed(u64) -> Vec<u32>.create_contract_with_deadlines(env, client, freelancer, token, milestone_amounts, deadlines)— validates length match, each non-zero deadline> now, and non-decreasing order, elseInvalidDeadline. Existingcreate_contractis unchanged and stores no deadlines.get_deadlines(env, id) -> Vec<u64>read.DEADLINE_GRACE_SECS: u64 = 3 * 86_400.💸 Overdue reclaim
contracts/escrow/src/lib.rsreclaim_overdue(env, id, index)— client auth; requires escrowCreated|Funded, milestone unreleased, has a deadline, andnow >= deadline + grace(checked add) elseNotOverdue. Refundsm.amountbounded byfunded - released, marks the milestone as reclaimed, decrementstotal_amountandfunded_amount, and setsCompletedif all remaining milestones are released orCancelledif none were ever released and none remain.release_milestonenow returnsMilestoneAlreadyReleasedfor reclaimed indices and ignores reclaimed milestones in the completion check.("overdue", id) -> (index, refunded).EscrowError(append-only, no renumbering):InvalidDeadline,NotOverdue.🧪 Tests
contracts/escrow/src/test.rsdeadline + grace - 1→NotOverdue;deadline + grace→ refund succeeds with balances asserted.funded - releasedafter every step.📖 Docs
README.mdcreate_contract_with_deadlines,reclaim_overdue,get_deadlines, theoverdueevent, and the new errors.Verification Results
deadline + grace - 1→NotOverdue;+ grace→ refund succeeds, balances assertedfunded - releasedafter every stepcargo build --target wasm32v1-none --releasesucceeds; wasm size reported and under 128 KBREADME.mddocuments new functions, errors and eventsSecurity Checklist
reclaim_overduerequires the milestone to be unreleased, to have a non-zero deadline, andnow >= deadline + grace(checked add); reclaimed indices are also tracked inDataKey::Reclaimedand rejected byrelease_milestone.u64::MAX? No. The grace addition useschecked_add, returningNotOverdueon overflow rather than wrapping.Notes
release_milestonecompletion-check signature/behaviour changed to ignore reclaimed milestones; no assertions were weakened.EscrowErrorvariants are appended at the end only — no existing codes renumbered or reused.Closes #1691