-
Notifications
You must be signed in to change notification settings - Fork 97
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
Update the Paths snippet test #739
Conversation
…strate ripple_path_find RPC
snippets/paths.py
Outdated
# References | ||
# - https://xrpl.org/paths.html#paths | ||
# - https://xrpl.org/ripple_path_find.html#ripple_path_find | ||
# Note: This test is inspired from a unit test titled `indirect_paths_path_find` in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main purpose of a snippet is to provide working examples for users, not for testing even though we implement tests on those. This should be reworded
snippets/paths.py
Outdated
currency="USD", | ||
issuer="rVnYNK9yuxBz4uP8zC8LEFokM2nqH3poc", | ||
# these wallets will have 100 testnet XRP | ||
alice = generate_faucet_wallet(client, debug=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we denote these as wallet somehow, just to avoid confusion?
snippets/paths.py
Outdated
# Extract out paths from the RipplePathFind response | ||
paths = path_response.result["alternatives"][0]["paths_computed"] | ||
print(paths) | ||
submit_and_wait( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before these submit_and_wait
, can you print out a statement such as Submitting AccountSet transaction for ...` so that user can expect to wait, and also print result or some kind of message when done?
snippets/paths.py
Outdated
|
||
print("signed: ", autofill_and_sign(payment_tx, client, wallet)) | ||
print("Test passed successfully!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto. This statement is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Snippets are documentation. The objective of this snippet is to make it easy to see how paths would work. I don't think setting up the whole system accomplishes that.
I understand that resets are difficult to work with, but we can either add some extra tokens to set up to the list every time, or use tokens that are already on that list.
snippets/paths.py
Outdated
) | ||
response = client.request(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Some kind of statement should be printed out
snippets/paths.py
Outdated
|
||
# Check the source amount | ||
source_amount = paths[0]["source_amount"] | ||
assert source_amount["currency"] == "USD" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we using assert
in other snippets since these are not tests?
What tokens and list are you referring to? If you are looking at theissuer and the destination account mentioned in the snippets test ( |
Are these https://xrpl-py.readthedocs.io/en/stable/source/snippets.html -- this page is using a static, older version of the snippets files (possibly from 2021). Does it need to be dynamically linked to the github repository's |
@mvadari @pdp2121 I can incorporate your suggestions into the snippets test (i.e. use hard-coded account number for readability). But I don't understand how the tests were working before the testnet reset i.e. how was We discovered that the account Have you guys saved the output from one of the older CI/CD runs? (I don't know if Github allows me to access really old logs) Do you know how this works? |
@intelliot @justinr1234 Do any of you know how the Specifically, how can a This must be the resulting path (output of |
WalkthroughThe changes involve the removal of the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
The changes created in this PR appears to have been included in other related PRs. I see an empty diff in the "Files" tab. Thanks for all the feedback. I'll close this PR. |
Create trust lines internally to demonstrate ripple_path_find RPC
High Level Overview of Change
The existing Paths snippets test depends on certain pre-requisite state of the test-net infrastructure. Upon a test-net reset, this state needs to be restored manually.
This process is error-prone, tedious. Moreover, tests must be self-contained i.e. Paths test must create the necessary blockchain state inside the test itself.
Context of Change
After this change, the effort needed to reset the test-net is lowered.
For instance, the Paths snippets test is currently failing with this error:
This PR ensures that the test completes successfully without a dependence on a set of accounts, trust-lines and account-related settings (like Default Rippling set on some accounts)
Type of Change
Did you update CHANGELOG.md?
Test Plan
Summary by CodeRabbit
New Features
Bug Fixes
Removed Features