V2 is live🥳 Stake your AZL on azzle.org/union

Docs / Deadlines and expiry

Deadlines and expiry

The poster sets one task deadline in post(). Later windows only decide when someone may call expire(). No window sends that transaction by itself.

Timeline

  1. post
  2. claim
  3. fund
  4. delivery
  5. deadline
  • MAX_TASK_DURATION At most 30 days, chosen at post. The bar runs from post to the deadline.
  • FUNDING_WINDOW 1 day from claim.
  • POSTER_DISPUTE_GRACE_WINDOW 12 hours from delivery.
  • DELIVERY_GRACE_WINDOW 1 day from delivery. It can run past the deadline.
Schematic. Bar lengths are not to scale. Source: TaskRegistryV2.

Task deadline

post(totalAmount, deadline) requires deadline > block.timestamp and deadline <= block.timestamp + MAX_TASK_DURATION. MAX_TASK_DURATION is 30 days. The poster picks the timestamp. The registry does not default it.

claim, fund, and markDelivered all require block.timestamp <= deadline. At the deadline timestamp those calls still succeed. expire() requires block.timestamp > deadline, unless the funding window has already expired. release and complete do not read the deadline.

Timely delivery is deliveredAt != 0 && deliveredAt <= deadline. markDelivered is worker only, once, in ACTIVE, fully funded, with unreleased escrow, and at or before the deadline. It stores deliveredAt = block.timestamp and does not move escrow. A recorded delivery is therefore timely. No delivery means not timely.

Windows

Window Constant Length Starts at What it gates What happens after
Task deadline MAX_TASK_DURATION 30 days post(). The poster sets deadline. claim, fund, and markDelivered need block.timestamp <= deadline. expire() can be sent once block.timestamp > deadline, unless delivery grace still blocks it.
Funding window FUNDING_WINDOW 1 days claim() sets fundingDeadline to block.timestamp + FUNDING_WINDOW. While CLAIMED, fund() also needs block.timestamp <= fundingDeadline. If the task is still CLAIMED and funded < totalAmount, anyone can expire() once block.timestamp > fundingDeadline, even before the task deadline. If the worker did not spend a credit, debitAccessFeeTo pays accessCompensation from the poster deposit to the worker.
Poster dispute cutoff POSTER_DISPUTE_GRACE_WINDOW DELIVERY_GRACE_WINDOW / 2 (43200 seconds) Timely markDelivered (deliveredAt). Poster openDispute after timely delivery needs block.timestamp <= deliveredAt + POSTER_DISPUTE_GRACE_WINDOW. The poster call reverts. The worker can still openDispute. expire() stays blocked until delivery grace ends.
Delivery grace DELIVERY_GRACE_WINDOW 1 days (86400 seconds) Timely deliveredAt. expire() reverts while unreleased escrow remains and block.timestamp <= deliveredAt + DELIVERY_GRACE_WINDOW. Escrow still refunds to the poster. Poster default is deposit only: debitAccessFeeTo, recordPosterExpiry, and a spent poster credit can settle to the worker.
Dispute timeout evidenceWindow, rulingWindow Not registry constants. Factories require 3 days and 2 days. openDispute. expire() reverts for the whole DISPUTED state. Anyone can call timeout() after the cutoff. Escrow goes to the poster. The expire poster default bundle does not run.

Full funding inside the window sets ACTIVE in that same fund(). Further fund() calls cannot add AZL past totalAmount. The funding window does not limit release or markDelivered.

The gap after delivery

After timely delivery the poster may openDispute while block.timestamp <= deliveredAt + POSTER_DISPUTE_GRACE_WINDOW. expire() stays blocked through deliveredAt + DELIVERY_GRACE_WINDOW when unreleased escrow remains. After the 12 hour cutoff, and through the 24 hour grace timestamp, the poster can neither dispute nor expire. Nobody else can expire in that gap either. The worker can still openDispute. At the exact 12 hour timestamp the poster can still dispute.

What expire() does

expire(taskId) is permissionless. Reaching a window does not cancel the task. Someone must send the transaction.

It reverts unless time is past deadline, or the task is CLAIMED, still under totalAmount, and time is past fundingDeadline. It also reverts in COMPLETED, CANCELLED, RESOLVED, or DISPUTED. Timely delivery with unreleased escrow blocks it until delivery grace has passed. On success the state becomes CANCELLED.

  1. Unreleased escrow (funded - released > 0): escrow.refund pays that remainder to the poster. This happens on poster default too. It is not a payout to the worker.
  2. No remainder, and a worker is set: escrow.close. An unclaimed POSTED task has no escrow to move.
  3. Poster default: unreleased escrow, timely delivery, and time past delivery grace. debitAccessFeeTo pays accessCompensation from the poster deposit to the worker. recordPosterExpiry counts a poster loss. If the poster spent a credit, settleSpentCredit sends it to the worker. None of this comes from escrow.
  4. Underfunded claim, and not poster default: if the worker did not spend a credit, the same deposit debit runs. A spent poster credit still settles to the worker. There is no poster loss record.
  5. Any other expiry: a spent poster credit settles back to the poster. If the task was ACTIVE, a spent worker credit settles to the worker. Otherwise the worker credit recipient is address(0), which returns it to the staking pool. No access fee debit.

Every successful expire() releases the poster deposit reservation, and the worker reservation when a worker is set.

Disputed tasks

DISPUTED cannot be expired. openDispute freezes escrow. The timeout path is ArbitrationModuleV2.timeout(), also permissionless, and also not automatic.

evidenceWindow and rulingWindow are immutables set in the arbitration constructor, not TaskRegistryV2 constants. Both suite factories require REQUIRED_EVIDENCE_WINDOW of 3 days and REQUIRED_RULING_WINDOW of 2 days. timeout() is callable once time is past rulingDeadline, or past evidenceDeadline + rulingWindow if ruling has not started. It settles escrow to the poster (workerBps = 0) and resolves MUTUAL. It does not run the expire() poster default deposit bundle.

Ordering of states is in Task lifecycle.