CR2 independent completion review for pre-TSW build tasks (0007) #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/cr2-completion-review"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Base:
feat/ofac-payout-hold· Head:feat/cr2-completion-review· Decided by George 2026-11-09/10 (taskuler/docs 0007). Not deployed. Replaces #2.Design
ReviewerRegistry(Ownable2Step, owner = the Safe, holds no funds): published reviewer list, signer-conflict list, per-tokenminimum fee. Reviewers join via RL2: open off-chain application against published criteria; the Safe lists them
(
setReviewer(reviewer, true, metadataURI)). No on-chain application flow.assignReviewer(jobId, reviewer)(payable, Safe only, jobOpen) escrowsthe reviewer fee on top of the bounty. After delivery the reviewer calls
submitRecommendation; the Safe canexecuteRecommendationat once, anyone afterOBJECTION_WINDOW(5 days, fixed constant).acceptDeliveryand settlement offersrevert
ReviewJob()on review jobs.executeRecommendation, or when the Kleros ruling givesexactly the recommended split (on ruling 0, refuse or tie paid 50/50, that means a 50% recommendation); refunded to the
customer (
j.customer, the Safe on build tasks) otherwise, including no recommendation, cancel andrefundAfterDeadline(missed work deadline). Settled inside PayoutLib from job funds, so
rule()can't revert (tested with a held reviewer).releaseAfterReviewnever opens (reviewEndsAt = max). A missed deadline lets the SafereassignReviewer(max 2). Once the limit is used and the last reviewer misses its deadline,reviewLapsed(jobId)is true andonly Kleros can end the job. Nobody has a duty to escalate: the builder files whenever it wants, and so can the customer; funds
stay in escrow until someone files.
requestArbitrationdoes not requirereviewLapsed. Either party can escalate any time after delivery, with orwithout a recommendation, until the recommendation is executed (usual ETH prepay; on ERC-20 jobs the filer bears it).
acceptBidon every Safe-funded job: builder can't be the reviewer (BadReviewer) or conflicted (Conflicted(builder)).PayoutLib, review bookkeeping inReviewLib. No newStatusvalues;WorkHistory.Outcome.Reviewed(5).Interface
setReviewer(address, bool listed, string metadataURI),setConflicted(address, bool, string reasonURI),setMinReviewerFee(address token, uint256), viewsreviewerFee(token, bounty),canReview,isConflicted.assignReviewer(jobId, reviewer),submitRecommendation(jobId, uint8 builderPct, bytes32 noteHash, string noteURI)(
builderPct ∈ {0,25,50,75,100}, beforereviewDeadline(jobId) = max(deliveredAt, assignedAt) + reviewPeriod),executeRecommendation(jobId),reassignReviewer(jobId, newReviewer), viewsreviews(jobId),reviewDeadline,reviewEndsAt,reviewLapsed, constantsOBJECTION_WINDOW(5 days),MAX_REVIEWER_REASSIGNMENTS(2).ReviewerRegistry reviewerRegistry_afterworkHistory(address(0)disables review jobs).ReviewJob,NotReviewer,BadReviewer,Conflicted(address),ReviewWindowClosed.DECIDED
review goes to Kleros; reviewer fee refunded to the customer if Kleros overrules; reviewers join via RL2.
escrow until someone files.
(code change in
PayoutLib;rule()still can't revert).PROVISIONAL (George decision pending)
postJobwithout a reviewer stays allowed for the Safe.Tests and coverage
forge test: 171 passed, 0 failed (test/CompletionReview.t.sol34 test functions, incl. no-show → Kleros, builder backstop after 2 yearswith the ERC-20 prepay borne by the builder, fee paid/refunded on agree/overrule fuzz over all rulings, ruling 0 with a 50%
recommendation (paid) and a 75% recommendation (refunded), held reviewer, fixed objection window, credit reasons).
Indexer events / ABI
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)(objectionEndsAt= recommendedAt + 5 days)ReviewerFeeSettled(uint256 indexed jobId, address indexed to, uint256 amount, bool paidToReviewer)Credited(address indexed account, address indexed token, uint256 amount, uint256 indexed jobId, uint8 reason)(new topic hash).reason(CreditReason): 0 Payout, 1 Refund, 2 DepositReturn, 3 DepositForfeit, 4 ProtocolFee, 5 ReviewerFee, 6 ReviewerFeeRefund,7 ArbitrationRefund (excess prepay), 8 ArbitrationReimbursement. Resolutions emit one
Creditedper component; per-account totals unchanged.ReviewerSet(address indexed reviewer, bool listed, string metadataURI),ConflictSet(address indexed account, bool conflicted, string reasonURI),MinReviewerFeeSet(address indexed token, uint256 minReviewerFee).Reviewed(5).Changelog 2026-11-10
reviewLapsed; lapsed reviews go to Kleros.ReviewerFeeSettled).OBJECTION_WINDOW = 5 daysconstant (no longer tied to the settablesettlementWindow).Creditedgaineduint8 reason(own commit); PayoutLib credits per component. Market +309 B for this.DECIDED (no Safe duty; filing builder bears the ERC-20 prepay); wording fixed (fee refund goes to the customer;
requestArbitrationdoesn't require
reviewLapsed;refundAfterDeadline(missed work deadline)). No ABI change.