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

[suggestion] Allow SCALE response body for GET /status #3964

Closed
0x009922 opened this issue Oct 6, 2023 · 1 comment
Closed

[suggestion] Allow SCALE response body for GET /status #3964

0x009922 opened this issue Oct 6, 2023 · 1 comment
Assignees
Labels
api-changes Changes in the API for client libraries Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST QA-pending This bug is reported but is missing an MWE

Comments

@0x009922
Copy link
Contributor

0x009922 commented Oct 6, 2023

Feature Request

Background

Currently GET /status endpoint returns data in JSON. The structure is:

https://github.com/hyperledger/iroha/blob/83a7e015c140e4775340cec62c26465399fc61ac/telemetry/src/metrics.rs#L25-L42

JSON standard supports IEEE 754-2008 binary64 (double precision) numbers, equivalent to Rust's f64. Most fields returned from /status are u64, which might go out of bounds in some cases. serde ignores it and encodes numbers as is. However, implementation in other languages (e.g. native JavaScript's JSON) fails to deserialise serde-encoded u64 numbers without losing precision when they are too big.

In most cases it is not an issue, but complete correctness is not met, and I considered this behaviour as a bug.

Proposed Solution

Allow to request status in SCALE-encoded format, and include Status structure into the data model schema.

It might be enabled by HTTP Headers or a query string, like GET /status?scale

Benefits

SDKs will naturally support it. In particular for JS SDK, it will allow to get rid of inefficient pure js json-bigint implementation.

@0x009922 0x009922 added Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST api-changes Changes in the API for client libraries labels Oct 6, 2023
@0x009922 0x009922 self-assigned this Oct 12, 2023
0x009922 added a commit to 0x009922/iroha that referenced this issue Oct 12, 2023
…se for `/status` endpoint

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Oct 13, 2023
…se for `/status` endpoint

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Oct 16, 2023
…se for `/status` endpoint

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Oct 19, 2023
…se for `/status` endpoint

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Oct 23, 2023
…se for `/status` endpoint

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Oct 23, 2023
…se for `/status` endpoint

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Oct 31, 2023
…se for `/status` endpoint

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Oct 31, 2023
…se for `/status` endpoint

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
6r1d pushed a commit that referenced this issue Oct 31, 2023
#3983)

Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
Signed-off-by: 6r1d <vic.6r1d@gmail.com>
@0x009922
Copy link
Contributor Author

Closed by #3983, but needs to be verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-changes Changes in the API for client libraries Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST QA-pending This bug is reported but is missing an MWE
Projects
None yet
Development

No branches or pull requests

4 participants