Skip to content

fix(x/prices): normalize pair case on the governance listing path - #3375

Open
SashaMIT wants to merge 1 commit into
dydxprotocol:mainfrom
SashaMIT:fix/normalize-pair-case-gov-path
Open

fix(x/prices): normalize pair case on the governance listing path#3375
SashaMIT wants to merge 1 commit into
dydxprotocol:mainfrom
SashaMIT:fix/normalize-pair-case-gov-path

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 6, 2026

Copy link
Copy Markdown

Summary

x/listing uppercases tickers before creating markets (listing.go: ticker = strings.ToUpper(ticker)), but the governance path (MsgCreateOracleMarket) stores the pair verbatim. The pricefeed daemon keys its exchange-config lookup on the exact stored string (price_feed_mutable_market_configs.go: marketNameToId[param.Pair] = param.Id), so a governance proposal that passes a non-canonical case (e.g. btc-usd) creates a market the daemon can never price. The market is governance-approved but silently receives no price updates.

The case-insensitive duplicate check in CreateMarket (strings.EqualFold) prevents collisions, so normalization here cannot conflict with existing markets.

Fix

Uppercase msg.Params.Pair in the gov msg server, matching the listing path.

Test plan

  • New test: gov path with btc-usd stores BTC-USD (matching x/listing behavior)
  • Full x/prices suite passes (4/4 packages); go vet clean

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes

    • Oracle markets created with lowercase trading pairs are now normalized to uppercase, ensuring consistent market creation and exponent handling.
  • Tests

    • Added coverage to verify lowercase pairs are stored in their canonical uppercase form.

x/listing uppercases tickers before creating markets, but the governance
path (MsgCreateOracleMarket) stores the pair verbatim. The pricefeed
daemon keys its exchange-config lookup on the exact stored string, so a
governance proposal that passes a non-canonical case (e.g. "btc-usd")
creates a market the daemon can never price, silently halting price
updates for a governance-approved market.

Uppercase the pair in the gov path to match the listing path.

Made-with: Cursor
@SashaMIT
SashaMIT requested a review from a team as a code owner August 6, 2026 16:41
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5e0ec270-26d8-41fd-a9e4-4886c5f0ca90

📥 Commits

Reviewing files that changed from the base of the PR and between 91316e6 and 97b9929.

📒 Files selected for processing (2)
  • protocol/x/prices/keeper/msg_server_create_oracle_market.go
  • protocol/x/prices/keeper/msg_server_create_oracle_market_test.go

📝 Walkthrough

Walkthrough

CreateOracleMarket now uppercases market pairs before exponent lookup and market creation. A regression test verifies that btc-usd is stored as BTC-USD.

Changes

Oracle market normalization

Layer / File(s) Summary
Normalize pairs during oracle market creation
protocol/x/prices/keeper/msg_server_create_oracle_market.go, protocol/x/prices/keeper/msg_server_create_oracle_market_test.go
CreateOracleMarket normalizes pairs to uppercase before lookup and creation. The regression test verifies canonical storage for a lowercase pair.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: pair-case normalization on the governance listing path.
Description check ✅ Passed The description explains the problem, fix, and test results, but it does not include the repository checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant