diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe3aae27cbd..96305a00448 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -277,7 +277,7 @@ It can be done by running: ```bash # compile executor without optimizations -cargo run --bin iroha_wasm_builder -- build ./path/to/executor --outfile executor.wasm +cargo run --bin iroha_wasm_builder -- build ./path/to/executor --out-file executor.wasm ``` With profiling feature enabled Iroha exposes endpoint to scrap pprof profiles: diff --git a/configs/swarm/executor.wasm b/configs/swarm/executor.wasm index fc5dd07b00c..c8a5c495cc6 100644 Binary files a/configs/swarm/executor.wasm and b/configs/swarm/executor.wasm differ diff --git a/default_executor/README.md b/default_executor/README.md index f14d1a887ad..45cff2f9d1d 100644 --- a/default_executor/README.md +++ b/default_executor/README.md @@ -4,5 +4,5 @@ Use the [Wasm Builder CLI](../tools/wasm_builder_cli) in order to build it: ```bash cargo run --bin iroha_wasm_builder -- \ - build ./default_executor --optimize --outfile ./configs/swarm/executor.wasm + build ./default_executor --optimize --out-file ./configs/swarm/executor.wasm ``` diff --git a/hooks/pre-commit.sample b/hooks/pre-commit.sample index a289118545b..9eb03157928 100755 --- a/hooks/pre-commit.sample +++ b/hooks/pre-commit.sample @@ -10,15 +10,15 @@ cd ./client/tests/integration/smartcontracts cargo fmt --all -- --check cd - # update the default executor -cargo run --release --bin iroha_wasm_builder -- build ./default_executor --optimize --outfile ./configs/swarm/executor.wasm +cargo run --release --bin iroha_wasm_builder -- build ./default_executor --optimize --out-file ./configs/swarm/executor.wasm # update the default genesis, assuming the transaction authority is `test_samples::SAMPLE_GENESIS_ACCOUNT_ID` cargo run --release --bin kagami -- genesis --executor-path-in-genesis ./executor.wasm --genesis-public-key ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 > ./configs/swarm/genesis.json # update schema cargo run --release --bin kagami -- schema > ./docs/source/references/schema.json # update docker compose files -cargo run --release --bin iroha_swarm -- -p 1 -s Iroha --force --config-dir ./configs/swarm --health-check --build . --outfile ./configs/swarm/docker-compose.single.yml -cargo run --release --bin iroha_swarm -- -p 4 -s Iroha --force --config-dir ./configs/swarm --health-check --build . --outfile ./configs/swarm/docker-compose.local.yml -cargo run --release --bin iroha_swarm -- -p 4 -s Iroha --force --config-dir ./configs/swarm --health-check --image hyperledger/iroha2:dev --outfile ./configs/swarm/docker-compose.yml +cargo run --release --bin iroha_swarm -- -p 1 -s Iroha --force --config-dir ./configs/swarm --health-check --build . --out-file ./configs/swarm/docker-compose.single.yml +cargo run --release --bin iroha_swarm -- -p 4 -s Iroha --force --config-dir ./configs/swarm --health-check --build . --out-file ./configs/swarm/docker-compose.local.yml +cargo run --release --bin iroha_swarm -- -p 4 -s Iroha --force --config-dir ./configs/swarm --health-check --image hyperledger/iroha2:dev --out-file ./configs/swarm/docker-compose.yml # lints cargo lints clippy --workspace --benches --tests --examples --all-features # stage updates diff --git a/scripts/generate_wasm.sh b/scripts/generate_wasm.sh index b6b3aca0d69..d91f9a3ca8a 100755 --- a/scripts/generate_wasm.sh +++ b/scripts/generate_wasm.sh @@ -20,7 +20,7 @@ for folder in "$SOURCE_DIR"/*; do folder_name=$(basename "$folder") target_wasm_file_path="${TARGET_DIR}/${folder_name}.wasm" # Build the smart contracts - cargo run --bin iroha_wasm_builder -- build "$folder" --optimize --outfile "$target_wasm_file_path" + cargo run --bin iroha_wasm_builder -- build "$folder" --optimize --out-file "$target_wasm_file_path" fi done diff --git a/scripts/tests/consistency.sh b/scripts/tests/consistency.sh index 3160ba0240f..b2924b206b1 100755 --- a/scripts/tests/consistency.sh +++ b/scripts/tests/consistency.sh @@ -21,11 +21,11 @@ case $1 in # it is not a default behaviour because Kagami resolves `build` path relative # to the output file location temp_file="configs/swarm/docker-compose.TMP.yml" - full_cmd="$cmd_base --outfile $temp_file" + full_cmd="$cmd_base --out-file $temp_file" eval "$full_cmd" diff "$temp_file" "$target" || { - echo "Please re-generate \`$target\` with \`$cmd_base --outfile $target\`" + echo "Please re-generate \`$target\` with \`$cmd_base --out-file $target\`" exit 1 } } diff --git a/tools/swarm/README.md b/tools/swarm/README.md index d0bf02a9ea8..987d9b38bd7 100644 --- a/tools/swarm/README.md +++ b/tools/swarm/README.md @@ -10,14 +10,14 @@ iroha_swarm **Options:** -- **`--outfile `** (required): specify the output file name, e.g. `./docker-compose.yml`. If the file exists, the prompt appears (might be disabled with `--force` option). -- **`--config-dir `** (required): specify the path to the directory containing `config.json` and `genesis.json`. The path to the config will be written into the file specified by `--outfile` relative to its location. +- **`--out-file `** (required): specify the output file name, e.g. `./docker-compose.yml`. If the file exists, the prompt appears (might be disabled with `--force` option). +- **`--config-dir `** (required): specify the path to the directory containing `config.json` and `genesis.json`. The path to the config will be written into the file specified by `--out-file` relative to its location. - **Image source** (required): - **`--image `**: specify image name, like `hyperledger/iroha2:dev` - **`--build `**: specify path to the Iroha repo - **`--peers ` (`-p`)** (required): amount of peers to generate - **`--seed ` (`-s`)** (optional): specify a string to use as a cryptographic seed for keys generation. Allows to generate compose configurations deterministically. UTF-8 bytes of the string will be used. -- **`--force`** (optional): override file specified with `--outfile` if it exists +- **`--force`** (optional): override file specified with `--out-file` if it exists ## Examples @@ -29,7 +29,7 @@ iroha_swarm \ --peers 5 \ --seed iroha \ --config-dir ./peer_config \ - --outfile docker-compose.dev.yml + --out-file docker-compose.dev.yml ``` Same, but using an existing Docker image instead: @@ -40,5 +40,5 @@ iroha_swarm \ --peers 5 \ --seed iroha \ --config-dir ./peer_config \ - --outfile docker-compose.dev.yml + --out-file docker-compose.dev.yml ``` diff --git a/tools/swarm/src/cli.rs b/tools/swarm/src/cli.rs index 42bdbb30675..88dc0c973a1 100644 --- a/tools/swarm/src/cli.rs +++ b/tools/swarm/src/cli.rs @@ -27,7 +27,7 @@ pub struct Cli { /// interactive, the app will stop execution with a non-zero exit code. In order to /// overwrite the file anyway, pass `--force` flag. #[arg(long, short)] - pub outfile: PathBuf, + pub out_file: PathBuf, /// Disable banner in the file saying that the file is generated. /// /// It includes all passed arguments in order to help with reproducibility. @@ -115,17 +115,17 @@ mod tests { #[test] fn work_with_build_source() { - let _ = match_args("-p 20 --build . --config-dir ./config --outfile sample.yml").unwrap(); + let _ = match_args("-p 20 --build . --config-dir ./config --out-file sample.yml").unwrap(); } #[test] fn doesnt_allow_multiple_sources() { - let _ = match_args("-p 1 --build . --image hp/irohad --config-dir ./ --outfile test.yml") + let _ = match_args("-p 1 --build . --image hp/irohad --config-dir ./ --out-file test.yml") .unwrap_err(); } #[test] fn doesnt_allow_omitting_source() { - let _ = match_args("-p 1 --outfile test.yml --config-dir ./").unwrap_err(); + let _ = match_args("-p 1 --out-file test.yml --config-dir ./").unwrap_err(); } } diff --git a/tools/swarm/src/main.rs b/tools/swarm/src/main.rs index 5616b626c63..3b0aa390a77 100644 --- a/tools/swarm/src/main.rs +++ b/tools/swarm/src/main.rs @@ -21,7 +21,7 @@ fn main() -> Result<()> { force, no_banner, source: image_source, - outfile: target_file_raw, + out_file: target_file_raw, config_dir: config_dir_raw, health_check, } = Cli::parse(); diff --git a/tools/wasm_builder_cli/README.md b/tools/wasm_builder_cli/README.md index 9d22356f075..cef8a10db00 100644 --- a/tools/wasm_builder_cli/README.md +++ b/tools/wasm_builder_cli/README.md @@ -13,11 +13,11 @@ iroha_wasm_builder check path/to/project **Build the smartcontract:** ```bash -iroha_wasm_builder build path/to/project --outfile ./smartcontract.wasm +iroha_wasm_builder build path/to/project --out-file ./smartcontract.wasm ``` **Build with options:** ```bash -iroha_wasm_builder build path/to/project --optimize --format --outfile ./smartcontract.wasm +iroha_wasm_builder build path/to/project --optimize --format --out-file ./smartcontract.wasm ``` diff --git a/tools/wasm_builder_cli/src/main.rs b/tools/wasm_builder_cli/src/main.rs index 8af017bf2cd..e5004888ccb 100644 --- a/tools/wasm_builder_cli/src/main.rs +++ b/tools/wasm_builder_cli/src/main.rs @@ -24,7 +24,7 @@ enum Cli { optimize: bool, /// Where to store the output WASM. If the file exists, it will be overwritten. #[arg(long)] - outfile: PathBuf, + out_file: PathBuf, }, } @@ -45,7 +45,7 @@ fn main() -> color_eyre::Result<()> { Cli::Build { common: CommonArgs { path }, optimize, - outfile, + out_file, } => { let builder = Builder::new(&path).show_output(); @@ -80,16 +80,16 @@ fn main() -> color_eyre::Result<()> { output }; - std::fs::copy(output.wasm_file_path(), &outfile).wrap_err_with(|| { + std::fs::copy(output.wasm_file_path(), &out_file).wrap_err_with(|| { eyre!( "Failed to write the resulting file into {}", - outfile.display() + out_file.display() ) })?; println!( "✓ File is written into {}", - outfile.display().green().bold() + out_file.display().green().bold() ); } }