Skip to content

fix(wzrd-markets): Plamen Phase 4 Low audit findings (L-01..L-05, DC-3)#118

Merged
twzrd-sol merged 1 commit into
mainfrom
claude/markets-lows
Jun 22, 2026
Merged

fix(wzrd-markets): Plamen Phase 4 Low audit findings (L-01..L-05, DC-3)#118
twzrd-sol merged 1 commit into
mainfrom
claude/markets-lows

Conversation

@twzrd-sol

Copy link
Copy Markdown
Owner

Summary

Implements all Plamen Phase 4 Low-severity audit findings for programs/wzrd-markets/:

  • L-01DeadlineTooFar guard: create_market now rejects resolve_deadline_slot > now + MAX_MARKET_DURATION_SLOTS (90 days at 400ms/slot). Prevents indefinite collateral lock-up via far-future deadlines.
  • L-02tokens_initialized guard in resolve_market: fires after publisher/deadline checks but before the Merkle fold, so a market with no outcome token mints cannot accept a resolution binding.
  • L-03settle_unlock_slot anchor unification: two named helpers (settle_unlock_from_now, settle_unlock_extend) replace three divergent inline checked_add calls, making the anchor point explicit and auditable at every call site.
  • L-05dispute_extended reset in resolve_override: clears the flag so the post-override dispute window can be extended once if needed (an override is functionally a fresh resolution).
  • L-04 — Subsumed by C-03 (merged in fix(wzrd-markets): Phase 3 + audit Critical remediations (C-01/C-02/C-03) — DO NOT MERGE until re-audit #113), skipped.
  • DC-3 — Settle boundary: changes >= to > so clock_slot == settle_unlock_slot belongs exclusively to the override window. The two windows are now strictly disjoint with no overlap.

Test plan

  • func_l01_deadline_too_far_rejectedu64::MAX deadline rejected; future_deadline_slot() accepted
  • func_l02_resolve_requires_tokens_initialized — resolve on uninit market → TokensNotInitialized
  • func_dc3_settle_boundary_slot_rejected — settle at boundary slot → DisputeWindowOpen; slot+1 succeeds
  • func_l05_override_resets_dispute_extended — override clears flag; second extend succeeds
  • func_c03_override_after_settle_forbidden — updated: settle at +1, extend to re-open override window, override refused with OverrideAfterSettle (DC-3 makes the same-slot scenario structurally impossible)

78 tests pass (29 lib + 8 config_init + 2 complete_set + 12 pool_swap + 27 resolution), 0 fail.

🤖 Generated with Claude Code

L-01: cap resolve_deadline_slot to now + MAX_MARKET_DURATION_SLOTS (90d)
      so collateral cannot be locked indefinitely by a far-future deadline.

L-02: guard tokens_initialized in resolve_market before the Merkle fold,
      so a market with no outcome tokens cannot accept a resolution.

L-03: unify settle_unlock_slot anchoring into two named helpers --
      settle_unlock_from_now (resolve + override) and settle_unlock_extend
      (extend_dispute_window) -- making the anchor point explicit at every
      call site and eliminating silent divergence risk.

L-05: reset dispute_extended in resolve_override so the new post-override
      dispute window can be extended once if needed (override = fresh resolution).

DC-3: change settle's clock guard from >= to > so the boundary slot at
      settle_unlock_slot belongs exclusively to the override window, making
      the two windows strictly disjoint.

Test updates: C-03 test extended to warp past unlock, settle, then re-open
the override window via extend_dispute_window before verifying OverrideAfterSettle
fires -- necessary because DC-3's strict disjoint windows prevent testing
C-03 in the same slot as settle.

78 tests pass (29 lib + 8 config_init + 2 complete_set + 12 pool_swap + 27 resolution).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@twzrd-sol twzrd-sol merged commit 747fee0 into main Jun 22, 2026
3 checks passed
@twzrd-sol twzrd-sol deleted the claude/markets-lows branch June 22, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant