Skip to content

feat: add oracle-url field to orders spec#45

Open
hardyjosh wants to merge 2 commits intomainfrom
feat/oracle-url-spec
Open

feat: add oracle-url field to orders spec#45
hardyjosh wants to merge 2 commits intomainfrom
feat/oracle-url-spec

Conversation

@hardyjosh
Copy link
Contributor

@hardyjosh hardyjosh commented Feb 16, 2026

Motivation

Orders that require external data (e.g. price feeds) at take-time currently have no way to advertise their oracle endpoint in the YAML config. This adds the spec for it.

Changes

Adds an optional oracle-url field to the orders section of the ob-yaml spec. When present, tooling encodes a SignedContextOracleV1 metadata item (magic 0xff7a1507ba4419ca) into the order's RainMetaDocumentV1, enabling oracle endpoint discovery by takers and indexers.

Includes:

  • Field documentation
  • Oracle server response format spec (SignedContextV1 JSON)
  • Example YAML showing an order with oracle-url

Context

Part of the signed context oracle integration:

  • rain.metadata#92 — metadata type
  • rain.interpreter#427 — submodule bump
  • rain.orderbook#2457 — SDK parsing
  • rain.orderbook#2458 — fetch + wiring
  • rain.orderbook#2459 — UI
  • rain-oracle-server — reference server implementation
  • This PR — YAML spec
  • Next: rain.orderbook YAML parsing (Phase 6)

Summary by CodeRabbit

  • Documentation
    • Added support for an optional oracle-url field in order front matter.
    • Documented oracle integration for referencing external signed context via an oracle URL, including how metadata is discovered on-chain.
    • Specified expected JSON response format from oracle servers and provided updated examples showing oracle-order usage with inputs/outputs.

Orders can now specify an optional oracle-url that points to a signed context
oracle server. When present, tooling encodes a SignedContextOracleV1 metadata
item into the order's RainMetaDocumentV1, enabling oracle discovery by takers
and indexers.
@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

Walkthrough

Adds an optional oracle-url front-matter field in ob-yaml.md and a new Oracle URL section describing external-data orders referencing a SignedContextV1, how a SignedContextOracleV1 metadata item is encoded into RainMetaDocumentV1 for on-chain discovery, and the expected JSON response format from oracle servers.

Changes

Cohort / File(s) Summary
Oracle URL Documentation
ob-yaml.md
Added optional oracle-url field to order front matter; new Oracle URL section describing SignedContextV1 fetch semantics, encoding SignedContextOracleV1 into RainMetaDocumentV1 for on-chain discovery, oracle-server GET JSON response format (SignedContextV1), and updated examples showing oracle-order with inputs/outputs.

Sequence Diagram(s)

sequenceDiagram
  participant Order as Order Front Matter
  participant Chain as RainMetaDocumentV1 (On-chain)
  participant Consumer as Consumer/Indexer
  participant Oracle as Oracle Server

  Order->>Chain: encode SignedContextOracleV1 into RainMetaDocumentV1
  Consumer->>Chain: discover order metadata (includes oracle-url)
  Consumer->>Oracle: GET <oracle-url>
  Oracle-->>Consumer: 200 JSON (SignedContextV1)
  Consumer->>Consumer: validate/use SignedContextV1
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: add oracle-url field to orders spec' accurately and concisely describes the main change: adding an optional oracle-url field to the orders specification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/oracle-url-spec

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 and usage tips.

hardyjosh pushed a commit to rainlanguage/rain.orderbook that referenced this pull request Feb 16, 2026
Adds optional oracle-url field to OrderCfg, parsed from the YAML front
matter orders section. When present, this URL identifies a signed context
oracle server for the order.

Changes:
- Add oracle_url: Option<String> to OrderCfg struct
- Parse oracle-url via optional_string in YAML parsing
- Add oracle-url to ALLOWED_ORDER_KEYS
- Update Default and PartialEq impls
- Add test for oracle-url parsing (present + absent)

Spec: rainlanguage/specs#45
Chained on: #2459 (Phase 4)
The signed context is provided by the caller during take/clear, not
just 'at take-time'. Updated wording to be precise about the usage
context.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@ob-yaml.md`:
- Around line 285-292: Update the Oracle URL documentation to state transport
and security expectations: require HTTPS for the `oracle-url` to prevent
downgrade/MITM, recommend servers use TLS with valid certificates, and document
that endpoints encoded via `SignedContextOracleV1` (magic 0xff7a1507ba4419ca)
into `RainMetaDocumentV1` are discoverable onchain so callers should not assume
confidentiality of the URL; also suggest optional authentication approaches
(e.g., bearer tokens, client TLS certs, or signature verification of
`SignedContextV1` responses) and indicate that callers must validate TLS and
signature/auth metadata when retrieving `SignedContextV1`.
- Around line 287-289: Update the wording in the documentation fragment that
describes oracle metadata: change “onchain” to “on-chain” and “webapp” to “web
app” to match standard terminology; locate the text mentioning `oracle-url`,
`SignedContextV1`, `SignedContextOracleV1`, and `RainMetaDocumentV1` (including
the magic `0xff7a1507ba4419ca`) and apply the two spelling/wording fixes there.

Comment on lines +285 to +292
### Oracle URL

Orders that require external data (e.g. price feeds) can specify an `oracle-url`. This URL points to a server that returns `SignedContextV1` data. The signed context is provided by the caller when taking or clearing the order — the order's rainlang can then read this data from the signed context columns during evaluation.

When `oracle-url` is specified, the tooling encodes a `SignedContextOracleV1` metadata item (magic `0xff7a1507ba4419ca`) into the order's `RainMetaDocumentV1`. This allows the oracle endpoint to be discovered onchain by anyone who needs to take or clear the order (e.g. Raindex bots, the webapp, or other takers).

The oracle server MUST respond to `GET` requests and return a JSON object matching the `SignedContextV1` struct:

Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Clarify transport/security expectations for oracle-url.

Consider stating whether the URL must be HTTPS (or otherwise authenticated) to avoid leaking endpoint access patterns or enabling downgrade/mitm risks.

🧰 Tools
🪛 LanguageTool

[grammar] ~289-~289: Ensure spelling is correct
Context: ...ws the oracle endpoint to be discovered onchain by anyone who needs to take or clear th...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~289-~289: Ensure spelling is correct
Context: ...clear the order (e.g. Raindex bots, the webapp, or other takers). The oracle server M...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
In `@ob-yaml.md` around lines 285 - 292, Update the Oracle URL documentation to
state transport and security expectations: require HTTPS for the `oracle-url` to
prevent downgrade/MITM, recommend servers use TLS with valid certificates, and
document that endpoints encoded via `SignedContextOracleV1` (magic
0xff7a1507ba4419ca) into `RainMetaDocumentV1` are discoverable onchain so
callers should not assume confidentiality of the URL; also suggest optional
authentication approaches (e.g., bearer tokens, client TLS certs, or signature
verification of `SignedContextV1` responses) and indicate that callers must
validate TLS and signature/auth metadata when retrieving `SignedContextV1`.

Comment on lines +287 to +289
Orders that require external data (e.g. price feeds) can specify an `oracle-url`. This URL points to a server that returns `SignedContextV1` data. The signed context is provided by the caller when taking or clearing the order — the order's rainlang can then read this data from the signed context columns during evaluation.

When `oracle-url` is specified, the tooling encodes a `SignedContextOracleV1` metadata item (magic `0xff7a1507ba4419ca`) into the order's `RainMetaDocumentV1`. This allows the oracle endpoint to be discovered onchain by anyone who needs to take or clear the order (e.g. Raindex bots, the webapp, or other takers).
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix spelling/wording: “on-chain”, “web app”.

Minor doc polish to match standard terminology.

✏️ Suggested edit
-This allows the oracle endpoint to be discovered onchain by anyone who needs to take or clear the order (e.g. Raindex bots, the webapp, or other takers).
+This allows the oracle endpoint to be discovered on-chain by anyone who needs to take or clear the order (e.g. Raindex bots, the web app, or other takers).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Orders that require external data (e.g. price feeds) can specify an `oracle-url`. This URL points to a server that returns `SignedContextV1` data. The signed context is provided by the caller when taking or clearing the order — the order's rainlang can then read this data from the signed context columns during evaluation.
When `oracle-url` is specified, the tooling encodes a `SignedContextOracleV1` metadata item (magic `0xff7a1507ba4419ca`) into the order's `RainMetaDocumentV1`. This allows the oracle endpoint to be discovered onchain by anyone who needs to take or clear the order (e.g. Raindex bots, the webapp, or other takers).
Orders that require external data (e.g. price feeds) can specify an `oracle-url`. This URL points to a server that returns `SignedContextV1` data. The signed context is provided by the caller when taking or clearing the order — the order's rainlang can then read this data from the signed context columns during evaluation.
When `oracle-url` is specified, the tooling encodes a `SignedContextOracleV1` metadata item (magic `0xff7a1507ba4419ca`) into the order's `RainMetaDocumentV1`. This allows the oracle endpoint to be discovered on-chain by anyone who needs to take or clear the order (e.g. Raindex bots, the web app, or other takers).
🧰 Tools
🪛 LanguageTool

[grammar] ~289-~289: Ensure spelling is correct
Context: ...ws the oracle endpoint to be discovered onchain by anyone who needs to take or clear th...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~289-~289: Ensure spelling is correct
Context: ...clear the order (e.g. Raindex bots, the webapp, or other takers). The oracle server M...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
In `@ob-yaml.md` around lines 287 - 289, Update the wording in the documentation
fragment that describes oracle metadata: change “onchain” to “on-chain” and
“webapp” to “web app” to match standard terminology; locate the text mentioning
`oracle-url`, `SignedContextV1`, `SignedContextOracleV1`, and
`RainMetaDocumentV1` (including the magic `0xff7a1507ba4419ca`) and apply the
two spelling/wording fixes there.

hardyjosh pushed a commit to rainlanguage/rain.orderbook that referenced this pull request Feb 17, 2026
Adds optional oracle-url field to OrderCfg, parsed from the YAML front
matter orders section. When present, this URL identifies a signed context
oracle server for the order.

Changes:
- Add oracle_url: Option<String> to OrderCfg struct
- Parse oracle-url via optional_string in YAML parsing
- Add oracle-url to ALLOWED_ORDER_KEYS
- Update Default and PartialEq impls
- Add test for oracle-url parsing (present + absent)

Spec: rainlanguage/specs#45
Chained on: #2459 (Phase 4)
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

Comments