You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(orderbook): let the owner stop new markets on old actions - #1491
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
Merge. The node binary does not change (SQL, docs and a test only), so no node release is needed.
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.
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.
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.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
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
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.
resolves: https://github.com/truflation/website/issues/5275
Summary
retired_market_actions(migration 064).create_marketthen refuses that action withAction <name> is retired for new markets: use an outcome action, ids 13 to 16.create_marketreads the table.docs/attestations.mdshows the insert that retiresprice_above_threshold,price_below_threshold,value_in_rangeandindex_change_in_range, the four actions the outcome actions replace.docs/prediction-market-indexer.mdnow says that a settled market withwinning_outcomenull was refunded with no winner.Rollout
create_marketfrom 032 (032.prod on mainnet), in that order or in oneexec-sql.create_marketreads the table on every call, so the table must exist first. With the table empty, markets are created as before.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.slow-integration-tests (order_book)runsTestRetiredMarketActions. I have not run it locally.price_above_thresholdis created before the action is retired and refused after.price_above_threshold_v2andprice_below_thresholdstill take markets after the retirement.Related:
Summary by CodeRabbit