Skip to content

fix: accept the ephemeral oracle discriminator for the price feed#112

Merged
dhruvja merged 1 commit into
mainfrom
dhruvja/fix/oracle-price-discriminator
Jul 7, 2026
Merged

fix: accept the ephemeral oracle discriminator for the price feed#112
dhruvja merged 1 commit into
mainfrom
dhruvja/fix/oracle-price-discriminator

Conversation

@dhruvja

@dhruvja dhruvja commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What

decodeOraclePrice validates the price-feed account's 8-byte discriminator before reading PriceUpdateV2 fields at fixed offsets. It only accepted the canonical Pyth PriceUpdateV2 discriminator (sha256("account:PriceUpdateV2")), but the SOL/USD feed the demo reads (ENYwebBThHzmzwPLAQvCucUTsjyfBSZdD9ViXksS4jPu) is served by MagicBlock's ephemeral oracle (owner PriCems5tHihc6UDXDjzjeawomAwBduWMGAi8ZUjppd), which mirrors the PriceUpdateV2 field layout but uses its own discriminator. So every price read threw Oracle account is not a Pyth PriceUpdateV2 account, breaking the live price display and the whole flow.

Why

The discriminator validation was added in #111 (a CodeRabbit suggestion) assuming a canonical Pyth account. This is a regression from that PR.

Fix

Accept the ephemeral oracle's discriminator ([234, 161, 14, 36, 172, 239, 15, 232]) in addition to the canonical Pyth PriceUpdateV2 one, so both a local/devnet ephemeral oracle and a real Pyth feed decode. Still fails clearly on an unrecognized account.

Testing

  • tsc --noEmit and vite build pass.
  • Ran the production build locally against devnet: the live SOL/USD price now renders instead of erroring (verified the feed account's on-chain discriminator matches the accepted value).

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
counter-session-keys Ready Ready Preview, Comment Jul 7, 2026 8:09am
er-rolldice Ready Ready Preview, Comment Jul 7, 2026 8:09am
magicblock-counter-example Ready Ready Preview, Comment Jul 7, 2026 8:09am
magicblock-engine-examples Ready Ready Preview, Comment Jul 7, 2026 8:09am
magicblock-rewards-dashboard Ready Ready Preview, Comment Jul 7, 2026 8:09am
rps-example Ready Ready Preview, Comment Jul 7, 2026 8:09am
spl-tokens Ready Ready Preview, Comment Jul 7, 2026 8:09am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@dhruvja, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ef2a42e2-1504-4150-b921-783d1b58514f

📥 Commits

Reviewing files that changed from the base of the PR and between 5492d69 and 763ab7b.

📒 Files selected for processing (1)
  • binary-prediction/app/src/lib/binaryPrediction.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dhruvja/fix/oracle-price-discriminator

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant