XRPLF / clio

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

“ledger_entry” request provided an invalid combination of fields returns "invalidParams" instead of "malformedRequest" #276

Closed mounikakun closed 1 year ago

mounikakun commented 2 years ago

Expected response: malformedRequest Actual response: invalidParams

Sample request: { "method": "ledger_entry", "params": [ { "index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4a", "ledger_index": "validated" } ] }

cjcobb23 commented 2 years ago

@ManiMounikaKunasani I don't think the example request is actually an invalid combination of fields. I think the example request is possibly a malformed index, because it a has a trailing a, but that should result in invalid params as an error

mounikakun commented 2 years ago

Yes by mistake I added only half part. “ledger_entry” request provided an invalid combination of fields, or provided the wrong type for one or more fields.Expected:malformedRequest

Malformed value in index should return malformedRequest but Clio is returning invalidParams

Sample rippled response for same request: { "result": { "error": "malformedRequest", "ledger_hash": "ACEFACCFABD4777066108B607963C08CF74025453257B735179A8B15615ED403", "ledger_index": 22304628, "request": { "command": "ledger_entry", "index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4a", "ledger_index": "validated" }, "status": "error", "validated": true } }

Ref:[(https://xrpl.org/ledger_entry.html#ledger_entry)]

cjcobb23 commented 2 years ago

that just doesn't line up with what the docs say: https://xrpl.org/ledger_entry.html#possible-errors

cjcobb23 commented 2 years ago

but it does seem like thats what rippled does: https://github.com/XRPLF/rippled/blob/fe05b8c4feb815e1aa6afd7ff8c85dbc92bcd651/src/ripple/rpc/handlers/LedgerEntry.cpp#L58

mounikakun commented 2 years ago

Yes it should be either "malformedRequest" or "invalidParams" but both rippled and Clio should have same response.