Market circuit breaker for new escrow + versioned redeploy runbook #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/circuit-breaker"
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?
Approved scope (2026-11-13): circuit breaker on TaskulerMarket and a runbook for shipping a fixed Market after launch. No deployment in this PR.
Circuit breaker
pause()/unpause(),onlyOwner(the governance Safe). EventsPaused(address account)/Unpaused(address account)(same signatures as OZPausable), viewpaused(), errorEnforcedPause(). Both calls are idempotent. Non-upgradeable as before.postJob,postProjectJob,placeBid,assignReviewer. The check is in_pull, the only function that increasesjobHeld, so a future value-in path can't skip it.cancelJob,withdrawBid,acceptBid(existing bids),submitDelivery,acceptDelivery,releaseAfterReview,refundAfterDeadline, every settlement offer call,submitRecommendation,reassignReviewer,executeRecommendation,requestArbitration,rule,resolveStalledDispute,withdraw, and every owner setting including OFAC holds.requestArbitrationstays open: its ETH goes straight to Kleros in the same call, and it is the only exit for escalated and lapsed-review jobs.Pausablewas measured at about 450 B more bytecode, so the flag is a plain bool packed withtreasury.WorkHistory recorder review
setRecorder(market, false)and any revert insiderecordare caught (WorkHistoryRecordFailed), and the payout stands.trywith noreturnsclause and an emptycatch).InsufficientGasonly means the caller sent too little gas; the call, including Kleros' ruling execution, can be repeated with more.try: the empty return data makes the call revert outside thecatch, which would block every settlement. The constructor now callsrecordCount()and requires code, a successful call and one 32-byte word back; It also requires WorkHistory'sowner()to be the Market's governance. Otherwise it revertsBadWorkHistory, which rejects an EOA, a contract with an empty fallback such as a Safe, a wrong contract, a WorkHistory owned by another address, and a look-alike that answersrecordCount()but has an empty fallback. These are constructor-only checks with 0 runtime bytes;DeployPhase1already deploys WorkHistory owned by the same governance. The address is immutable, and WorkHistory has no selfdestruct and no upgrade path.Ownership
renounceOwnership()now revertsRenounceDisabled()on every Ownable contract: TaskulerMarket, WorkHistory, ReviewerRegistry, BuilderBonus and LiquidityReserve (TSKR and the vesting vaults have no owner). Ownership only moves through the two-step transfer, so the owner-only safety controls can't be lost.Versioned redeploy runbook
New
docs/VERSIONED-REDEPLOY-RUNBOOK.md, linked fromDEPLOY-RUNBOOK.md. It covers:Runbook notes added in review: the current Arbitrum Sepolia set is the
ae943b1deploy (Market0x1B8B23CE442922Cb2629E2A4898C5b7cC44a6AD5, BuilderBonus0x229aE95602e6E62b32022cdB2d2B9c1903091473; record on PR #14); the old Market stays whitelisted at Kleros until its wind-down is complete (pre-pause bids can still be accepted and disputed); when (normally never) to zero the old BuilderBonusminBounty, and that doing so also releases honest reserved slots (KI-14); the deploy-only script does not exist yet (23c); the dispute check needs a Delivered job and real ETH.Immutable dependencies found:
BuilderBonus.marketis immutable, so a new Market needs a new BuilderBonus. The old program'sreturnExcesskeeps the budget for unused slots, and the new one starts again at 5,000 slots with no bars or exclusions carried over (new KI-14, OPEN-QUESTIONS 23a). BuilderBonus has no pause of its own (agreed). Follow-up PR #16 makes BuilderBonus repointable instead.TaskulerMarket.reviewerRegistryandworkHistoryare immutable on the Market, but neither contract is bound to a Market. Reuse both:setRecorderfor the new Market, and revoke the old one only after wind-down.DeployPhase1.s.soldeploys a full new set, so it must not be used for a versioned redeploy. A dedicated script is still to be written (OPEN-QUESTIONS 23c).ABI changes
pause(),unpause(),paused()Paused(address)(topic00x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258) andUnpaused(address)(topic00x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa)EnforcedPause()BadWorkHistory()(Market constructor) andRenounceDisabled()(all five Ownable contracts;renounceOwnership()keeps its selector but always reverts).Tests
test/CircuitBreaker.t.sol(17 tests):recordCount()-plus-empty-fallback contract (BadWorkHistory)renounceOwnershipreverts on all five Ownable contractsNoEscrowInflowWhilePausedchecks that no call made while paused adds to escrow.forge testwith the fork RPC set: 272 passed, 0 failed, 0 skipped (including the 5 fork tests).Size
TaskulerMarket runtime is 24,146 B, 430 B under the 24,576 B limit (+206 B vs main). No logic moved into the libraries.
Docs updated: KNOWN-ISSUES (KI-3, new KI-13 and KI-14), THREAT-MODEL, AUDIT-SCOPE (Market 1327/925, total 2661/1751), SECURITY-NOTES, OPEN-QUESTIONS 23, README.