Skip to content

[docs]: add configuration reference #397

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

Merged
merged 86 commits into from
Apr 17, 2025
Merged
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
15d9ea4
[misc]: update deps
0x009922 Aug 30, 2023
6b17267
[style]: remove brand colors and `SButton`; revert prettier
0x009922 Aug 30, 2023
d13775b
[refactor]: use headless dialog; revert plugin-pwa
0x009922 Sep 1, 2023
793959a
[chore]: disable `vue/no-v-html` in Mermaid
0x009922 Sep 1, 2023
122f05f
[refactor]: remove sora components from MermaidRender
0x009922 Sep 1, 2023
c472637
[chore]: format
0x009922 Sep 1, 2023
6bd761d
[chore]: remove `@soramitsu-ui/*` packages
0x009922 Sep 1, 2023
15f8e10
[refactor]: remove `vite-plugin-pwa`
0x009922 Sep 1, 2023
6d39164
[docs]: introduce "Reference" section
0x009922 Sep 8, 2023
6a9e6dd
[chore]: remove logo temporarily
0x009922 Sep 8, 2023
1d091a7
Merge branch 'service-update' into 392-draft-config-reference
0x009922 Sep 8, 2023
29736bd
[chore]: fix ffi link
0x009922 Sep 8, 2023
c88c48e
[chore]: update deps
0x009922 Sep 11, 2023
17fc897
[refactor]: simplify logging, remove `log-update`
0x009922 Sep 11, 2023
e123ac0
Merge branch 'service-update' into 392-draft-config-reference
0x009922 Sep 11, 2023
f6bb470
[docs]: change headings
0x009922 Sep 11, 2023
e2ecaa7
[docs]: format chores
0x009922 Sep 11, 2023
6786935
Merge remote-tracking branch 'hyperledger/main' into service-update
0x009922 Sep 15, 2023
ce9bf11
[chore]: update pnpm
0x009922 Sep 15, 2023
5828496
[fix]: remove `SSpinner` import
0x009922 Sep 15, 2023
134a275
[chore]: bump vitepress
0x009922 Sep 15, 2023
de585ca
[fix]: fix version of unocss
0x009922 Sep 15, 2023
4bafdab
[chore]: fix format
0x009922 Sep 15, 2023
cd0cede
[chore]: bump vitepress to `rc.14`
0x009922 Sep 18, 2023
1fe2a67
Merge branch 'service-update' into 392-draft-config-reference
0x009922 Sep 18, 2023
cbe8885
[docs]: use tex math syntax across
0x009922 Sep 18, 2023
13fe5ce
[docs]: move `/reference/` to `/api/`; split config reference
0x009922 Sep 18, 2023
5e2265a
[docs]: describe duration type
0x009922 Sep 18, 2023
eff21b2
[docs]: describe byte size type
0x009922 Sep 18, 2023
18b614b
[docs]: remove `*.actor-channel-capacity`
0x009922 Sep 18, 2023
32008ad
[fix]: dead links
0x009922 Sep 18, 2023
2adbbf9
[docs]: restore `snake_case`
0x009922 Sep 20, 2023
cfabb36
[docs]: update config reference
0x009922 Sep 21, 2023
6d88337
Merge branch 'main' into 392-draft-config-reference
0x009922 Sep 21, 2023
c9e4fcf
[chore]: remove dead code
0x009922 Sep 21, 2023
07fd463
Apply suggestions from code review
0x009922 Sep 22, 2023
60edf4e
Apply suggestions from code review
yamkovoy Sep 26, 2023
a0bc81f
[docs]: use TODO marks
0x009922 Sep 27, 2023
b1c7ef8
[docs]: add Snapshot section
0x009922 Sep 27, 2023
12a026d
Merge remote-tracking branch '0x009922/392-draft-config-reference' in…
0x009922 Sep 27, 2023
2db62aa
[chore]: fix format
0x009922 Sep 27, 2023
08532e0
[docs]: change TODO notation
0x009922 Sep 27, 2023
bb938ef
Merge branch 'main' into 392-draft-config-reference
0x009922 Sep 27, 2023
35a0974
Apply suggestions from code review
0x009922 Sep 29, 2023
5b3dd60
Merge branch 'main' into 392-draft-config-reference
0x009922 Sep 29, 2023
0efcf1c
[docs]: put TODOs
0x009922 Sep 29, 2023
ea286e6
Merge remote-tracking branch '0x009922/392-draft-config-reference' in…
0x009922 Sep 29, 2023
9dd1a49
[chore]: remove dead sidebar link
0x009922 Sep 29, 2023
76b850c
[docs]: expand logger params
0x009922 Sep 29, 2023
38dd466
[docs]: expand sections, update naming, rethink structure
0x009922 Sep 29, 2023
6688e80
Apply suggestions from code review
0x009922 Oct 2, 2023
d5d1156
[docs]: refactor the reference
0x009922 Oct 4, 2023
e9aa302
[chore]: fix typo and format
0x009922 Oct 4, 2023
fc9bd81
[docs]: combine sumeragi and block_sync
0x009922 Oct 4, 2023
2750023
Merge branch 'main' into 392-draft-config-reference
0x009922 Oct 10, 2023
df7415b
[docs]: torii bindings
0x009922 Oct 10, 2023
bde027d
Apply suggestions from code review
0x009922 Oct 20, 2023
b86a04c
Update src/api/config/sumeragi-params.md
0x009922 Oct 23, 2023
5e5582a
bunch of updates
0x009922 Nov 3, 2023
b9177e7
Merge remote-tracking branch 'hyperledger/main' into 392-draft-config…
0x009922 Nov 3, 2023
0d949c6
Merge remote-tracking branch '0x009922/392-draft-config-reference' in…
0x009922 Nov 3, 2023
f74845e
[docs]: fix broken link
0x009922 Nov 3, 2023
99698dd
[docs]: a bunch of edits of config
0x009922 Nov 22, 2023
7d9c926
[docs]: update configuration guides (wip)
0x009922 Nov 22, 2023
128e675
Merge branch 'main' into 392-draft-config-reference
0x009922 Nov 22, 2023
2be984d
Merge branch 'main' into 392-draft-config-reference
0x009922 Feb 12, 2024
4c78fe2
[chore]: update deps
0x009922 Feb 12, 2024
8841a0b
[chore]: `type: module`, fixing warning from Vitest
0x009922 Feb 12, 2024
3d26c72
[revert]: project is not ready for ESM
0x009922 Feb 12, 2024
c704b6f
Merge branch 'housekeeping' into 392-draft-config-reference
0x009922 Feb 12, 2024
a96fa91
[docs]: update reference section
0x009922 Feb 21, 2024
b21c68e
[docs]: migration guide; edits
0x009922 Mar 25, 2024
cfe5ae4
[revert]: remove `Specs` component
0x009922 Mar 25, 2024
dfd5498
[feat]: add sidebar link
0x009922 Mar 25, 2024
ca2f813
[chore]: fix format
0x009922 Mar 25, 2024
eb231f3
misc: update dependencies
0x009922 Nov 7, 2024
aae25ba
Merge branch 'housekeeping' into 392-draft-config-reference
0x009922 Nov 7, 2024
9fe82b7
docs: revamp config reference
0x009922 Nov 8, 2024
1e3b453
Merge branch 'main' into 392-draft-config-reference
0x009922 Nov 8, 2024
39cfe97
docs: fix links
0x009922 Nov 8, 2024
790686a
docs: complete structure of config reference & related docs
0x009922 Nov 13, 2024
1f1c868
docs: chores
0x009922 Nov 13, 2024
a44d9b4
chore: fix format
0x009922 Nov 13, 2024
dd64c4a
Merge branch 'main' into 392-draft-config-reference
0x009922 Apr 7, 2025
16b5b31
docs: update config, reflect logger changes, chores
0x009922 Apr 7, 2025
54b1b72
chore: format
0x009922 Apr 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'hyperledger/main' into 392-draft-config…
…-reference

Signed-off-by: Dmitry Balashov <[email protected]>
  • Loading branch information
0x009922 committed Nov 3, 2023
commit b9177e76538504a159a0069d1b404c6516fa877c
192 changes: 100 additions & 92 deletions src/reference/torii-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

**Responses:**

`200 OK`: The current version of API used by Iroha returned as a JSON string. Grabbed from the genesis block's version,
so at least a minimal subnet of 4 peers should be running and the genesis be submitted at the time of request.
`200 OK`: The current version of API used by Iroha returned as a JSON
string. Grabbed from the genesis block's version, so at least a minimal
subnet of 4 peers should be running and the genesis be submitted at the
time of request.

```json
"1"
Expand All @@ -23,22 +25,29 @@ so at least a minimal subnet of 4 peers should be running and the genesis be sub
- **Protocol Upgrade:** WebSocket
- **Endpoint:** `/block/stream`

The client should send a [`BlockSubscriptionRequest`](/reference/data-model-schema#blocksubscriptionrequest) to initiate
communication after the WebSocket handshake. Then the server sends a
[`BlockMessage`](/reference/data-model-schema#blockmessage). Messages are SCALE-encoded[^1].
The client should send a
[`BlockSubscriptionRequest`](/reference/data-model-schema#blocksubscriptionrequest)
to initiate communication after the WebSocket handshake. Then the server
sends a [`BlockMessage`](/reference/data-model-schema#blockmessage).
Messages are SCALE-encoded[^1].

Via this endpoint, the client first provides the starting block number (i.e. height) in the subscription request. After
sending the confirmation message, the server starts streaming all the blocks from the given block number up to the
current block and continues to stream blocks as they are added to the blockchain.
Via this endpoint, the client first provides the starting block number
(i.e. height) in the subscription request. After sending the confirmation
message, the server starts streaming all the blocks from the given block
number up to the current block and continues to stream blocks as they are
added to the blockchain.

## Configuration > Retrieve

- **Protocol:** HTTP
- Method: `GET`
- Endpoint: `/configuration`
- Responses: with JSON-serialized subset of configuration parameters. The subset of returned parameters is equal to the
one accepted by [Configuration > Update endpoint](#configuration-update), i.e. it contains only
[`logger.level`](/reference/config/logger-params#logger-level) parameter as of now.
- Responses: with JSON-serialized subset of configuration parameters. The
subset of returned parameters is equal to the one accepted by
[Configuration > Update endpoint](#configuration-update), i.e. it
contains only
[`logger.level`](/reference/config/logger-params#logger-level) parameter
as of now.

Example response:

Expand Down Expand Up @@ -77,20 +86,27 @@ Example request:
- **Endpoint:** `/events`

After a handshake, the client should send an
[`EventSubscriptionRequest`](/reference/data-model-schema#eventsubscriptionrequest). Then the server sends an
[`EventMessage`](/reference/data-model-schema#eventmessage). Messages are SCALE-encoded[^1].
[`EventSubscriptionRequest`](/reference/data-model-schema#eventsubscriptionrequest).
Then the server sends an
[`EventMessage`](/reference/data-model-schema#eventmessage). Messages are
SCALE-encoded[^1].

### Transaction Events

Transaction event statuses can be either `Validating`, `Committed` or `Rejected`.
Transaction event statuses can be either `Validating`, `Committed` or
`Rejected`.

Transaction statuses proceed from `Validating` to either `Committed` or `Rejected`. However, due to the distributed
nature of the network, some peers might receive events out of order (e.g. `Committed` before `Validating`).
Transaction statuses proceed from `Validating` to either `Committed` or
`Rejected`. However, due to the distributed nature of the network, some
peers might receive events out of order (e.g. `Committed` before
`Validating`).

Some peers in the network may be offline for the validation round. If the client connects to them while they are
offline, the peers might not respond with the `Validating` status. But when the offline peers come back online they will
synchronize the blocks. They are then guaranteed to respond with the `Committed` (or `Rejected`) status depending on the
information found in the block.
Some peers in the network may be offline for the validation round. If the
client connects to them while they are offline, the peers might not respond
with the `Validating` status. But when the offline peers come back online
they will synchronize the blocks. They are then guaranteed to respond with
the `Committed` (or `Rejected`) status depending on the information found
in the block.

## Health

Expand Down Expand Up @@ -169,16 +185,18 @@ Learn [how to use metrics](/guide/advanced/metrics).
- **Method:** `POST`
- **Endpoint:** `/query`
- **Expects:**
- **Body:** SCALE-encoded[^1] [`VersionedSignedQuery`](/reference/data-model-schema#versionedsignedquery)
- **Body:** SCALE-encoded[^1]
[`VersionedSignedQuery`](/reference/data-model-schema#versionedsignedquery)
- **Query parameters:**
- **`start`:** An optional parameter in queries where results can be indexed. Use to return results from a specified
point. Results are ordered by id, which uses Rust's
[PartialOrd](https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html#derivable) and
[Ord](https://doc.rust-lang.org/std/cmp/trait.Ord.html) traits.
- **`limit`:** An optional parameter in queries where results can be indexed. Use to return a specific number of
results.
- **`sort_by_metadata_key`:** An optional parameter in queries. Use to sort results containing metadata with a given
key.
- **`start`:** An optional parameter in queries where results can be
indexed. Use to return results from a specified point. Results are
ordered by id, which uses Rust's
[PartialOrd](https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html#derivable)
and [Ord](https://doc.rust-lang.org/std/cmp/trait.Ord.html) traits.
- **`limit`:** An optional parameter in queries where results can be
indexed. Use to return a specific number of results.
- **`sort_by_metadata_key`:** An optional parameter in queries. Use to
sort results containing metadata with a given key.

**Responses:**

Expand All @@ -194,14 +212,16 @@ Learn [how to use metrics](/guide/advanced/metrics).
::: tip Lazily Evaluated Pagination

TODO: explain how it works. Explain that this behaviour is configured with
[`torii.query_results_per_fetch`](/reference/config/torii-params#torii-query-results-per-fetch) and
[`torii.query_results_per_fetch`](/reference/config/torii-params#torii-query-results-per-fetch)
and
[`torii.query_idle_time`](/reference/config/torii-params#torii-query-idle-time).

:::

### Account Not Found 404

Whether each prerequisite object was found and [`FindError`](/reference/data-model-schema#finderror):
Whether each prerequisite object was found and
[`FindError`](/reference/data-model-schema#finderror):

| Domain | Account | [`FindError`](/reference/data-model-schema#finderror) |
| :----: | :-----: | ------------------------------------------------------------------------- |
Expand All @@ -210,7 +230,8 @@ Whether each prerequisite object was found and [`FindError`](/reference/data-mod

### Asset Not Found 404

Whether each prerequisite object was found and [`FindError`](/reference/data-model-schema#finderror):
Whether each prerequisite object was found and
[`FindError`](/reference/data-model-schema#finderror):

| Domain | Account | Asset Definition | Asset | [`FindError`](/reference/data-model-schema#finderror) |
| :----: | :-----: | :--------------: | :---: | ----------------------------------------------------------------------------------------- |
Expand All @@ -224,86 +245,72 @@ Whether each prerequisite object was found and [`FindError`](/reference/data-mod
- **Protocol:** HTTP
- **Method:** `GET`
- **Endpoint:** `/status`
- **Expects:** an optional `Accept: application/x-parity-scale` request header to encode response with SCALE[^1].
Otherwise, will fall back to `application/json`.
- **Responses**: with `Content-Type` set either to `application/json` or `application/x-parity-scale`, and an
accordingly encoded response body.

Response body is of the following `Status` structure:

```rust
struct Status {
/// Number of connected peers, except for the reporting peer itself
peers: u64,
/// Number of committed blocks
blocks: u64,
/// Number of accepted transactions
txs_accepted: u64,
/// Number of rejected transactions
txs_rejected: u64,
/// Uptime since genesis block creation
uptime: Uptime,
/// Number of view changes in the current round
view_changes: u64,
/// Number of the transactions in the queue
queue_size: u64,
}

struct Uptime {
secs: u64,
nanos: u32
}
```
**Responses:**

`200 OK` reports status as JSON:

::: warning JSON Precision Lost
::: details Sample response

Almost all fields in the `Status` structure are 64-bit integers, and they are encoded in JSON as-is. Since native JSON's
number type according to the specification effectively is `f64`, the precision might be lost on deserialization, for
example, in
[JavaScript's `JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
For more details, see related [issue](https://github.com/hyperledger/iroha/issues/3964).
```json5
// Note: while this snippet is JSON5 (for better readability),
// the actual response is JSON
{
/**
* Number of connected peers, except for the reporting peer itself
*/
peers: 3,
/**
* Number of committed blocks (block height)
*/
blocks: 1,
/**
* Total number of accepted transactions
*/
txs_accepted: 3,
/**
* Total number of rejected transactions
*/
txs_rejected: 0,
/**
* Uptime with nanosecond precision since creation of the genesis block
*/
uptime: {
secs: 5,
nanos: 937000000,
},
/**
* Number of view changes in the current round
*/
view_changes: 0,
}
```

:::

::: tip Compact Form in SCALE
::: warning

Almost all fields are 64-bit integers and should be handled with care in JavaScript. <!--todo: explain the issue with
Almost all fields are 64-bit integers and should be handled with care in
JavaScript. <!--todo: explain the issue with
`serde`--> Only the `uptime.nanos` field is a 32-bit integer. See [`iroha_telemetry::metrics::Status`](https://github.com/hyperledger/iroha/blob/iroha2-dev/telemetry/src/metrics.rs?rgh-link-date=2023-10-02T19%3A29%3A10Z#L27C1-L42C2)

:::

### Sub-routing

To obtain the value of a specific field, one can append the name of the field to the path, e.g. `/status/peers`. This
returns the corresponding JSON value.

::: code-group

```json [/status/peers]
4
```

```json [/status/uptime]
{
"secs": 5,
"nanos": 937000000
}
```

```json [/status/uptime/secs]
5
```

:::
To obtain the value of a specific field, one can append the name of the
field to the path, e.g. `/status/peers`. This returns the corresponding
JSON value, inline, so strings are quoted, numbers are not quoted, and maps
are presented as in example above.

## Transaction

- **Protocol:** HTTP
- **Method:** `POST`
- **Endpoint:** `/transaction`
- **Expects:**
- **Body:** SCALE-encoded[^1] [`VersionedSignedTransaction`](/reference/data-model-schema#versionedsignedtransaction)
- **Body:** SCALE-encoded[^1]
[`VersionedSignedTransaction`](/reference/data-model-schema#versionedsignedtransaction)

**Responses:**

Expand All @@ -322,7 +329,8 @@ Maximum allowed `Content-Length` for this endpoint is configured with

[^1]:
For more information on Parity SCALE Codec check
[Substrate Dev Hub](https://docs.substrate.io/reference/scale-codec/) and codec's
[Substrate Dev Hub](https://docs.substrate.io/reference/scale-codec/)
and codec's
[GitHub repository](https://github.com/paritytech/parity-scale-codec).

<!--TODO: link to our own article about SCALE--> (https://github.com/hyperledger/iroha-2-docs/issues/367)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.