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

PriceOracle: rippled returns inconsistent error codes with invalid inputs under different situations #4962

Open
SaxenaKaustubh opened this issue Mar 21, 2024 · 1 comment

Comments

@SaxenaKaustubh
Copy link
Collaborator

Rippled returns different error codes for invalid inputs under different situations. Following is the list of such fields:

OracleSet:

Field Value Error Notes
PriceDataSeries "", 1, "Invalid", ([{}]), [{"PriceDataSeries": ""}]] invalidParams
PriceDataSeries None, ([]) temARRAY_EMPTY
TransactionType 123 internal
TransactionType "InvalidEntryShouldFail" invalidParams
Provider "" temMALFORMED
Provider None, 0, -1, 1, 1.2, "Invalid" invalidParams
URI None, 0, -1, 1, 1.2, "Invalid" invalidParams
URI "" temMALFORMED
AssetClass "", "020382A62402D2357ABC020382A6240205" temMALFORMED
AssetClass None, 0, -1, 1, 1.2, "Invalid" invalidParams

Oracle GET (using ledger_entry method call):

Field Value Error Notes
oracle_document_id "", "Invalid", -1 malformedDocumentID
oracle_document_id None, 1.2 entryNotFound We may be truncating decimal 1.2 to int 1.

Get Aggregate Price (using get_aggregate_price method call):

Field Value Error Notes
Trim "", -1, "abc" oracleMalformed
Trim None invalidParams
@gregtatcam
Copy link
Collaborator

There are different levels of validation. Some validation happens by a low layer validation, before the feature (Transactor or API) receives the parameters and then another validation happens in the feature code. The first PriceDataSeries validation happens by a lower layer validation. The reason it fails is that the values are not a valid array. The second PriceDataSeries validation happens by the feature code and it correctly identifies that the array is empty.
TransactionType is validated by a lower layer and the feature code doesn't have control over it.
All of the above is true for Provider, URI, AssetClass. The first failure, for instance "" happens by the feature and it correctly identifies it as temMALFORMED. The second failure, None, etc, happens by the lower layer.
I don't think OracleSet errors are inconsistent.
I will update ledger_entry validation to return malformedDocumentID for all invalid input.
I will update Trim validation to return invalidParams for all invalid input.

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

No branches or pull requests

2 participants