[ledger_entry of oracle with non numeric input of oracle_document_id do not return an error] (Version: ["2.2.0-b2"])
mounikakun opened this issue · 6 comments
Issue Description
As per docs, oracle_document_id
type is a number and should return an error if there's non numeric input but rippled do not return error whereas Clio does.
Steps to Reproduce
- Create an account and do a
OracleSet
transaction. - Retrieve
ledger_entry
of above transaction with non numeric value inoracle_document_id
Sample request:
{
"method": "ledger_entry",
"params" : [
{
"oracle" : {
"account": "rpzkq5WTrgVQs3bx1ZodHRdK2MwXue1NKX",
"oracle_document_id": "1"
},
"ledger_index": "validated"
}
]
}
Expected Result
Clio response
{
"result": {
"error": "malformedDocumentID",
"error_code": 5007,
"error_message": "Malformed oracle_document_id.",
"status": "error",
"type": "response",
"request": {
"method": "ledger_entry",
"params": [
{
"oracle": {
"account": "rpzkq5WTrgVQs3bx1ZodHRdK2MwXue1NKX",
"oracle_document_id": "1"
},
"ledger_index": "validated"
}
]
}
},
"warnings": [
{
"id": 2001,
"message": "This is a clio server. clio only serves validated data. If you want to talk to rippled, include 'ledger_index':'current' in your request"
}
]
}
Actual Result
{
"result": {
"index": "1FB0F6E973C37DC512BCEB5775434E71D2651009C726C443BA5B9CAA483AB192",
"ledger_hash": "FA84A726DBB795C6BFD427127CE4AC1E8ADD8D487DBB52CC5EE44E5595690263",
"ledger_index": 476452,
"node": {
"AssetClass": "20382A62402D23574E35295961607053",
"Flags": 0,
"LastUpdateTime": 1715038120,
"LedgerEntryType": "Oracle",
"Owner": "rpzkq5WTrgVQs3bx1ZodHRdK2MwXue1NKX",
"OwnerNode": "0",
"PreviousTxnID": "0009C9E0AA232FBD80EF9B6A31299E5177A0690AB30188E7579D5F0F57C58EB0",
"PreviousTxnLgrSeq": 476038,
"PriceDataSeries": [
{
"PriceData": {
"AssetPrice": "2e4",
"BaseAsset": "BTC",
"QuoteAsset": "ETH",
"Scale": 1
}
}
],
"Provider": "0123",
"index": "1FB0F6E973C37DC512BCEB5775434E71D2651009C726C443BA5B9CAA483AB192"
},
"status": "success",
"validated": true
}
}
Environment
Supporting Files
This seems like correct behavior to me. Numbers can be represented as strings in most cases in rippled JSON.
@cindyyan317 please add your thoughts on this.
rippled
accepts both "1" and 1 as valid input.
As the comment here suggested , I believed this is a known mismatch. @godexsoft We have decided not to accept the string type uint, right?
If rippled accepts string-like uint as valid input consistently, Clio will mimic this behavior. @mounikakun Can you please open an issue for Clio.
We could support this in Clio but it would have to be the same for all RPCs, not just some of them as in Clio there is lots of common code that does all the parsing and validation, unlike rippled
where those things are done (potentially) differently in each handler.
We discussed this with @gregtatcam some time ago and at least for oracle_document_id
the conclusion was that it's ok to support just the UInt
. Perhaps we can all align here on what we want to get to as the final result.
I'm fine with Clio supporting just UInt
for oracle_document_id
. Is this a problem for the client libraries?