Skip to content

fix: point the oracle tutorial at Pragma's Miden v0.15 oracle#209

Merged
BrianSeong99 merged 1 commit into
mainfrom
kbg/fix/oracle-v15-pragma
Jul 11, 2026
Merged

fix: point the oracle tutorial at Pragma's Miden v0.15 oracle#209
BrianSeong99 merged 1 commit into
mainfrom
kbg/fix/oracle-v15-pragma

Conversation

@Keinberger

Copy link
Copy Markdown
Collaborator

Overview

The Pragma oracle tutorial (oracle_data_query + oracle_reader.masm + oracle_tutorial.md) couldn't run: it pointed at Pragma's old pre-v0.15 oracle, which the v0.15 client rejects. Pragma has since redeployed on Miden 0.15 (astraly-labs/pragma-miden, miden-client 0.15.3), so this points the tutorial at the new deployment and gets it reading a live price again.

Key Changes

  • masm/accounts/oracle_reader.masm: update the two stale hardcoded values used by the execute_foreign_procedure call: the get_median procedure MAST root and the oracle account id. The BTC/USD faucet pair (1:0) is unchanged.
  • rust-client/src/bin/oracle_data_query.rs: default the oracle address to Pragma's current testnet oracle (mtst1apadf2szkxqkcyt7x2znuggv9qkhccam) so cargo run works with no args; a bech32 id passed as the first argument still overrides it.
  • docs/src/rust-client/oracle_tutorial.md: update the masm block, the run command, and the expected-output transcript to match, plus a note that Pragma's addresses change between testnet iterations.

Rationale

I took the new get_median MAST root and the oracle id felts from Pragma's own get_median_procedure_hash() rather than hardcoding a guess, then ran it against the live oracle: it returns is_tracked = 1 and a real BTC/USD median. A wrong root would fail the foreign procedure call, not return a price.

The publisher id word in the oracle's storage is laid out as [prefix, suffix, 0, 0] with this client version, so the tutorial keeps reading [w[0], w[1]]. Pragma's own examples/consume-price reads [w[3], w[2]] and currently panics (UnknownAccountIdVersion(0)) against the released miden-client, so I did not follow it there.

Tests

Ran oracle_data_query against testnet: is_tracked=1, median 6439689500000, exit 0. cargo test --doc (17 passed, 0 failed) and prettier --check are green, and the doc's no_run program is byte-identical to the binary.

Open Questions

  1. Decimals: get_median returns only the raw fixed-point median; the decimals live per-entry in Pragma's feed. The raw value only makes sense for BTC at 8 decimals (about $64,396.89), so that is what the doc says, but the old feed used 6. Happy to adjust if you know the exact precision.
  2. Fragility: Pragma's addresses change between testnet iterations, so these hardcoded values will need re-updating on each redeploy. Worth tracking if we want the tutorial to stay green on its own.

@Keinberger

Copy link
Copy Markdown
Collaborator Author

@brianseong could you give this one a review when you get a chance? 🙏

@Keinberger Keinberger requested a review from BrianSeong99 July 10, 2026 12:17

@BrianSeong99 BrianSeong99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved 👍

@BrianSeong99 BrianSeong99 merged commit 7c7ea4f into main Jul 11, 2026
6 checks passed
@BrianSeong99 BrianSeong99 deleted the kbg/fix/oracle-v15-pragma branch July 11, 2026 22:28
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.

2 participants