XRPLF / clio

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

[get_aggregate_price] with malformed trim value returns different error on Clio compared to rippled #1371

Closed mounikakun closed 3 weeks ago

mounikakun commented 2 months ago

Issue Description

Clio returns invalidParams whereas rippled returns oracleMalformed with malformed trim values in get_aggregate_price

Steps to Reproduce

Request:

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

Expected Result

Rippled response:

{
    "result": {
        "error": "oracleMalformed",
        "error_code": 94,
        "error_message": "Oracle request is malformed.",
        "request": {
            "base_asset": "BTC",
            "command": "get_aggregate_price",
            "oracles": [
                {
                    "account": "rwz8i5bUKa12tYxQjsSuzDQaBwKkuGUqa5",
                    "oracle_document_id": 1
                },
                {
                    "account": "rDtBhKmzKveCSd5jmrcQD6CU8kidCLCy7h",
                    "oracle_document_id": 1
                }
            ],
            "quote_asset": "ETH",
            "trim": ""
        },
        "status": "error"
    }
}

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": "ETH",
                    "trim": "",
                    "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

cindyyan317 commented 2 months ago

According to SPEC Screenshot 2024-04-23 at 09 18 23 We should return error when trim is invalid uint.

mounikakun commented 3 weeks ago

Issue is fixed on rippled end so no need to fix on Clio end.