XRPLF / clio

An XRP Ledger API Server
https://xrpl.org
ISC License
56 stars 48 forks source link

[get_aggregate_price] with malformed quote_asset value returns different error on Clio compared to rippled #1373

Closed mounikakun closed 1 week ago

mounikakun commented 2 months ago

Issue Description

Clio returns invalidParams whereas rippled returns objectNotFound with malformed quote_asset values in get_aggregate_price

Steps to Reproduce

Request:


{
  "method": "get_aggregate_price",
  "params": [
    {
      "base_asset": "BTC",
      "quote_asset": 123,
      "oracles": [
        {
          "account": "rwz8i5bUKa12tYxQjsSuzDQaBwKkuGUqa5",
          "oracle_document_id": 1
        },
        {
          "account": "rDtBhKmzKveCSd5jmrcQD6CU8kidCLCy7h",
          "oracle_document_id": 1
        }
      ]
    }
  ]
}

Expected Result

Rippled response:

{
    "result": {
        "error": "objectNotFound",
        "error_code": 92,
        "error_message": "The requested object was not found.",
        "ledger_current_index": 82571,
        "request": {
            "base_asset": "BTC",
            "command": "get_aggregate_price",
            "oracles": [
                {
                    "account": "rwz8i5bUKa12tYxQjsSuzDQaBwKkuGUqa5",
                    "oracle_document_id": 1
                },
                {
                    "account": "rDtBhKmzKveCSd5jmrcQD6CU8kidCLCy7h",
                    "oracle_document_id": 1
                }
            ],
            "quote_asset": 123
        },
        "status": "error",
        "validated": false
    }
}

Actual Result

Clio response:

{
    "result": {
        "error": "invalidParams",
        "error_code": 31,
        "error_message": "Invalid parameters.",
        "status": "error",
        "type": "response",
        "request": {
            "method": "get_aggregate_price",
            "params": [
                {
                    "base_asset": "BTC",
                    "quote_asset": 123,
                    "oracles": [
                        {
                            "account": "rwz8i5bUKa12tYxQjsSuzDQaBwKkuGUqa5",
                            "oracle_document_id": 1
                        },
                        {
                            "account": "rDtBhKmzKveCSd5jmrcQD6CU8kidCLCy7h",
                            "oracle_document_id": 1
                        }
                    ]
                }
            ]
        }
    },
    "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"
        }
    ]
}

Environment

Supporting Files

mounikakun commented 2 months ago

Issue exists with malformed values of oracle_document_id. The values are: None, 1.2

cindyyan317 commented 2 months ago

I think Clio's response (invalidParams) maybe more descriptive.

Sumasamms commented 1 month ago

hi

mounikakun commented 1 month ago

Issue is fixed on rippled end for the below invalid test data of quote_asset and reported cases oforacle_document_id.

None, "Invalid", 123, -1, 0, 1.2, "H", "HB", "HBAR", "", _INVALID_NON_STANDARD_CURRENCY_CODE_:"0158415500000000C1F76FF6ECB0BAC600000000A"

objectNotFound remains same for the below cases

VALID_NON_STANDARD_CURRENCY_CODE = "0158415500000000C1F76FF6ECB0BAC600000000", "HBA"

mounikakun commented 1 month ago

Clio is not replicating invalidParams error for below test data

"Invalid", _INVALID_NON_STANDARD_CURRENCY_CODE_:"0158415500000000C1F76FF6ECB0BAC600000000A", "H", "HB", "HBAR", ""

mounikakun commented 1 week ago

Issue still exists for empty "" value of and quote_asset

empty quote_asset request: {"method": "get_aggregate_price", "params": [{"base_asset": "BTC", "quote_asset": "", "oracles": [{"account": "rHLmopST54fABrhgmhsiDou3hMDXcsSTfJ", "oracle_document_id": 1}, {"account": "rK1agLUfmeSyqTpBUmK49FnF77kV9HgdKu", "oracle_document_id": 1}], "Fee": "20"}]}

rippled response:

{
    "result": {
        "error": "invalidParams",
        "error_code": 31,
        "error_message": "Invalid parameters.",
        "request": {
            "Fee": "20",
            "base_asset": "BTC",
            "command": "get_aggregate_price",
            "oracles": [
                {
                    "account": "rHLmopST54fABrhgmhsiDou3hMDXcsSTfJ",
                    "oracle_document_id": 1
                },
                {
                    "account": "rK1agLUfmeSyqTpBUmK49FnF77kV9HgdKu",
                    "oracle_document_id": 1
                }
            ],
            "quote_asset": ""
        },
        "status": "error"
    }
}

clio response:

{
    "result": {
        "error": "objectNotFound",
        "error_code": 92,
        "error_message": "The requested object was not found.",
        "status": "error",
        "type": "response",
        "request": {
            "method": "get_aggregate_price",
            "params": [
                {
                    "base_asset": "BTC",
                    "quote_asset": "",
                    "oracles": [
                        {
                            "account": "rHLmopST54fABrhgmhsiDou3hMDXcsSTfJ",
                            "oracle_document_id": 1
                        },
                        {
                            "account": "rK1agLUfmeSyqTpBUmK49FnF77kV9HgdKu",
                            "oracle_document_id": 1
                        }
                    ],
                    "Fee": "20"
                }
            ]
        }
    },
    "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"
        }
    ]
}
cindyyan317 commented 1 week ago

Fixed by #1481