From a18bd6338076fb9c65f16f9444f1fda96768f35d Mon Sep 17 00:00:00 2001 From: Shunkichi Sato <49983831+s8sato@users.noreply.github.com> Date: Thu, 13 Feb 2025 19:21:50 +0900 Subject: [PATCH] docs(cli, testnet/2.0.0-rc.1): fixup #5291 (#5316) * fixup! feat(cli): add `iroha transaction get` and other important commands * ci: exclude from coverage `iroha_cli` `iroha_torii` covered by pytests * docs: fix invalid links * docs: fix lints * chore: remove `scripts/tests/tick.json` * chore: update CHANGELOG.md * chore: minor version bump to `2.0.0-rc.1.1` Signed-off-by: Shunkichi Sato <49983831+s8sato@users.noreply.github.com> --- .github/workflows/iroha2-dev-pr.yml | 2 +- CHANGELOG.md | 6 + Cargo.lock | 106 +-- Cargo.toml | 70 +- crates/iroha_cli/CommandLineHelp.md | 605 ++++++++++-------- crates/iroha_cli/README.md | 32 +- crates/iroha_cli/docs/multisig.md | 133 ++++ crates/iroha_cli/samples/parameter.json | 4 +- crates/iroha_cli/samples/query.json | 31 +- crates/iroha_cli/src/main.rs | 565 ++++++++-------- .../src/smartcontracts/wasm/cache.rs | 11 +- crates/iroha_data_model/src/parameter.rs | 5 - crates/iroha_smart_contract_utils/src/lib.rs | 2 +- scripts/tests/tick.json | 8 - wasm/Cargo.toml | 14 +- wasm/samples/mint_rose_trigger/Cargo.toml | 2 +- 16 files changed, 926 insertions(+), 670 deletions(-) create mode 100644 crates/iroha_cli/docs/multisig.md delete mode 100644 scripts/tests/tick.json diff --git a/.github/workflows/iroha2-dev-pr.yml b/.github/workflows/iroha2-dev-pr.yml index c788a32d12e..2b0d6e22c31 100644 --- a/.github/workflows/iroha2-dev-pr.yml +++ b/.github/workflows/iroha2-dev-pr.yml @@ -122,7 +122,7 @@ jobs: --all-features --branch --no-report - name: Generate lcov report - run: cargo llvm-cov report --doctests --lcov --output-path lcov.info + run: cargo llvm-cov report --doctests --ignore-filename-regex 'iroha_cli|iroha_torii' --lcov --output-path lcov.info - name: Upload lcov report uses: actions/upload-artifact@v4 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4174b19d1e4..3d958c1af9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased] +## [2.0.0-rc.1.1] - 2025-02-12 + +### Added + +- add `iroha transaction get` and other important commands (#5289) + ## [2.0.0-rc.1.0] - 2024-12-06 ### Added diff --git a/Cargo.lock b/Cargo.lock index e64afd551c8..3499bea369e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "executor_custom_data_model" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_data_model", "iroha_executor_data_model", @@ -2917,7 +2917,7 @@ checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "iroha" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "assert_matches", "assertables", @@ -2965,7 +2965,7 @@ dependencies = [ [[package]] name = "iroha_cli" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "clap", "clap-markdown", @@ -2990,7 +2990,7 @@ dependencies = [ [[package]] name = "iroha_codec" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "clap", "colored", @@ -3007,7 +3007,7 @@ dependencies = [ [[package]] name = "iroha_config" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "assertables", "cfg-if", @@ -3035,7 +3035,7 @@ dependencies = [ [[package]] name = "iroha_config_base" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "derive_more", "drop_bomb", @@ -3055,7 +3055,7 @@ dependencies = [ [[package]] name = "iroha_config_base_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "expect-test", @@ -3071,7 +3071,7 @@ dependencies = [ [[package]] name = "iroha_core" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "async-trait", "criterion", @@ -3113,7 +3113,7 @@ dependencies = [ [[package]] name = "iroha_crypto" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "aead", "amcl", @@ -3155,7 +3155,7 @@ dependencies = [ [[package]] name = "iroha_data_model" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "base64 0.22.1", "criterion", @@ -3182,7 +3182,7 @@ dependencies = [ [[package]] name = "iroha_data_model_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "derive_more", @@ -3201,7 +3201,7 @@ dependencies = [ [[package]] name = "iroha_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "impls", @@ -3217,7 +3217,7 @@ dependencies = [ [[package]] name = "iroha_executor" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_executor_data_model", "iroha_executor_derive", @@ -3230,7 +3230,7 @@ dependencies = [ [[package]] name = "iroha_executor_data_model" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "derive_more", "iroha_data_model", @@ -3242,7 +3242,7 @@ dependencies = [ [[package]] name = "iroha_executor_data_model_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_executor_data_model", "manyhow", @@ -3253,7 +3253,7 @@ dependencies = [ [[package]] name = "iroha_executor_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "iroha_macro_utils", @@ -3265,7 +3265,7 @@ dependencies = [ [[package]] name = "iroha_ffi" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "derive_more", "getset", @@ -3275,7 +3275,7 @@ dependencies = [ [[package]] name = "iroha_ffi_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "getset", @@ -3292,7 +3292,7 @@ dependencies = [ [[package]] name = "iroha_futures" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_config", "iroha_futures_derive", @@ -3308,7 +3308,7 @@ dependencies = [ [[package]] name = "iroha_futures_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_macro_utils", "manyhow", @@ -3319,7 +3319,7 @@ dependencies = [ [[package]] name = "iroha_genesis" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "derive_more", "eyre", @@ -3336,7 +3336,7 @@ dependencies = [ [[package]] name = "iroha_kagami" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "clap", "color-eyre", @@ -3355,7 +3355,7 @@ dependencies = [ [[package]] name = "iroha_logger" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "color-eyre", "console-subscriber", @@ -3374,14 +3374,14 @@ dependencies = [ [[package]] name = "iroha_macro" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_derive", ] [[package]] name = "iroha_macro_utils" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "drop_bomb", @@ -3393,7 +3393,7 @@ dependencies = [ [[package]] name = "iroha_numeric" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "derive_more", "displaydoc", @@ -3409,7 +3409,7 @@ dependencies = [ [[package]] name = "iroha_p2p" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "async-trait", "bytes", @@ -3431,7 +3431,7 @@ dependencies = [ [[package]] name = "iroha_primitives" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "derive_more", "displaydoc", @@ -3453,7 +3453,7 @@ dependencies = [ [[package]] name = "iroha_primitives_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_numeric", "iroha_primitives", @@ -3465,7 +3465,7 @@ dependencies = [ [[package]] name = "iroha_schema" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "impls", "iroha_schema_derive", @@ -3476,7 +3476,7 @@ dependencies = [ [[package]] name = "iroha_schema_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "iroha_macro_utils", @@ -3490,7 +3490,7 @@ dependencies = [ [[package]] name = "iroha_schema_gen" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_crypto", "iroha_data_model", @@ -3502,7 +3502,7 @@ dependencies = [ [[package]] name = "iroha_smart_contract" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "derive_more", "displaydoc", @@ -3517,7 +3517,7 @@ dependencies = [ [[package]] name = "iroha_smart_contract_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_macro_utils", "manyhow", @@ -3528,7 +3528,7 @@ dependencies = [ [[package]] name = "iroha_smart_contract_utils" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "cfg-if", "getrandom", @@ -3539,7 +3539,7 @@ dependencies = [ [[package]] name = "iroha_swarm" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "clap", "color-eyre", @@ -3562,7 +3562,7 @@ dependencies = [ [[package]] name = "iroha_telemetry" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "async-trait", "chrono", @@ -3588,7 +3588,7 @@ dependencies = [ [[package]] name = "iroha_telemetry_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_macro_utils", "manyhow", @@ -3600,7 +3600,7 @@ dependencies = [ [[package]] name = "iroha_test_network" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "backoff", "color-eyre", @@ -3633,7 +3633,7 @@ dependencies = [ [[package]] name = "iroha_test_samples" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_crypto", "iroha_data_model", @@ -3642,7 +3642,7 @@ dependencies = [ [[package]] name = "iroha_torii" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "async-trait", "axum 0.7.5", @@ -3677,14 +3677,14 @@ dependencies = [ [[package]] name = "iroha_torii_const" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_primitives", ] [[package]] name = "iroha_trigger" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_smart_contract", "iroha_smart_contract_utils", @@ -3693,7 +3693,7 @@ dependencies = [ [[package]] name = "iroha_trigger_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "iroha_macro_utils", @@ -3705,7 +3705,7 @@ dependencies = [ [[package]] name = "iroha_version" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_data_model", "iroha_logger", @@ -3719,7 +3719,7 @@ dependencies = [ [[package]] name = "iroha_version_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "darling", "iroha_macro", @@ -3736,7 +3736,7 @@ dependencies = [ [[package]] name = "iroha_wasm_builder" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "clap", "color-eyre", @@ -3751,7 +3751,7 @@ dependencies = [ [[package]] name = "iroha_wasm_codec" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_wasm_codec_derive", "parity-scale-codec", @@ -3761,7 +3761,7 @@ dependencies = [ [[package]] name = "iroha_wasm_codec_derive" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_macro_utils", "manyhow", @@ -3772,7 +3772,7 @@ dependencies = [ [[package]] name = "iroha_wasm_test_runner" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "anyhow", "wasmtime", @@ -3780,7 +3780,7 @@ dependencies = [ [[package]] name = "irohad" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "assertables", "clap", @@ -3932,7 +3932,7 @@ dependencies = [ [[package]] name = "kura_inspector" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "clap", "iroha_core", @@ -4181,7 +4181,7 @@ dependencies = [ [[package]] name = "mint_rose_trigger_data_model" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" dependencies = [ "iroha_data_model", "serde", diff --git a/Cargo.toml b/Cargo.toml index 8f503b36eba..3238f141e60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace.package] edition = "2021" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" # TODO: teams are being deprecated update the authors URL authors = ["Iroha 2 team "] @@ -14,40 +14,40 @@ keywords = ["blockchain", "crypto", "iroha", "ledger"] categories = ["cryptography::cryptocurrencies"] [workspace.dependencies] -iroha_core = { version = "=2.0.0-rc.1.0 ", path = "crates/iroha_core" } - -iroha_torii = { version = "=2.0.0-rc.1.0", path = "crates/iroha_torii" } -iroha_torii_const = { version = "=2.0.0-rc.1.0", path = "crates/iroha_torii_const" } - -iroha = { version = "=2.0.0-rc.1.0", path = "crates/iroha" } - -iroha_macro_utils = { version = "=2.0.0-rc.1.0", path = "crates/iroha_macro_utils" } -iroha_telemetry = { version = "=2.0.0-rc.1.0", path = "crates/iroha_telemetry" } -iroha_p2p = { version = "=2.0.0-rc.1.0", path = "crates/iroha_p2p" } -iroha_primitives = { version = "=2.0.0-rc.1.0", path = "crates/iroha_primitives", default-features = false } -iroha_config = { version = "=2.0.0-rc.1.0", path = "crates/iroha_config" } -iroha_config_base = { version = "=2.0.0-rc.1.0", path = "crates/iroha_config_base" } -iroha_schema_gen = { version = "=2.0.0-rc.1.0", path = "crates/iroha_schema_gen" } -iroha_schema = { version = "=2.0.0-rc.1.0", path = "crates/iroha_schema", default-features = false } -iroha_logger = { version = "=2.0.0-rc.1.0", path = "crates/iroha_logger" } -iroha_crypto = { version = "=2.0.0-rc.1.0", path = "crates/iroha_crypto", default-features = false } -iroha_macro = { version = "=2.0.0-rc.1.0", path = "crates/iroha_macro", default-features = false } -iroha_futures = { version = "=2.0.0-rc.1.0", path = "crates/iroha_futures" } -iroha_genesis = { version = "=2.0.0-rc.1.0", path = "crates/iroha_genesis" } -iroha_ffi = { version = "=2.0.0-rc.1.0", path = "crates/iroha_ffi" } -iroha_version = { version = "=2.0.0-rc.1.0", path = "crates/iroha_version", default-features = false } -iroha_wasm_codec = { version = "=2.0.0-rc.1.0", path = "crates/iroha_wasm_codec" } -iroha_wasm_builder = { version = "=2.0.0-rc.1.0", path = "crates/iroha_wasm_builder" } - -iroha_smart_contract = { version = "=2.0.0-rc.1.0", path = "crates/iroha_smart_contract" } -iroha_smart_contract_utils = { version = "=2.0.0-rc.1.0", path = "crates/iroha_smart_contract_utils" } -iroha_executor = { version = "=2.0.0-rc.1.0", path = "crates/iroha_executor" } - -iroha_data_model = { version = "=2.0.0-rc.1.0", path = "crates/iroha_data_model", default-features = false } -iroha_executor_data_model = { version = "=2.0.0-rc.1.0", path = "crates/iroha_executor_data_model" } - -iroha_test_network = { version = "=2.0.0-rc.1.0", path = "crates/iroha_test_network" } -iroha_test_samples = { version = "=2.0.0-rc.1.0", path = "crates/iroha_test_samples" } +iroha_core = { version = "=2.0.0-rc.1.1 ", path = "crates/iroha_core" } + +iroha_torii = { version = "=2.0.0-rc.1.1", path = "crates/iroha_torii" } +iroha_torii_const = { version = "=2.0.0-rc.1.1", path = "crates/iroha_torii_const" } + +iroha = { version = "=2.0.0-rc.1.1", path = "crates/iroha" } + +iroha_macro_utils = { version = "=2.0.0-rc.1.1", path = "crates/iroha_macro_utils" } +iroha_telemetry = { version = "=2.0.0-rc.1.1", path = "crates/iroha_telemetry" } +iroha_p2p = { version = "=2.0.0-rc.1.1", path = "crates/iroha_p2p" } +iroha_primitives = { version = "=2.0.0-rc.1.1", path = "crates/iroha_primitives", default-features = false } +iroha_config = { version = "=2.0.0-rc.1.1", path = "crates/iroha_config" } +iroha_config_base = { version = "=2.0.0-rc.1.1", path = "crates/iroha_config_base" } +iroha_schema_gen = { version = "=2.0.0-rc.1.1", path = "crates/iroha_schema_gen" } +iroha_schema = { version = "=2.0.0-rc.1.1", path = "crates/iroha_schema", default-features = false } +iroha_logger = { version = "=2.0.0-rc.1.1", path = "crates/iroha_logger" } +iroha_crypto = { version = "=2.0.0-rc.1.1", path = "crates/iroha_crypto", default-features = false } +iroha_macro = { version = "=2.0.0-rc.1.1", path = "crates/iroha_macro", default-features = false } +iroha_futures = { version = "=2.0.0-rc.1.1", path = "crates/iroha_futures" } +iroha_genesis = { version = "=2.0.0-rc.1.1", path = "crates/iroha_genesis" } +iroha_ffi = { version = "=2.0.0-rc.1.1", path = "crates/iroha_ffi" } +iroha_version = { version = "=2.0.0-rc.1.1", path = "crates/iroha_version", default-features = false } +iroha_wasm_codec = { version = "=2.0.0-rc.1.1", path = "crates/iroha_wasm_codec" } +iroha_wasm_builder = { version = "=2.0.0-rc.1.1", path = "crates/iroha_wasm_builder" } + +iroha_smart_contract = { version = "=2.0.0-rc.1.1", path = "crates/iroha_smart_contract" } +iroha_smart_contract_utils = { version = "=2.0.0-rc.1.1", path = "crates/iroha_smart_contract_utils" } +iroha_executor = { version = "=2.0.0-rc.1.1", path = "crates/iroha_executor" } + +iroha_data_model = { version = "=2.0.0-rc.1.1", path = "crates/iroha_data_model", default-features = false } +iroha_executor_data_model = { version = "=2.0.0-rc.1.1", path = "crates/iroha_executor_data_model" } + +iroha_test_network = { version = "=2.0.0-rc.1.1", path = "crates/iroha_test_network" } +iroha_test_samples = { version = "=2.0.0-rc.1.1", path = "crates/iroha_test_samples" } proc-macro2 = "1.0.86" syn = { version = "2.0.72", default-features = false } diff --git a/crates/iroha_cli/CommandLineHelp.md b/crates/iroha_cli/CommandLineHelp.md index 5001dc51369..780acba1754 100644 --- a/crates/iroha_cli/CommandLineHelp.md +++ b/crates/iroha_cli/CommandLineHelp.md @@ -104,167 +104,181 @@ This document contains the help content for the `iroha` command-line program. * [`iroha trigger get`↴](#iroha-trigger-get) * [`iroha trigger register`↴](#iroha-trigger-register) * [`iroha trigger unregister`↴](#iroha-trigger-unregister) +* [`iroha trigger mint`↴](#iroha-trigger-mint) +* [`iroha trigger burn`↴](#iroha-trigger-burn) * [`iroha trigger meta`↴](#iroha-trigger-meta) * [`iroha trigger meta get`↴](#iroha-trigger-meta-get) * [`iroha trigger meta set`↴](#iroha-trigger-meta-set) * [`iroha trigger meta remove`↴](#iroha-trigger-meta-remove) * [`iroha executor`↴](#iroha-executor) +* [`iroha executor data-model`↴](#iroha-executor-data-model) * [`iroha executor upgrade`↴](#iroha-executor-upgrade) * [`iroha markdown-help`↴](#iroha-markdown-help) ## `iroha` -Iroha CLI Client provides an ability to interact with Iroha Peers Web API without direct network usage +Iroha Client CLI provides a simple way to interact with the Iroha Web API **Usage:** `iroha [OPTIONS] ` ###### **Subcommands:** -* `domain` — Read/Write domains -* `account` — Read/Write accounts -* `asset` — Read/Write assets -* `peer` — Read/Write peers -* `events` — Subscribe events: state changes, status of transactions/blocks/triggers -* `blocks` — Subscribe blocks -* `multisig` — Read/Write multisig accounts and transactions -* `query` — Read in general -* `transaction` — Read transactions, Write in general -* `role` — Read/Write roles -* `parameter` — Read/Write parameters -* `trigger` — TODO Read/Write triggers -* `executor` — Update executor -* `markdown-help` — Dump a markdown help of this CLI to stdout +* `domain` — Read and write domains +* `account` — Read and write accounts +* `asset` — Read and write assets +* `peer` — Read and write peers +* `events` — Subscribe to events: state changes, transaction/block/trigger progress +* `blocks` — Subscribe to blocks +* `multisig` — Read and write multi-signature accounts and transactions +* `query` — Read various data +* `transaction` — Read transactions and write various data +* `role` — Read and write roles +* `parameter` — Read and write system parameters +* `trigger` — Read and write triggers +* `executor` — Read and write the executor +* `markdown-help` — Output CLI documentation in Markdown format ###### **Options:** * `-c`, `--config ` — Path to the configuration file Default value: `client.toml` -* `-v`, `--verbose` — More verbose output -* `-m`, `--metadata ` — Optional path to read a JSON5 file to attach transaction metadata -* `-a`, `--accumulate` — Whether to accumulate instructions into a single transaction: If specified, loads instructions from stdin, appends some, and returns them to stdout +* `-v`, `--verbose` — Print configuration details to stderr +* `-m`, `--metadata ` — Path to a JSON5 file for attaching transaction metadata (optional) +* `-i`, `--input` — Reads instructions from stdin and appends new ones. - Usage: `echo "[]" | iroha -a domain register -i "domain" | iroha -a asset definition register -i "asset#domain" -t Numeric | iroha transaction stdin` + Example usage: + + `echo "[]" | iroha -io domain register --id "domain" | iroha -i asset definition register --id "asset#domain" -t Numeric` +* `-o`, `--output` — Outputs instructions to stdout without submitting them. + + Example usage: + + `iroha -o domain register --id "domain" | iroha -io asset definition register --id "asset#domain" -t Numeric | iroha transaction stdin` ## `iroha domain` -Read/Write domains +Read and write domains **Usage:** `iroha domain ` ###### **Subcommands:** -* `list` — List domain ids -* `get` — Read a single domain details -* `register` — Register domain -* `unregister` — Unregister domain -* `transfer` — Transfer domain -* `meta` — Read/Write metadata +* `list` — List domains +* `get` — Retrieve details of a specific domain +* `register` — Register a domain +* `unregister` — Unregister a domain +* `transfer` — Transfer ownership of a domain +* `meta` — Read and write metadata ## `iroha domain list` -List domain ids +List domains **Usage:** `iroha domain list ` ###### **Subcommands:** -* `all` — List all domain ids -* `filter` — Filter domains by given predicate +* `all` — List all IDs, or full entries when `--verbose` is specified +* `filter` — Filter by a given predicate ## `iroha domain list all` -List all domain ids +List all IDs, or full entries when `--verbose` is specified + +**Usage:** `iroha domain list all [OPTIONS]` + +###### **Options:** -**Usage:** `iroha domain list all` +* `-v`, `--verbose` — Display detailed entry information instead of just IDs ## `iroha domain list filter` -Filter domains by given predicate +Filter by a given predicate **Usage:** `iroha domain list filter ` ###### **Arguments:** -* `` — Predicate for filtering given as JSON5 string +* `` — Filtering condition specified as a JSON5 string ## `iroha domain get` -Read a single domain details +Retrieve details of a specific domain **Usage:** `iroha domain get --id ` ###### **Options:** -* `-i`, `--id ` — Domain name as double-quoted string +* `-i`, `--id ` — Domain name ## `iroha domain register` -Register domain +Register a domain **Usage:** `iroha domain register --id ` ###### **Options:** -* `-i`, `--id ` — Domain name as double-quoted string +* `-i`, `--id ` — Domain name ## `iroha domain unregister` -Unregister domain +Unregister a domain **Usage:** `iroha domain unregister --id ` ###### **Options:** -* `-i`, `--id ` — Domain name as double-quoted string +* `-i`, `--id ` — Domain name ## `iroha domain transfer` -Transfer domain +Transfer ownership of a domain **Usage:** `iroha domain transfer --id --from --to ` ###### **Options:** -* `-i`, `--id ` — Domain name as double-quoted string -* `-f`, `--from ` — Account from which to transfer, in form "multihash@domain" -* `-t`, `--to ` — Account to which to transfer, in form "multihash@domain" +* `-i`, `--id ` — Domain name +* `-f`, `--from ` — Source account, in the format "multihash@domain" +* `-t`, `--to ` — Destination account, in the format "multihash@domain" ## `iroha domain meta` -Read/Write metadata +Read and write metadata **Usage:** `iroha domain meta ` ###### **Subcommands:** -* `get` — Read a value from a key-value store -* `set` — Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin -* `remove` — Delete an entry from a key-value store +* `get` — Retrieve a value from the key-value store +* `set` — Create or update an entry in the key-value store using JSON5 input from stdin +* `remove` — Delete an entry from the key-value store ## `iroha domain meta get` -Read a value from a key-value store +Retrieve a value from the key-value store **Usage:** `iroha domain meta get --id --key ` @@ -277,7 +291,7 @@ Read a value from a key-value store ## `iroha domain meta set` -Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin +Create or update an entry in the key-value store using JSON5 input from stdin **Usage:** `iroha domain meta set --id --key ` @@ -290,7 +304,7 @@ Create or update an entry in a key-value store, with a value constructed from a ## `iroha domain meta remove` -Delete an entry from a key-value store +Delete an entry from the key-value store **Usage:** `iroha domain meta remove --id --key ` @@ -303,85 +317,85 @@ Delete an entry from a key-value store ## `iroha account` -Read/Write accounts +Read and write accounts **Usage:** `iroha account ` ###### **Subcommands:** -* `role` — Read/Write account roles -* `permission` — Read/Write account permissions -* `list` — List account ids -* `get` — Read a single account details -* `register` — Register account -* `unregister` — Unregister account -* `meta` — Read/Write metadata +* `role` — Read and write account roles +* `permission` — Read and write account permissions +* `list` — List accounts +* `get` — Retrieve details of a specific account +* `register` — Register an account +* `unregister` — Unregister an account +* `meta` — Read and write metadata ## `iroha account role` -Read/Write account roles +Read and write account roles **Usage:** `iroha account role ` ###### **Subcommands:** -* `list` — List account role ids -* `grant` — Grant account role -* `revoke` — Revoke account role +* `list` — List account role IDs +* `grant` — Grant a role to an account +* `revoke` — Revoke a role from an account ## `iroha account role list` -List account role ids +List account role IDs **Usage:** `iroha account role list --id ` ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" +* `-i`, `--id ` — Account in the format "multihash@domain" ## `iroha account role grant` -Grant account role +Grant a role to an account **Usage:** `iroha account role grant --id --role ` ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" -* `-r`, `--role ` — Role name as double-quoted string +* `-i`, `--id ` — Account in the format "multihash@domain" +* `-r`, `--role ` — Role name ## `iroha account role revoke` -Revoke account role +Revoke a role from an account **Usage:** `iroha account role revoke --id --role ` ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" -* `-r`, `--role ` — Role name as double-quoted string +* `-i`, `--id ` — Account in the format "multihash@domain" +* `-r`, `--role ` — Role name ## `iroha account permission` -Read/Write account permissions +Read and write account permissions **Usage:** `iroha account permission ` ###### **Subcommands:** * `list` — List account permissions -* `grant` — Grant account permission constructed from a JSON5 stdin -* `revoke` — Revoke account permission constructed from a JSON5 stdin +* `grant` — Grant an account permission using JSON5 input from stdin +* `revoke` — Revoke an account permission using JSON5 input from stdin @@ -393,120 +407,124 @@ List account permissions ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" +* `-i`, `--id ` — Account in the format "multihash@domain" ## `iroha account permission grant` -Grant account permission constructed from a JSON5 stdin +Grant an account permission using JSON5 input from stdin **Usage:** `iroha account permission grant --id ` ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" +* `-i`, `--id ` — Account in the format "multihash@domain" ## `iroha account permission revoke` -Revoke account permission constructed from a JSON5 stdin +Revoke an account permission using JSON5 input from stdin **Usage:** `iroha account permission revoke --id ` ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" +* `-i`, `--id ` — Account in the format "multihash@domain" ## `iroha account list` -List account ids +List accounts **Usage:** `iroha account list ` ###### **Subcommands:** -* `all` — List all account ids -* `filter` — Filter accounts by given predicate +* `all` — List all IDs, or full entries when `--verbose` is specified +* `filter` — Filter by a given predicate ## `iroha account list all` -List all account ids +List all IDs, or full entries when `--verbose` is specified + +**Usage:** `iroha account list all [OPTIONS]` -**Usage:** `iroha account list all` +###### **Options:** + +* `-v`, `--verbose` — Display detailed entry information instead of just IDs ## `iroha account list filter` -Filter accounts by given predicate +Filter by a given predicate **Usage:** `iroha account list filter ` ###### **Arguments:** -* `` — Predicate for filtering given as JSON5 string +* `` — Filtering condition specified as a JSON5 string ## `iroha account get` -Read a single account details +Retrieve details of a specific account **Usage:** `iroha account get --id ` ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" +* `-i`, `--id ` — Account in the format "multihash@domain" ## `iroha account register` -Register account +Register an account **Usage:** `iroha account register --id ` ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" +* `-i`, `--id ` — Account in the format "multihash@domain" ## `iroha account unregister` -Unregister account +Unregister an account **Usage:** `iroha account unregister --id ` ###### **Options:** -* `-i`, `--id ` — Account in form "multihash@domain" +* `-i`, `--id ` — Account in the format "multihash@domain" ## `iroha account meta` -Read/Write metadata +Read and write metadata **Usage:** `iroha account meta ` ###### **Subcommands:** -* `get` — Read a value from a key-value store -* `set` — Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin -* `remove` — Delete an entry from a key-value store +* `get` — Retrieve a value from the key-value store +* `set` — Create or update an entry in the key-value store using JSON5 input from stdin +* `remove` — Delete an entry from the key-value store ## `iroha account meta get` -Read a value from a key-value store +Retrieve a value from the key-value store **Usage:** `iroha account meta get --id --key ` @@ -519,7 +537,7 @@ Read a value from a key-value store ## `iroha account meta set` -Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin +Create or update an entry in the key-value store using JSON5 input from stdin **Usage:** `iroha account meta set --id --key ` @@ -532,7 +550,7 @@ Create or update an entry in a key-value store, with a value constructed from a ## `iroha account meta remove` -Delete an entry from a key-value store +Delete an entry from the key-value store **Usage:** `iroha account meta remove --id --key ` @@ -545,144 +563,148 @@ Delete an entry from a key-value store ## `iroha asset` -Read/Write assets +Read and write assets **Usage:** `iroha asset ` ###### **Subcommands:** -* `definition` — Read/Write asset definitions -* `get` — Read a single asset details -* `list` — List asset ids -* `mint` — Increase an amount of asset -* `burn` — Decrease an amount of asset -* `transfer` — Transfer an amount of asset between accounts +* `definition` — Read and write asset definitions +* `get` — Retrieve details of a specific asset +* `list` — List assets +* `mint` — Increase the quantity of an asset +* `burn` — Decrease the quantity of an asset +* `transfer` — Transfer an asset between accounts * `transferkvs` — Transfer a key-value store between accounts -* `getkv` — Read a value from a key-value store -* `setkv` — Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin -* `removekv` — Delete an entry from a key-value store +* `getkv` — Retrieve a value from the key-value store +* `setkv` — Create or update a key-value entry using JSON5 input from stdin +* `removekv` — Delete an entry from the key-value store ## `iroha asset definition` -Read/Write asset definitions +Read and write asset definitions **Usage:** `iroha asset definition ` ###### **Subcommands:** -* `list` — List asset definition ids -* `get` — Read a single asset definition details -* `register` — Register asset definition -* `unregister` — Unregister asset definition -* `transfer` — Transfer asset definition -* `meta` — Read/Write metadata +* `list` — List asset definitions +* `get` — Retrieve details of a specific asset definition +* `register` — Register an asset definition +* `unregister` — Unregister an asset definition +* `transfer` — Transfer ownership of an asset definition +* `meta` — Read and write metadata ## `iroha asset definition list` -List asset definition ids +List asset definitions **Usage:** `iroha asset definition list ` ###### **Subcommands:** -* `all` — List all asset definition ids -* `filter` — Filter asset definitions by given predicate +* `all` — List all IDs, or full entries when `--verbose` is specified +* `filter` — Filter by a given predicate ## `iroha asset definition list all` -List all asset definition ids +List all IDs, or full entries when `--verbose` is specified -**Usage:** `iroha asset definition list all` +**Usage:** `iroha asset definition list all [OPTIONS]` + +###### **Options:** + +* `-v`, `--verbose` — Display detailed entry information instead of just IDs ## `iroha asset definition list filter` -Filter asset definitions by given predicate +Filter by a given predicate **Usage:** `iroha asset definition list filter ` ###### **Arguments:** -* `` — Predicate for filtering given as JSON5 string +* `` — Filtering condition specified as a JSON5 string ## `iroha asset definition get` -Read a single asset definition details +Retrieve details of a specific asset definition **Usage:** `iroha asset definition get --id ` ###### **Options:** -* `-i`, `--id ` — Asset definition in form "asset#domain" +* `-i`, `--id ` — Asset definition in the format "asset#domain" ## `iroha asset definition register` -Register asset definition +Register an asset definition **Usage:** `iroha asset definition register [OPTIONS] --id --type ` ###### **Options:** -* `-i`, `--id ` — Asset definition in form "asset#domain" -* `-u`, `--unmintable` — Mintability of asset -* `-t`, `--type ` — Value type stored in asset +* `-i`, `--id ` — Asset definition in the format "asset#domain" +* `-m`, `--mint-once` — Disables minting after the first instance +* `-t`, `--type ` — Data type stored in the asset ## `iroha asset definition unregister` -Unregister asset definition +Unregister an asset definition **Usage:** `iroha asset definition unregister --id ` ###### **Options:** -* `-i`, `--id ` — Asset definition in form "asset#domain" +* `-i`, `--id ` — Asset definition in the format "asset#domain" ## `iroha asset definition transfer` -Transfer asset definition +Transfer ownership of an asset definition **Usage:** `iroha asset definition transfer --id --from --to ` ###### **Options:** -* `-i`, `--id ` — Asset definition in form "asset#domain" -* `-f`, `--from ` — Account from which to transfer, in form "multihash@domain" -* `-t`, `--to ` — Account to which to transfer, in form "multihash@domain" +* `-i`, `--id ` — Asset definition in the format "asset#domain" +* `-f`, `--from ` — Source account, in the format "multihash@domain" +* `-t`, `--to ` — Destination account, in the format "multihash@domain" ## `iroha asset definition meta` -Read/Write metadata +Read and write metadata **Usage:** `iroha asset definition meta ` ###### **Subcommands:** -* `get` — Read a value from a key-value store -* `set` — Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin -* `remove` — Delete an entry from a key-value store +* `get` — Retrieve a value from the key-value store +* `set` — Create or update an entry in the key-value store using JSON5 input from stdin +* `remove` — Delete an entry from the key-value store ## `iroha asset definition meta get` -Read a value from a key-value store +Retrieve a value from the key-value store **Usage:** `iroha asset definition meta get --id --key ` @@ -695,7 +717,7 @@ Read a value from a key-value store ## `iroha asset definition meta set` -Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin +Create or update an entry in the key-value store using JSON5 input from stdin **Usage:** `iroha asset definition meta set --id --key ` @@ -708,7 +730,7 @@ Create or update an entry in a key-value store, with a value constructed from a ## `iroha asset definition meta remove` -Delete an entry from a key-value store +Delete an entry from the key-value store **Usage:** `iroha asset definition meta remove --id --key ` @@ -721,86 +743,90 @@ Delete an entry from a key-value store ## `iroha asset get` -Read a single asset details +Retrieve details of a specific asset **Usage:** `iroha asset get --id ` ###### **Options:** -* `-i`, `--id ` — Asset in form "asset##account@domain" or "asset#another_domain#account@domain" +* `-i`, `--id ` — Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" ## `iroha asset list` -List asset ids +List assets **Usage:** `iroha asset list ` ###### **Subcommands:** -* `all` — List all asset ids -* `filter` — Filter assets by given predicate +* `all` — List all IDs, or full entries when `--verbose` is specified +* `filter` — Filter by a given predicate ## `iroha asset list all` -List all asset ids +List all IDs, or full entries when `--verbose` is specified + +**Usage:** `iroha asset list all [OPTIONS]` + +###### **Options:** -**Usage:** `iroha asset list all` +* `-v`, `--verbose` — Display detailed entry information instead of just IDs ## `iroha asset list filter` -Filter assets by given predicate +Filter by a given predicate **Usage:** `iroha asset list filter ` ###### **Arguments:** -* `` — Predicate for filtering given as JSON5 string +* `` — Filtering condition specified as a JSON5 string ## `iroha asset mint` -Increase an amount of asset +Increase the quantity of an asset **Usage:** `iroha asset mint --id --quantity ` ###### **Options:** -* `-i`, `--id ` — Asset in form "asset##account@domain" or "asset#another_domain#account@domain" -* `-q`, `--quantity ` — Amount in an integer or decimal +* `-i`, `--id ` — Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" +* `-q`, `--quantity ` — Amount of change (integer or decimal) ## `iroha asset burn` -Decrease an amount of asset +Decrease the quantity of an asset **Usage:** `iroha asset burn --id --quantity ` ###### **Options:** -* `-i`, `--id ` — Asset in form "asset##account@domain" or "asset#another_domain#account@domain" -* `-q`, `--quantity ` — Amount in an integer or decimal +* `-i`, `--id ` — Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" +* `-q`, `--quantity ` — Amount of change (integer or decimal) ## `iroha asset transfer` -Transfer an amount of asset between accounts +Transfer an asset between accounts **Usage:** `iroha asset transfer --id --to --quantity ` ###### **Options:** -* `-i`, `--id ` — Asset to transfer, in form "asset##account@domain" or "asset#another_domain#account@domain" -* `-t`, `--to ` — Account to which to transfer, in form "multihash@domain" -* `-q`, `--quantity ` — Amount to transfer, in an integer or decimal +* `-i`, `--id ` — Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" +* `-t`, `--to ` — Destination account, in the format "multihash@domain" +* `-q`, `--quantity ` — Transfer amount (integer or decimal) @@ -812,61 +838,61 @@ Transfer a key-value store between accounts ###### **Options:** -* `-i`, `--id ` — Asset to transfer, in form "asset##account@domain" or "asset#another_domain#account@domain" -* `-t`, `--to ` — Account to which to transfer, in form "multihash@domain" +* `-i`, `--id ` — Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" +* `-t`, `--to ` — Destination account, in the format "multihash@domain" ## `iroha asset getkv` -Read a value from a key-value store +Retrieve a value from the key-value store **Usage:** `iroha asset getkv --id --key ` ###### **Options:** -* `-i`, `--id ` — Asset in form "asset##account@domain" or "asset#another_domain#account@domain" -* `-k`, `--key ` — Key for the value +* `-i`, `--id ` — Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" +* `-k`, `--key ` — Key for retrieving the corresponding value ## `iroha asset setkv` -Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin +Create or update a key-value entry using JSON5 input from stdin **Usage:** `iroha asset setkv --id --key ` ###### **Options:** -* `-i`, `--id ` — Asset in form "asset##account@domain" or "asset#another_domain#account@domain" -* `-k`, `--key ` — Key for the value +* `-i`, `--id ` — Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" +* `-k`, `--key ` — Key for retrieving the corresponding value ## `iroha asset removekv` -Delete an entry from a key-value store +Delete an entry from the key-value store **Usage:** `iroha asset removekv --id --key ` ###### **Options:** -* `-i`, `--id ` — Asset in form "asset##account@domain" or "asset#another_domain#account@domain" -* `-k`, `--key ` — Key for the value +* `-i`, `--id ` — Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" +* `-k`, `--key ` — Key for retrieving the corresponding value ## `iroha peer` -Read/Write peers +Read and write peers **Usage:** `iroha peer ` ###### **Subcommands:** * `list` — List registered peers expected to connect with each other -* `register` — Register peer -* `unregister` — Unregister peer +* `register` — Register a peer +* `unregister` — Unregister a peer @@ -892,51 +918,51 @@ List all registered peers ## `iroha peer register` -Register peer +Register a peer **Usage:** `iroha peer register --key ` ###### **Options:** -* `-k`, `--key ` — Peer's public key in multihash +* `-k`, `--key ` — Peer's public key in multihash format ## `iroha peer unregister` -Unregister peer +Unregister a peer **Usage:** `iroha peer unregister --key ` ###### **Options:** -* `-k`, `--key ` — Peer's public key in multihash +* `-k`, `--key ` — Peer's public key in multihash format ## `iroha events` -Subscribe events: state changes, status of transactions/blocks/triggers +Subscribe to events: state changes, transaction/block/trigger progress **Usage:** `iroha events [OPTIONS] ` ###### **Subcommands:** -* `state` — Notify when world state has certain changes -* `transaction` — Notify when transaction passes certain processes -* `block` — Notify when block passes certain processes -* `trigger-execute` — Notify when trigger execution is ordered -* `trigger-complete` — Notify when trigger execution is completed +* `state` — Notify when the world state undergoes certain changes +* `transaction` — Notify when a transaction reaches specific stages +* `block` — Notify when a block reaches specific stages +* `trigger-execute` — Notify when a trigger execution is ordered +* `trigger-complete` — Notify when a trigger execution is completed ###### **Options:** -* `-t`, `--timeout ` — How long to listen for events ex. "1y 6M 2w 3d 12h 30m 30s 500ms" +* `-t`, `--timeout ` — Duration to listen for events. Example: "1y 6M 2w 3d 12h 30m 30s" ## `iroha events state` -Notify when world state has certain changes +Notify when the world state undergoes certain changes **Usage:** `iroha events state` @@ -944,7 +970,7 @@ Notify when world state has certain changes ## `iroha events transaction` -Notify when transaction passes certain processes +Notify when a transaction reaches specific stages **Usage:** `iroha events transaction` @@ -952,7 +978,7 @@ Notify when transaction passes certain processes ## `iroha events block` -Notify when block passes certain processes +Notify when a block reaches specific stages **Usage:** `iroha events block` @@ -960,7 +986,7 @@ Notify when block passes certain processes ## `iroha events trigger-execute` -Notify when trigger execution is ordered +Notify when a trigger execution is ordered **Usage:** `iroha events trigger-execute` @@ -968,7 +994,7 @@ Notify when trigger execution is ordered ## `iroha events trigger-complete` -Notify when trigger execution is completed +Notify when a trigger execution is completed **Usage:** `iroha events trigger-complete` @@ -976,7 +1002,7 @@ Notify when trigger execution is completed ## `iroha blocks` -Subscribe blocks +Subscribe to blocks **Usage:** `iroha blocks [OPTIONS] ` @@ -986,13 +1012,15 @@ Subscribe blocks ###### **Options:** -* `-t`, `--timeout ` — How long to listen for blocks ex. "1y 6M 2w 3d 12h 30m 30s 500ms" +* `-t`, `--timeout ` — Duration to listen for events. Example: "1y 6M 2w 3d 12h 30m 30s" ## `iroha multisig` -Read/Write multisig accounts and transactions +Read and write multi-signature accounts and transactions. + +See the [usage guide](./docs/multisig.md) for details **Usage:** `iroha multisig ` @@ -1000,7 +1028,7 @@ Read/Write multisig accounts and transactions * `list` — List pending multisig transactions relevant to you * `register` — Register a multisig account -* `propose` — Propose a multisig transaction, constructed from instructions as a JSON5 stdin +* `propose` — Propose a multisig transaction using JSON5 input from stdin * `approve` — Approve a multisig transaction @@ -1034,10 +1062,10 @@ Register a multisig account ###### **Options:** * `-a`, `--account ` — ID of the multisig account to be registered -* `-s`, `--signatories ` — Signatories of the multisig account -* `-w`, `--weights ` — Relative weights of responsibility of respective signatories -* `-q`, `--quorum ` — Threshold of total weight at which the multisig is considered authenticated -* `-t`, `--transaction-ttl ` — Time-to-live of multisig transactions made by the multisig account ex. "1y 6M 2w 3d 12h 30m 30s 500ms" +* `-s`, `--signatories ` — List of signatories for the multisig account +* `-w`, `--weights ` — Relative weights of signatories' responsibilities +* `-q`, `--quorum ` — Threshold of total weight required for authentication +* `-t`, `--transaction-ttl ` — Time-to-live for multisig transactions. Example: "1y 6M 2w 3d 12h 30m 30s" Default value: `1h` @@ -1045,14 +1073,14 @@ Register a multisig account ## `iroha multisig propose` -Propose a multisig transaction, constructed from instructions as a JSON5 stdin +Propose a multisig transaction using JSON5 input from stdin **Usage:** `iroha multisig propose [OPTIONS] --account ` ###### **Options:** -* `-a`, `--account ` — Multisig authority of the multisig transaction -* `-t`, `--transaction-ttl ` — Time-to-live of multisig transactions that overrides to shorten the account default ex. "1y 6M 2w 3d 12h 30m 30s 500ms" +* `-a`, `--account ` — Multisig authority managing the proposed transaction +* `-t`, `--transaction-ttl ` — Overrides the default time-to-live for this transaction. Example: "1y 6M 2w 3d 12h 30m 30s" @@ -1064,26 +1092,26 @@ Approve a multisig transaction ###### **Options:** -* `-a`, `--account ` — Multisig authority of the multisig transaction -* `-i`, `--instructions-hash ` — Instructions to approve +* `-a`, `--account ` — Multisig authority of the transaction +* `-i`, `--instructions-hash ` — Hash of the instructions to approve ## `iroha query` -Read in general +Read various data **Usage:** `iroha query ` ###### **Subcommands:** -* `stdin` — Query constructed from a JSON5 stdin +* `stdin` — Query using JSON5 input from stdin ## `iroha query stdin` -Query constructed from a JSON5 stdin +Query using JSON5 input from stdin **Usage:** `iroha query stdin` @@ -1091,40 +1119,40 @@ Query constructed from a JSON5 stdin ## `iroha transaction` -Read transactions, Write in general +Read transactions and write various data **Usage:** `iroha transaction ` ###### **Subcommands:** -* `get` — Read a single transaction details -* `ping` — Empty transaction that just leaves a log message -* `wasm` — Transaction constructed from a Wasm executable input -* `stdin` — Transaction constructed from instructions as a JSON5 stdin +* `get` — Retrieve details of a specific transaction +* `ping` — Send an empty transaction that logs a message +* `wasm` — Send a transaction using Wasm input +* `stdin` — Send a transaction using JSON5 input from stdin ## `iroha transaction get` -Read a single transaction details +Retrieve details of a specific transaction **Usage:** `iroha transaction get --hash ` ###### **Options:** -* `-H`, `--hash ` — Transaction hash +* `-H`, `--hash ` — Hash of the transaction to retrieve ## `iroha transaction ping` -Empty transaction that just leaves a log message +Send an empty transaction that logs a message **Usage:** `iroha transaction ping [OPTIONS] --msg ` ###### **Options:** -* `-l`, `--log-level ` — TRACE, DEBUG, INFO, WARN, ERROR: grows more noticeable in this order +* `-l`, `--log-level ` — Log levels: TRACE, DEBUG, INFO, WARN, ERROR (in increasing order of visibility) Default value: `INFO` * `-m`, `--msg ` — Log message @@ -1133,19 +1161,19 @@ Empty transaction that just leaves a log message ## `iroha transaction wasm` -Transaction constructed from a Wasm executable input +Send a transaction using Wasm input **Usage:** `iroha transaction wasm [OPTIONS]` ###### **Options:** -* `-p`, `--path ` — Specify a path to the Wasm file or skip this arg to read from stdin +* `-p`, `--path ` — Path to the Wasm file. If omitted, reads from stdin ## `iroha transaction stdin` -Transaction constructed from instructions as a JSON5 stdin +Send a transaction using JSON5 input from stdin **Usage:** `iroha transaction stdin` @@ -1153,30 +1181,30 @@ Transaction constructed from instructions as a JSON5 stdin ## `iroha role` -Read/Write roles +Read and write roles **Usage:** `iroha role ` ###### **Subcommands:** -* `permission` — Read/Write role permissions -* `list` — List role ids -* `register` — Register role and grant it to you registrant -* `unregister` — Unregister role +* `permission` — Read and write role permissions +* `list` — List role IDs +* `register` — Register a role and grant it to the registrant +* `unregister` — Unregister a role ## `iroha role permission` -Read/Write role permissions +Read and write role permissions **Usage:** `iroha role permission ` ###### **Subcommands:** * `list` — List role permissions -* `grant` — Grant role permission constructed from a JSON5 stdin -* `revoke` — Revoke role permission constructed from a JSON5 stdin +* `grant` — Grant role permission using JSON5 input from stdin +* `revoke` — Revoke role permission using JSON5 input from stdin @@ -1188,49 +1216,49 @@ List role permissions ###### **Options:** -* `-i`, `--id ` — Role name as double-quoted string +* `-i`, `--id ` — Role name ## `iroha role permission grant` -Grant role permission constructed from a JSON5 stdin +Grant role permission using JSON5 input from stdin **Usage:** `iroha role permission grant --id ` ###### **Options:** -* `-i`, `--id ` — Role name as double-quoted string +* `-i`, `--id ` — Role name ## `iroha role permission revoke` -Revoke role permission constructed from a JSON5 stdin +Revoke role permission using JSON5 input from stdin **Usage:** `iroha role permission revoke --id ` ###### **Options:** -* `-i`, `--id ` — Role name as double-quoted string +* `-i`, `--id ` — Role name ## `iroha role list` -List role ids +List role IDs **Usage:** `iroha role list ` ###### **Subcommands:** -* `all` — List all role ids +* `all` — List all role IDs ## `iroha role list all` -List all role ids +List all role IDs **Usage:** `iroha role list all` @@ -1238,56 +1266,56 @@ List all role ids ## `iroha role register` -Register role and grant it to you registrant +Register a role and grant it to the registrant **Usage:** `iroha role register --id ` ###### **Options:** -* `-i`, `--id ` — Role name as double-quoted string +* `-i`, `--id ` — Role name ## `iroha role unregister` -Unregister role +Unregister a role **Usage:** `iroha role unregister --id ` ###### **Options:** -* `-i`, `--id ` — Role name as double-quoted string +* `-i`, `--id ` — Role name ## `iroha parameter` -Read/Write parameters +Read and write system parameters **Usage:** `iroha parameter ` ###### **Subcommands:** -* `list` — List parameters -* `set` — Set parameter constructed from a JSON5 stdin +* `list` — List system parameters +* `set` — Set a system parameter using JSON5 input from stdin ## `iroha parameter list` -List parameters +List system parameters **Usage:** `iroha parameter list ` ###### **Subcommands:** -* `all` — List all parameters +* `all` — List all system parameters ## `iroha parameter list all` -List all parameters +List all system parameters **Usage:** `iroha parameter list all` @@ -1295,7 +1323,7 @@ List all parameters ## `iroha parameter set` -Set parameter constructed from a JSON5 stdin +Set a system parameter using JSON5 input from stdin **Usage:** `iroha parameter set` @@ -1303,35 +1331,37 @@ Set parameter constructed from a JSON5 stdin ## `iroha trigger` -TODO Read/Write triggers +Read and write triggers **Usage:** `iroha trigger ` ###### **Subcommands:** -* `list` — List trigger ids -* `get` — Read a single trigger details -* `register` — TODO Register trigger -* `unregister` — Unregister trigger -* `meta` — Read/Write metadata +* `list` — List trigger IDs +* `get` — Retrieve details of a specific trigger +* `register` — TODO: Register a trigger +* `unregister` — Unregister a trigger +* `mint` — Increase the number of trigger executions +* `burn` — Decrease the number of trigger executions +* `meta` — Read and write metadata ## `iroha trigger list` -List trigger ids +List trigger IDs **Usage:** `iroha trigger list ` ###### **Subcommands:** -* `all` — List all trigger ids +* `all` — List all trigger IDs ## `iroha trigger list all` -List all trigger ids +List all trigger IDs **Usage:** `iroha trigger list all` @@ -1339,19 +1369,19 @@ List all trigger ids ## `iroha trigger get` -Read a single trigger details +Retrieve details of a specific trigger **Usage:** `iroha trigger get --id ` ###### **Options:** -* `-i`, `--id ` — Trigger name as double-quoted string +* `-i`, `--id ` — Trigger name ## `iroha trigger register` -TODO Register trigger +TODO: Register a trigger **Usage:** `iroha trigger register` @@ -1359,33 +1389,59 @@ TODO Register trigger ## `iroha trigger unregister` -Unregister trigger +Unregister a trigger **Usage:** `iroha trigger unregister --id ` ###### **Options:** -* `-i`, `--id ` — Trigger name as double-quoted string +* `-i`, `--id ` — Trigger name + + + +## `iroha trigger mint` + +Increase the number of trigger executions + +**Usage:** `iroha trigger mint --id --repetitions ` + +###### **Options:** + +* `-i`, `--id ` — Trigger name +* `-r`, `--repetitions ` — Amount of change (integer) + + + +## `iroha trigger burn` + +Decrease the number of trigger executions + +**Usage:** `iroha trigger burn --id --repetitions ` + +###### **Options:** + +* `-i`, `--id ` — Trigger name +* `-r`, `--repetitions ` — Amount of change (integer) ## `iroha trigger meta` -Read/Write metadata +Read and write metadata **Usage:** `iroha trigger meta ` ###### **Subcommands:** -* `get` — Read a value from a key-value store -* `set` — Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin -* `remove` — Delete an entry from a key-value store +* `get` — Retrieve a value from the key-value store +* `set` — Create or update an entry in the key-value store using JSON5 input from stdin +* `remove` — Delete an entry from the key-value store ## `iroha trigger meta get` -Read a value from a key-value store +Retrieve a value from the key-value store **Usage:** `iroha trigger meta get --id --key ` @@ -1398,7 +1454,7 @@ Read a value from a key-value store ## `iroha trigger meta set` -Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin +Create or update an entry in the key-value store using JSON5 input from stdin **Usage:** `iroha trigger meta set --id --key ` @@ -1411,7 +1467,7 @@ Create or update an entry in a key-value store, with a value constructed from a ## `iroha trigger meta remove` -Delete an entry from a key-value store +Delete an entry from the key-value store **Usage:** `iroha trigger meta remove --id --key ` @@ -1424,19 +1480,28 @@ Delete an entry from a key-value store ## `iroha executor` -Update executor +Read and write the executor **Usage:** `iroha executor ` ###### **Subcommands:** -* `upgrade` — Upgrade executor +* `data-model` — Retrieve the executor data model +* `upgrade` — Upgrade the executor + + + +## `iroha executor data-model` + +Retrieve the executor data model + +**Usage:** `iroha executor data-model` ## `iroha executor upgrade` -Upgrade executor +Upgrade the executor **Usage:** `iroha executor upgrade --path ` @@ -1448,7 +1513,7 @@ Upgrade executor ## `iroha markdown-help` -Dump a markdown help of this CLI to stdout +Output CLI documentation in Markdown format **Usage:** `iroha markdown-help` diff --git a/crates/iroha_cli/README.md b/crates/iroha_cli/README.md index 0c6d727b2ef..67b57c6df72 100644 --- a/crates/iroha_cli/README.md +++ b/crates/iroha_cli/README.md @@ -31,7 +31,7 @@ Refer to [Iroha Special Instructions](https://docs.iroha.tech/blockchain/instruc To create a domain, you need to specify the entity type first (`domain` in our case) and then the command (`register`) with a list of required parameters. For the `domain` entity, you only need to provide the `id` argument as a string that doesn't contain the `@` and `#` symbols. ```bash -./iroha domain register --id "Soramitsu" +iroha domain register --id "Soramitsu" ``` ### Create new Account @@ -39,7 +39,7 @@ To create a domain, you need to specify the entity type first (`domain` in our c To create an account, specify the entity type (`account`) and the command (`register`). Then define the value of the `id` argument in "signatory@domain" format, where signatory is the account's public key in multihash representation: ```bash -./iroha account register --id "ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" +iroha account register --id "ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" ``` ### Mint Asset to Account @@ -47,8 +47,8 @@ To create an account, specify the entity type (`account`) and the command (`regi To add assets to the account, you must first register an Asset Definition. Specify the `asset` entity and then use the `register` and `mint` commands respectively. Here is an example of adding Assets of the type `Quantity` to the account: ```bash -./iroha asset register --id "XOR#Soramitsu" --type Numeric -./iroha asset mint --id "XOR##ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" --quantity 1010 +iroha asset register --id "XOR#Soramitsu" --type Numeric +iroha asset mint --id "XOR##ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" --quantity 1010 ``` With this, you created `XOR#Soramitsu`, an asset of type `Numeric`, and then gave `1010` units of this asset to the account `ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu`. @@ -58,22 +58,22 @@ With this, you created `XOR#Soramitsu`, an asset of type `Numeric`, and then gav You can use Query API to check that your instructions were applied and the _world_ is in the desired state. For example, to know how many units of a particular asset an account has, use `asset get` with the specified account and asset: ```bash -./iroha asset get --id "XOR##ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" +iroha asset get --id "XOR##ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" ``` This query returns the quantity of `XOR#Soramitsu` asset for the `ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu` account. -You can also filter based on either account, asset or domain id by using the filtering API provided by the Iroha client CLI. Generally, filtering follows the `./iroha ENTITY list filter PREDICATE` pattern, where ENTITY is asset, account or domain and PREDICATE is condition used for filtering serialized using JSON5 (check `iroha::data_model::predicate::value::ValuePredicate` type). +You can also filter based on either account, asset or domain id by using the filtering API provided by the Iroha client CLI. Generally, filtering follows the `iroha ENTITY list filter PREDICATE` pattern, where ENTITY is asset, account or domain and PREDICATE is condition used for filtering serialized using JSON5 (check `iroha::data_model::predicate::value::ValuePredicate` type). Here are some examples of filtering: ```bash -# FIXME Filter domains by id -./iroha domain list filter '{"Identifiable": {"Is": "wonderland"}}' -# FIXME Filter accounts by domain -./iroha account list filter '{"Identifiable": {"EndsWith": "@wonderland"}}' -# FIXME Filter asset by domain -./iroha asset list filter '{"Or": [{"Identifiable": {"Contains": "#wonderland#"}}, {"And": [{"Identifiable": {"Contains": "##"}}, {"Identifiable": {"EndsWith": "@wonderland"}}]}]}' +# Filter domains by id +iroha domain list filter '{"Atom": {"Id": {"Atom": {"Equals": "wonderland"}}}}' +# Filter accounts by domain +iroha account list filter '{"Atom": {"Id": {"Domain": {"Atom": {"Equals": "wonderland"}}}}}' +# Filter asset by domain +iroha asset list filter '{"Or": [{"Atom": {"Id": {"Definition": {"Domain": {"Atom": {"Equals": "wonderland"}}}}}}, {"Atom": {"Id": {"Account": {"Domain": {"Atom": {"Equals": "wonderland"}}}}}}]}' ``` ### Execute WASM transaction @@ -81,13 +81,13 @@ Here are some examples of filtering: Use `--file` to specify a path to the WASM file: ```bash -./iroha transaction wasm --file /path/to/file.wasm +iroha transaction wasm --file /path/to/file.wasm ``` Or skip `--file` to read WASM from standard input: ```bash -cat /path/to/file.wasm | ./iroha transaction wasm +cat /path/to/file.wasm | iroha transaction wasm ``` These subcommands submit the provided wasm binary as an `Executable` to be executed outside a trigger context. @@ -99,11 +99,11 @@ The reference implementation of the Rust client, `iroha`, is often used for diag To test transactions in the JSON format (used in the genesis block and by other SDKs), pipe the transaction into the client and add the `transaction stdin` subcommand to the arguments: ```bash -cat ./samples/instructions.json | ./iroha transaction stdin +cat samples/instructions.json | iroha transaction stdin ``` ### Request arbitrary query ```bash -cat ./samples/query.json | ./iroha --config ./client.toml query stdin +cat samples/query.json | iroha query stdin ``` diff --git a/crates/iroha_cli/docs/multisig.md b/crates/iroha_cli/docs/multisig.md new file mode 100644 index 00000000000..68b74a7c078 --- /dev/null +++ b/crates/iroha_cli/docs/multisig.md @@ -0,0 +1,133 @@ +# Multi-Signature Usage Guide + +This guide explains how to create and operate a multi-signature account shared by multiple users. + +## Registering a Multi-Signature Account + +__Prerequisites:__ + +- All __signatories__ must be registered in advance. +- The registrant must have sufficient permissions to create an account. + +__Example usage:__ + +```bash +iroha multisig register \ +--account \ +ed0120987EE8092B2CE4622B4F66D6FE87F5D61575F0D0DFCB2D6B2E8905FE68F685B6@domain \ +--signatories \ +ed01203EB45C199FD3998A18FCA1E567F5F228C714BFF5203FEFF00FF06230836BAD22@domain \ +ed01206D75010256E96805161387608125326DD0068F29B4D4FC6755C98E5DA5413EC5@domain \ +ed01201F8E7213A3064DF569776E2ED861D21E574BED93EE5BC41B5540593E70182F8B@domain \ +--weights 1 2 3 \ +--quorum 3 \ +--transaction-ttl "1y 6M 2w 3d 12h 30m 30s" +``` + +__Explanation:__ + +To simplify explanations, accounts are identified by the last four digits of their multihash. + +- `85B6` represents a multi-signature __account__. + + ⚠️ __Warning:__ Any private key associated with the account can control it as a personal account. This security issue will be addressed in [#5022](https://github.com/hyperledger-iroha/iroha/issues/5022). + +- The multi-signature account consists of three __signatories__: `AD22`, `3EC5`, and `2F8B`. +- Each signatory has an assigned __weight__: + - `AD22`: __1__ + - `3EC5`: __2__ + - `2F8B`: __3__ +- A transaction is executed once the total weight of approving signatories meets the __quorum__: + - For example, `AD22` (weight __1__) and `3EC5` (weight __2__) together meet the quorum (__3__). + - Alternatively, `2F8B` (weight __3__) alone meets the quorum. +- If the __transaction TTL__ expires before reaching the quorum, the proposal is discarded. + +## Proposing a Multi-Signature Transaction + +__Prerequisites:__ + +- The multi-signature account must already be registered. +- The proposer must be one of the signatories. + +__Example usage:__ + +```bash +echo '"congratulations"' | iroha -o account meta set \ +--id ed0120987EE8092B2CE4622B4F66D6FE87F5D61575F0D0DFCB2D6B2E8905FE68F685B6@domain \ +--key success_marker \ +| iroha multisig propose \ +--account ed0120987EE8092B2CE4622B4F66D6FE87F5D61575F0D0DFCB2D6B2E8905FE68F685B6@domain +``` + +__Explanation:__ + +- Proposes setting the string value "congratulations" for the key "success_marker" in the metadata of the multi-signature __account__. +- The proposer automatically becomes the first __approver__. + +## Listing Multi-Signature Transactions + +__Assumptions:__ + +- `AD22` (weight __1__) proposed the transaction. +- `3EC5` (weight __2__) is your account, listing the transactions involved. + +__Usage:__ + +```bash +iroha multisig list all +``` + +__Example output:__ + +```json +{ + "FB8AEBB405236A9B4CCD26BBA4988D0B8E03957FDC52DD2A1F9F0A6953079989": { + "instructions": [ + { + "SetKeyValue": { + "Account": { + "object": "ed0120987EE8092B2CE4622B4F66D6FE87F5D61575F0D0DFCB2D6B2E8905FE68F685B6@domain", + "key": "success_marker", + "value": "congratulations" + } + } + } + ], + "proposed_at": "2025-02-06T19:59:58Z", + "expires_in": "1year 6months 17days 12h 26m 39s", + "approval_path": [ + "2 -> [1/3] ed0120987EE8092B2CE4622B4F66D6FE87F5D61575F0D0DFCB2D6B2E8905FE68F685B6@domain" + ] + } +} +``` + +__Explanation:__ + +- The key `FB8A..9989` is the __instructions hash__, identifying the proposal. +- `instructions` contains the proposed changes that will be executed once the quorum is reached. +- `approval_path` represents the approval chain from your account to the root multi-signature account for this proposal. + + The notation `2 -> [1/3]` means: + You are adding a weight of 2 to an existing 1 (by the proposer), out of a required 3 (quorum). + +## Approving a Multi-Signature Transaction + +__Prerequisites:__ + +- The proposal must have been submitted. +- The approver must be a signatory of the multi-signature account. + +__Example usage:__ + +```bash +iroha multisig approve \ +--account ed0120987EE8092B2CE4622B4F66D6FE87F5D61575F0D0DFCB2D6B2E8905FE68F685B6@domain \ +--instructions-hash FB8AEBB405236A9B4CCD26BBA4988D0B8E03957FDC52DD2A1F9F0A6953079989 +``` + +__Explanation:__ + +- Approves a proposal linked to the given __instructions hash__ for the multi-signature __account__. +- Approval may lead to either execution or expiration of the proposal. +- If the approval meets the quorum but the multi-signature account lacks the necessary permissions to execute it, the final approval is discarded. Signatories who have not yet approved it can retry after the multi-signature account has acquired the required permissions. diff --git a/crates/iroha_cli/samples/parameter.json b/crates/iroha_cli/samples/parameter.json index 947d0dc8532..76f72b99ccc 100644 --- a/crates/iroha_cli/samples/parameter.json +++ b/crates/iroha_cli/samples/parameter.json @@ -1,5 +1,5 @@ { - "sumeragi": { - "block_time_ms": 2001 + "Sumeragi": { + "BlockTimeMs": 2001 } } diff --git a/crates/iroha_cli/samples/query.json b/crates/iroha_cli/samples/query.json index eb3ad8c1785..1c01e409634 100644 --- a/crates/iroha_cli/samples/query.json +++ b/crates/iroha_cli/samples/query.json @@ -1,5 +1,32 @@ { - "Singular": { - "FindParameters": null + "Iterable": { + "query": { + "FindAccounts": { + "query": null, + "predicate": { + "Atom": { + "Metadata": { + "Key": { + "key": "key", + "projection": { + "Atom": { + "Equals": "value" + } + } + } + } + } + }, + "selector": [ + { + "Id": { + "Signatory": { + "Atom": null + } + } + } + ] + } + } } } diff --git a/crates/iroha_cli/src/main.rs b/crates/iroha_cli/src/main.rs index 9a2b95cf48b..aad665ed608 100644 --- a/crates/iroha_cli/src/main.rs +++ b/crates/iroha_cli/src/main.rs @@ -18,26 +18,33 @@ use iroha::{client::Client, config::Config, data_model::prelude::*}; use thiserror::Error; use tokio::runtime::Runtime; -/// Iroha CLI Client provides an ability to interact with Iroha Peers Web API without direct network usage. +/// Iroha Client CLI provides a simple way to interact with the Iroha Web API. #[derive(clap::Parser, Debug)] #[command(name = "iroha", version = concat!("version=", env!("CARGO_PKG_VERSION"), " git_commit_sha=", env!("VERGEN_GIT_SHA")), author)] struct Args { /// Path to the configuration file #[arg(short, long, value_name("PATH"), default_value = "client.toml")] config: PathBuf, - /// More verbose output + /// Print configuration details to stderr #[arg(short, long)] verbose: bool, - /// Optional path to read a JSON5 file to attach transaction metadata + /// Path to a JSON5 file for attaching transaction metadata (optional) #[arg(short, long, value_name("PATH"))] metadata: Option, - /// Whether to accumulate instructions into a single transaction: - /// If specified, loads instructions from stdin, appends some, and returns them to stdout + /// Reads instructions from stdin and appends new ones. /// - /// Usage: - /// `echo "[]" | iroha -a domain register -i "domain" | iroha -a asset definition register -i "asset#domain" -t Numeric | iroha transaction stdin` + /// Example usage: + /// + /// `echo "[]" | iroha -io domain register --id "domain" | iroha -i asset definition register --id "asset#domain" -t Numeric` + #[arg(short, long)] + input: bool, + /// Outputs instructions to stdout without submitting them. + /// + /// Example usage: + /// + /// `iroha -o domain register --id "domain" | iroha -io asset definition register --id "asset#domain" -t Numeric | iroha transaction stdin` #[arg(short, long)] - accumulate: bool, + output: bool, /// Commands #[command(subcommand)] command: Command, @@ -45,44 +52,46 @@ struct Args { #[derive(clap::Subcommand, Debug)] enum Command { - /// Read/Write domains + /// Read and write domains #[command(subcommand)] Domain(domain::Command), - /// Read/Write accounts + /// Read and write accounts #[command(subcommand)] Account(account::Command), - /// Read/Write assets + /// Read and write assets #[command(subcommand)] Asset(asset::Command), - /// Read/Write peers + /// Read and write peers #[command(subcommand)] Peer(peer::Command), - /// Subscribe events: state changes, status of transactions/blocks/triggers + /// Subscribe to events: state changes, transaction/block/trigger progress Events(events::Args), - /// Subscribe blocks + /// Subscribe to blocks Blocks(blocks::Args), - /// Read/Write multisig accounts and transactions + /// Read and write multi-signature accounts and transactions. + /// + /// See the [usage guide](./docs/multisig.md) for details #[command(subcommand)] Multisig(multisig::Command), - /// Read in general + /// Read various data #[command(subcommand)] Query(query::Command), - /// Read transactions, Write in general + /// Read transactions and write various data #[command(subcommand)] Transaction(transaction::Command), - /// Read/Write roles + /// Read and write roles #[command(subcommand)] Role(role::Command), - /// Read/Write parameters + /// Read and write system parameters #[command(subcommand)] Parameter(parameter::Command), - /// TODO Read/Write triggers + /// Read and write triggers #[command(subcommand)] Trigger(trigger::Command), - /// Update executor + /// Read and write the executor #[command(subcommand)] Executor(executor::Command), - /// Dump a markdown help of this CLI to stdout + /// Output CLI documentation in Markdown format MarkdownHelp(MarkdownHelp), } @@ -92,7 +101,9 @@ trait RunContext { fn transaction_metadata(&self) -> Option<&Metadata>; - fn accumulate_instructions(&self) -> bool; + fn input_instructions(&self) -> bool; + + fn output_instructions(&self) -> bool; fn print_data(&mut self, data: &dyn Serialize) -> Result<()>; @@ -104,16 +115,27 @@ trait RunContext { /// Submit instructions or dump them to stdout depending on the flag fn finish(&mut self, instructions: impl Into) -> Result<()> { - if !self.accumulate_instructions() { - return self._submit(instructions); - } - let instructions = match instructions.into() { - Executable::Wasm(wasm) => return self._submit(wasm), - Executable::Instructions(instructions) => instructions, + let mut instructions = match instructions.into() { + Executable::Wasm(wasm) => { + if self.input_instructions() || self.output_instructions() { + eyre::bail!( + "Incompatible `--input` `--output` flags with `iroha transaction wasm`" + ) + } + return self._submit(wasm); + } + Executable::Instructions(instructions) => instructions.into_vec(), }; - let mut acc: Vec = parse_json5_stdin()?; - acc.append(&mut instructions.into_vec()); - dump_json5_stdout(&acc) + if self.input_instructions() { + let mut acc: Vec = parse_json5_stdin_unchecked()?; + acc.append(&mut instructions); + instructions = acc; + } + if self.output_instructions() { + dump_json5_stdout(&instructions) + } else { + self._submit(instructions) + } } /// Combine instructions into a single transaction and submit it @@ -150,7 +172,8 @@ struct PrintJsonContext { write: W, config: Config, transaction_metadata: Option, - accumulate_instructions: bool, + input_instructions: bool, + output_instructions: bool, } impl RunContext for PrintJsonContext { @@ -162,8 +185,12 @@ impl RunContext for PrintJsonContext { self.transaction_metadata.as_ref() } - fn accumulate_instructions(&self) -> bool { - self.accumulate_instructions + fn input_instructions(&self) -> bool { + self.input_instructions + } + + fn output_instructions(&self) -> bool { + self.output_instructions } /// Serialize and print data @@ -256,7 +283,8 @@ fn main() -> error_stack::Result<(), MainError> { write: io::stdout(), config, transaction_metadata: None, - accumulate_instructions: args.accumulate, + input_instructions: args.input, + output_instructions: args.output, }; if let Some(path) = args.metadata { let str = fs::read_to_string(&path) @@ -291,34 +319,30 @@ mod filter { use super::*; - /// Filter for domain queries #[derive(clap::Args, Debug)] pub struct DomainFilter { - /// Predicate for filtering given as JSON5 string + /// Filtering condition specified as a JSON5 string #[arg(value_parser = parse_json5::>)] pub predicate: CompoundPredicate, } - /// Filter for account queries #[derive(clap::Args, Debug)] pub struct AccountFilter { - /// Predicate for filtering given as JSON5 string + /// Filtering condition specified as a JSON5 string #[arg(value_parser = parse_json5::>)] pub predicate: CompoundPredicate, } - /// Filter for asset queries #[derive(clap::Args, Debug)] pub struct AssetFilter { - /// Predicate for filtering given as JSON5 string + /// Filtering condition specified as a JSON5 string #[arg(value_parser = parse_json5::>)] pub predicate: CompoundPredicate, } - /// Filter for asset definition queries #[derive(clap::Args, Debug)] pub struct AssetDefinitionFilter { - /// Predicate for filtering given as JSON5 string + /// Filtering condition specified as a JSON5 string #[arg(value_parser = parse_json5::>)] pub predicate: CompoundPredicate, } @@ -332,7 +356,8 @@ mod events { #[derive(clap::Args, Debug)] pub struct Args { - /// How long to listen for events ex. "1y 6M 2w 3d 12h 30m 30s 500ms" + /// Duration to listen for events. + /// Example: "1y 6M 2w 3d 12h 30m 30s" #[arg(short, long, global = true)] timeout: Option, #[command(subcommand)] @@ -341,15 +366,15 @@ mod events { #[derive(clap::Subcommand, Debug)] enum Command { - /// Notify when world state has certain changes + /// Notify when the world state undergoes certain changes State, - /// Notify when transaction passes certain processes + /// Notify when a transaction reaches specific stages Transaction, - /// Notify when block passes certain processes + /// Notify when a block reaches specific stages Block, - /// Notify when trigger execution is ordered + /// Notify when a trigger execution is ordered TriggerExecute, - /// Notify when trigger execution is completed + /// Notify when a trigger execution is completed TriggerComplete, } @@ -387,7 +412,7 @@ mod events { while let Ok(event) = tokio::time::timeout(timeout, stream.try_next()).await { context.print_data(&event?)?; } - eprintln!("Timeout period has expired"); + eprintln!("Timeout period has expired."); Result::<()>::Ok(()) })?; } else { @@ -410,8 +435,8 @@ mod blocks { pub struct Args { /// Block height from which to start streaming blocks height: NonZeroU64, - - /// How long to listen for blocks ex. "1y 6M 2w 3d 12h 30m 30s 500ms" + /// Duration to listen for events. + /// Example: "1y 6M 2w 3d 12h 30m 30s" #[arg(short, long)] timeout: Option, } @@ -441,7 +466,7 @@ mod blocks { while let Ok(event) = tokio::time::timeout(timeout, stream.try_next()).await { context.print_data(&event?)?; } - eprintln!("Timeout period has expired"); + eprintln!("Timeout period has expired."); Result::<()>::Ok(()) })?; } else { @@ -455,23 +480,62 @@ mod blocks { } } +macro_rules! impl_list { + ($filter:ty, $query:expr) => { + #[derive(clap::Subcommand, Debug)] + pub enum List { + /// List all IDs, or full entries when `--verbose` is specified + All { + /// Display detailed entry information instead of just IDs + #[arg(short, long)] + verbose: bool, + }, + /// Filter by a given predicate + Filter($filter), + } + + impl Run for List { + fn run(self, context: &mut C) -> Result<()> { + let client = context.client_from_config(); + let query = client.query($query); + match self { + List::All { verbose } => { + if verbose { + let entries = query.execute_all()?; + context.print_data(&entries)?; + } else { + let ids = query.select_with(|entry| entry.id).execute_all()?; + context.print_data(&ids)?; + } + } + List::Filter(filter) => { + let view = query.filter(filter.predicate).execute_all()?; + context.print_data(&view)?; + } + } + Ok(()) + } + } + }; +} + mod domain { use super::*; #[derive(clap::Subcommand, Debug)] pub enum Command { - /// List domain ids + /// List domains #[command(subcommand)] List(List), - /// Read a single domain details + /// Retrieve details of a specific domain Get(Id), - /// Register domain + /// Register a domain Register(Id), - /// Unregister domain + /// Unregister a domain Unregister(Id), - /// Transfer domain + /// Transfer ownership of a domain Transfer(Transfer), - /// Read/Write metadata + /// Read and write metadata #[command(subcommand)] Meta(metadata::domain::Command), } @@ -517,44 +581,25 @@ mod domain { #[derive(clap::Args, Debug)] pub struct Transfer { - /// Domain name as double-quoted string + /// Domain name #[arg(short, long)] pub id: DomainId, - /// Account from which to transfer, in form "multihash@domain" + /// Source account, in the format "multihash@domain" #[arg(short, long)] pub from: AccountId, - /// Account to which to transfer, in form "multihash@domain" + /// Destination account, in the format "multihash@domain" #[arg(short, long)] pub to: AccountId, } #[derive(clap::Args, Debug)] pub struct Id { - /// Domain name as double-quoted string + /// Domain name #[arg(short, long)] pub id: DomainId, } - #[derive(clap::Subcommand, Debug)] - pub enum List { - /// List all domain ids - All, - /// Filter domains by given predicate - Filter(filter::DomainFilter), - } - - impl Run for List { - fn run(self, context: &mut C) -> Result<()> { - let client = context.client_from_config(); - let query = client.query(FindDomains).select_with(|entry| entry.id); - let query = match self { - List::All => query, - List::Filter(filter) => query.filter(filter.predicate), - }; - let ids = query.execute_all()?; - context.print_data(&ids) - } - } + impl_list!(filter::DomainFilter, FindDomains); } mod account { @@ -564,22 +609,22 @@ mod account { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// Read/Write account roles + /// Read and write account roles #[command(subcommand)] Role(RoleCommand), - /// Read/Write account permissions + /// Read and write account permissions #[command(subcommand)] Permission(PermissionCommand), - /// List account ids + /// List accounts #[command(subcommand)] List(List), - /// Read a single account details + /// Retrieve details of a specific account Get(Id), - /// Register account + /// Register an account Register(Id), - /// Unregister account + /// Unregister an account Unregister(Id), - /// Read/Write metadata + /// Read and write metadata #[command(subcommand)] Meta(metadata::account::Command), } @@ -620,11 +665,11 @@ mod account { #[derive(clap::Subcommand, Debug)] pub enum RoleCommand { - /// List account role ids + /// List account role IDs List(Id), - /// Grant account role + /// Grant a role to an account Grant(IdRole), - /// Revoke account role + /// Revoke a role from an account Revoke(IdRole), } @@ -661,9 +706,9 @@ mod account { pub enum PermissionCommand { /// List account permissions List(Id), - /// Grant account permission constructed from a JSON5 stdin + /// Grant an account permission using JSON5 input from stdin Grant(Id), - /// Revoke account permission constructed from a JSON5 stdin + /// Revoke an account permission using JSON5 input from stdin Revoke(Id), } @@ -679,7 +724,7 @@ mod account { context.print_data(&permissions) } Grant(args) => { - let permission: Permission = parse_json5_stdin()?; + let permission: Permission = parse_json5_stdin(context)?; let instruction = iroha::data_model::isi::Grant::account_permission(permission, args.id); context @@ -687,7 +732,7 @@ mod account { .wrap_err("Failed to grant the permission to the account") } Revoke(args) => { - let permission: Permission = parse_json5_stdin()?; + let permission: Permission = parse_json5_stdin(context)?; let instruction = iroha::data_model::isi::Revoke::account_permission(permission, args.id); context @@ -700,41 +745,22 @@ mod account { #[derive(clap::Args, Debug)] pub struct Id { - /// Account in form "multihash@domain" + /// Account in the format "multihash@domain" #[arg(short, long)] id: AccountId, } #[derive(clap::Args, Debug)] pub struct IdRole { - /// Account in form "multihash@domain" + /// Account in the format "multihash@domain" #[arg(short, long)] pub id: AccountId, - /// Role name as double-quoted string + /// Role name #[arg(short, long)] pub role: RoleId, } - #[derive(clap::Subcommand, Debug)] - pub enum List { - /// List all account ids - All, - /// Filter accounts by given predicate - Filter(filter::AccountFilter), - } - - impl Run for List { - fn run(self, context: &mut C) -> Result<()> { - let client = context.client_from_config(); - let query = client.query(FindAccounts).select_with(|entry| entry.id); - let query = match self { - List::All => query, - List::Filter(filter) => query.filter(filter.predicate), - }; - let ids = query.execute_all()?; - context.print_data(&ids) - } - } + impl_list!(filter::AccountFilter, FindAccounts); } mod asset { @@ -744,31 +770,31 @@ mod asset { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// Read/Write asset definitions + /// Read and write asset definitions #[command(subcommand)] Definition(definition::Command), - /// Read a single asset details + /// Retrieve details of a specific asset Get(Id), - /// List asset ids + /// List assets #[command(subcommand)] List(List), - /// Increase an amount of asset + /// Increase the quantity of an asset Mint(IdQuantity), - /// Decrease an amount of asset + /// Decrease the quantity of an asset Burn(IdQuantity), - /// Transfer an amount of asset between accounts + /// Transfer an asset between accounts #[command(name = "transfer")] TransferNumeric(TransferNumeric), /// Transfer a key-value store between accounts #[command(name = "transferkvs")] TransferStore(TransferStore), - /// Read a value from a key-value store + /// Retrieve a value from the key-value store #[command(name = "getkv")] GetKeyValue(IdKey), - /// Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin + /// Create or update a key-value entry using JSON5 input from stdin #[command(name = "setkv")] SetKeyValue(IdKey), - /// Delete an entry from a key-value store + /// Delete an entry from the key-value store #[command(name = "removekv")] RemoveKeyValue(IdKey), } @@ -830,7 +856,7 @@ mod asset { context.print_data(&value) } SetKeyValue(args) => { - let value: Json = parse_json5_stdin()?; + let value: Json = parse_json5_stdin(context)?; let instruction = iroha::data_model::isi::SetKeyValue::asset(args.id, args.key, value); context.finish([instruction]) @@ -851,18 +877,18 @@ mod asset { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// List asset definition ids + /// List asset definitions #[command(subcommand)] List(List), - /// Read a single asset definition details + /// Retrieve details of a specific asset definition Get(Id), - /// Register asset definition + /// Register an asset definition Register(Register), - /// Unregister asset definition + /// Unregister an asset definition Unregister(Id), - /// Transfer asset definition + /// Transfer ownership of an asset definition Transfer(Transfer), - /// Read/Write metadata + /// Read and write metadata #[command(subcommand)] Meta(metadata::asset_definition::Command), } @@ -883,7 +909,7 @@ mod asset { } Register(args) => { let mut entry = AssetDefinition::new(args.id, args.r#type); - if args.unmintable { + if args.mint_once { entry = entry.mintable_once(); } let instruction = iroha::data_model::isi::Register::asset_definition(entry); @@ -913,131 +939,91 @@ mod asset { #[derive(clap::Args, Debug)] pub struct Register { - /// Asset definition in form "asset#domain" + /// Asset definition in the format "asset#domain" #[arg(short, long)] pub id: AssetDefinitionId, - /// Mintability of asset + /// Disables minting after the first instance #[arg(short, long)] - pub unmintable: bool, - /// Value type stored in asset + pub mint_once: bool, + /// Data type stored in the asset #[arg(short, long)] pub r#type: AssetType, } #[derive(clap::Args, Debug)] pub struct Transfer { - /// Asset definition in form "asset#domain" + /// Asset definition in the format "asset#domain" #[arg(short, long)] pub id: AssetDefinitionId, - /// Account from which to transfer, in form "multihash@domain" + /// Source account, in the format "multihash@domain" #[arg(short, long)] pub from: AccountId, - /// Account to which to transfer, in form "multihash@domain" + /// Destination account, in the format "multihash@domain" #[arg(short, long)] pub to: AccountId, } #[derive(clap::Args, Debug)] pub struct Id { - /// Asset definition in form "asset#domain" + /// Asset definition in the format "asset#domain" #[arg(short, long)] pub id: AssetDefinitionId, } - #[derive(clap::Subcommand, Debug)] - pub enum List { - /// List all asset definition ids - All, - /// Filter asset definitions by given predicate - Filter(filter::AssetDefinitionFilter), - } - - impl Run for List { - fn run(self, context: &mut C) -> Result<()> { - let client = context.client_from_config(); - let query = client - .query(FindAssetsDefinitions) - .select_with(|entry| entry.id); - let query = match self { - List::All => query, - List::Filter(filter) => query.filter(filter.predicate), - }; - let ids = query.execute_all()?; - context.print_data(&ids) - } - } + impl_list!(filter::AssetDefinitionFilter, FindAssetsDefinitions); } #[derive(clap::Args, Debug)] pub struct TransferNumeric { - /// Asset to transfer, in form "asset##account@domain" or "asset#another_domain#account@domain" + /// Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" #[arg(short, long)] pub id: AssetId, - /// Account to which to transfer, in form "multihash@domain" + /// Destination account, in the format "multihash@domain" #[arg(short, long)] pub to: AccountId, - /// Amount to transfer, in an integer or decimal + /// Transfer amount (integer or decimal) #[arg(short, long)] pub quantity: Numeric, } #[derive(clap::Args, Debug)] pub struct TransferStore { - /// Asset to transfer, in form "asset##account@domain" or "asset#another_domain#account@domain" + /// Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" #[arg(short, long)] pub id: AssetId, - /// Account to which to transfer, in form "multihash@domain" + /// Destination account, in the format "multihash@domain" #[arg(short, long)] pub to: AccountId, } #[derive(clap::Args, Debug)] pub struct Id { - /// Asset in form "asset##account@domain" or "asset#another_domain#account@domain" + /// Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" #[arg(short, long)] pub id: AssetId, } #[derive(clap::Args, Debug)] pub struct IdQuantity { - /// Asset in form "asset##account@domain" or "asset#another_domain#account@domain" + /// Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" #[arg(short, long)] pub id: AssetId, - /// Amount in an integer or decimal + /// Amount of change (integer or decimal) #[arg(short, long)] pub quantity: Numeric, } #[derive(clap::Args, Debug)] pub struct IdKey { - /// Asset in form "asset##account@domain" or "asset#another_domain#account@domain" + /// Asset in the format "asset##account@domain" or "asset#another_domain#account@domain" #[arg(short, long)] pub id: AssetId, - /// Key for the value + /// Key for retrieving the corresponding value #[arg(short, long)] pub key: Name, } - #[derive(clap::Subcommand, Debug)] - pub enum List { - /// List all asset ids - All, - /// Filter assets by given predicate - Filter(filter::AssetFilter), - } - - impl Run for List { - fn run(self, context: &mut C) -> Result<()> { - let client = context.client_from_config(); - let query = client.query(FindAssets).select_with(|entry| entry.id); - let query = match self { - List::All => query, - List::Filter(filter) => query.filter(filter.predicate), - }; - let ids = query.execute_all()?; - context.print_data(&ids) - } - } + impl_list!(filter::AssetFilter, FindAssets); } mod peer { @@ -1048,9 +1034,9 @@ mod peer { /// List registered peers expected to connect with each other #[command(subcommand)] List(List), - /// Register peer + /// Register a peer Register(Id), - /// Unregister peer + /// Unregister a peer Unregister(Id), } @@ -1091,7 +1077,7 @@ mod peer { #[derive(clap::Args, Debug)] pub struct Id { - /// Peer's public key in multihash + /// Peer's public key in multihash format #[arg(short, long)] pub key: PublicKey, } @@ -1118,7 +1104,7 @@ mod multisig { List(List), /// Register a multisig account Register(Register), - /// Propose a multisig transaction, constructed from instructions as a JSON5 stdin + /// Propose a multisig transaction using JSON5 input from stdin Propose(Propose), /// Approve a multisig transaction Approve(Approve), @@ -1135,16 +1121,17 @@ mod multisig { /// ID of the multisig account to be registered #[arg(short, long)] pub account: AccountId, - /// Signatories of the multisig account + /// List of signatories for the multisig account #[arg(short, long, num_args(2..))] pub signatories: Vec, - /// Relative weights of responsibility of respective signatories + /// Relative weights of signatories' responsibilities #[arg(short, long, num_args(2..))] pub weights: Vec, - /// Threshold of total weight at which the multisig is considered authenticated + /// Threshold of total weight required for authentication #[arg(short, long)] pub quorum: u16, - /// Time-to-live of multisig transactions made by the multisig account ex. "1y 6M 2w 3d 12h 30m 30s 500ms" + /// Time-to-live for multisig transactions. + /// Example: "1y 6M 2w 3d 12h 30m 30s" #[arg(short, long, default_value_t = default_transaction_ttl())] pub transaction_ttl: humantime::Duration, } @@ -1180,17 +1167,18 @@ mod multisig { #[derive(clap::Args, Debug)] pub struct Propose { - /// Multisig authority of the multisig transaction + /// Multisig authority managing the proposed transaction #[arg(short, long)] pub account: AccountId, - /// Time-to-live of multisig transactions that overrides to shorten the account default ex. "1y 6M 2w 3d 12h 30m 30s 500ms" + /// Overrides the default time-to-live for this transaction. + /// Example: "1y 6M 2w 3d 12h 30m 30s" #[arg(short, long)] pub transaction_ttl: Option, } impl Run for Propose { fn run(self, context: &mut C) -> Result<()> { - let instructions: Vec = parse_json5_stdin()?; + let instructions: Vec = parse_json5_stdin(context)?; let transaction_ttl_ms = self.transaction_ttl.map(|duration| { duration .as_millis() @@ -1214,10 +1202,10 @@ mod multisig { #[derive(clap::Args, Debug)] pub struct Approve { - /// Multisig authority of the multisig transaction + /// Multisig authority of the transaction #[arg(short, long)] pub account: AccountId, - /// Instructions to approve + /// Hash of the instructions to approve #[arg(short, long)] pub instructions_hash: ProposalKey, } @@ -1434,7 +1422,7 @@ mod query { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// Query constructed from a JSON5 stdin + /// Query using JSON5 input from stdin Stdin(Stdin), } @@ -1451,7 +1439,7 @@ mod query { impl Run for Stdin { fn run(self, context: &mut C) -> Result<()> { let client = Client::new(context.config().clone()); - let query: AnyQueryBox = parse_json5_stdin()?; + let query: AnyQueryBox = parse_json5_stdin(context)?; match query { AnyQueryBox::Singular(query) => { @@ -1512,13 +1500,13 @@ mod transaction { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// Read a single transaction details + /// Retrieve details of a specific transaction Get(Get), - /// Empty transaction that just leaves a log message + /// Send an empty transaction that logs a message Ping(Ping), - /// Transaction constructed from a Wasm executable input + /// Send a transaction using Wasm input Wasm(Wasm), - /// Transaction constructed from instructions as a JSON5 stdin + /// Send a transaction using JSON5 input from stdin Stdin(Stdin), } @@ -1531,7 +1519,7 @@ mod transaction { #[derive(clap::Args, Debug)] pub struct Get { - /// Transaction hash + /// Hash of the transaction to retrieve #[arg(short('H'), long)] pub hash: HashOf, } @@ -1549,7 +1537,7 @@ mod transaction { #[derive(clap::Args, Debug)] pub struct Ping { - /// TRACE, DEBUG, INFO, WARN, ERROR: grows more noticeable in this order + /// Log levels: TRACE, DEBUG, INFO, WARN, ERROR (in increasing order of visibility) #[arg(short, long, default_value = "INFO")] pub log_level: LogLevel, /// Log message @@ -1566,7 +1554,7 @@ mod transaction { #[derive(clap::Args, Debug)] pub struct Wasm { - /// Specify a path to the Wasm file or skip this arg to read from stdin + /// Path to the Wasm file. If omitted, reads from stdin #[arg(short, long)] path: Option, } @@ -1590,7 +1578,7 @@ mod transaction { impl Run for Stdin { fn run(self, context: &mut C) -> Result<()> { - let instructions: Vec = parse_json5_stdin()?; + let instructions: Vec = parse_json5_stdin(context)?; context .finish(instructions) .wrap_err("Failed to submit parsed instructions") @@ -1603,15 +1591,15 @@ mod role { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// Read/Write role permissions + /// Read and write role permissions #[command(subcommand)] Permission(PermissionCommand), - /// List role ids + /// List role IDs #[command(subcommand)] List(List), - /// Register role and grant it to you registrant + /// Register a role and grant it to the registrant Register(Id), - /// Unregister role + /// Unregister a role Unregister(Id), } @@ -1644,9 +1632,9 @@ mod role { pub enum PermissionCommand { /// List role permissions List(Id), - /// Grant role permission constructed from a JSON5 stdin + /// Grant role permission using JSON5 input from stdin Grant(Id), - /// Revoke role permission constructed from a JSON5 stdin + /// Revoke role permission using JSON5 input from stdin Revoke(Id), } @@ -1666,7 +1654,7 @@ mod role { Ok(()) } Grant(args) => { - let permission: Permission = parse_json5_stdin()?; + let permission: Permission = parse_json5_stdin(context)?; let instruction = iroha::data_model::isi::Grant::role_permission(permission, args.id); context @@ -1674,7 +1662,7 @@ mod role { .wrap_err("Failed to grant the permission to the role") } Revoke(args) => { - let permission: Permission = parse_json5_stdin()?; + let permission: Permission = parse_json5_stdin(context)?; let instruction = iroha::data_model::isi::Revoke::role_permission(permission, args.id); context @@ -1687,14 +1675,14 @@ mod role { #[derive(clap::Args, Debug)] pub struct Id { - /// Role name as double-quoted string + /// Role name #[arg(short, long)] id: RoleId, } #[derive(clap::Subcommand, Debug)] pub enum List { - /// List all role ids + /// List all role IDs All, } @@ -1712,10 +1700,10 @@ mod parameter { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// List parameters + /// List system parameters #[command(subcommand)] List(List), - /// Set parameter constructed from a JSON5 stdin + /// Set a system parameter using JSON5 input from stdin Set(Set), } @@ -1728,7 +1716,7 @@ mod parameter { #[derive(clap::Subcommand, Debug)] pub enum List { - /// List all parameters + /// List all system parameters All, } @@ -1745,7 +1733,7 @@ mod parameter { impl Run for Set { fn run(self, context: &mut C) -> Result<()> { - let entry: Parameter = parse_json5_stdin()?; + let entry: Parameter = parse_json5_stdin(context)?; let instruction = SetParameter::new(entry); context.finish([instruction]) } @@ -1757,17 +1745,21 @@ mod trigger { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// List trigger ids + /// List trigger IDs #[command(subcommand)] List(List), - /// Read a single trigger details - // TODO for readability and reusability, trigger should hold a reference to a Wasm executable instead of the blob itself + /// Retrieve details of a specific trigger + // TODO: For better readability and reusability, triggers should reference a Wasm executable instead of storing the blob itself. Get(Id), - /// TODO Register trigger + /// TODO: Register a trigger Register(Register), - /// Unregister trigger + /// Unregister a trigger Unregister(Id), - /// Read/Write metadata + /// Increase the number of trigger executions + Mint(IdInt), + /// Decrease the number of trigger executions + Burn(IdInt), + /// Read and write metadata #[command(subcommand)] Meta(metadata::trigger::Command), } @@ -1793,6 +1785,24 @@ mod trigger { .finish([instruction]) .wrap_err("Failed to unregister trigger") } + Mint(args) => { + let instruction = iroha::data_model::isi::Mint::trigger_repetitions( + args.repetitions, + args.id, + ); + context + .finish([instruction]) + .wrap_err("Failed to mint trigger repetitions") + } + Burn(args) => { + let instruction = iroha::data_model::isi::Burn::trigger_repetitions( + args.repetitions, + args.id, + ); + context + .finish([instruction]) + .wrap_err("Failed to burn trigger repetitions") + } Meta(cmd) => cmd.run(context), } } @@ -1800,7 +1810,7 @@ mod trigger { #[derive(clap::Subcommand, Debug)] pub enum List { - /// List all trigger ids + /// List all trigger IDs All, } @@ -1814,9 +1824,19 @@ mod trigger { #[derive(clap::Args, Debug)] pub struct Id { - /// Trigger name as double-quoted string + /// Trigger name + #[arg(short, long)] + pub id: TriggerId, + } + + #[derive(clap::Args, Debug)] + pub struct IdInt { + /// Trigger name #[arg(short, long)] pub id: TriggerId, + /// Amount of change (integer) + #[arg(short, long)] + pub repetitions: u32, } #[derive(clap::Args, Debug)] @@ -1834,14 +1854,30 @@ mod executor { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// Upgrade executor + /// Retrieve the executor data model + DataModel, + /// Upgrade the executor Upgrade(Upgrade), } impl Run for Command { fn run(self, context: &mut C) -> Result<()> { use self::Command::*; - match_all!((self, context), { Upgrade }) + match self { + DataModel => { + let client = context.client_from_config(); + let model = client.query_single(FindExecutorDataModel)?; + context.print_data(&model) + } + Upgrade(args) => { + let instruction = fs::read(args.path) + .map(WasmSmartContract::from_compiled) + .map(Executor::new) + .map(iroha::data_model::isi::Upgrade::new) + .wrap_err("Failed to read a Wasm from the file")?; + context.finish([instruction]) + } + } } } @@ -1851,17 +1887,6 @@ mod executor { #[arg(short, long)] path: PathBuf, } - - impl Run for Upgrade { - fn run(self, context: &mut C) -> Result<()> { - let instruction = fs::read(self.path) - .map(WasmSmartContract::from_compiled) - .map(Executor::new) - .map(iroha::data_model::isi::Upgrade::new) - .wrap_err("Failed to read a Wasm from the file")?; - context.finish([instruction]) - } - } } mod metadata { @@ -1874,11 +1899,11 @@ mod metadata { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// Read a value from a key-value store + /// Retrieve a value from the key-value store Get(IdKey), - /// Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin + /// Create or update an entry in the key-value store using JSON5 input from stdin Set(IdKey), - /// Delete an entry from a key-value store + /// Delete an entry from the key-value store Remove(IdKey), } @@ -1905,7 +1930,7 @@ mod metadata { context.print_data(&value) } Set(args) => { - let value: Json = parse_json5_stdin()?; + let value: Json = parse_json5_stdin(context)?; let instruction = iroha::data_model::isi::SetKeyValue::$constructor( args.id, args.key, value, ); @@ -1935,11 +1960,11 @@ mod metadata { #[derive(clap::Subcommand, Debug)] pub enum Command { - /// Read a value from a key-value store + /// Retrieve a value from the key-value store Get(IdKey), - /// Create or update an entry in a key-value store, with a value constructed from a JSON5 stdin + /// Create or update an entry in the key-value store using JSON5 input from stdin Set(IdKey), - /// Delete an entry from a key-value store + /// Delete an entry from the key-value store Remove(IdKey), } @@ -1966,7 +1991,7 @@ mod metadata { context.print_data(&value) } Set(args) => { - let value: Json = parse_json5_stdin()?; + let value: Json = parse_json5_stdin(context)?; let instruction = iroha::data_model::isi::SetKeyValue::trigger(args.id, args.key, value); context.finish([instruction]) @@ -1991,7 +2016,17 @@ where Ok(()) } -fn parse_json5_stdin() -> Result +fn parse_json5_stdin(context: &impl RunContext) -> Result +where + T: for<'a> serde::Deserialize<'a>, +{ + if context.input_instructions() { + eyre::bail!("Incompatible `--input` flag with the command") + } + parse_json5_stdin_unchecked() +} + +fn parse_json5_stdin_unchecked() -> Result where T: for<'a> serde::Deserialize<'a>, { diff --git a/crates/iroha_core/src/smartcontracts/wasm/cache.rs b/crates/iroha_core/src/smartcontracts/wasm/cache.rs index c3cf72652ad..85c2bd9293f 100644 --- a/crates/iroha_core/src/smartcontracts/wasm/cache.rs +++ b/crates/iroha_core/src/smartcontracts/wasm/cache.rs @@ -10,10 +10,13 @@ use crate::{ state::StateTransaction, }; -/// Executor related things (linker initialization, module instantiation, memory free) -/// takes significant amount of time in case of single peer transactions handling. -/// (https://github.com/hyperledger/iroha/issues/3716#issuecomment-2348417005). -/// So this cache is used to share `Store` and `Instance` for different transaction validation. +/// Enables the reuse of `Store` and `Instance` across multiple transaction validations. +/// +/// # Context +/// +/// Executor-related operations (such as linker initialization, module instantiation, and memory deallocation) +/// can significantly impact performance when handling transactions. This issue is discussed in +/// [#3716](https://github.com/hyperledger-iroha/iroha/issues/3716#issuecomment-2348417005). #[derive(Default)] pub struct WasmCache<'world, 'block, 'state> { cache: Option>>, diff --git a/crates/iroha_data_model/src/parameter.rs b/crates/iroha_data_model/src/parameter.rs index 3d081679746..b90a4e7ff27 100644 --- a/crates/iroha_data_model/src/parameter.rs +++ b/crates/iroha_data_model/src/parameter.rs @@ -108,7 +108,6 @@ mod model { Deserialize, IntoSchema, )] - #[serde(rename_all = "snake_case")] pub enum SumeragiParameter { BlockTimeMs(u64), CommitTimeMs(u64), @@ -146,7 +145,6 @@ mod model { #[derive( Debug, Display, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encode, Serialize, IntoSchema, )] - #[serde(rename_all = "snake_case")] pub enum BlockParameter { MaxTransactions(NonZeroU64), } @@ -181,7 +179,6 @@ mod model { #[derive( Debug, Display, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encode, Serialize, IntoSchema, )] - #[serde(rename_all = "snake_case")] pub enum TransactionParameter { MaxInstructions(NonZeroU64), SmartContractSize(NonZeroU64), @@ -217,7 +214,6 @@ mod model { #[derive( Debug, Display, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encode, Serialize, IntoSchema, )] - #[serde(rename_all = "snake_case")] pub enum SmartContractParameter { Fuel(NonZeroU64), Memory(NonZeroU64), @@ -302,7 +298,6 @@ mod model { IntoSchema, )] #[ffi_type(opaque)] - #[serde(rename_all = "snake_case")] pub enum Parameter { Sumeragi(SumeragiParameter), Block(BlockParameter), diff --git a/crates/iroha_smart_contract_utils/src/lib.rs b/crates/iroha_smart_contract_utils/src/lib.rs index 9e907a15d6c..340917d5822 100644 --- a/crates/iroha_smart_contract_utils/src/lib.rs +++ b/crates/iroha_smart_contract_utils/src/lib.rs @@ -36,7 +36,7 @@ macro_rules! register_getrandom_err_callback { fn stub_getrandom(_dest: &mut [u8]) -> Result<(), $crate::getrandom::Error> { const ERROR_MESSAGE: &str = "`getrandom()` is not implemented. To provide your custom function \ - see https://docs.rs/getrandom/latest/getrandom/macro.register_custom_getrandom.html. \ + see https://docs.rs/getrandom/0.2/getrandom/macro.register_custom_getrandom.html. \ Be aware that your function must give the same result on different peers at the same execution round, and keep in mind the consequences of purely implemented random function."; diff --git a/scripts/tests/tick.json b/scripts/tests/tick.json deleted file mode 100644 index 9e2361059de..00000000000 --- a/scripts/tests/tick.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "Log": { - "level": "DEBUG", - "msg": "Just ticking time" - } - } -] diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 60db2044600..e449f1a641b 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,6 +1,6 @@ [workspace.package] edition = "2021" -version = "2.0.0-rc.1.0" +version = "2.0.0-rc.1.1" # TODO: teams are being deprecated update the authors URL authors = ["Iroha 2 team "] @@ -24,13 +24,13 @@ opt-level = "z" # Optimize for size vs speed with "s"/"z"(removes vectorizat codegen-units = 1 # Further reduces binary size but increases compilation time [workspace.dependencies] -iroha_smart_contract = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_smart_contract", features = ["debug"] } -iroha_trigger = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_trigger", features = ["debug"] } -iroha_executor = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_executor", features = ["debug"] } -iroha_schema = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_schema" } +iroha_smart_contract = { version = "=2.0.0-rc.1.1", path = "../crates/iroha_smart_contract", features = ["debug"] } +iroha_trigger = { version = "=2.0.0-rc.1.1", path = "../crates/iroha_trigger", features = ["debug"] } +iroha_executor = { version = "=2.0.0-rc.1.1", path = "../crates/iroha_executor", features = ["debug"] } +iroha_schema = { version = "=2.0.0-rc.1.1", path = "../crates/iroha_schema" } -iroha_data_model = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_data_model", default-features = false } -iroha_executor_data_model = { version = "=2.0.0-rc.1.0", path = "../crates/iroha_executor_data_model" } +iroha_data_model = { version = "=2.0.0-rc.1.1", path = "../crates/iroha_data_model", default-features = false } +iroha_executor_data_model = { version = "=2.0.0-rc.1.1", path = "../crates/iroha_executor_data_model" } mint_rose_trigger_data_model = { path = "../data_model/samples/mint_rose_trigger_data_model" } executor_custom_data_model = { path = "../data_model/samples/executor_custom_data_model" } diff --git a/wasm/samples/mint_rose_trigger/Cargo.toml b/wasm/samples/mint_rose_trigger/Cargo.toml index 2ceb93a8810..539e35a4fb1 100644 --- a/wasm/samples/mint_rose_trigger/Cargo.toml +++ b/wasm/samples/mint_rose_trigger/Cargo.toml @@ -11,7 +11,7 @@ license.workspace = true crate-type = ['cdylib'] [dependencies] -mint_rose_trigger_data_model = { version = "=2.0.0-rc.1.0", path = "../../../data_model/samples/mint_rose_trigger_data_model" } +mint_rose_trigger_data_model = { version = "=2.0.0-rc.1.1", path = "../../../data_model/samples/mint_rose_trigger_data_model" } iroha_trigger.workspace = true panic-halt.workspace = true