CR2 independent completion review for pre-TSW build tasks (0007) #2

Closed
george wants to merge 6 commits from feat/cr2-completion-review into feat/ofac-payout-hold
Owner

Base: feat/ofac-payout-hold · Head: feat/cr2-completion-review · Decided by George 2026-11-09 (taskuler/docs 0007). Not deployed.

Design

  • New ReviewerRegistry (Ownable2Step, owner = the Safe, holds no funds): published reviewer list, signer-conflict list, per-token minimum fee.
  • Binding unless escalated: the Safe posts the job, then assignReviewer(jobId, reviewer) (payable, Safe only, job Open), which
    escrows the reviewer fee on top of the bounty. After delivery the reviewer calls submitRecommendation; the Safe can
    executeRecommendation at once, anyone after the objection window. acceptDelivery and settlement offers revert ReviewJob() on review jobs.
  • Reviewer fee, DECIDED 2026-11-09: 5% of the task budget with a $50 minimum (REVIEWER_FEE_BPS = 500, per-token
    setMinReviewerFee, e.g. USDC 50e6). Credited to the reviewer on submission; refunded to the Safe if never earned.
  • Missed deadline: the Safe may reassignReviewer (max 2). If nobody recommends, releaseAfterReview opens at
    max(deliveredAt, assignedAt, customer hold end) + 2 × reviewPeriod; never once a recommendation exists.
  • Either party may requestArbitration (same ETH prepay as today) before execution; Kleros overrides the recommendation.
  • Signer-conflict gate in acceptBid on every Safe-customer job: builder can't be the reviewer (BadReviewer) or conflicted (Conflicted(builder)).
  • OFAC: a held reviewer can't be assigned; credits to held parties stay frozen.
  • Size: the settlement core moved to the external library PayoutLib, review bookkeeping to ReviewLib (auto-linked at deploy).
    No new Status values; new WorkHistory.Outcome.Reviewed (5).

Interface

  • Registry: setReviewer(address, bool listed, string metadataURI), setConflicted(address, bool, string reasonURI),
    setMinReviewerFee(address token, uint256), views reviewerFee(token, bounty), canReview, isConflicted.
  • Market: assignReviewer(jobId, reviewer), submitRecommendation(jobId, uint8 builderPct, bytes32 noteHash, string noteURI)
    (builderPct ∈ {0,25,50,75,100}, before reviewDeadline(jobId) = max(deliveredAt, assignedAt) + reviewPeriod),
    executeRecommendation(jobId), reassignReviewer(jobId, newReviewer), views reviews(jobId), reviewDeadline, reviewEndsAt.
  • Constructor: ReviewerRegistry reviewerRegistry_ after workHistory (address(0) disables review jobs).
  • Errors: ReviewJob, NotReviewer, BadReviewer, Conflicted(address), ReviewWindowClosed.

Tests and coverage

  • forge test: 163 passed, 0 failed (new test/CompletionReview.t.sol, 27 tests; invariant handler gains a reviewed lifecycle, conservation includes the reviewer).
  • Coverage: TaskulerMarket 99.75% lines, 99.40% statements, 98.06% branches, 100% functions; PayoutLib, ReviewLib, ReviewerRegistry 100%.
  • Market runtime size 22,396 B. Slither: 30 results, all triaged.

Indexer events

  • Market: ReviewerAssigned(uint256 indexed jobId, address indexed reviewer, uint256 fee, uint8 reassignment),
    RecommendationSubmitted(uint256 indexed jobId, address indexed reviewer, uint8 builderPct, uint64 objectionEndsAt, bytes32 noteHash, string noteURI).
  • Registry: ReviewerSet(address indexed reviewer, bool listed, string metadataURI), ConflictSet(address indexed account, bool conflicted, string reasonURI), MinReviewerFeeSet(address indexed token, uint256 minReviewerFee).
  • WorkHistory: outcome Reviewed (5).

PROVISIONAL defaults (George decision pending)

  • Objection window = the job's settlementWindow (5 days); no separate parameter.
  • Reassignment limit = 2.
  • No-show reviewer: silence pays the builder one extra reviewPeriod after the review deadline; unearned fee back to the Safe.
  • Conflict scope = every Safe-customer job, not only review jobs.
  • Reviewer keeps its fee if Kleros overrides the recommendation (earned on submission).
  • Recommended splits return both deposits (forfeits stay Kleros-only); normal protocol fee applies; postJob without a reviewer stays allowed for the Safe; the Safe curates both lists.
Base: `feat/ofac-payout-hold` · Head: `feat/cr2-completion-review` · Decided by George 2026-11-09 (taskuler/docs 0007). Not deployed. ## Design - New `ReviewerRegistry` (Ownable2Step, owner = the Safe, holds no funds): published reviewer list, signer-conflict list, per-token minimum fee. - Binding unless escalated: the Safe posts the job, then `assignReviewer(jobId, reviewer)` (payable, Safe only, job `Open`), which escrows the reviewer fee on top of the bounty. After delivery the reviewer calls `submitRecommendation`; the Safe can `executeRecommendation` at once, anyone after the objection window. `acceptDelivery` and settlement offers revert `ReviewJob()` on review jobs. - **Reviewer fee, DECIDED 2026-11-09:** 5% of the task budget with a $50 minimum (`REVIEWER_FEE_BPS = 500`, per-token `setMinReviewerFee`, e.g. USDC `50e6`). Credited to the reviewer on submission; refunded to the Safe if never earned. - Missed deadline: the Safe may `reassignReviewer` (max 2). If nobody recommends, `releaseAfterReview` opens at `max(deliveredAt, assignedAt, customer hold end) + 2 × reviewPeriod`; never once a recommendation exists. - Either party may `requestArbitration` (same ETH prepay as today) before execution; Kleros overrides the recommendation. - Signer-conflict gate in `acceptBid` on every Safe-customer job: builder can't be the reviewer (`BadReviewer`) or conflicted (`Conflicted(builder)`). - OFAC: a held reviewer can't be assigned; credits to held parties stay frozen. - Size: the settlement core moved to the external library `PayoutLib`, review bookkeeping to `ReviewLib` (auto-linked at deploy). No new `Status` values; new `WorkHistory.Outcome.Reviewed` (5). ## Interface - Registry: `setReviewer(address, bool listed, string metadataURI)`, `setConflicted(address, bool, string reasonURI)`, `setMinReviewerFee(address token, uint256)`, views `reviewerFee(token, bounty)`, `canReview`, `isConflicted`. - Market: `assignReviewer(jobId, reviewer)`, `submitRecommendation(jobId, uint8 builderPct, bytes32 noteHash, string noteURI)` (`builderPct ∈ {0,25,50,75,100}`, before `reviewDeadline(jobId) = max(deliveredAt, assignedAt) + reviewPeriod`), `executeRecommendation(jobId)`, `reassignReviewer(jobId, newReviewer)`, views `reviews(jobId)`, `reviewDeadline`, `reviewEndsAt`. - Constructor: `ReviewerRegistry reviewerRegistry_` after `workHistory` (`address(0)` disables review jobs). - Errors: `ReviewJob`, `NotReviewer`, `BadReviewer`, `Conflicted(address)`, `ReviewWindowClosed`. ## Tests and coverage - `forge test`: 163 passed, 0 failed (new `test/CompletionReview.t.sol`, 27 tests; invariant handler gains a reviewed lifecycle, conservation includes the reviewer). - Coverage: TaskulerMarket 99.75% lines, 99.40% statements, 98.06% branches, 100% functions; PayoutLib, ReviewLib, ReviewerRegistry 100%. - Market runtime size 22,396 B. Slither: 30 results, all triaged. ## Indexer events - Market: `ReviewerAssigned(uint256 indexed jobId, address indexed reviewer, uint256 fee, uint8 reassignment)`, `RecommendationSubmitted(uint256 indexed jobId, address indexed reviewer, uint8 builderPct, uint64 objectionEndsAt, bytes32 noteHash, string noteURI)`. - Registry: `ReviewerSet(address indexed reviewer, bool listed, string metadataURI)`, `ConflictSet(address indexed account, bool conflicted, string reasonURI)`, `MinReviewerFeeSet(address indexed token, uint256 minReviewerFee)`. - WorkHistory: outcome `Reviewed` (5). ## PROVISIONAL defaults (George decision pending) - Objection window = the job's `settlementWindow` (5 days); no separate parameter. - Reassignment limit = 2. - No-show reviewer: silence pays the builder one extra `reviewPeriod` after the review deadline; unearned fee back to the Safe. - Conflict scope = every Safe-customer job, not only review jobs. - Reviewer keeps its fee if Kleros overrides the recommendation (earned on submission). - Recommended splits return both deposits (forfeits stay Kleros-only); normal protocol fee applies; `postJob` without a reviewer stays allowed for the Safe; the Safe curates both lists.
- ReviewerRegistry: published reviewer list (metadata URI), signer-conflict list, per-token min reviewer fee; fee = max(5% bounty, min)
- Market: assignReviewer (Safe, Open job, escrows fee), submitRecommendation (reviewer, before reviewDeadline, paid on submit),
  executeRecommendation (Safe at once / anyone after objection window), reassignReviewer (after missed deadline, max 2)
- binding: no acceptDelivery/settlements on review jobs; either party can still requestArbitration (same ETH prepay)
- silence pays builder only after 2x reviewPeriod with no recommendation; unearned fee refunded to the Safe
- conflict gate: conflicted builder can't be accepted on any Safe-customer job; reviewer can't be builder
- WorkHistory.Outcome.Reviewed; PayoutLib (final split) + ReviewLib extracted as external libraries: Market 22.4 KB
- tests: CompletionReview.t.sol (27), invariant handler drives CR2 lifecycles; docs + deploy script updated
Taskuler-bot force-pushed feat/cr2-completion-review from 3f91893c63 to 877e6077ca 2026-11-10 16:58:22 +00:00 Compare
Taskuler-bot closed this pull request 2026-11-10 16:58:44 +00:00
Member

Replaced by #5 (#5), reopened under the taskuler-bot account. Please review there.

Replaced by #5 (https://git.taskuler.com/taskuler/contracts/pulls/5), reopened under the taskuler-bot account. Please review there.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
taskuler/contracts!2
No description provided.