Pre-audit hardening, part 3: Kleros 0.10.0 views, bonus and review-job controls #13

Merged
Taskuler-bot merged 2 commits from fix/pre-audit-3 into main 2026-11-13 03:38:22 +00:00
Member

Decisions of 2026-11-12 (George). No deployment in this PR.

Dispute timeout and the deployed KlerosCore

  • The KlerosCore deployed on Arbitrum Sepolia reports version 0.10.0 (Arbitrum One runs KlerosCoreNeo, see below). Its disputes(id) returns 5 values (160 bytes); rc.2 returns 6 (192 bytes). DisputeLib now accepts any return of at least 96 bytes and reads the period from the third word, which is the same in both versions.
  • Any period after evidence (commit, vote, appeal, execution) now counts as pending for resolveStalledDispute.
  • Return data from the KlerosCore views is copied up to three words. The fail-open behaviour for views that revert or return too little data is unchanged (KI-8).
  • KI-8: disputes with more than one round have no timeout and wait for a Kleros ruling. This is documented as an accepted risk.

Fork tests (test/fork/KlerosSepoliaFork.t.sol, local fork of Arbitrum Sepolia at block 328,678,215; need ARB_SEPOLIA_RPC_URL. With CI or REQUIRE_FORK_TESTS=true set, a missing URL fails the run; a plain local run without it skips them)

  • The disputes() layout of an existing dispute is 160 bytes, and the period gate reads it correctly.
  • createDispute from the Market works against the real core. The run covers staking, drawing (RNG mocked on the fork), commit, vote, appeal, execution, and then executeRuling, which settles through rule(). The timeout is blocked in every period after evidence, including when a refused ruling (0) is waiting in execution.
  • The timeout fires on the real core when jurors were never drawn.
  • DisputeRequest: the Market emits the rc.2 3-field event. The deployed 0.10.0 IArbitrableV2 declares a 5-field event. The event shape is not changed here.

Kleros items before mainnet (KNOWN-ISSUES KI-5, OPEN-QUESTIONS 22, new docs/DEPLOY-RUNBOOK.md)

  • DisputeRequest form: mainnet blocker pending Kleros confirmation. Fallback: emit both forms (about +62 B Market bytecode, about +2.6k gas per dispute).
  • Arbitrable whitelist: the Arbitrum One core is KlerosCoreNeo, which only accepts disputes from arbitrables whitelisted by Kleros governance. Every Market deploy and redeploy has to be whitelisted before use; this is a go-live gate in the new deploy runbook. The deploy script comment is corrected (the Sepolia core has no whitelist).

Builder bonus

  • cancelAward now bars both the award's builder and its customer for 2 full funding periods from the cancel: BAR_PERIODS = 2, barredUntil(account) = cancel timestamp + 2 × PERIOD, isBarred, new event AccountBarred(account, until). A cancel in the last second of a period still bars for 2 full periods. The cancelled award keeps its place in both period counts. This replaces "cancel frees the counts". While the bar lasts, reserve rejects the addresses and finalize releases their slots instead of awarding.
  • USDC minimum bounty is now 1,000 USDC (1_000e6). It stays a Safe setting: DeployPhase1.BONUS_MIN_BOUNTY_USDC, docs and tests are updated.

Review jobs

  • REVIEWER_ACCEPT_DELAY = 24 hours. On a review job, acceptBid reverts TooEarly until 24h after the reviewer was last (re)assigned (decided 2026-11-12).
  • ReviewerRegistry.setReviewer(reviewer, false, reason) now requires a reason that is not empty or whitespace-only (MissingReason), which is emitted in ReviewerSet.
  • Both are added to THREAT-MODEL.

ABI

  • No selector changes to existing functions.
  • New: TaskulerMarket.REVIEWER_ACCEPT_DELAY(), BuilderBonus.BAR_PERIODS(), BuilderBonus.barredUntil(address), BuilderBonus.isBarred(address), event BuilderBonus.AccountBarred(address,uint256), error ReviewerRegistry.MissingReason().
  • BuilderBonus.qualifies now also checks the bar.

Size and tests

  • TaskulerMarket runtime is 23,940 B, 636 B under the 24,576 B limit.
  • forge test with the fork RPC set: 253 passed, 0 failed, 0 skipped (including the 5 fork tests).

Docs updated: KNOWN-ISSUES (KI-5, KI-8, KI-9), THREAT-MODEL, AUDIT-SCOPE, README, SECURITY-NOTES, OPEN-QUESTIONS, new DEPLOY-RUNBOOK.

Merge this PR before #12. #12 already contains this branch with the docs/AUDIT-SCOPE.md table resolved, so the second merge is clean.

Decisions of 2026-11-12 (George). No deployment in this PR. **Dispute timeout and the deployed KlerosCore** - The KlerosCore deployed on Arbitrum Sepolia reports version 0.10.0 (Arbitrum One runs `KlerosCoreNeo`, see below). Its `disputes(id)` returns 5 values (160 bytes); rc.2 returns 6 (192 bytes). `DisputeLib` now accepts any return of at least 96 bytes and reads the period from the third word, which is the same in both versions. - Any period after `evidence` (commit, vote, appeal, execution) now counts as pending for `resolveStalledDispute`. - Return data from the KlerosCore views is copied up to three words. The fail-open behaviour for views that revert or return too little data is unchanged (KI-8). - KI-8: disputes with more than one round have no timeout and wait for a Kleros ruling. This is documented as an accepted risk. **Fork tests** (`test/fork/KlerosSepoliaFork.t.sol`, local fork of Arbitrum Sepolia at block 328,678,215; need `ARB_SEPOLIA_RPC_URL`. With `CI` or `REQUIRE_FORK_TESTS=true` set, a missing URL fails the run; a plain local run without it skips them) - The `disputes()` layout of an existing dispute is 160 bytes, and the period gate reads it correctly. - `createDispute` from the Market works against the real core. The run covers staking, drawing (RNG mocked on the fork), commit, vote, appeal, execution, and then `executeRuling`, which settles through `rule()`. The timeout is blocked in every period after evidence, including when a refused ruling (0) is waiting in execution. - The timeout fires on the real core when jurors were never drawn. - `DisputeRequest`: the Market emits the rc.2 3-field event. The deployed 0.10.0 `IArbitrableV2` declares a 5-field event. The event shape is not changed here. **Kleros items before mainnet** (KNOWN-ISSUES KI-5, OPEN-QUESTIONS 22, new `docs/DEPLOY-RUNBOOK.md`) - `DisputeRequest` form: mainnet blocker pending Kleros confirmation. Fallback: emit both forms (about +62 B Market bytecode, about +2.6k gas per dispute). - Arbitrable whitelist: the Arbitrum One core is `KlerosCoreNeo`, which only accepts disputes from arbitrables whitelisted by Kleros governance. Every Market deploy and redeploy has to be whitelisted before use; this is a go-live gate in the new deploy runbook. The deploy script comment is corrected (the Sepolia core has no whitelist). **Builder bonus** - `cancelAward` now bars both the award's builder and its customer for 2 full funding periods from the cancel: `BAR_PERIODS = 2`, `barredUntil(account)` = cancel timestamp + 2 × `PERIOD`, `isBarred`, new event `AccountBarred(account, until)`. A cancel in the last second of a period still bars for 2 full periods. The cancelled award keeps its place in both period counts. This replaces "cancel frees the counts". While the bar lasts, `reserve` rejects the addresses and `finalize` releases their slots instead of awarding. - USDC minimum bounty is now 1,000 USDC (`1_000e6`). It stays a Safe setting: `DeployPhase1.BONUS_MIN_BOUNTY_USDC`, docs and tests are updated. **Review jobs** - `REVIEWER_ACCEPT_DELAY` = 24 hours. On a review job, `acceptBid` reverts `TooEarly` until 24h after the reviewer was last (re)assigned (decided 2026-11-12). - `ReviewerRegistry.setReviewer(reviewer, false, reason)` now requires a reason that is not empty or whitespace-only (`MissingReason`), which is emitted in `ReviewerSet`. - Both are added to THREAT-MODEL. **ABI** - No selector changes to existing functions. - New: `TaskulerMarket.REVIEWER_ACCEPT_DELAY()`, `BuilderBonus.BAR_PERIODS()`, `BuilderBonus.barredUntil(address)`, `BuilderBonus.isBarred(address)`, event `BuilderBonus.AccountBarred(address,uint256)`, error `ReviewerRegistry.MissingReason()`. - `BuilderBonus.qualifies` now also checks the bar. **Size and tests** - TaskulerMarket runtime is 23,940 B, 636 B under the 24,576 B limit. - `forge test` with the fork RPC set: 253 passed, 0 failed, 0 skipped (including the 5 fork tests). Docs updated: KNOWN-ISSUES (KI-5, KI-8, KI-9), THREAT-MODEL, AUDIT-SCOPE, README, SECURITY-NOTES, OPEN-QUESTIONS, new DEPLOY-RUNBOOK. Merge this PR before #12. #12 already contains this branch with the `docs/AUDIT-SCOPE.md` table resolved, so the second merge is clean.
- DisputeLib: timeout pending check works with the deployed KlerosCore 0.10.0
  (5-value disputes() return) as well as rc.2; any period after evidence counts
  as pending; returndata copies capped at three words.
- Fork tests against the KlerosCore on Arbitrum Sepolia: disputes() layout,
  createDispute from the Market, full period flow to executeRuling, timeout gate.
- BuilderBonus: cancelling an award bars its builder and customer for the rest
  of the current period and keeps their period counts; USDC minimum bounty
  documented and scripted as 1,000 USDC.
- Review jobs: 24h REVIEWER_ACCEPT_DELAY between reviewer (re)assignment and
  accepting a bid; delisting a reviewer requires a reason.
- Docs: KNOWN-ISSUES (KI-5, KI-8, KI-9), THREAT-MODEL, AUDIT-SCOPE, README,
  SECURITY-NOTES, OPEN-QUESTIONS.
- BuilderBonus: a cancel bars both addresses for BAR_PERIODS (2) full periods from the cancel (barredUntil timestamp)
- ReviewerRegistry: whitespace-only delist reasons are rejected
- Fork tests fail instead of skipping when CI or REQUIRE_FORK_TESTS is set and ARB_SEPOLIA_RPC_URL is missing
- REVIEWER_ACCEPT_DELAY = 24 hours recorded as decided
- docs: DEPLOY-RUNBOOK go-live gates, Kleros mainnet items in KNOWN-ISSUES and OPEN-QUESTIONS, deploy script note
george approved these changes 2026-11-13 03:37:33 +00:00
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!13
No description provided.