diff --git a/.github/workflows/iroha2-dev-pr-wasm.yaml b/.github/workflows/iroha2-dev-pr-wasm.yaml index fe4f65ea579..7681cce3d04 100644 --- a/.github/workflows/iroha2-dev-pr-wasm.yaml +++ b/.github/workflows/iroha2-dev-pr-wasm.yaml @@ -12,6 +12,8 @@ on: - "wasm/**.json" - "wasm/**.toml" - "wasm/**.yml" + - "data_model/**.rs" + - "data_model/**.toml" env: RUSTC_BOOTSTRAP: 1 diff --git a/.github/workflows/iroha2-dev-pr.yml b/.github/workflows/iroha2-dev-pr.yml index 3d52da7aea9..856a90fa775 100644 --- a/.github/workflows/iroha2-dev-pr.yml +++ b/.github/workflows/iroha2-dev-pr.yml @@ -62,7 +62,7 @@ jobs: - name: Run tests run: mold -run cargo test --quiet --workspace --no-fail-fast -- --skip unstable_network --test-threads 2 || true env: - RUSTFLAGS: "-Zinstrument-coverage" + RUSTFLAGS: "-C instrument-coverage" LLVM_PROFILE_FILE: "iroha-%p-%m.profraw" - name: Generate a grcov coverage report run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info diff --git a/.github/workflows/iroha2-dev.yml b/.github/workflows/iroha2-dev.yml index 7eced522db0..295fbdd4a89 100644 --- a/.github/workflows/iroha2-dev.yml +++ b/.github/workflows/iroha2-dev.yml @@ -52,14 +52,14 @@ jobs: with: context: . push: true - tags: hyperledger/iroha2:crypto-cli-dev + tags: hyperledger/iroha2:kagami-dev build-args: | TARGET_DIR=release PROFILE=--release - BIN=iroha_crypto_cli + BIN=kagami - name: Build and push load-rs:dev docker image - run: | + run: | sleep 10s echo "wait to other workflow" - uses: convictional/trigger-workflow-and-wait@v1.6.0 @@ -112,11 +112,11 @@ jobs: uses: actions/upload-artifact@v2 with: name: cargo-crypto-cli-build-release - path: target/release/iroha_crypto_cli + path: target/release/kagami - name: Run schema generation run: | mkdir -p target/schema - cargo run -p iroha_schema_bin > target/schema/schema.json + cargo run --bin kagami -- schema > target/schema/schema.json - name: Upload schema uses: actions/upload-artifact@v2 with: @@ -186,7 +186,7 @@ jobs: - name: Run tests run: mold -run cargo test --workspace --no-fail-fast -- --skip unstable_network || true env: - RUSTFLAGS: "-Zinstrument-coverage" + RUSTFLAGS: "-C instrument-coverage" RUSTC_BOOTSTRAP: 1 LLVM_PROFILE_FILE: "iroha-%p-%m.profraw" - name: Generate a grcov coverage report diff --git a/.github/workflows/iroha2-push-nightly.yml b/.github/workflows/iroha2-push-nightly.yml index fcc7c7cb822..5780bd6b07c 100644 --- a/.github/workflows/iroha2-push-nightly.yml +++ b/.github/workflows/iroha2-push-nightly.yml @@ -38,8 +38,8 @@ jobs: with: context: . push: true - tags: hyperledger/iroha2:crypto-cli-dev-nightly-${{ github.sha }} + tags: hyperledger/iroha2:kagami-dev-nightly-${{ github.sha }} build-args: | TARGET_DIR=release PROFILE=--release - BIN=iroha_crypto_cli + BIN=kagami diff --git a/.github/workflows/iroha2.yml b/.github/workflows/iroha2.yml index 7b8ef3f70e5..8ad143647c2 100644 --- a/.github/workflows/iroha2.yml +++ b/.github/workflows/iroha2.yml @@ -19,7 +19,7 @@ jobs: - name: Run tests run: mold -run cargo test --quiet --workspace --no-fail-fast -- --skip unstable_network --test-threads 2 || true env: - RUSTFLAGS: "-Zinstrument-coverage" + RUSTFLAGS: "-C instrument-coverage" LLVM_PROFILE_FILE: "iroha-%p-%m.profraw" - name: Generate a grcov coverage report run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info @@ -59,7 +59,7 @@ jobs: with: context: . push: true - tags: hyperledger/iroha2:stable-client-cli + tags: hyperledger/iroha2:client-cli-stable build-args: | TARGET_DIR=release PROFILE=--release @@ -69,11 +69,11 @@ jobs: with: context: . push: true - tags: hyperledger/iroha2:stable-crypto-cli + tags: hyperledger/iroha2:kagami-stable build-args: | TARGET_DIR=release PROFILE=--release - BIN=iroha_crypto_cli + BIN=kagami - name: Build and push load-rs:release docker image run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4ced8c0e32d..e413438cb1d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,7 @@ The following is a short set of guidelines for contributing to Iroha. * Fix your issue of choice. * Write [tests](https://doc.rust-lang.org/cargo/commands/cargo-test.html). Ensure they all pass (`cargo test`). * Fix [`clippy`](https://lib.rs/crates/cargo-lints) warnings: `cargo lints clippy --workspace --benches --tests --examples --all-features` -* Format code `cargo +nightly fmt --all` and generate docs `cargo run --bin iroha_docs >"docs/source/references/config.md" && git add "docs/source/references/config.md"` +* Format code `cargo +nightly fmt --all` and generate docs `cargo run --bin kagami -- docs >"docs/source/references/config.md" && git add "docs/source/references/config.md"` * `git pull -r hyperledger iroha2-dev`, `git commit -s`, `git push `, and [create a pull request](https://github.com/hyperledger/iroha/compare) to the `iroha2-dev` branch on GitHub. ### Reporting Bugs @@ -149,7 +149,7 @@ Set the `LOG_FILE_PATH` environment variable to an appropriate location to store - Limit the first line of your commit message to 50 characters or less. - The first line of your commit message should contain the summary of the work you've done. If you need more than one line, leave a blank line between each paragraph and describe your changes in the middle. The last line must be the sign-off. - Use the [Git Rebase Workflow](https://git-rebase.io/). Avoid using `git pull` use `git pull --rebase` instead. -- If you modify the Schema (check by generating the schema with `iroha_schema_bin` and diff), you should make all changes to the schema in a separate commit with the message `[schema]`. +- If you modify the Schema (check by generating the schema with `kagami schema` and diff), you should make all changes to the schema in a separate commit with the message `[schema]`. - Generally, try to stick to one commit per meaningful change. - If you fixed several issues in one PR, give them separate commits. - As mentioned previously changes to the `schema` and the API should be done in appropriate commits separate from the rest of your work. diff --git a/Cargo.lock b/Cargo.lock index 3b8eabed801..429cc11b50c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -465,13 +465,9 @@ version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ - "ansi_term", - "atty", "bitflags", - "strsim 0.8.0", "textwrap 0.11.0", "unicode-width", - "vec_map", ] [[package]] @@ -486,7 +482,7 @@ dependencies = [ "clap_lex", "indexmap", "lazy_static", - "strsim 0.10.0", + "strsim", "termcolor", "textwrap 0.15.0", ] @@ -497,7 +493,7 @@ version = "3.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" dependencies = [ - "heck 0.4.0", + "heck", "proc-macro-error", "proc-macro2", "quote", @@ -1491,15 +1487,6 @@ dependencies = [ "http", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.0" @@ -1693,7 +1680,7 @@ dependencies = [ "iroha_macro", "iroha_p2p", "iroha_permissions_validators", - "iroha_schema_bin", + "iroha_schema_gen", "iroha_telemetry", "iroha_version", "parity-scale-codec", @@ -1770,6 +1757,7 @@ dependencies = [ name = "iroha_client_cli" version = "2.0.0-pre-rc.3" dependencies = [ + "clap 3.1.10", "color-eyre", "dialoguer", "futures", @@ -1777,7 +1765,6 @@ dependencies = [ "iroha_crypto", "iroha_data_model", "serde_json", - "structopt", ] [[package]] @@ -2000,25 +1987,25 @@ dependencies = [ ] [[package]] -name = "iroha_schema_bin" +name = "iroha_schema_derive" version = "2.0.0-pre-rc.3" dependencies = [ - "iroha_core", - "iroha_crypto", - "iroha_data_model", "iroha_schema", - "serde_json", + "proc-macro2", + "quote", + "syn", + "trybuild", ] [[package]] -name = "iroha_schema_derive" +name = "iroha_schema_gen" version = "2.0.0-pre-rc.3" dependencies = [ + "iroha_core", + "iroha_crypto", + "iroha_data_model", "iroha_schema", - "proc-macro2", - "quote", - "syn", - "trybuild", + "serde_json", ] [[package]] @@ -2155,7 +2142,7 @@ dependencies = [ name = "kagami" version = "2.0.0-pre-rc.3" dependencies = [ - "clap 2.34.0", + "clap 3.1.10", "color-eyre", "hex", "iroha", @@ -2163,7 +2150,7 @@ dependencies = [ "iroha_core", "iroha_crypto", "iroha_data_model", - "iroha_schema_bin", + "iroha_schema_gen", "serde_json", ] @@ -2562,7 +2549,7 @@ dependencies = [ "iroha_crypto", "iroha_data_model", "iroha_schema", - "iroha_schema_bin", + "iroha_schema_gen", "iroha_version", "parity-scale-codec", ] @@ -3407,42 +3394,12 @@ dependencies = [ "num-traits", ] -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap 2.34.0", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "subtle" version = "2.4.1" @@ -3950,12 +3907,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - [[package]] name = "unicode-width" version = "0.1.9" @@ -4063,12 +4014,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "vergen" version = "5.1.17" diff --git a/Cargo.toml b/Cargo.toml index 7013bc63c2e..6705c72ea9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ members = [ "p2p", "permissions_validators", "schema", - "schema/bin", + "schema/gen", "schema/derive", "substrate", "telemetry", diff --git a/README.md b/README.md index 1b41d72f32f..51fde0fb649 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Iroha project mainly consists of the following crates: * [`iroha_config`](config), which handles configuration, generating documentation for options and run-time changes * [`iroha_core`](core) — the primary library used by all other crates which includes the peer's endpoint management * [`iroha_crypto`](crypto) — cryptographic aspects of Iroha -* [`iroha_crypto_cli`](crypto_cli), which is used to generate cryptographic keys +* [`kagami`](tools/kagami), which is used to generate cryptographic keys, default genesis, configuration reference, and schema * [`iroha_data_model`](data_model), which defines common data models in Iroha * [`iroha_futures`](futures) — technical crate used for `async` programming * [`iroha_logger`](logger), which uses `tracing` to provide logging facilities diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 919601480e3..53aaba50f8b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -18,7 +18,7 @@ bridge = ["iroha_core/bridge"] dex = ["iroha_core/dex"] telemetry = ["iroha_telemetry", "iroha_core/telemetry"] dev-telemetry = ["iroha_core/dev-telemetry", "iroha_telemetry"] -schema-endpoint = ["iroha_schema_bin"] +schema-endpoint = ["iroha_schema_gen"] test-network = [] [badges] @@ -39,7 +39,7 @@ iroha_version = { version = "=2.0.0-pre-rc.3", path = "../version", features = [ iroha_config = { version = "=2.0.0-pre-rc.3", path = "../config" } iroha_crypto = { version = "=2.0.0-pre-rc.3", path = "../crypto" } iroha_p2p = { version = "=2.0.0-pre-rc.3", path = "../p2p" } -iroha_schema_bin = { version = "=2.0.0-pre-rc.3", path = "../schema/bin", optional = true } +iroha_schema_gen = { version = "=2.0.0-pre-rc.3", path = "../schema/gen", optional = true } eyre = "0.6.5" futures = { version = "0.3.17", default-features = false, features = ["std", "async-await"] } diff --git a/cli/README.md b/cli/README.md index 4850f0a5f2d..fc2152a97b5 100644 --- a/cli/README.md +++ b/cli/README.md @@ -49,12 +49,12 @@ This flag can be combined with the `--features` flag in order to precisely speci ### Generating Keys -We highly recommend that any non-testing deployment generate a new key pair, with the recommended algorithm `Ed25519`. For convenience, you can use the provided [`iroha_crypto_cli`](../crypto_cli/README.md). For example, +We highly recommend that any non-testing deployment generate a new key pair, with the recommended algorithm `Ed25519`. For convenience, you can use the provided [`kagami`](../tools/kagami/README.md). For example, ```bash -cargo run --bin iroha_crypto_cli +cargo run --bin kagami -- crypto ``` should produce @@ -65,13 +65,13 @@ Private key: 0311152fad9308482f51ca2832fdfab18e1c74f36c6adb198e3ef0213fe42fd8bdf Digest function: ed25519 ``` -**NOTE**: to see the command-line options for `iroha_crypto_cli` you must first terminate the arguments passed to `cargo`, so the command for running the `iroha_crypto_cli` binary with JSON formatting is +**NOTE**: to see the command-line options for `kagami` you must first terminate the arguments passed to `cargo`, so the command for running the `kagami` binary with JSON formatting is ```bash -cargo run --bin iroha_crypto_cli -- --json +cargo run --bin kagami -- crypto --json ``` -**NOTE**: The `iroha_crypto_cli` binary can be run without `cargo` using the `/target/release/iroha_crypto_cli` binary. +**NOTE**: The `kagami` binary can be run without `cargo` using the `/target/release/kagami` binary. ### Configuration file diff --git a/cli/src/torii/mod.rs b/cli/src/torii/mod.rs index 28c967324e8..1eb46527774 100644 --- a/cli/src/torii/mod.rs +++ b/cli/src/torii/mod.rs @@ -1,5 +1,6 @@ -//! This module contains incoming requests handling logic of Iroha. -//! `Torii` is used to receive, accept and route incoming instructions, queries and messages. +//! Translates to gateway. Request handling logic of Iroha. `Torii` +//! is used to receive, accept and route incoming instructions, +//! queries and messages. use std::{convert::Infallible, fmt::Debug, net::ToSocketAddrs, sync::Arc}; diff --git a/cli/src/torii/routing.rs b/cli/src/torii/routing.rs index cef25eae20e..9795263de17 100644 --- a/cli/src/torii/routing.rs +++ b/cli/src/torii/routing.rs @@ -153,7 +153,7 @@ async fn handle_health() -> Json { #[iroha_futures::telemetry_future] #[cfg(feature = "schema-endpoint")] async fn handle_schema() -> Json { - reply::json(&iroha_schema_bin::build_schemas()) + reply::json(&iroha_schema_gen::build_schemas()) } #[iroha_futures::telemetry_future] diff --git a/client/tests/integration/roles.rs b/client/tests/integration/roles.rs index 06a9a7f9c3d..12d2409ddd6 100644 --- a/client/tests/integration/roles.rs +++ b/client/tests/integration/roles.rs @@ -127,7 +127,7 @@ fn register_role_with_empty_token_params() -> Result<()> { // test more about whether or not roles actually work. #[test] -fn register_and_grant_metadata_role_to_account() -> Result<()> { +fn register_metadata_role() -> Result<()> { let (_rt, _peer, mut test_client) = ::start_test_with_runtime(); wait_for_genesis_committed(&vec![test_client.clone()], 0); diff --git a/client/tests/integration/unregister_peer.rs b/client/tests/integration/unregister_peer.rs index 6650540355d..18ba7a3c0f8 100644 --- a/client/tests/integration/unregister_peer.rs +++ b/client/tests/integration/unregister_peer.rs @@ -8,8 +8,9 @@ use test_network::*; use super::Configuration; +// Note the test is marked as `unstable`, not the network. #[test] -fn network_stable_after_add_and_after_remove_peer() -> Result<()> { +fn unstable_network_stable_after_add_and_after_remove_peer() -> Result<()> { // Given a network let (rt, network, mut genesis_client, pipeline_time, account_id, asset_definition_id) = init()?; wait_for_genesis_committed(&network.clients(), 0); diff --git a/client_cli/Cargo.toml b/client_cli/Cargo.toml index c7bbc2c5387..25d57faaf7d 100644 --- a/client_cli/Cargo.toml +++ b/client_cli/Cargo.toml @@ -22,7 +22,7 @@ iroha_data_model = { version = "=2.0.0-pre-rc.3", path = "../data_model" } iroha_crypto = { version = "=2.0.0-pre-rc.3", path = "../crypto" } color-eyre = "0.5.11" -structopt = "0.3" +clap = { version = "3.1.10", features = ["derive"] } futures = { version = "0.3.17", default-features = false, features = ["std", "async-await"] } dialoguer = { version = "0.9", default-features = false } serde_json = "1.0" diff --git a/client_cli/src/main.rs b/client_cli/src/main.rs index f73ca055e86..b622dc5afa8 100644 --- a/client_cli/src/main.rs +++ b/client_cli/src/main.rs @@ -9,6 +9,7 @@ use std::{fmt, fs::File, str::FromStr, time::Duration}; +use clap::StructOpt; use color_eyre::{ eyre::{Error, WrapErr}, Result, @@ -17,7 +18,6 @@ use dialoguer::Confirm; use iroha_client::{client::Client, config::Configuration as ClientConfiguration}; use iroha_crypto::prelude::*; use iroha_data_model::prelude::*; -use structopt::StructOpt; /// Metadata wrapper, which can be captured from cli arguments (from user supplied file). #[derive(Debug, Clone)] @@ -60,11 +60,7 @@ impl FromStr for Configuration { /// Iroha CLI Client provides an ability to interact with Iroha Peers Web API without direct network usage. #[derive(StructOpt, Debug)] -#[structopt( - name = "iroha_client_cli", - version = "0.1.0", - author = "Soramitsu Iroha2 team (https://github.com/orgs/soramitsu/teams/iroha2)" -)] +#[structopt(name = "iroha_client_cli", version, author)] pub struct Args { /// Sets a config file path #[structopt(short, long, default_value = "config.json")] @@ -77,14 +73,19 @@ pub struct Args { #[derive(StructOpt, Debug)] pub enum Subcommand { /// The subcommand related to domains + #[clap(subcommand)] Domain(domain::Args), /// The subcommand related to accounts + #[clap(subcommand)] Account(account::Args), /// The subcommand related to assets + #[clap(subcommand)] Asset(asset::Args), /// The subcommand related to p2p networking + #[clap(subcommand)] Peer(peer::Args), /// The subcommand related to event streaming + #[clap(subcommand)] Events(events::Args), } @@ -121,8 +122,7 @@ fn main() -> Result<()> { let Args { config: Configuration(config), subcommand, - } = Args::from_args(); - println!("Iroha Client CLI: build v0.0.1 [release]"); + } = clap::Parser::parse(); println!( "User: {}@{}", config.account_id.name, config.account_id.domain_id @@ -229,11 +229,12 @@ mod domain { use super::*; /// Arguments for domain subcommand - #[derive(Debug, StructOpt)] + #[derive(Debug, clap::Subcommand)] pub enum Args { /// Register domain Register(Register), /// List domains + #[clap(subcommand)] List(List), } @@ -301,8 +302,10 @@ mod account { /// Register account Register(Register), /// Set something in account + #[clap(subcommand)] Set(Set), /// List accounts + #[clap(subcommand)] List(List), } @@ -429,6 +432,7 @@ mod asset { /// Get info of asset Get(Get), /// List assets + #[clap(subcommand)] List(List), } diff --git a/core/src/genesis.rs b/core/src/genesis.rs index 918a8a15bf7..f8bfb5df574 100644 --- a/core/src/genesis.rs +++ b/core/src/genesis.rs @@ -11,8 +11,7 @@ use iroha_crypto::{KeyPair, PublicKey}; use iroha_data_model::{asset::AssetDefinition, prelude::*}; use iroha_schema::prelude::*; use serde::{Deserialize, Serialize}; -use small::SmallVec; -use smallvec::smallvec; +use small::{smallvec, SmallVec}; use tokio::{time, time::Duration}; pub use self::config::GenesisConfiguration; diff --git a/core/src/kura.rs b/core/src/kura.rs index fd527afeb0d..56c3564d51f 100644 --- a/core/src/kura.rs +++ b/core/src/kura.rs @@ -1,5 +1,7 @@ -//! This module contains persistence related Iroha logic. -//! [`Kura`] is the main entity which should be used to store new [`Block`](`crate::block::VersionedCommittedBlock`)s on the blockchain. +//! Translates to warehouse. File-system and persistence-related +//! logic. [`Kura`] is the main entity which should be used to store +//! new [`Block`](`crate::block::VersionedCommittedBlock`)s on the +//! blockchain. use std::{ collections::BTreeSet, diff --git a/core/src/sumeragi/mod.rs b/core/src/sumeragi/mod.rs index d1dc65a6cfb..7f703c5b423 100644 --- a/core/src/sumeragi/mod.rs +++ b/core/src/sumeragi/mod.rs @@ -1,4 +1,4 @@ -//! This module contains consensus related logic of the Iroha. +//! Translates to Emperor. Consensus-related logic of Iroha. //! //! `Consensus` trait is now implemented only by `Sumeragi` for now. diff --git a/docs/source/references/glossary.md b/docs/source/references/glossary.md index b6cb791281f..fdfecd74f62 100644 --- a/docs/source/references/glossary.md +++ b/docs/source/references/glossary.md @@ -62,6 +62,9 @@ Module with the incoming request handling logic for the peer. It is used to rece ### Kura (Warehouse) Persistence-related logic. It handles storing the blocks, log rotation, block storage folder rotation etc. +### Kagami(Teacher) +Generator for commonly used data. Can generate cryptographic key pairs, genesis blocks, documentation etc. + ### Merkle tree (hash tree) A data structure used to validate and verify the state at each block height. Iroha's current implementation is a binary tree. See [Wikipedia](https://en.wikipedia.org/wiki/Merkle_tree) for more details. diff --git a/docs/source/references/keypairs.md b/docs/source/references/keypairs.md index 2c18f4053ba..73797bb1152 100644 --- a/docs/source/references/keypairs.md +++ b/docs/source/references/keypairs.md @@ -5,10 +5,10 @@ Iroha uses Public key cryptography. # TL;DR The easiest way to generate keys for use in Iroha is to use -`iroha_crypto_cli`. +`kagami`. ```bash -cargo run --bin iroha_crypto_cli -- --json +cargo run --bin kagami -- crypto --json ``` Which produces (for example) @@ -47,7 +47,7 @@ The `payload** is the private key itself. The digest_function you can ignore for ### What needs signing. -Let's look at an [example configuration](../../../configs/peer/config.json). A peer has a `PUBLIC_KEY` and a corresponding `PRIVATE_KEY`, which must come from a single pair generated by `iroha_crypto_cli`. Every peer that wants to connect to it from the outside must know its `PRIVATE_KEY` specified in the `TRUSTED_PEERS` section. +Let's look at an [example configuration](../../../configs/peer/config.json). A peer has a `PUBLIC_KEY` and a corresponding `PRIVATE_KEY`, which must come from a single pair generated by `kagami`. Every peer that wants to connect to it from the outside must know its `PRIVATE_KEY` specified in the `TRUSTED_PEERS` section. Now look at [`genesis.json`](../../../configs/peer/genesis.json). We register an account "alice@wonderland", which has a signatory, this is not the genesis account, it's just **an** account with a key, so matching this signature to the genesis account's key is not necessary. You *could*, though and that wouldn't compromise the blockchain's security as the genesis account only has `root` user privileges for the duration of the genesis round. diff --git a/schema/bin/Cargo.toml b/schema/gen/Cargo.toml similarity index 94% rename from schema/bin/Cargo.toml rename to schema/gen/Cargo.toml index d1f327aad1e..6e40c70f135 100644 --- a/schema/bin/Cargo.toml +++ b/schema/gen/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "iroha_schema_bin" +name = "iroha_schema_gen" version = "2.0.0-pre-rc.3" authors = ["Iroha 2 team "] edition = "2021" diff --git a/schema/bin/src/lib.rs b/schema/gen/src/lib.rs similarity index 100% rename from schema/bin/src/lib.rs rename to schema/gen/src/lib.rs diff --git a/scripts/check.sh b/scripts/check.sh index 76acfa5c391..6f9a3b210f5 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -5,15 +5,15 @@ TMPFILE=$(mktemp) case $1 in "docs") - cargo run --bin kagami -- --docs >"$TMPFILE" + cargo run --bin kagami -- docs >"$TMPFILE" diff "$TMPFILE" docs/source/references/config.md || { - echo 'Please re-generate docs with git hook in ./hooks directory' + echo 'Please re-generate docs using `cargo run --bin kagami -- docs`' exit 1 };; "genesis") - cargo run --bin kagami -- --genesis >"$TMPFILE" + cargo run --bin kagami -- genesis >"$TMPFILE" diff "$TMPFILE" configs/peer/genesis.json || { - echo 'Please re-generate the genesis with `cargo run --bin iroha_gen -- --genesis`' + echo 'Please re-generate the genesis with `cargo run --bin kagami -- genesis`' exit 1 };; esac diff --git a/tools/crypto_cli/src/main.rs b/tools/crypto_cli/src/main.rs deleted file mode 100644 index 0c6a4db57d4..00000000000 --- a/tools/crypto_cli/src/main.rs +++ /dev/null @@ -1,110 +0,0 @@ -//! `iroha_crypto_cli` is a command line tool used to generate keys for Iroha peers and clients. - -use clap::{App, Arg, ArgGroup}; -use color_eyre::{ - eyre::{self, eyre, WrapErr}, - Report, Result, -}; -use iroha_crypto::{Algorithm, KeyGenConfiguration, KeyPair, PrivateKey}; - -fn main() -> Result<(), Report> { - color_eyre::install()?; - let default_algorithm = Algorithm::default().to_string(); - let matches = App::new("iroha_crypto_cli") - .version("0.1") - .author("Soramitsu") - .about("iroha_crypto_cli is a command line tool used to generate keys for Iroha peers and clients.") - .arg( - Arg::with_name("seed") - .long("seed") - .value_name("seed") - .help("Sets a seed for random number generator. Should be used separately from `private_key`.") - .required(false) - .takes_value(true) - ) - .arg( - Arg::with_name("private_key") - .long("private_key") - .value_name("private_key") - .help("Sets a private key. Should be used separately from `seed`.") - .required(false) - .takes_value(true) - ) - .arg( - Arg::with_name("algorithm") - .long("algorithm") - .value_name("algorithm") - .help("Function used to generate the key pair.") - .takes_value(true) - .possible_value(&Algorithm::Ed25519.to_string()) - .possible_value(&Algorithm::Secp256k1.to_string()) - .possible_value(&Algorithm::BlsNormal.to_string()) - .possible_value(&Algorithm::BlsSmall.to_string()) - .default_value(&default_algorithm) - ) - .arg( - Arg::with_name("json") - .long("json") - .help("If specified the output will be formatted as json.") - .takes_value(false) - .multiple(false) - ) - .group( - ArgGroup::with_name("key_gen_options") - .args(&["seed", "private_key"]) - .required(false) - .multiple(false) - ) - .get_matches(); - let seed_option = matches.value_of("seed"); - let private_key_option = matches.value_of("private_key"); - let algorithm = matches - .value_of("algorithm") - .ok_or_else(|| eyre!("Failed to get algorithm name."))? - .parse::() - .wrap_err("Failed to parse algorithm.")?; - let key_gen_configuration = KeyGenConfiguration::default().with_algorithm(algorithm); - let keypair: KeyPair = seed_option.map_or_else( - || -> eyre::Result<_> { - private_key_option.map_or_else( - || { - KeyPair::generate_with_configuration(key_gen_configuration.clone()) - .wrap_err("failed to generate key pair") - }, - |private_key| { - KeyPair::generate_with_configuration( - key_gen_configuration.clone().use_private_key( - PrivateKey::from_hex(algorithm, &private_key) - .wrap_err("Failed to decode private key.")?, - ), - ) - .wrap_err("Failed to generate key pair") - }, - ) - }, - |seed| -> eyre::Result<_> { - KeyPair::generate_with_configuration( - key_gen_configuration - .clone() - .use_seed(seed.as_bytes().into()), - ) - .wrap_err("Failed to generate key pair") - }, - )?; - - #[allow(clippy::print_stdout)] - if matches.is_present("json") { - let json = - serde_json::to_string_pretty(&keypair).wrap_err("Failed to serialize to json.")?; - println!("{}", json); - } else { - println!("Public key (multihash): {}", keypair.public_key()); - println!("Private key: {}", keypair.private_key()); - println!( - "Digest function: {}", - keypair.public_key().digest_function() - ); - } - - Ok(()) -} diff --git a/tools/kagami/Cargo.toml b/tools/kagami/Cargo.toml index f0ce913910b..ffd0f513282 100644 --- a/tools/kagami/Cargo.toml +++ b/tools/kagami/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "kagami" +# Translates to teacher. A tool used to generate cryptographic keys, docs, the schema and genesis block. version = "2.0.0-pre-rc.3" authors = ["Iroha 2 team "] edition = "2021" @@ -23,10 +24,10 @@ iroha_core = { version = "=2.0.0-pre-rc.3", path = "../../core" } iroha_crypto = { version = "=2.0.0-pre-rc.3", path = "../../crypto" } iroha_config = { version = "=2.0.0-pre-rc.3", path = "../../config" } iroha_data_model = { version = "=2.0.0-pre-rc.3", path = "../../data_model" } -iroha_schema_bin = { version = "=2.0.0-pre-rc.3", path = "../../schema/bin" } +iroha_schema_gen = { version = "=2.0.0-pre-rc.3", path = "../../schema/gen" } iroha = { path = "../../cli" } color-eyre = "0.5.11" hex = "0.4.0" -clap = "2.33.0" +clap = { version = "3.1.10", features = ["derive"] } serde_json = "1" diff --git a/tools/kagami/README.md b/tools/kagami/README.md index 2b5086c4723..31a687eb83b 100644 --- a/tools/kagami/README.md +++ b/tools/kagami/README.md @@ -1,6 +1,6 @@ -# Kagami +# Kagami (Teacher) -This tool is used to generate and validate the automatically generated data files shipped with Iroha. +Generate and validate the automatically generated data files shipped with Iroha. ### Building @@ -15,37 +15,31 @@ anywhere in this repository. This will place `kagami` inside the `target/debug/` ### Usage ```bash -Kagami 0.1 -Iroha development team. -Generator for data used in Iroha. +kagami 2.0.0-pre-rc.3 +Soramitsu Iroha2 team (https://github.com/orgs/soramitsu/teams/iroha2) +Tool generating the cryptorgraphic key pairs, USAGE: -kagami [FLAGS] [OPTIONS] - -FLAGS: --d, --docs If specified, print configuration docs --g, --genesis If specified, print the Genesis --h, --help Prints help information ---json If specified the output will be formatted as json. --s, --schema If specified, print Schema --V, --version Prints version information +kagami OPTIONS: ---algorithm Function used to generate the key pair. [default: ed25519] [possible values: -ed25519, secp256k1, bls_normal, bls_small] ---private_key Sets a private key. Should be used separately from `seed`. ---seed Sets a seed for random number generator. Should be used separately from -`private_key`. +-h, --help Print help information +-V, --version Print version information + +SUBCOMMANDS: +crypto Generate cryptorgraphic key pairs +docs Generate a Markdown reference of configuration parameters +genesis Generate a default genesis block that is used in tests +help Print this message or the help of the given subcommand(s) +schema Generate schema used for code generation in Iroha SDKs ``` #### Key generation With a few examples. -By default, will generate a key pair. - ```bash -$ ./kagami +$ ./kagami crypto ``` ```bash @@ -59,28 +53,26 @@ Digest function: ed25519 To generate a key pair from a given seed, run ```bash -$ ./kagami --seed +$ ./kagami crypto --seed ``` To generate a key with the `secp256k1` algorithm, which corresponds to the private key `8e170e7abe3cc71afeb2459b2d055641159dca4825e0536234e120ced756fabda2bfcb42761216a95a5bf2574219c602a9e7d410420af8b020c9e9e40ffb3690`, run ```bash -$ ./kagami --algorithm --private-key 8e170e7abe3cc71afeb2459b2d055641159dca4825e0536234e120ced756fabda2bfcb42761216a95a5bf2574219c602a9e7d410420af8b020c9e9e40ffb3690 +$ ./kagami crypto --algorithm secp256k1 --private-key "b32129af69b829a88ab9bac60b2a33cc57f8843e93aae0478e93f2285059c236" ``` ```bash -Kagami. To see help run with `--help`. -No flags specified, generating key-pair. -Public key (multihash): ed0120a2bfcb42761216a95a5bf2574219c602a9e7d410420af8b020c9e9e40ffb3690 -Private key: 8e170e7abe3cc71afeb2459b2d055641159dca4825e0536234e120ced756fabda2bfcb42761216a95a5bf2574219c602a9e7d410420af8b020c9e9e40ffb3690 -Digest function: ed25519 +Public key (multihash): e70121031c59a9cabaf58f3b8a6157362b9f6feac3dd47ee947fbf2f335805e1a7f96bde +Private key: b32129af69b829a88ab9bac60b2a33cc57f8843e93aae0478e93f2285059c236 +Digest function: secp256k1 ``` #### Genesis ```bash -kagami -g +kagami genesis ``` Should produce a genesis block in JSON format. You might want to use shell redirections e.g. `kagami -g >genesis.json`. @@ -88,15 +80,15 @@ Should produce a genesis block in JSON format. You might want to use shell redir #### Schema ```bash -kagami -s +kagami schema ``` Should generate the schema in JSON format. You might want to use shell redirections e.g. `kagami -g >genesis.json`. #### Peer configuration reference -```bash -kagami --docs +```bash +kagami docs ``` Should generate the documentation in Markdown format. Should be identical to the [reference configuration](../../docs/source/references/config.md). diff --git a/tools/kagami/src/main.rs b/tools/kagami/src/main.rs index 1ec31af062b..7313f6f1278 100644 --- a/tools/kagami/src/main.rs +++ b/tools/kagami/src/main.rs @@ -4,182 +4,153 @@ use std::io::{stdout, BufWriter, Write}; -use clap::{App, Arg, ArgGroup}; +use clap::{ArgGroup, StructOpt}; use color_eyre::eyre::WrapErr as _; -use docs::PrintDocs as _; use iroha::config::Configuration; +pub type Outcome = color_eyre::Result<()>; + // The reason for hard-coding this default is to ensure that the // algorithm is matched to the public key. If you need to change // either, you should definitely change both. static DEFAULT_PUBLIC_KEY: &str = "ed01207233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"; -static DEFAULT_ALGORITHM: &str = iroha_crypto::ED_25519; +// static DEFAULT_ALGORITHM: &str = iroha_crypto::ED_25519; -fn main() -> color_eyre::Result<()> { +fn main() -> Outcome { color_eyre::install()?; - let matches = arg_parse(); - let keypair = crypto::key_pair(&matches)?; - let mut output = BufWriter::new(stdout()); - - if matches.is_present("genesis") { - writeln!( - output, - "{}", - serde_json::to_string_pretty(&genesis::generate_default()?)? - )?; - } else if matches.is_present("docs") { - Configuration::get_markdown(&mut BufWriter::new(stdout())) - .wrap_err("Failed to generate documentation")?; - } else if matches.is_present("schema") { - let schemas = iroha_schema_bin::build_schemas(); - writeln!(output, "{}", serde_json::to_string_pretty(&schemas)?)?; - } else if matches.is_present("key") { - #[allow(clippy::print_stdout)] - if matches.is_present("json") { - let json = - serde_json::to_string_pretty(&keypair).wrap_err("Failed to serialize to json.")?; - writeln!(output, "{}", json)?; - } else { - writeln!(output, "Public key (multihash): {}", &keypair.public_key())?; - writeln!(output, "Private key: {}", &keypair.private_key())?; - writeln!( - output, - "Digest function: {}", - &keypair.public_key().digest_function() - )?; + let args: Args = clap::Parser::parse(); + let mut writer = BufWriter::new(stdout()); + args.run(&mut writer) +} + +/// Trait to encapsulate common attributes of the commands and sub-commands. +pub trait RunArgs { + /// Run the given command. + /// + /// # Errors + /// if inner command fails. + fn run(self, writer: &mut BufWriter) -> Outcome; +} + +/// Tool generating the cryptorgraphic key pairs, schema, genesis block and configuration reference. +#[derive(StructOpt, Debug)] +#[structopt(name = "kagami", version, author)] +pub enum Args { + /// Generate cryptorgraphic key pairs + Crypto(crypto::Args), + /// Generate schema used for code generation in Iroha SDKs + Schema(schema::Args), + /// Generate a default genesis block that is used in tests + Genesis(genesis::Args), + /// Generate a Markdown reference of configuration parameters + Docs(docs::Args), +} + +impl RunArgs for Args { + fn run(self, writer: &mut BufWriter) -> Outcome { + use Args::*; + + match self { + Crypto(args) => args.run(writer), + Schema(args) => args.run(writer), + Genesis(args) => args.run(writer), + Docs(args) => args.run(writer), } - } else { - writeln!(output, "No arguments specified, run with `--help`")?; } - Ok(()) } -// TODO: Refactor to use the `StructOpt` syntax just like all other tools. -fn arg_parse() -> clap::ArgMatches<'static> { - let app = App::new("Kagami") - .version("0.1") - .author("Iroha development team.") - .about("Generator for data used in Iroha.") - .arg( - Arg::with_name("seed") - .long("seed") - .value_name("seed") - .help("Sets a seed for random number generator. Should be used separately from `private_key`.") - .required(false) - .takes_value(true) - ) - .arg( - Arg::with_name("private-key") - .long("private-key") - .value_name("private_key") - .help("Sets a private key. Should be used separately from `seed`.") - .required(false) - .takes_value(true) - ) - .arg( - Arg::with_name("algorithm") - .long("algorithm") - .value_name("algorithm") - .help("Function used to generate the key pair.") - .takes_value(true) - .possible_value(iroha_crypto::ED_25519) - .possible_value(iroha_crypto::SECP_256_K1) - .possible_value(iroha_crypto::BLS_NORMAL) - .possible_value(iroha_crypto::BLS_SMALL) - .default_value(DEFAULT_ALGORITHM) - ) - .arg( - Arg::with_name("json") - .long("json") - .help("If specified the output will be formatted as json.") - .takes_value(false) - .multiple(false) - ) - .arg( - Arg::with_name("genesis") - .long("genesis") - .short("g") - .help("If specified, print the Genesis") - .takes_value(false) - .multiple(false) - ) - .arg( - Arg::with_name("schema") - .long("schema") - .short("s") - .help("If specified, print Schema") - .takes_value(false) - .multiple(false) - ) - .arg( - Arg::with_name("docs") - .long("docs") - .short("d") - .help("If specified, print configuration docs") - .takes_value(false) - .multiple(false) - ) - .group( - ArgGroup::with_name("other_gen_options") - .args(&["docs", "schema", "genesis"]) - .required(false) - .multiple(false) - ) - .group( - ArgGroup::with_name("key_gen_options") - .args(&["seed", "private-key"]) - .required(false) - .multiple(false) - ).get_matches(); - app +mod crypto { + use color_eyre::eyre::WrapErr as _; + use iroha_crypto::{Algorithm, KeyGenConfiguration, KeyPair, PrivateKey}; + + use super::*; + + /// Use `Kagami` to generate cryptographic key-pairs. + #[derive(StructOpt, Debug, Clone)] + #[structopt(group = ArgGroup::new("generate_from").required(false))] + pub struct Args { + /// Algorithm used for generating the key-pair + #[clap(default_value_t, long, short)] + algorithm: Algorithm, + /// The `private_key` used to generate the key-pair + #[clap(long, short, group = "generate_from")] + private_key: Option, + /// The `seed` used to generate the key-pair + #[clap(long, short, group = "generate_from")] + seed: Option, + /// Output the key-pair in JSON format + #[clap(long, short)] + json: bool, + } + + impl RunArgs for Args { + fn run(self, writer: &mut BufWriter) -> Outcome { + if self.json { + let output = serde_json::to_string_pretty(&self.key_pair()?) + .wrap_err("Failed to serialise to JSON.")?; + writeln!(writer, "{}", output)?; + } else { + let key_pair = self.key_pair()?; + writeln!(writer, "Public key (multihash): {}", &key_pair.public_key())?; + writeln!(writer, "Private key: {}", &key_pair.private_key())?; + writeln!( + writer, + "Digest function: {}", + &key_pair.public_key().digest_function() + )?; + } + Ok(()) + } + } + + impl Args { + fn key_pair(self) -> color_eyre::Result { + let key_gen_configuration = + KeyGenConfiguration::default().with_algorithm(self.algorithm); + let keypair: KeyPair = self.seed.map_or_else( + || -> color_eyre::Result<_> { + self.private_key.map_or_else( + || { + KeyPair::generate_with_configuration(key_gen_configuration.clone()) + .wrap_err("failed to generate key pair") + }, + |private_key| { + let private_key = PrivateKey::from_hex(self.algorithm, &private_key) + .wrap_err("Failed to decode private key")?; + KeyPair::generate_with_configuration( + key_gen_configuration.clone().use_private_key(private_key), + ) + .wrap_err("Failed to generate key pair") + }, + ) + }, + |seed| -> color_eyre::Result<_> { + KeyPair::generate_with_configuration( + key_gen_configuration + .clone() + .use_seed(seed.as_bytes().into()), + ) + .wrap_err("Failed to generate key pair") + }, + )?; + Ok(keypair) + } + } } -mod crypto { +mod schema { + use super::*; - use color_eyre::eyre::{eyre, WrapErr as _}; - use iroha_crypto::{Algorithm, KeyGenConfiguration, KeyPair, PrivateKey}; + #[derive(StructOpt, Debug, Clone, Copy)] + pub struct Args; - pub fn key_pair(matches: &clap::ArgMatches) -> color_eyre::Result { - let seed_option = matches.value_of("seed"); - let private_key_option = matches.value_of("private-key"); - let algorithm = matches - .value_of("algorithm") - .ok_or_else(|| eyre!("Failed to get algorithm name."))? - .parse::() - .wrap_err("Failed to parse algorithm.")?; - let key_gen_configuration = KeyGenConfiguration::default().with_algorithm(algorithm); - let keypair: KeyPair = seed_option.map_or_else( - || -> color_eyre::Result<_> { - private_key_option.map_or_else( - || { - KeyPair::generate_with_configuration(key_gen_configuration.clone()) - .wrap_err("failed to generate key pair") - }, - |private_key| { - KeyPair::generate_with_configuration( - key_gen_configuration - .clone() - .use_private_key(PrivateKey::from_hex( - algorithm, - &hex::decode(private_key) - .wrap_err("Failed to decode private key")?, - )?), - ) - .wrap_err("Failed to generate key pair") - }, - ) - }, - |seed| -> color_eyre::Result<_> { - KeyPair::generate_with_configuration( - key_gen_configuration - .clone() - .use_seed(seed.as_bytes().into()), - ) - .wrap_err("Failed to generate key pair") - }, - )?; - Ok(keypair) + impl RunArgs for Args { + fn run(self, writer: &mut BufWriter) -> Outcome { + let schemas = iroha_schema_gen::build_schemas(); + writeln!(writer, "{}", serde_json::to_string_pretty(&schemas)?) + .wrap_err("Failed to write schema.") + } } } @@ -189,6 +160,22 @@ mod genesis { tx::{AssetDefinition, MintBox}, }; + use super::*; + + #[derive(StructOpt, Debug, Clone, Copy)] + pub struct Args; + + impl RunArgs for Args { + fn run(self, writer: &mut BufWriter) -> Outcome { + writeln!( + writer, + "{}", + serde_json::to_string_pretty(&generate_default()?)? + ) + .wrap_err("Failed to write.") + } + } + pub fn generate_default() -> color_eyre::Result { let asset_definition = AssetDefinition::quantity("rose#wonderland".parse()?).build(); let mut result = RawGenesisBlockBuilder::new() @@ -213,11 +200,23 @@ mod docs { #![allow(clippy::panic_in_result_fn, clippy::expect_used)] use std::{fmt::Debug, io::Write}; + use color_eyre::eyre::WrapErr as _; use iroha_config::Configurable; use serde_json::Value; + use super::*; + impl + Send + Sync + Default> PrintDocs for C {} + #[derive(StructOpt, Debug, Clone, Copy)] + pub struct Args; + + impl RunArgs for Args { + fn run(self, writer: &mut BufWriter) -> crate::Outcome { + Configuration::get_markdown(writer).wrap_err("Failed to generate documentation") + } + } + pub trait PrintDocs: Configurable + Send + Sync + Default where Self::Error: Debug, diff --git a/tools/kura_inspector/Cargo.toml b/tools/kura_inspector/Cargo.toml index 5b42ce5d2ae..eb96fc6c0a6 100644 --- a/tools/kura_inspector/Cargo.toml +++ b/tools/kura_inspector/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" iroha_core = { path = "../../core" } iroha_config = { path = "../../config" } -clap = { version = "3.1.8", features = ["derive", "cargo"] } +clap = { version = "3.1.10", features = ["derive", "cargo"] } futures-util = "0.3" tokio = { version = "1.6.0", features = ["rt"]} diff --git a/tools/parity_scale_decoder/Cargo.toml b/tools/parity_scale_decoder/Cargo.toml index 4ae5b8002c3..3271bf12cb9 100644 --- a/tools/parity_scale_decoder/Cargo.toml +++ b/tools/parity_scale_decoder/Cargo.toml @@ -15,10 +15,10 @@ iroha_schema = { version = "=2.0.0-pre-rc.3", path = "../../schema"} iroha_core = { version = "=2.0.0-pre-rc.3", path = "../../core"} iroha_crypto = { version = "=2.0.0-pre-rc.3", path = "../../crypto", default-features = false } iroha_version = { version = "=2.0.0-pre-rc.3", path = "../../version", default-features = false } -clap = { version = "3.1.8", features = ["derive", "cargo"] } +clap = { version = "3.1.10", features = ["derive", "cargo"] } eyre = "0.6.8" parity-scale-codec = { version = "2.3.1", default-features = false } colored = "2.0.0" [dev-dependencies] -iroha_schema_bin = { version = "=2.0.0-pre-rc.3", path = "../../schema/bin"} +iroha_schema_gen = { version = "=2.0.0-pre-rc.3", path = "../../schema/gen"} diff --git a/tools/parity_scale_decoder/src/generate_map.rs b/tools/parity_scale_decoder/src/generate_map.rs index 3a4576bf8de..843e7b8b5f9 100644 --- a/tools/parity_scale_decoder/src/generate_map.rs +++ b/tools/parity_scale_decoder/src/generate_map.rs @@ -361,7 +361,7 @@ pub fn generate_map() -> DumpDecodedMap { mod tests { use std::collections::HashSet; - use iroha_schema_bin::build_schemas; + use iroha_schema_gen::build_schemas; use super::*;