ChainMovers / suibase

Sui development environment and cookbook.
https://suibase.io
Apache License 2.0
35 stars 6 forks source link

Add more proxy server JSON-RPC error statistic #76

Open mario4tier opened 10 months ago

mario4tier commented 10 months ago

Goal is to help the user distinguish if RPCs are failing because:

As of right now, the proxy does not reflect JSON-RPC level errors in its statistics (but it is still seen transparently as an error to the proxy caller of course).

The proxy interpret and act only on errors at lower protocol layers (IP, HTTP), but not at "JSON-RPC" level.

The enhancement is to interpret the JSON-RPC to update the statistic and better reflect the "end result".

Related info: https://github.com/MystenLabs/sui/pull/12989

mario4tier commented 9 months ago

More related info: https://github.com/MystenLabs/sui/pull/13695

From v1.10 release notes: "You can now convert the sui_sdk::error::Error::RpcError response into a sui_sdk::error::JsonRpcError response to determine whether the error is a client or transient error. After converting, you can inspect the code, message, and data of the error, and use the methods is_call_error, is_client_error, is_execution_error, and is_transient_error. You can find an example of this usage at sui-sdk/examples/json_rpc_errors.rs. Note that transient errors now map to code -32050, and -32001 is reserved for any unknown errors the RPC returns."