diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 137b1032f..e24b9114a 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -65,9 +65,13 @@ function sidebarReference(): DefaultTheme.SidebarItem[] { { text: 'Reference', items: [ + { + text: 'CLI', + link: '/reference/cli', + }, { text: 'Torii Endpoints', - link: '/reference/torii-endpoints.md', + link: '/reference/torii-endpoints', }, { text: 'Data Model Schema', @@ -79,12 +83,16 @@ function sidebarReference(): DefaultTheme.SidebarItem[] { }, { text: 'Queries', - link: '/reference/queries.md', + link: '/reference/queries', }, { text: 'Permissions', - link: '/reference/permissions.md', + link: '/reference/permissions', }, + { + text: 'Genesis Block', + link: '/reference/genesis' + } ], }, { @@ -106,6 +114,18 @@ function sidebarReference(): DefaultTheme.SidebarItem[] { text: 'Genesis', link: '/reference/config/genesis-params', }, + { + text: 'Network', + link: '/reference/config/network-params', + }, + { + text: 'Torii', + link: '/reference/config/torii-params', + }, + { + text: 'Sumeragi', + link: '/reference/config/sumeragi-params', + }, { text: 'Kura', link: '/reference/config/kura-params', @@ -122,30 +142,30 @@ function sidebarReference(): DefaultTheme.SidebarItem[] { text: 'Snapshot', link: '/reference/config/snapshot-params', }, - - { - text: 'Sumeragi', - link: '/reference/config/sumeragi-params', - }, { text: 'Telemetry', link: '/reference/config/telemetry-params', }, - { - text: 'Torii', - link: '/reference/config/torii-params', + text: 'Chain Wide', + link: '/reference/config/chain-wide-params', }, ], }, - { text: 'Glossary', link: '/reference/config/glossary', }, + ], + }, + { + text: 'Client CLI', + items: [ { - text: 'Deprecation and Migration', - link: '/reference/config/deprecation-and-migration', + text: 'CLI', + }, + { + text: 'Configuration', }, ], }, diff --git a/.vitepress/theme/components/ConfigParameterSpecs.vue b/.vitepress/theme/components/ConfigParameterSpecs.vue new file mode 100644 index 000000000..422c24a5d --- /dev/null +++ b/.vitepress/theme/components/ConfigParameterSpecs.vue @@ -0,0 +1,65 @@ + + + diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index e923fafdb..fa2173305 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -22,5 +22,9 @@ export default { 'CompatibilityMatrixTableIcon', defineAsyncComponent(async () => import('./components/CompatibilityMatrixTableIcon.vue')), ) + app.component( + 'ConfigParameterSpecs', + defineAsyncComponent(() => import('./components/ConfigParameterSpecs.vue')), + ) }, } diff --git a/src/guide/configure/configuration-types.md b/src/guide/configure/configuration-types.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/reference/cli.md b/src/reference/cli.md index 560c91551..bf81fad64 100644 --- a/src/reference/cli.md +++ b/src/reference/cli.md @@ -4,16 +4,73 @@ TODO ## `--config` -Alias: `-c` +- **Type:** File Path +- **Required** +- **Alias:** `-c` -Env: `IROHA_CONFIG` +Path to the [configuration](/reference/config/) file. -TODO +```shell +iroha --config path/to/iroha.toml +``` -## `--trace-config` +::: tip -TODO +Paths parameters in the config file are resolved relative to its own +location. See how +[paths resolution](/reference/config/glossary#paths-resolution) works. + +::: + +## `--terminal-colors` + +- **Type:** Boolean, either `--terminal-colors=false` or + `--terminal-colors=true` +- **Default:** Auto-detect +- **ENV:** `TERMINAL_COLORS` + +Whether to enable ANSI-colored output or not. + +By default, Iroha determines whether the terminal supports colored output +or not. + +To explicitly disable colors: + +```shell +iroha --terminal-colors=false + +# or via env + +set TERMINAL_COLORS=false +iroha +``` ## `--submit-genesis` -TODO \ No newline at end of file +- **Type:** Flag, either set or omitted + +Whether the current peer should submit the genesis block or not. + +Only one peer in the network should submit the genesis block. + +This argument must be set alongside with +[`genesis.file`](/reference/config/genesis-params#genesis-file) and +[`genesis.private_key`](/reference/config/genesis-params#genesis-private-key) +configuration parameters. If not, Iroha will exit with an error. + +In case when the network consists only of this one peer, i.e. the amount of +trusted peers in the configuration +([`sumeragi.trusted_peers`](/reference/config/sumeragi-params#sumeragi-trusted-peers)) +is less than 2, this peer must submit the genesis, since there are no other +peers who can provide it. In this case, Iroha will exit with an error if +`--submit-genesis` is not set. + +**Examples:** + +```shell +# the peer that doesn't submit the genesis block +iroha + +# the peer submits the genesis +iroha --submit-genesis +``` diff --git a/src/reference/config/base-params.md b/src/reference/config/base-params.md index 81d0884f2..debd655c8 100644 --- a/src/reference/config/base-params.md +++ b/src/reference/config/base-params.md @@ -1,35 +1,58 @@ # Base Parameters -## `address` +## `chain_id` -- **Type:** String, [Socket-Address](glossary#type-socket-address) -- **Required** + -Address for p2p communication for consensus (sumeragi) and block synchronization (block_sync) purposes. +::: code-group -```toml -address = "localhost:1337" +```toml [Config File] +chain_id = "00000000-0000-0000-0000-000000000000" ``` +```shell [ENV] +CHAIN_ID=00000000-0000-0000-0000-000000000000 +``` + +::: + ## `private_key` -- **Type:** Table, [Private Key](glossary#type-private-key) -- **Required** + + + -Private key of this peer +Private key of the peer + +::: code-group + +```toml [Config File] +private_key = { algorithm = "ed25519", payload = "8f4c15e5d664da3f13778801d23d4e89b76e94c1b94b389544168b6cb894f84f8ba62848cf767d72e7f7f4b9d2d7ba07fee33760f79abe5597a51520e292a0cb" } +``` -```toml -private_key.digest = "ed25519" -private_key.payload = "82886B5A2BB3785F3CA8F8A78F60EA9DB62F939937B1CFA8407316EF07909A8D236808A6D4C12C91CA19E54686C2B8F5F3A786278E3824B4571EF234DEC8683B" +```shell [ENV] +PRIVATE_KEY_ALGORITHM=ed25519 +PRIVATE_KEY_PAYLOAD=8f4c15e5d664da3f13778801d23d4e89b76e94c1b94b389544168b6cb894f84f8ba62848cf767d72e7f7f4b9d2d7ba07fee33760f79abe5597a51520e292a0cb ``` +::: + ## `public_key` -- **Type:** String, [Multi-hash](glossary#type-multi-hash) -- **Required** + + +Public key of the peer -Public key of this peer +::: code-group -```toml +```toml [Config File] public_key = "ed0120FAFCB2B27444221717F6FCBF900D5BE95273B1B0904B08C736B32A19F16AC1F9" ``` + +```shell [ENV] +PUBLIC_KEY=ed0120FAFCB2B27444221717F6FCBF900D5BE95273B1B0904B08C736B32A19F16AC1F9 +``` + +::: diff --git a/src/reference/config/chain-wide-params.md b/src/reference/config/chain-wide-params.md new file mode 100644 index 000000000..8f60f8fba --- /dev/null +++ b/src/reference/config/chain-wide-params.md @@ -0,0 +1,5 @@ +# On-Chain Parameters + +- These parameters are chain-wide, and each peer should have the same +- It should not be specified in the config file: https://github.com/hyperledger/iroha/issues/4028 +- We don't document it for now diff --git a/src/reference/config/deprecation-and-migration.md b/src/reference/config/deprecation-and-migration.md deleted file mode 100644 index 444f0634b..000000000 --- a/src/reference/config/deprecation-and-migration.md +++ /dev/null @@ -1,3 +0,0 @@ -# Deprecation and Migration Policy - -TODO diff --git a/src/reference/config/genesis-params.md b/src/reference/config/genesis-params.md index 9c7b83f4e..678dfb6bc 100644 --- a/src/reference/config/genesis-params.md +++ b/src/reference/config/genesis-params.md @@ -1,34 +1,12 @@ # Genesis Parameters -This module configures how Iroha handles genesis block. - -Each peer must have [`genesis.public_key`](#genesis-public-key) set in order to verify the genesis block. Only one peer in the network is -responsible for submitting the block, and for that one [`genesis.private_key`](#genesis-private-key) and [`genesis.file`](#genesis-file) must be specified -together in addition to [`genesis.public_key`](#genesis-public-key). - -For example, a peer that submits the genesis should have the following config: - -```toml -[genesis] -public_key = "..." -private_key = "..." -file = "./genesis.json" -``` - -In the meantime, all other peers should only have [`genesis.public_key`](#genesis-public-key) specified: - -```toml -[genesis] -public_key = "..." -``` +This module configures the [genesis](/reference/genesis) block. ## `genesis.file` -- **Type:** String, file path -- **Optional**, must be paired with [`genesis.private_key`](#genesis-private-key) -- **ENV:** `GENESIS_FILE` + -The file path to the Genesis JSON (link). +The file path to the [Genesis JSON](/reference/genesis). ::: code-group @@ -45,41 +23,16 @@ GENESIS_FILE="genesis.json" ::: tip Path Resolution -Path is resolved relatively to the config file location. If this parameter is set through ENV, then the path is resolved -relatively to the Current Working Directory. +[Paths resolution rules](glossary#paths-resolution) apply to this parameter. ::: -## `genesis.private_key` - -- **Type:** Table, [Private Key](glossary#type-private-key) -- **Optional**, must be paired with [`genesis.file`](#genesis-file) -- **ENV:** `GENESIS_PRIVATE_KEY` (TODO: or split to DIGEST + PAYLOAD?) - -The private key of the genesis account, only needed for the peer that submits the genesis block. - -::: code-group - -```toml [Config File] -[genesis] -private_key.digest = "ed25519" -private_key.payload = "82886B5A2BB3785F3CA8F8A78F60EA9DB62F939937B1CFA8407316EF07909A8D236808A6D4C12C91CA19E54686C2B8F5F3A786278E3824B4571EF234DEC8683B" -``` - -```shell [Environment] -GENESIS_PRIVATE_KEY="{\"digest\":\"ed25519\",\"payload\":\"82886B5A2BB3785F3CA8F8A78F60EA9DB62F939937B1CFA8407316EF07909A8D236808A6D4C12C91CA19E54686C2B8F5F3A786278E3824B4571EF234DEC8683B\"}" -``` - -::: - ## `genesis.public_key` -- **Type:** [Multi-hash](glossary#type-multi-hash) -- **Required** -- **ENV:** `GENESIS_PUBLIC_KEY` + -The public key of the genesis account, should be supplied to all peers. +The public key of the genesis account. ::: code-group @@ -89,9 +42,7 @@ public_key = "ed0120FAFCB2B27444221717F6FCBF900D5BE95273B1B0904B08C736B32A19F16A ``` ```shell [Environment] -GENESIS_PUBLIC_KEY= +GENESIS_PUBLIC_KEY=ed0120FAFCB2B27444221717F6FCBF900D5BE95273B1B0904B08C736B32A19F16AC1F9 ``` - ::: - diff --git a/src/reference/config/glossary.md b/src/reference/config/glossary.md index 91f6b9c7b..764339653 100644 --- a/src/reference/config/glossary.md +++ b/src/reference/config/glossary.md @@ -9,23 +9,13 @@ TODO Explain the limitations of different numeric types, like `u8` and `u64`. ## Type: Duration -Duration might be specified in two ways: - -- As a Number, which will be considered an amount in milliseconds -- As a String, which will be parsed as a human-readable string - -Numeric setting is straightforward: - -```toml -value = 1000 # 1000 milliseconds -``` - -String setting might be more readable: +Duration is specified as a human-readable string: ```toml value1 = "1sec" value2 = "1hour 12min 5s" value3 = "2years 2min 12us" +value4 = "550ms" ``` The duration string is a concatenation of time spans. Each time span is an @@ -48,41 +38,57 @@ It is an implementation detail. ## Type: Multi-hash -TODO Describe what the hell this is -## Type: Byte Size +To configure Multihash types in Iroha 2, you specify the cryptographic hash function used for digital signatures or data integrity verification. Iroha 2 supports a limited set of hash functions, identified by unique byte codes as defined in the [official multicodec table](https://github.com/multiformats/multicodec/blob/master/table.csv). -Byte size values might be set in two ways: +Supported Digest Functions: -- As a Number, which will be considered an amount in bytes -- As a String, which will be parsed as a human-readable string +- `Ed25519Pub` (code: `0xed`) - Ed25519 public key +- `Secp256k1Pub` (code: `0xe7`) - Secp256k1 public key +- `Bls12381G1Pub` (code: `0xea`) - BLS12-381 G1 public key +- `Bls12381G2Pub` (code: `0xeb`) - BLS12-381 G2 public key -Byte size as a number: +Below is an example of how to specify these multihashes in your TOML configuration: ```toml -value = 512 # 512 bytes +# Ed25519 public key hash +ed25519_pub = "0xed..." + +# Secp256k1 public key hash +secp256k1_pub = "0xe7..." + +# BLS12-381 G1 public key hash +bls12381_g1_pub = "0xea..." + +# BLS12-381 G2 public key hash +bls12381_g2_pub = "0xeb..." ``` -Byte size as a string: +In these examples, replace `` with the actual hash output encoded in hexadecimal. The code before the hash value corresponds to the hash function used, as per the Iroha 2 supported options. + +For further details on Multihash and its implementation, please refer to the [Multihash specification](https://multiformats.io/multihash/) and the [Multicodec Table](https://github.com/multiformats/multicodec/blob/master/table.csv) for a comprehensive list of hash function codes. + + +## Type: Bytes Amount + +Bytes amount is specified as a human-readable string: ```toml # 42 bytes -value1 = "42" -value2 = "42b" -value3 = "42bytes" +value1 = "42B" # 1 kilobyte = 1000 bytes -value4 = "1KB" +value2 = "1KB" # 1 kilobyte (binary format) = 1024 bytes -value5 = "1KiB" +value3 = "1KiB" -# Combination of multiple -value412 = "1GB 5MB" +# Sum of multiple +value4 = "1GB 5MB" ``` -Iroha can parse sizes in bytes, kilobytes, megabytes, gigabytes, terabytes, -and petabytes. +Iroha can parse sizes in bytes, kilobytes (`K`), megabytes (`M`), gigabytes (`G`), terabytes (`T`), +and petabytes (`P`). The format of suffixes: @@ -101,33 +107,53 @@ Consider it for the format. TODO explain private key ```toml -private_key = { digest = "ed25519", payload = "" } +private_key = { algorithm = "ed25519", payload = "" } ``` ## Type: Socket Address -TODO explain socket addresses +To specify a socket address in the configuration, use the format `host:port`, where `host` is either a hostname or an IP address, and `port` is the numeric port number the application should connect to or listen on. -``` -: -``` +- **Hostname example**: `localhost:8080` +- **IP address example**: `192.168.1.100:8080` + +**Hostname**: Can be a local hostname (`localhost` for the local machine) or a remote server's domain name (e.g., `example.com`). + +**IP address**: Use IPv4 (e.g., `192.168.1.100`) or IPv6 (enclosed in square brackets, e.g., `[2001:db8::1]`) formats. +**Port**: A numeric value typically ranging from `1` to `65535`, where ports below `1024` are reserved for well-known services and require root privileges on Unix-like systems. + +**Example in TOML:** + +```toml +address = "localhost:8080" ``` -localhost:8080 -127.0.0.1:1337 -sample.com:9090 + +For more information on socket addresses and networking, refer to the [IANA Service Name and Transport Protocol Port Number Registry](https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml) or the [RFC 3986](https://tools.ietf.org/html/rfc3986) specification. + +## Paths Resolution + +There are numerous parameters in the configuration that specify file paths. These paths might be relative. If they are specified in the config file, they are resolved relative to the config file location. If a path is specified via a Environment Variable, it is resolved relative to the CWD. + +For example, we run Iroha from `/home/alice` directory, using a config file at `/home/alice/projects/iroha.toml`: + +```shell +iroha --config ./projects/iroha.toml ``` -In TOML it should be specified as a string: +In `iroha.toml`, we specify [`kura.block_store_path`](kura-params#kura-block-store-path): ```toml -address = "localhost:8000" +[kura] +block_store_path = "./storage" ``` -## Type: Metadata Limits +This path will be resolved as `/home/alice/projects/storage`. -TODO +On the other hand, if we pass it via env: -### Default Metadata Limits +```shell +KURA_BLOCK_STORE=./env-storage iroha --config ./projects/iroha.toml +``` -TODO Display the value here +Then it will be set to `/home/alice/env-storage`. diff --git a/src/reference/config/index.md b/src/reference/config/index.md index 3be39b5bc..98fe747e2 100644 --- a/src/reference/config/index.md +++ b/src/reference/config/index.md @@ -1,108 +1,73 @@ # Configuring Iroha -::: danger WORK IN PROGRESS +Iroha is configured via a [TOML](https://toml.io/) file and/or Environment +Variables. -It is not implemented yet. Early draft document according to the RFC. +The path to the configuration file should be passed through the +[`--config` CLI argument](/reference/cli#config): -::: - -When running `iroha` from the command line, Iroha will try to resolve a config file named `iroha.toml` inside the -current working directory. Then it tries to read a set of Environment Variables associated with configuration -parameters. The most basic `iroha.toml` config file looks like this: - -```toml -public_key = "ed0120FAFCB2B27444221717F6FCBF900D5BE95273B1B0904B08C736B32A19F16AC1F9" -private_key = { digest = "ed25519", payload = "82886B5A2BB3785F3CA8F8A78F60EA9DB62F939937B1CFA8407316EF07909A8D236808A6D4C12C91CA19E54686C2B8F5F3A786278E3824B4571EF234DEC8683B" } - -# Peer-to-Peer communication address -address = "localhost:1337" - -[genesis] -public_key = "..." - -[torii] -# API address -address = "localhost:8080" +```shell +iroha --config iroha_config.toml ``` -The path to the configuration file can be overwritten either with `--config` CLI argument, or with `IROHA_CONFIG` -environment variable: - -::: code-group +If the peer submits the genesis: -```bash [Using CLI] -$ iroha --config ./config.toml +```shell +# `iroha_config.toml` should contain `genesis.file` and `genesis.private_key` +iroha --config iroha_config.toml --submit-genesis ``` -```bash [Using ENV] -$ IROHA_CONFIG=/path/to/config.toml iroha -``` - -::: - -Additionally, Iroha reads a set of Environment Variables, associated with configuration parameters. Values from ENV -override values from the config file. For example: +## Structure -::: code-group +- List links to all modules, giving high-level overview of them +- List required parameters -```shell [ENV variables] -PUBLIC_KEY=ed0120FAFCB2B27444221717F6FCBF900D5BE95273B1B0904B08C736B32A19F16AC1F9 -PRIVATE_KEY="{\"digest\":\"ed25519\",\"payload\":\"82886B5A2BB3785F3CA8F8A78F60EA9DB62F939937B1CFA8407316EF07909A8D236808A6D4C12C91CA19E54686C2B8F5F3A786278E3824B4571EF234DEC8683B\"}" -NETWORK_ADDRESS=localhost:1337 -TORII_API_ADDRESS=localhost:8080 -``` - -```toml [Equivalent in TOML] -public_key = "ed0120FAFCB2B27444221717F6FCBF900D5BE95273B1B0904B08C736B32A19F16AC1F9" -private_key = { digest = "ed25519", payload = "82886B5A2BB3785F3CA8F8A78F60EA9DB62F939937B1CFA8407316EF07909A8D236808A6D4C12C91CA19E54686C2B8F5F3A786278E3824B4571EF234DEC8683B" } -address = "localhost:1337" +| Module Name | Description | Required fields | +| ------------------------------- | ---------------------------- | ------------------------------------------------------------------------- | +| [Base](base-params) | Basic, root-level parameters | `chain_id`, `public_key`, `private_key` | +| [Genesis](genesis-params) | Genesis block configuration | `genesis.public_key`, and possibly `genesis.file` & `genesis.private_key` | +| [Network](network-params) | ? | `network.address` | +| [Torii](torii-params) | ? | `torii.address` | +| [Sumeragi](sumeragi-params) | ? | `sumeragi.trusted_peers` if doesn't submit the genesis | +| [Kura](kura-params) | ? | | +| [Queue](queue-params) | ? | | +| [Snapshot](snapshot-params) | ? | | +| [Logger](logger-params) | ? | | +| [Telemetry](telemetry-params) | ? | | +| [Chain Wide](chain-wide-params) | ? | | -[torii] -api_address = "localhost:8080" -``` +## Example Configuration -::: +- Show minimal TOML +- Show same minimal ENVs +- Refer to `peer.template.toml` in the repo, or show it here under the + spoiler. -Please refer to each field's documentation for specific ENV names. +## Extends feature -::: tip Debugging +- You can compose configuration files together using the `extends` + root-level field -To trace how configuration is resolved, run `iroha` with [`--trace-config`](../cli#trace-config) flag: - -```bash -$ iroha --trace-config -``` - -The output will be something like: - -``` -TODO: sample output -``` - -TODO: maybe also enable with `IROHA_CONFIG_TRACE=1` env var? - -::: - -## TOML Format - -Iroha uses the [TOML (Tom's Obvious Minimal Language)](https://toml.io/) format for its configuration. Please refer to -its documentation if you need assistance with how it works. +--- ## Required Parameters - [`public_key`](base-params#public-key): _explain the option_ - [`private_key`](base-params#private-key): _explain the option_ - [`address`](base-params#address): _explain the option_ -- [`genesis.public_key`](genesis-params#genesis-public-key): _explain the option_ -- [`genesis.private_key`](genesis-params#genesis-private-key) if the peer is the one who submits the genesis. _explain - the option_ -- [`sumeragi.trusted_peers`](sumeragi-params#sumeragi-trusted-peers): _explain the option_. It is not _strictly_ - required, but you might need to set it in most cases. +- [`genesis.public_key`](genesis-params#genesis-public-key): _explain the + option_ +- [`genesis.private_key`](genesis-params#genesis-private-key) if the peer + is the one who submits the genesis. _explain the option_ +- [`sumeragi.trusted_peers`](sumeragi-params#sumeragi-trusted-peers): + _explain the option_. It is not _strictly_ required, but you might need + to set it in most cases. - [`torii.address`](torii-params#torii-address): _explain the option_ ## Modules Overview -TODO: list each section (sumeragi, torii, kura etc) with links and short explanations of their responsibility. +TODO: list each section (sumeragi, torii, kura etc) with links and short +explanations of their responsibility. - **[Base Options](base-params):** _explain_ - **[Genesis](genesis-params):** _explain_ @@ -118,6 +83,7 @@ TODO: list each section (sumeragi, torii, kura etc) with links and short explana TODO: -- Consider refining `Number` types to exact `Integer`, `Float`, `Unsigned 64-bits integer`? +- Consider refining `Number` types to exact `Integer`, `Float`, + `Unsigned 64-bits integer`? - Is `sumeragi.trusted_peers` optional or required? - Define more ENVs, and provide samples of how it should be parsed diff --git a/src/reference/config/kura-params.md b/src/reference/config/kura-params.md index c9fc10ff9..efe467325 100644 --- a/src/reference/config/kura-params.md +++ b/src/reference/config/kura-params.md @@ -18,19 +18,7 @@ block_store_path = "./storage" TODO: will the path be resolved relative to the config file location, or to CWD? the former is more intuitive -## `kura.blocks_per_store_file` - -- **Type:** non-zero u64 -- **Default:** $1\ 000$ - -Maximum number of blocks to write into a single storage file. - -**Example:** - -```toml -[kura] -blocks_per_store_file = 1_000 -``` +## `kura.debug.output_new_blocks` ## `kura.init_mode` diff --git a/src/reference/config/logger-params.md b/src/reference/config/logger-params.md index a5d4da2c1..9e5063c1d 100644 --- a/src/reference/config/logger-params.md +++ b/src/reference/config/logger-params.md @@ -2,63 +2,7 @@ This page explains the parameters related to logging operations of Iroha 2, as managed by the Logger module. -## `logger.compact` - -- **Type:** Boolean -- **Default:** `false` - -Use compact logging format. - -**Example:** - -```toml -[logger] -compact = true -``` - -TODO: give an example of compact and full logs. More clue in -[tracing Compact docs](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/format/struct.Compact.html#example-output) - -## `logger.file` - -- **Type:** String -- **Optional** - -If provided, logs will be copied to said file in the format readable by [bunyan](https://lib.rs/crates/bunyan). - -**Example:** - -```toml -[logger] -file = "/usr/logs/iroha.jsonlogs" -``` - -::: tip Relative Paths - -You can use relative paths. They will be resolved relative to the configuration file location: - -```toml -# /home/iroha.toml -[logger] -file = "logs.jsonlogs" # will be `/home/logs.jsonlogs` -``` - -::: - -::: tip Standard Streams - -[Standard streams](https://en.wikipedia.org/wiki/Standard_streams) might be used as a destination as well: - -```toml -[logger] -file = "/dev/stdout" -``` - -::: - -TODO: relative to CWD or to the config file? - -TODO: which file extension should we use in examples? `.jsonlogs`? +## `logger.format` ## `logger.level` @@ -94,16 +38,4 @@ LOG_LEVEL=INFO ::: -## `logger.terminal_colors` - -- **Type:** Boolean -- **Default:** `true` - -Enable ANSI terminal colors for formatted output. - -**Example:** - -```toml -[logger] -terminal_colors = true -``` +## `logger.tokio_console_address` \ No newline at end of file diff --git a/src/reference/config/network-params.md b/src/reference/config/network-params.md new file mode 100644 index 000000000..6bb9286a9 --- /dev/null +++ b/src/reference/config/network-params.md @@ -0,0 +1,86 @@ +# Network Parameters + +## `network.address` + +- **Type:** String, [Socket-Address](glossary#type-socket-address) +- **Required** + +Address for p2p communication for consensus (sumeragi) and block synchronization (block_sync) purposes. + +```toml +[network] +address = "localhost:1337" +``` + +TODO: wait for renamings + +## `network.block_gossip_period` + +- **Type:** String or Number, [Duration](glossary#type-duration) +- **Default:** 10 seconds + +The time interval between requests to peers for the most recent block. + +**Example:** + +```toml +[sumeragi] +block_gossip_period = "5s" +``` + +::: warning + +More frequent gossiping shortens the time to sync, but can overload the +network. + +::: + +## `network.max_blocks_per_gossip` + +- **Type:** Number +- **Default:** $4$ + +The amount of blocks that can be sent in a single synchronization message. + +**Example:** + +```toml +[sumeragi] +max_blocks_per_gossip = 4 +``` + +## `network.max_transactions_per_gossip` + +- **Type:** Number +- **Default:** $500$ + +Max number of transactions in a gossip batch message. Smaller size leads to +longer time to synchronise, but useful if you have high packet loss. + +**Example:** + +```toml +[sumeragi] +max_transactions_per_gossip = 500 +``` + +## `network.transaction_gossip_period` + +- **Type:** String or Number, [Duration](glossary#type-duration) +- **Default:** 1 second + +Period for pending transaction gossiping between peers. + +**Example:** + +```toml +[sumeragi] +transaction_gossip_period = "1s" +``` + +::: warning + +More frequent gossiping shortens the time to sync, but can overload the +network. + +::: \ No newline at end of file diff --git a/src/reference/config/queue-params.md b/src/reference/config/queue-params.md index 3084038cc..ae4222db5 100644 --- a/src/reference/config/queue-params.md +++ b/src/reference/config/queue-params.md @@ -1,53 +1,53 @@ # Queue Parameters -TODO Explain Queue module. The queue holds incoming transactions. From time to time, Sumeragi fetches them in order to -create a block. +TODO Explain Queue module. The queue holds incoming transactions. From time +to time, Sumeragi fetches them in order to create a block. -## `queue.future_threshold` - -- **Type:** String or Number, [Duration](glossary#type-duration) -- **Default:** 1 second +## `queue.capacity` -The threshold to determine if a transaction has been tampered with to have a future timestamp. +- **Type:** u32 +- **Default:** $2^{16} = 65\ 536$ -TODO: explain that _timestamp_ is the value specified in -[`TransactionPayload`'s `creation_time_ms` field](/reference/data-model-schema#transactionpayload). +The upper limit of the number of transactions waiting in the queue. **Example:** ```toml [queue] -future_threshold = "1s" +max_transactions_in_queue = 65_536 ``` - -## `queue.max_transactions_in_queue` +## `queue.capacity_per_user` - **Type:** u32 - **Default:** $2^{16} = 65\ 536$ -The upper limit of the number of transactions waiting in the queue. +The upper limit of the number of transactions waiting in the queue for a +single user. Use this option to apply throttling. **Example:** ```toml [queue] -max_transactions_in_queue = 65_536 +max_transactions_in_queue_per_user = 65_536 ``` -## `queue.max_transactions_in_queue_per_user` +## `queue.future_threshold` -- **Type:** u32 -- **Default:** $2^{16} = 65\ 536$ +- **Type:** String or Number, [Duration](glossary#type-duration) +- **Default:** 1 second -The upper limit of the number of transactions waiting in the queue for a single user. Use this option to apply -throttling. +The threshold to determine if a transaction has been tampered with to have +a future timestamp. + +TODO: explain that _timestamp_ is the value specified in +[`TransactionPayload`'s `creation_time_ms` field](/reference/data-model-schema#transactionpayload). **Example:** ```toml [queue] -max_transactions_in_queue_per_user = 65_536 +future_threshold = "1s" ``` ## `queue.transaction_time_to_live` @@ -55,10 +55,12 @@ max_transactions_in_queue_per_user = 65_536 - **Type:** String or Number, [Duration](glossary#type-duration) - **Default:** 24 hours -The transaction will be dropped after this time if it is still in the queue. +The transaction will be dropped after this time if it is still in the +queue. -TODO: there is also `TransactionPayload`'s `time_to_live` parameter. We should probably say here that configuration -parameter has higher priority. Name it `queue.max_transaction_time_to_live`? +TODO: there is also `TransactionPayload`'s `time_to_live` parameter. We +should probably say here that configuration parameter has higher priority. +Name it `queue.max_transaction_time_to_live`? **Example:** @@ -66,4 +68,3 @@ parameter has higher priority. Name it `queue.max_transaction_time_to_live`? [queue] transaction_time_to_live = "24h" ``` - diff --git a/src/reference/config/snapshot-params.md b/src/reference/config/snapshot-params.md index f05a12f5e..ab5f7cdb4 100644 --- a/src/reference/config/snapshot-params.md +++ b/src/reference/config/snapshot-params.md @@ -26,6 +26,11 @@ Frequency of making snapshots create_every = "1 minute" ``` +## `snapshot.creation_enabled` + + + + ## `snapshot.store_path` - **Type:** String diff --git a/src/reference/config/sumeragi-params.md b/src/reference/config/sumeragi-params.md index 499f59a16..6968fe862 100644 --- a/src/reference/config/sumeragi-params.md +++ b/src/reference/config/sumeragi-params.md @@ -6,77 +6,6 @@ gossip sizes might affect network load & speed of sync. Explain the pipeline of transactions and blocks, refer to consensus section and maybe some others. -## `sumeragi.block_gossip_period` - -- **Type:** String or Number, [Duration](glossary#type-duration) -- **Default:** 10 seconds - -The time interval between requests to peers for the most recent block. - -**Example:** - -```toml -[sumeragi] -block_gossip_period = "5s" -``` - -::: warning - -More frequent gossiping shortens the time to sync, but can overload the -network. - -::: - -## `sumeragi.max_blocks_per_gossip` - -- **Type:** Number -- **Default:** $4$ - -The amount of blocks that can be sent in a single synchronization message. - -**Example:** - -```toml -[sumeragi] -max_blocks_per_gossip = 4 -``` - -## `sumeragi.max_transactions_per_gossip` - -- **Type:** Number -- **Default:** $500$ - -Max number of transactions in a gossip batch message. Smaller size leads to -longer time to synchronise, but useful if you have high packet loss. - -**Example:** - -```toml -[sumeragi] -max_transactions_per_gossip = 500 -``` - -## `sumeragi.transaction_gossip_period` - -- **Type:** String or Number, [Duration](glossary#type-duration) -- **Default:** 1 second - -Period for pending transaction gossiping between peers. - -**Example:** - -```toml -[sumeragi] -transaction_gossip_period = "1s" -``` - -::: warning - -More frequent gossiping shortens the time to sync, but can overload the -network. - -::: - ## `sumeragi.trusted_peers`