Skip to content

feat(orderbook): let the owner stop new markets on old actions - #1491

Merged
MicBun merged 2 commits into
mainfrom
feat/5275-new-markets-on-outcome-actions
Nov 19, 2026
Merged

MicBun merged 2 commits into
mainfrom
feat/5275-new-markets-on-outcome-actions

Conversation

@MicBun

@MicBun MicBun commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

resolves: https://github.com/truflation/website/issues/5275

Summary

  • The network owner can stop new markets on an action by adding its name to retired_market_actions (migration 064). create_market then refuses that action with Action <name> is retired for new markets: use an outcome action, ids 13 to 16.
  • Markets that already exist on a retired action still capture and settle. Only create_market reads the table.
  • The table ships empty, so merging and applying this changes nothing on its own.
  • docs/attestations.md shows the insert that retires price_above_threshold, price_below_threshold, value_in_range and index_change_in_range, the four actions the outcome actions replace.
  • docs/prediction-market-indexer.md now says that a settled market with winning_outcome null was refunded with no winner.

Rollout

  1. Merge. The node binary does not change (SQL, docs and a test only), so no node release is needed.
  2. Apply 064 and then create_market from 032 (032.prod on mainnet), in that order or in one exec-sql. create_market reads the table on every call, so the table must exist first. With the table empty, markets are created as before.
  3. Later, once the SDKs and the market bots create markets on ids 13 to 16, the network owner runs the insert from docs/attestations.md. The SDK releases are out. The bots change is listed below.

Test plan

  • go vet -tags=kwiltest ./tests/streams/order_book/ passes, so the new test compiles.
  • CI slow-integration-tests (order_book) runs TestRetiredMarketActions. I have not run it locally.
    • A market on price_above_threshold is created before the action is retired and refused after.
    • price_above_threshold_v2 and price_below_threshold still take markets after the retirement.
    • A market created before the retirement still captures and settles YES.

Related:

Summary by CodeRabbit

  • Behavior Changes
    • New markets can no longer be created using retired market actions. Existing markets using those actions can still be attested and settled.
  • Documentation
    • Added guidance on identifying retired market actions and using outcome action IDs 13–16.
    • Clarified that a refunded, settled market may have no winner: shares are paid $0.50 each, and open buy orders are returned.

@MicBun MicBun self-assigned this Nov 19, 2026
@holdex

holdex Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Time Submission Status

Member # Time Running Total Status Last Update
MicBun 15min ✅ Submitted Nov 19, 2026, 4:02 PM

Submit or update total time with:

@holdex pr submit-time 2h

Add time on top of previous submission with:

@holdex pr add-time 1h30m

See available commands to help comply with our Guidelines.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The changes add a table of retired market actions and prevent new markets from using listed actions. Markets created before retirement remain eligible for settlement. Tests cover both creation rejection and post-retirement settlement. Documentation describes the retirement process and settled refunds with no winner.

Changes: Market action retirement

Layer / File(s) Summary
Retirement registry and creation guard
internal/migrations/064-retired-market-actions.sql, internal/migrations/032-order-book-actions.sql, internal/migrations/032-order-book-actions.prod.sql, docs/attestations.md
A new table stores retired action names. Both create_market definitions reject new markets on listed actions. The documentation gives an SQL example and states that existing markets can still settle.
Retirement behavior and outcome descriptions
tests/streams/order_book/retired_market_actions_test.go, docs/prediction-market-indexer.md
Tests check rejection for new markets on retired actions and settlement of a market created before retirement. The indexer documentation describes a settled refund with no winner.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related PRs

  • trufnetwork/node#1486: Adds outcome action IDs 13–16, which the rejection message identifies as alternatives to the retired actions.
Merge Risk: Minimal · up to fb63e

Applying the migration changes nothing until the network owner retires actions. Applying migration 064 before using create_market, as the PR describes, is enough to avoid errors. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(orderbook): let the owner stop new markets on old actions" matches the main change. The PR adds a retired_market_actions table (migration 064) and makes create_market reject new market…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(orderbook): let the owner stop new markets on old actions" matches the main change. The PR adds a retired_market_actions table (migration 064) and makes create_market reject new markets on retired actions, while existing markets keep settling. The title is specific and concise, and it names the scope (orderbook) and the owner-controlled behavior. The docs and indexer clarifications are minor supporting changes that the title does not need to cover.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 144c0c6a-3f0e-4a73-81c5-8718f72f2242
Commits

Reviewing files that changed from the base of the PR and between 9b23167 and fb63e99.

Files selected for processing: 6

  • docs/attestations.md
  • docs/prediction-market-indexer.md
  • internal/migrations/032-order-book-actions.prod.sql
  • internal/migrations/032-order-book-actions.sql
  • internal/migrations/064-retired-market-actions.sql
  • tests/streams/order_book/retired_market_actions_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@MicBun

MicBun commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

@holdex pr submit-time 15m

@MicBun
MicBun merged commit 19d2493 into main Nov 19, 2026
14 checks passed
@MicBun
MicBun deleted the feat/5275-new-markets-on-outcome-actions branch November 19, 2026 16:02
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