Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/v1/db_size/get formatting #2394

Open
Rossco99 opened this issue May 30, 2024 · 2 comments
Open

/v1/db_size/get formatting #2394

Rossco99 opened this issue May 30, 2024 · 2 comments
Labels

Comments

@Rossco99
Copy link

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
Copy link
Author

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

3 participants