AntelopeIO / leap

C++ implementation of the Antelope protocol
Other
113 stars 69 forks source link

/v1/db_size/get formatting #2394

Open Rossco99 opened 4 weeks ago

Rossco99 commented 4 weeks ago

It appears that after v5.0.0 the used_bytes number does not include "quotes" after requesting

/v1/db_size/get

"free_bytes":"13532691840","used_bytes":3647176320,"size":"17179868160","indices"

Rossco99 commented 4 weeks ago

I did some more checking this morning, it would seem to be that this issue is from v5.0.2 and is also seen in v1.0.0-beta1.2

spoonincode commented 4 weeks ago

This is long standing behavior with nodeos' JSON formatting that has existed since 1.0: numbers 2^32 or greater are quoted, while numbers less than that are not. It'll be formatted this way on just about any JSON response, not just db_size

Obviously this does make it more difficult to handle the JSON returned from nodeos since you don't know in advance what type a value will be for a response that is a number.

With modern tech it might make sense to never quote numbers and force any receiver to parse them as bigints if they want proper behavior. But such a change would need to be done carefully for compatibility reasons.