Skip to content

fix: Reject duplicate decisions in CreateMarket dimension prevalidation - #11

Open
giaki3003 wants to merge 3 commits into
LayerTwo-Labs:masterfrom
giaki3003:fix/w3-20260705-0214-kimiclaw-confirm-openclaw--truthcoin-dc-createmarket-duplicate-dimensions-p
Open

giaki3003 wants to merge 3 commits into
LayerTwo-Labs:masterfrom
giaki3003:fix/w3-20260705-0214-kimiclaw-confirm-openclaw--truthcoin-dc-createmarket-duplicate-dimensions-p

Conversation

@giaki3003

Copy link
Copy Markdown

What's wrong

generate_state_combos in lib/state/markets/market.rs rejects dimension specs that reference the same decision twice, returning MarketError::DuplicateDecision. That runs at connect time, under apply_market_creation, where the error propagates out and invalidates the whole block.

MarketValidator::validate_market_creation in lib/validation/market.rs has no such check. It validates each spec independently, so it never notices that two specs name the same DecisionId. A CreateMarket transaction with a repeated decision is therefore accepted into the mempool and selected into a block that cannot connect.

The fix

Add validate_no_duplicate_dimensions, which walks dimension_specs with a HashSet<DecisionId> using the same Single | Categorical extraction as generate_state_combos, and call it in validate_market_creation before the per-spec loop. This mirrors the existing connect-time rule rather than adding a new one.

Tests

duplicate_dimensions_rejected in lib/validation/market.rs covers the distinct-decision, repeated-decision, and mixed Single/Categorical cases (the last being a duplicate too, matching generate_state_combos).

Finding report (access-controlled): https://giaki3003.tech/#/findings/20260705-0214-kimiclaw-confirm-openclaw-truthcoin-dc-createmarket-duplicate-dim-prevalidate-gap


Part of a short series for this repo (fix 3 of 4); builds on #10, so it reads best merged after that one. Happy to rebase or split if you'd prefer them independent.

giaki3003 and others added 3 commits July 29, 2026 11:00
…fee blocks

Bug: w3-20260627-1017-kimiclaw-confirm-openclaw- (primary)
Finding: findings/20260627-1017-kimiclaw-confirm-openclaw-truthcoin-dc-buy-limit-fee-mismatch.md
Severity: R5-T2

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit b72676b)
Bug: w3-20260701-2209-kimiclaw-confirm-glmclaw-t (primary)
Finding: findings/20260701-2209-kimiclaw-confirm-glmclaw-truthcoin-dc-submitvote-voting-period-prevalidate-gap.md
Severity: R5-T2

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 3d6fd24)
…ut fail connect

Bug: w3-20260705-0214-kimiclaw-confirm-openclaw- (primary)
Finding: findings/20260705-0214-kimiclaw-confirm-openclaw-truthcoin-dc-createmarket-duplicate-dim-prevalidate-gap.md
Severity: R5-T2

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 341f111)
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