fix(oracle): accept any non-empty BaseAsset/QuoteAsset in OracleSet#335
Open
e-desouza wants to merge 1 commit into
Open
fix(oracle): accept any non-empty BaseAsset/QuoteAsset in OracleSet#335e-desouza wants to merge 1 commit into
e-desouza wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #335 +/- ##
==========================================
+ Coverage 84.49% 84.53% +0.03%
==========================================
Files 227 227
Lines 24245 24283 +38
==========================================
+ Hits 20487 20528 +41
+ Misses 3758 3755 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
validate_oracle_currencyrestricted BaseAsset and QuoteAsset to 3-character ISO codes or 40-character hex strings. The rippled node imposes no such restriction — it accepts any non-empty string for these fields. This caused the Rust SDK to silently reject valid oracle pairs (e.g. BTC, DOGE, AAPL, EURO) that rippled would happily process.Introduced in #156 (9570a0e).
What changed
validate_oracle_currencyinsrc/models/transactions/mod.rs: replaced the ISO/hex pattern check with a simple non-empty string checktest_invalid_base_asset_rejected(which asserted the old ISO/hex restriction) with:test_arbitrary_non_empty_base_asset_accepted— verifies EURO, BTC, DOGE, AAPL, and other arbitrary codes are acceptedtest_empty_base_asset_rejected— verifies empty string is still rejectedtest_empty_quote_asset_rejected— verifies empty string is rejected for quote_asset tooHow to validate
cargo test --lib --features std