XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.52k stars 1.47k forks source link

Submitting JSON values greater than 2*32 returns 400 error #4769

Open legleux opened 1 year ago

legleux commented 1 year ago

Issue Description

Submitting an integer to rippled greater than 2**32 results in an HTTP response of 400 with the message

Unable to parse request: * Line 1, Column 188\n  '4294967296' exceeds the allowable range.

Steps to Reproduce

Submit any request to rippled that contains a number greater than 2**32. Submitting a payment transaction with 4295 XRP or greater will reproduce.

Submitting the value as a string works as expected.

Expected Result

I don't think I've seen another error response from rippled that isn't a 200 HTTP response but if there was an issue an error message is returned.

Actual Result

Since the number isn't getting past the JSON parsing code of rippled I'm not sure how There is code in json_reader.cpp catching this value: https://github.com/XRPLF/rippled/blob/c915984340e999cf8224e7d9377eeee8acbc0f2e/src/ripple/json/impl/json_reader.cpp#L606-L612

intelliot commented 1 year ago

Are you saying that this situation should return a 200 but include an error message in the response body?

Is it actually valid to submit a payment transaction and provide a number for the amount? (I thought you must submit the value as a string.)

mvadari commented 1 year ago

Aren't amounts specified as strings?