Skip to content

Conversation

@andrejrakic
Copy link
Collaborator

This PR adds Report Data Version 10 Schema to the Rust chainlink_data_streams_report crate

@andrejrakic andrejrakic self-assigned this Aug 4, 2025
@andrejrakic andrejrakic changed the title Add ReportDataV10 schema Rust: Add ReportDataV10 schema Aug 4, 2025
@andrejrakic andrejrakic requested a review from Copilot August 4, 2025 17:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Report Data Version 10 Schema to the Rust chainlink_data_streams_report crate, extending the existing V8 schema with additional fields for multipliers and tokenized pricing.

  • Implements a new ReportDataV10 struct with fields for current/new multipliers, activation dates, and tokenized pricing
  • Adds encoding/decoding functionality and comprehensive test coverage for the new schema
  • Updates package versions from 1.0.0/1.0.1 to 1.0.2 to reflect the new functionality

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
rust/crates/sdk/Cargo.toml Updates SDK version and report dependency to 1.0.2
rust/crates/report/src/report/v10.rs Implements new ReportDataV10 struct with decode/encode methods and tests
rust/crates/report/src/report.rs Adds v10 module import and test utilities for the new schema
rust/crates/report/Cargo.toml Updates report crate version to 1.0.2

let encoded = report_data.abi_encode().unwrap();
let decoded = ReportDataV10::decode(&encoded).unwrap();

const MOCK_MULTIPLIER: isize = 1000000000000000000;
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The magic number 1000000000000000000 should be defined as a named constant or use a more readable format like 10_i128.pow(18) to clearly indicate it represents 1.0 with 18 decimal places.

Suggested change
const MOCK_MULTIPLIER: isize = 1000000000000000000;
const ONE_WITH_18_DECIMALS: isize = 10_isize.pow(18);
const MOCK_MULTIPLIER: isize = ONE_WITH_18_DECIMALS;

Copilot uses AI. Check for mistakes.
Comment on lines +264 to +265
const MOCK_MULTIPLIER: isize = 1000000000000000000; // 1.0 with 18 decimals

Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

This duplicates the same magic number from the v10.rs test. Consider defining a shared constant or using 10_i128.pow(18) for better readability and maintainability.

Suggested change
const MOCK_MULTIPLIER: isize = 1000000000000000000; // 1.0 with 18 decimals
// Use shared constant for 1.0 with 18 decimals

Copilot uses AI. Check for mistakes.
@andrejrakic andrejrakic marked this pull request as ready for review August 4, 2025 17:48
brunotm
brunotm previously approved these changes Aug 4, 2025
@andrejrakic andrejrakic dismissed brunotm’s stale review August 7, 2025 16:03

The merge-base changed after approval.

@brunotm brunotm self-requested a review August 7, 2025 16:29
@andrejrakic andrejrakic merged commit 5d545e9 into main Aug 7, 2025
6 checks passed
@andrejrakic andrejrakic deleted the rust/add-v10-schema branch August 7, 2025 16:33
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