diff --git a/src/api/archive_unstable_call.md b/src/api/archive_unstable_call.md index 1fced36..bb861d7 100644 --- a/src/api/archive_unstable_call.md +++ b/src/api/archive_unstable_call.md @@ -16,8 +16,11 @@ The JSON-RPC server must invoke the entry point of the runtime of the given bloc **Note**: The runtime is still allowed to call host functions with side effects, however these side effects must be discarded. For example, a runtime function call can try to modify the storage of the chain, but this modification must not be actually applied. The only motivation for performing a call is to obtain the return value. -In situations where the provided runtime function doesn't exist, or the runtime crashes, or similar, an error is returned. The `error` isn't meant to be shown to end users, but is for developers to understand the problem. +If the height of the block hash provided is less than or equal to the current finalized block height (which can be obtained via `archive_unstable_finalizedHeight`), then calling this method multiple times is guaranteed to always return non-null and always the same result (except for the `error` message which is allowed to change). -If the block was previously returned by `archive_unstable_hashByHeight` at a height inferior or equal to the current finalized block height (as indicated by `archive_unstable_finalizedHeight`), then calling this method multiple times is guaranteed to always return non-null and always the same result (except for the `error` message which is allowed to change). +If the height of the block hash provided is greater than the current finalized block height, then the block might be pruned at any time and calling this method may return null. -If the block was previously returned by `archive_unstable_hashByHeight` at a height strictly superior to the current finalized block height (as indicated by `archive_unstable_finalizedHeight`), then the block might "disappear" and calling this function might return `null` at any point. +## Possible errors + +- A JSON-RPC error if the provided parameters are invalid. +- `{ "success": false, "error": ... }` is returned if a problem happens during the call, such as a Wasm trap, runtime panics, function not supported etc. The `error` isn't meant to be shown to end users, but is for developers to understand the problem. diff --git a/src/api/sudo_sessionKeys_unstable_generate.md b/src/api/sudo_sessionKeys_unstable_generate.md index 3c85828..34dcd68 100644 --- a/src/api/sudo_sessionKeys_unstable_generate.md +++ b/src/api/sudo_sessionKeys_unstable_generate.md @@ -6,8 +6,8 @@ **Return value**: -- If the runtime supports the function call (see below), an object of the form `{"result":"..."}` where `result` contains a string containing the hexadecimal-encoded output of the runtime function call. -- Otherwise, an object of the form `{"error":"..."}` where `error` is a human-readable error message indicating the problem. This string isn't meant to be shown to end users, but is for developers to understand the problem. +- If the runtime supports the function call (see below), an object of the form `{ "success": true, "value": ... }` where `value` contains a string containing the hexadecimal-encoded output of the runtime function call. +- Otherwise, an object of the form `{ "success": false, "error": ... }` where `error` is a human-readable error message indicating the problem. This string isn't meant to be shown to end users, but is for developers to understand the problem. The JSON-RPC server must check that the runtime supports the `SessionKeys` API (64bits blake2 hash: `0xab3c0572291feb8b`) at version 1, and call the `SessionKeys_generate_session_keys` runtime function. The runtime call is done against the current best block of the chain. @@ -20,9 +20,9 @@ Contrary to most other JSON-RPC functions that perform runtime function calls wh ## Possible errors -- `{"error":"..."}` is returned if the runtime doesn't support the given API. -- `{"error":"..."}` is returned if a problem happens during the call, such as a Wasm trap. -- `{"error":"..."}` is returned if the runtime attempts to modify the storage of the block. +- `{ "success": false, "error": ... }` is returned if the runtime doesn't support the given API. +- `{ "success": false, "error": ... }` is returned if a problem happens during the call, such as a Wasm trap. +- `{ "success": false, "error": ... }` is returned if the runtime attempts to modify the storage of the block. ## About the behavior of `SessionKeys_generate_session_keys`