Skip to content

Revert "Data Streams: RWA v8" #2871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions public/samples/DataStreams/ClientReportsVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,16 @@ contract ClientReportsVerifier {
}

/**
* @dev Data Streams report schema v8 (RWA streams).
* @dev Data Streams report schema v4 (RWA streams).
*/
struct ReportV8 {
struct ReportV4 {
bytes32 feedId;
uint32 validFromTimestamp;
uint32 observationsTimestamp;
uint192 nativeFee;
uint192 linkFee;
uint32 expiresAt;
uint64 lastUpdateTimestamp;
int192 midPrice;
int192 price;
uint32 marketStatus;
}

Expand Down Expand Up @@ -141,11 +140,11 @@ contract ClientReportsVerifier {
// ----------------- Public API -----------------

/**
* @notice Verify a Data Streams report (schema v3 or v8).
* @notice Verify a Data Streams report (schema v3 or v4).
*
* @dev Steps:
* 1. Decode the unverified report to get `reportData`.
* 2. Read the first two bytes → schema version (`0x0003` or `0x0008`).
* 2. Read the first two bytes → schema version (`0x0003` or `0x0004`).
* - Revert if the version is unsupported.
* 3. Fee handling:
* - Query `s_feeManager()` on the proxy.
Expand All @@ -156,7 +155,7 @@ contract ClientReportsVerifier {
* 5. Decode the verified report into the correct struct and emit the price.
*
* @param unverifiedReport Full payload returned by Streams Direct.
* @custom:reverts InvalidReportVersion when schema ≠ v3/v8.
* @custom:reverts InvalidReportVersion when schema ≠ v3/v4.
*/
function verifyReport(bytes memory unverifiedReport) external {
// ─── 1. & 2. Extract reportData and schema version ──
Expand All @@ -167,7 +166,7 @@ contract ClientReportsVerifier {

uint16 reportVersion = (uint16(uint8(reportData[0])) << 8) |
uint16(uint8(reportData[1]));
if (reportVersion != 3 && reportVersion != 8)
if (reportVersion != 3 && reportVersion != 4)
revert InvalidReportVersion(reportVersion);

// ─── 3. Fee handling ──
Expand Down Expand Up @@ -205,7 +204,7 @@ contract ClientReportsVerifier {
lastDecodedPrice = price;
emit DecodedPrice(price);
} else {
int192 price = abi.decode(verified, (ReportV8)).midPrice;
int192 price = abi.decode(verified, (ReportV4)).price;
lastDecodedPrice = price;
emit DecodedPrice(price);
}
Expand Down
6 changes: 3 additions & 3 deletions src/config/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
children: [
{
title: "Report Schema v3 (Crypto)",
url: "data-streams/reference/report-schema-v3",
url: "data-streams/reference/report-schema",
},
{
title: "Report Schema v3 (DEX State Price)",
Expand All @@ -362,8 +362,8 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
url: "data-streams/rwa-streams",
children: [
{
title: "Report Schema v8",
url: "data-streams/reference/report-schema-v8",
title: "Report Schema v4",
url: "data-streams/reference/report-schema-v4",
},
],
},
Expand Down
3 changes: 1 addition & 2 deletions src/content/data-streams/architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ whatsnext:
"Learn more about the Standard API Implementation": "/data-streams/tutorials/api-go",
"Learn more about the Streams Trade Implementation": "/data-streams/streams-trade",
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
}
---

Expand Down
3 changes: 1 addition & 2 deletions src/content/data-streams/billing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ whatsnext:
{
"Learn the basics about how to retrieve Data Streams reports in the Getting Started guide.": "/data-streams/getting-started",
"Find the list of available Stream IDs.": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
"Find the schema of data to expect from Data Streams reports.": "/data-streams/reference/report-schema",
}
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ metadata:
whatsnext:
{
"Find the list of available Stream IDs.": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
"Find the schema of data to expect from Data Streams reports.": "/data-streams/reference/report-schema",
}
---

import DataStreams from "@features/data-streams/common/DataStreams.astro"

<DataStreams section="dsNotes" />

Chainlink Data Streams provides [reports](/data-streams/reference/report-schema-v3) with a _Mid_ and _Liquidity-Weighted Bid and Ask (LWBA)_ prices. These three prices form a pricing spread that offers protocols insight into market activity based on the current state of the order books.
Chainlink Data Streams provides [reports](/data-streams/reference/report-schema) with a _Mid_ and _Liquidity-Weighted Bid and Ask (LWBA)_ prices. These three prices form a pricing spread that offers protocols insight into market activity based on the current state of the order books.

**Note**: At the moment, only [Crypto streams](/data-streams/crypto-streams) provide LWBA prices.

Expand Down
3 changes: 1 addition & 2 deletions src/content/data-streams/developer-responsibilities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ metadata:
whatsnext:
{
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
"Learn the basics about how to retrieve Data Streams reports using the Streams Trade implementation": "/data-streams/getting-started",
"Learn how to fetch and decode Data Streams reports using the Data Streams API": "/data-streams/tutorials/api-go",
}
Expand Down
5 changes: 2 additions & 3 deletions src/content/data-streams/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ whatsnext:
{
"Learn how to fetch and decode Data Streams reports with the API": "/data-streams/tutorials/api-go",
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
}
---

Expand Down Expand Up @@ -86,7 +85,7 @@ Access data directly through REST APIs or WebSocket connections using our SDKs:

1. Understand the Architecture: Review the [system components and data flow](/data-streams/architecture) to understand how Data Streams works.

1. Explore Available Data: Browse [available Stream IDs](/data-streams/crypto-streams) and [report schemas](/data-streams/reference/report-schema-v3) to see what data is available.
1. Explore Available Data: Browse [available Stream IDs](/data-streams/crypto-streams) and [report schemas](/data-streams/reference/report-schema) to see what data is available.

1. Try the API: Follow our [hands-on tutorial](/data-streams/tutorials/api-go) to fetch and decode your first report.

Expand Down
5 changes: 2 additions & 3 deletions src/content/data-streams/market-hours.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ whatsnext:
{
"Find the list of available Crypto streams": "/data-streams/crypto-streams",
"Find the list of available RWA streams": "/data-streams/rwa-streams",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
}
---

Expand All @@ -27,4 +26,4 @@ Markets for several assets are actively traded only during certain hours. Listed

## Real World Asset market status

Reports for Real World Asset (RWA) streams include the `marketStatus` value, which reflects the DON'S consensus on whether the market is currently open. For additional information, refer to the [RWA report schema](/data-streams/reference/report-schema-v8) page.
Reports for Real World Asset (RWA) streams include the `marketStatus` value, which reflects the DON'S consensus on whether the market is currently open. For additional information, refer to the [RWA report schema](/data-streams/reference/report-schema-v4) page.
4 changes: 2 additions & 2 deletions src/content/data-streams/reference/go-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Where `ID` is the unique identifier for the stream.

#### `FeedVersion` uint16

Represents the stream [report schema](/data-streams/reference/report-schema-v3) version.
Represents the stream [report schema](/data-streams/reference/report-schema) version.

```go
type FeedVersion uint16
Expand Down Expand Up @@ -329,7 +329,7 @@ import report "github.com/smartcontractkit/data-streams-sdk/go/report"

```go
type Data interface {
v1.Data | v2.Data | v3.Data | v4.Data | v8.Data | v9.Data
v1.Data | v2.Data | v3.Data | v4.Data
Schema() abi.Arguments
}
```
Expand Down
4 changes: 2 additions & 2 deletions src/content/data-streams/reference/report-schema-v3-dex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { PageTabs } from "@components"
url: "/data-streams/reference/report-schema-v3-dex",
},
{
name: "RWA Report Schema (v8)",
url: "/data-streams/reference/report-schema-v8",
name: "Real World Asset (RWA) Report Schema (v4)",
url: "/data-streams/reference/report-schema-v4",
},
]}
headerTitle="Available Report Schemas"
Expand Down
27 changes: 8 additions & 19 deletions src/content/data-streams/reference/report-schema-v4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,35 @@ section: dataStreams
date: Last Modified
title: "Report Schemas"
metadata:
title: "Real World Asset (RWA) Report Schema (v4) (Deprecated) | Chainlink Data Streams"
title: "Real World Asset (RWA) Report Schema (v4) | Chainlink Data Streams"
description: "Learn about Chainlink Data Streams Real World Asset (RWA) report schema (v4), including fields, encoding, and examples for integrating RWA data in your applications."
keywords: ["Report Schema", "RWA", "Real World Assets", "v4 Schema", "Data Format", "Report Structure"]
---

import DataStreams from "@features/data-streams/common/DataStreams.astro"
import { Aside, PageTabs } from "@components"
import { PageTabs } from "@components"

<DataStreams section="dsNotes" />

<PageTabs
pages={[

{
name: "Cryptocurrency Report Schema (v3)",
url: "/data-streams/reference/report-schema-v3",
url: "/data-streams/reference/report-schema",
},
{
name: "DEX State Price Report Schema (v3)",
url: "/data-streams/reference/report-schema-v3-dex",
},
{
name: "(Deprecated) RWA Report Schema (v4)",
name: "Real World Asset (RWA) Report Schema (v4)",
url: "/data-streams/reference/report-schema-v4",
},
{
name: "RWA Report Schema (v8)",
url: "/data-streams/reference/report-schema-v8",
},

]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
/>

<Aside type="danger">
The v4 report schema is deprecated. View the [v8 report schema](/data-streams/reference/report-schema-v8) for the
latest RWA report schema.
</Aside>

Real World Asset (RWA) streams adhere to the report schema outlined below.

## Schema Fields
Expand All @@ -55,7 +44,7 @@ Real World Asset (RWA) streams adhere to the report schema outlined below.
| `nativeFee` | `uint192` | The cost to verify this report onchain when paying with the blockchain's native token |
| `linkFee` | `uint192` | The cost to verify this report onchain when paying with LINK |
| `expiresAt` | `uint32` | The expiration date of this report |
| `price` | `int192` | The DON's consensus median price |
| `price` | `int192` | The DON's consensus median price for this report carried to 18 decimal places |
| `marketStatus` | `uint32` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). |

**Notes**:
Expand Down
47 changes: 0 additions & 47 deletions src/content/data-streams/reference/report-schema-v8.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,21 @@ import { PageTabs } from "@components"

<PageTabs
pages={[

{
name: "Cryptocurrency Report Schema (v3)",
url: "/data-streams/reference/report-schema-v3",
url: "/data-streams/reference/report-schema",
},
{
name: "DEX State Price Report Schema (v3)",
url: "/data-streams/reference/report-schema-v3-dex",
},
{
name: "RWA Report Schema (v8)",
url: "/data-streams/reference/report-schema-v8",
}

]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
name: "Real World Asset (RWA) Report Schema (v4)",
url: "/data-streams/reference/report-schema-v4",
},
]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
/>

Cryptocurrency streams adhere to the report schema outlined below.
Expand All @@ -47,7 +45,7 @@ Cryptocurrency streams adhere to the report schema outlined below.
| `nativeFee` | `uint192` | Verification cost in native blockchain tokens |
| `linkFee` | `uint192` | Verification cost in LINK tokens |
| `expiresAt` | `uint32` | Timestamp when this report expires |
| `price` | `int192` | DON consensus median price |
| `price` | `int192` | DON consensus median price (18 decimal places) |
| `bid` | `int192` | Simulated buy impact price at X% liquidity depth |
| `ask` | `int192` | Simulated sell impact price at X% liquidity depth |

Expand Down
21 changes: 10 additions & 11 deletions src/content/data-streams/reference/rust-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The [Data Streams SDK for Rust](https://github.com/smartcontractkit/data-streams

- **REST API Client**: Fetch point-in-time data from Data Streams
- **WebSocket Client**: Stream real-time data with automatic reconnection
- **Report Decoding**: Built-in support for decoding and validating multiple report formats (V3, V8)
- **Report Decoding**: Built-in support for decoding and validating multiple report formats (V3, V4)
- **High Availability**: WebSocket connection management with failover support
- **Tracing Support**: Optional logging via the [`tracing`](https://crates.io/crates/tracing) crate
- **Async/Await**: Built on Tokio for efficient async operations
Expand All @@ -72,10 +72,10 @@ The SDK provides several feature flags to customize its functionality:

## Report Types

The Rust SDK supports multiple report formats, including **V3 (Crypto)** and **V8 (RWA)**. For the complete list of fields and their detailed descriptions, refer to the dedicated schema pages:
The Rust SDK supports multiple report formats, including **V3 (Crypto)** and **V4 (RWA)**. For the complete list of fields and their detailed descriptions, refer to the dedicated schema pages:

- [V3 (Cryptocurrency) Report Schema](/data-streams/reference/report-schema-v3)
- [V8 (RWA) Report Schema](/data-streams/reference/report-schema-v8)
- [V3 (Cryptocurrency) Report Schema](/data-streams/reference/report-schema)
- [V4 (RWA) Report Schema](/data-streams/reference/report-schema-v4)

Below are basic code snippets for decoding these reports with the SDK:

Expand All @@ -95,23 +95,22 @@ println!("Ask: {}", report_data.ask);
// ... etc.
```

For more details on every field in V3 (Crypto) reports, see the [V3 report schema page](/data-streams/reference/report-schema-v3).
For more details on every field in V3 (Crypto) reports, see the [V3 report schema page](/data-streams/reference/report-schema).

### V8 Reports (RWA Streams)
### V4 Reports (RWA Streams)

```rust
use chainlink_data_streams_report::report::v8::ReportDataV8;
use chainlink_data_streams_report::report::v4::ReportDataV4;

let report_data = ReportDataV8::decode(&report_blob)?;
let report_data = ReportDataV4::decode(&report_blob)?;

// Example usage:
println!("Mid Price: {}", report_data.mid_price);
println!("Price: {}", report_data.price);
println!("Market Status: {}", report_data.market_status);

// ... etc.
```

For more details on every field in v8 (RWA) reports, see the [V8 report schema page](/data-streams/reference/report-schema-v8).
For more details on every field in V4 (RWA) reports, see the [V4 report schema page](/data-streams/reference/report-schema-v4).

## Authentication

Expand Down
Loading
Loading