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

[refactor] #4161: rewrite config, _minimally_ #4239

Merged
merged 94 commits into from
Feb 16, 2024

Conversation

0x009922
Copy link
Contributor

@0x009922 0x009922 commented Jan 29, 2024

Description

This PR is a complete overhaul of Iroha & Client CLI configuration. It is based on the Configuration Overhaul RFC.

Although this PR has many changes already, there are still big parts of the RFC to be completed separately.

Configuration changes

  • Change format: TOML, lower-case fields
  • Restructure and rename parameters for users' convenience
  • Localise chain-wide parameters in the [chain_wide] section to ease further transition: [discussion] Align configuration-related instructions with the RFC #4028
  • Limit set of ENV aliases for the parameters
  • Support composition via extends mechanism
  • Split user config view from strongly-typed internal config representation
  • Emit as many errors at once as possible: collecting all missing fields, all ENV parsing failures, and semantic errors.

Subsequent changes

  • Revise sample configurations:
    • remove alt branch configs (configs/peer/lts|stable, configs/client/lts|stable)
    • put client.template.toml, peer.template.toml, and prometheus.template.yaml in the root of configs. These configs are not for direct use, but rather a part of documentation.
    • move docker compose files into configs/swarm
    • move docker compose related configurations into configs/swarm as well (client.toml, genesis.json, and executor.wasm)
    • some tests & deployment docs relied to /configs directory to use client/peer configs. It was implied that the configs are actually workable and filled with everything needed. It was ambiguous. Now those places rely on /configs/swarm content.
  • Update test environment:
    • test_env.py:
      • doesn't use ENVs to set configuration
      • generates a shared config, and individual configs (extending the shared one) for each peer
    • Pytests:
      • Split CLIENT_CLI_DIR (implying it has iroha_client_cli and config.json content) setting into CLIENT_CLI_BINARY and CLIENT_CLI_CONFIG
  • Iroha Swarm:
    • Doesn't rely on IROHA_CONFIG variable anymore, and doesn't expect Iroha configuration to be present in the configs directory; relies only on genesis.json, and all necessary configs are set in ENV.
    • TODO: allow users to customise configuration? For all peers or for individual ones somehow?
      • maybe via --config-shared=shared.toml --config-peer0=peer0.toml CLI
  • Iroha Torii:
    • split constants (namely - URIs) into a iroha_torii_const crate for easier re-use in iroha_client. Previously those were defined in iroha_config, which is not an appropriate place for it.
  • Kagami:
    • remove kagami config command, which used to produce "sample" peer/client configurations

Intentionally left issues (temporarily)

  • Using Report as a universal error to not bother with errors (yet)
  • Default is used for *Partials to create empty layers, while Default for actual config structures fills them with default values.

Not implemented

  • Tracing of configuration: basic debug logging to track how config is read, where and what is overwritten, how final value looks like etc
  • Enhanced errors:
    • emitting errors with fancy diagnostics by ariadne, spans to config files and/or ENVs, hints etc
    • "lazy" parsing of TOML with multiple-errors emitting
  • Human-readable durations and byte sizes; although I put HumanDuration and HumanBytes as stubs for future.

Post-merge

Upon merging of this PR, create these as separate issues:

Linked issues

Closes #4161, #3499, #3500, #3501, #3504, #3358

@0x009922 0x009922 added Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST Documentation Documentation changes config-changes Changes in configuration and start up of the Iroha Refactor Improvement to overall code quality UI Something about the interface python Pull requests that update Python code labels Jan 29, 2024
@0x009922 0x009922 self-assigned this Jan 29, 2024
README.md Outdated Show resolved Hide resolved
cli/src/main.rs Outdated Show resolved Hide resolved
client/src/client.rs Outdated Show resolved Hide resolved
client/src/client.rs Show resolved Hide resolved
config/iroha_test_config.toml Outdated Show resolved Hide resolved
core/src/queue.rs Outdated Show resolved Hide resolved
core/src/queue.rs Outdated Show resolved Hide resolved
core/src/queue.rs Outdated Show resolved Hide resolved
core/src/queue.rs Outdated Show resolved Hide resolved
core/src/query/store.rs Outdated Show resolved Hide resolved
torii/const/src/lib.rs Outdated Show resolved Hide resolved
core/src/kiso.rs Outdated Show resolved Hide resolved
core/src/block_sync.rs Outdated Show resolved Hide resolved
core/src/block_sync.rs Outdated Show resolved Hide resolved
config_samples/swarm/client.toml Outdated Show resolved Hide resolved
config_samples/swarm/client.toml Outdated Show resolved Hide resolved
config_samples/swarm/executor.wasm Outdated Show resolved Hide resolved
config_samples/swarm/docker-compose.single.yml Outdated Show resolved Hide resolved
config_samples/swarm/docker-compose.single.yml Outdated Show resolved Hide resolved
config_samples/examples/client.example.toml Outdated Show resolved Hide resolved
config_samples/examples/client.example.toml Outdated Show resolved Hide resolved
config/tests/fixtures/full.env Outdated Show resolved Hide resolved
config/tests/fixtures/empty_ok_genesis.json Show resolved Hide resolved
tools/kagami/src/config.rs Outdated Show resolved Hide resolved
telemetry/src/ws.rs Outdated Show resolved Hide resolved
telemetry/src/ws.rs Outdated Show resolved Hide resolved
logger/src/lib.rs Outdated Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
cli/src/lib.rs Show resolved Hide resolved
cli/src/lib.rs Show resolved Hide resolved
cli/src/lib.rs Outdated Show resolved Hide resolved
cli/src/lib.rs Outdated Show resolved Hide resolved
cli/src/lib.rs Outdated Show resolved Hide resolved
cli/src/lib.rs Outdated Show resolved Hide resolved
config_samples/swarm/docker-compose.single.yml Outdated Show resolved Hide resolved
client/src/config.rs Outdated Show resolved Hide resolved
client/src/config.rs Outdated Show resolved Hide resolved
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
@0x009922 0x009922 merged commit 9644767 into hyperledger-iroha:iroha2-dev Feb 16, 2024
13 checks passed
@0x009922 0x009922 deleted the minimal-config-rewrite branch February 16, 2024 10:10
@0x009922 0x009922 mentioned this pull request Apr 17, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config-changes Changes in configuration and start up of the Iroha Documentation Documentation changes Enhancement New feature or request iroha2-dev The re-implementation of a BFT hyperledger in RUST python Pull requests that update Python code Refactor Improvement to overall code quality UI Something about the interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants