Skip to content
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

Support for PriceOracles #701

Merged
merged 32 commits into from
May 9, 2024
Merged

Support for PriceOracles #701

merged 32 commits into from
May 9, 2024

Conversation

ckeshava
Copy link
Collaborator

High Level Overview of Change

This PR adds client library support for Price Oracle amendment.
Please refer to the spec: XRPLF/XRPL-Standards#129
CPP Implementation: XRPLF/rippled#4789

Context of Change

Support for transactions OracleSet and OracleDelete has been added. GetAggregatePrice request is included in the client library.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Did you update CHANGELOG.md?

  • Yes
  • No, this change does not impact library users

Test Plan

Unit, Integration and snippet tests have been included. There is some overlap between integration and snippet tests, perhaps they could be streamlined better.

.ci-config/rippled.cfg Outdated Show resolved Hide resolved
@ckeshava ckeshava requested review from mvadari and pdp2121 May 1, 2024 20:55
snippets/oracle.py Outdated Show resolved Hide resolved
@ckeshava ckeshava requested a review from pdp2121 May 4, 2024 04:02
CHANGELOG.md Outdated Show resolved Hide resolved
xrpl/models/transactions/oracle_set.py Outdated Show resolved Hide resolved
xrpl/models/transactions/oracle_set.py Outdated Show resolved Hide resolved
xrpl/models/requests/ledger_entry.py Show resolved Hide resolved
xrpl/models/requests/get_aggregate_price.py Outdated Show resolved Hide resolved
xrpl/models/requests/get_aggregate_price.py Outdated Show resolved Hide resolved
xrpl/models/requests/get_aggregate_price.py Outdated Show resolved Hide resolved
@ckeshava ckeshava requested a review from khancode May 6, 2024 19:55
errors = super()._get_errors()

# If price_data_series is not set, do not perform further validation
if "price_data_series" not in errors and (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if "price_data_series" not in errors and (
if self.price_data_series and (

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these two statements are not equivalent. surprisingly, self.price_dataa-series is interpreted as an [Object object], even when it is not specified as an input by the user

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

self.price_data_series **

@ckeshava ckeshava requested review from pdp2121 and mvadari May 7, 2024 21:41
@ckeshava ckeshava requested a review from pdp2121 May 8, 2024 17:54
@ckeshava
Copy link
Collaborator Author

ckeshava commented May 8, 2024

c'mon guys, please approve the PR soon! we've had enough back and forth :)

tests/unit/models/requests/test_ledger_entry.py Outdated Show resolved Hide resolved
tests/unit/models/requests/test_ledger_entry.py Outdated Show resolved Hide resolved
tests/unit/models/transactions/test_delete_oracle.py Outdated Show resolved Hide resolved
tests/unit/models/transactions/test_set_oracle.py Outdated Show resolved Hide resolved
tests/unit/models/transactions/test_set_oracle.py Outdated Show resolved Hide resolved
transaction_type: TransactionType = field(
default=TransactionType.ORACLE_DELETE,
init=False,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only tem... error code pertaining to OracleDelete stems from a misuse of the Flags field. Since none of the transactions OracleSet or OracleDelete, the request GetAggregatePrice or the LedgerEntry Oracle make use of a non-zero Flag, I chose to not model it.

Consequently, there are no other tem... errors pertaining to this transaction

@ckeshava
Copy link
Collaborator Author

ckeshava commented May 9, 2024

I have resolved those comments which I could address -- If any of the reviewers prefer to resolve the comments yourself, please let me know.

@ckeshava ckeshava requested a review from khancode May 9, 2024 22:38
Copy link
Collaborator

@khancode khancode left a comment

Choose a reason for hiding this comment

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

LGTM, great work! 👏

@ckeshava
Copy link
Collaborator Author

ckeshava commented May 9, 2024

thanks to all the reviewers for patiently working through this PR.

If there are any other comments, please let me know. I'll create a separate PR.

@ckeshava ckeshava merged commit 13e4012 into XRPLF:main May 9, 2024
21 checks passed
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.

4 participants