fix(wzrd-markets): Plamen Phase 4 Low audit findings (L-01..L-05, DC-3)#118
Merged
Conversation
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>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements all Plamen Phase 4 Low-severity audit findings for
programs/wzrd-markets/:DeadlineTooFarguard:create_marketnow rejectsresolve_deadline_slot > now + MAX_MARKET_DURATION_SLOTS(90 days at 400ms/slot). Prevents indefinite collateral lock-up via far-future deadlines.tokens_initializedguard inresolve_market: fires after publisher/deadline checks but before the Merkle fold, so a market with no outcome token mints cannot accept a resolution binding.settle_unlock_slotanchor unification: two named helpers (settle_unlock_from_now,settle_unlock_extend) replace three divergent inlinechecked_addcalls, making the anchor point explicit and auditable at every call site.dispute_extendedreset inresolve_override: clears the flag so the post-override dispute window can be extended once if needed (an override is functionally a fresh resolution).>=to>soclock_slot == settle_unlock_slotbelongs exclusively to the override window. The two windows are now strictly disjoint with no overlap.Test plan
func_l01_deadline_too_far_rejected—u64::MAXdeadline rejected;future_deadline_slot()acceptedfunc_l02_resolve_requires_tokens_initialized— resolve on uninit market →TokensNotInitializedfunc_dc3_settle_boundary_slot_rejected— settle at boundary slot →DisputeWindowOpen; slot+1 succeedsfunc_l05_override_resets_dispute_extended— override clears flag; second extend succeedsfunc_c03_override_after_settle_forbidden— updated: settle at +1, extend to re-open override window, override refused withOverrideAfterSettle(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