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

[ledger_entry of oracle with non numeric input of oracle_document_id do not return an error] (Version: ["2.2.0-b2"]) #5014

Open
mounikakun opened this issue May 6, 2024 · 6 comments

Comments

@mounikakun
Copy link
Collaborator

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 in oracle_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

@mounikakun mounikakun changed the title [ledger_entry of oracle with non numeric input of oracle_document_id do not return an error] (Version: [rippled version]) [ledger_entry of oracle with non numeric input of oracle_document_id do not return an error] (Version: ["2.2.0-b2"]) May 6, 2024
@mvadari
Copy link
Collaborator

mvadari commented May 14, 2024

This seems like correct behavior to me. Numbers can be represented as strings in most cases in rippled JSON.

@mounikakun
Copy link
Collaborator Author

@cindyyan317 please add your thoughts on this.

@gregtatcam
Copy link
Collaborator

rippled accepts both "1" and 1 as valid input.

@cindyyan317
Copy link
Collaborator

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.

@godexsoft
Copy link
Collaborator

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.

@gregtatcam
Copy link
Collaborator

I'm fine with Clio supporting just UInt for oracle_document_id. Is this a problem for the client libraries?

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

5 participants