Skip to content

Conversation

@timbrinded
Copy link
Collaborator

OracleHelper requires assets in numerical order, but Oracle requires base asset first. This change will force base asset to be first in Report struct that gets passed for submitReport() txn constructed

Closes #63

OracleHelper requires assets in numerical order, but Oracle requires base asset first. This change will force base asset to be first in Report struct that gets passed for submitReport() txn constructed
Copilot AI review requested due to automatic review settings November 3, 2025 10:12
@timbrinded timbrinded changed the title fix: 🐛 make base_asset first in report fix: 🐛 make base_asset first in report Nov 3, 2025
Copy link
Contributor

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 a base_asset field to the OracleReport dataclass to ensure that the base asset price is always encoded first in the reports array when submitting to the oracle contract. The base asset is sourced from the PriceData context.

  • Added base_asset field to OracleReport dataclass and generate_report function signature
  • Modified encoder to sort reports array with base asset first, using a simple binary sorting key
  • Updated all test fixtures and test cases to include the new base_asset parameter

Reviewed Changes

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

Show a summary per file
File Description
src/tq_oracle/report/generator.py Added base_asset field to OracleReport dataclass and as parameter to generate_report function
src/tq_oracle/report/encoder.py Added import for ChecksumAddress and modified sorting logic to place base asset first in reports array
src/tq_oracle/pipeline/report.py Updated generate_report call to pass base_asset from price data context
tests/report/test_generator.py Updated all test cases to include base_asset parameter and add assertions for the new field
tests/report/test_encoder.py Updated test fixtures with base_asset and added new test to verify base asset ordering
tests/report/test_publisher.py Updated sample report fixture to include base_asset field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@timbrinded timbrinded merged commit 73ecf41 into master Nov 3, 2025
6 checks passed
@timbrinded timbrinded deleted the fix/report-asset-ordering branch November 3, 2025 10:14
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.

Invalid order of assets in the oracle report

2 participants