Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[suggestion]: Disallow invalid transactions in genesis block #3075

Closed
Erigara opened this issue Jan 23, 2023 · 4 comments
Closed

[suggestion]: Disallow invalid transactions in genesis block #3075

Erigara opened this issue Jan 23, 2023 · 4 comments
Assignees
Labels
Chore This is a small task that can be done at any point in time and is easier than others good first issue Good for newcomers iroha2-dev The re-implementation of a BFT hyperledger in RUST QA-confirmed This bug is reproduced and needs a fix question Further information is requested

Comments

@Erigara
Copy link
Contributor

Erigara commented Jan 23, 2023

          Let me rephrase. If a transaction in a genesis fails we seem to just skip it and log error. Why don't we fail blockchain initialization if there is even one invalid transaction?

Originally posted by @mversic in #3074 (comment)

@Erigara Erigara added question Further information is requested iroha2-dev The re-implementation of a BFT hyperledger in RUST labels Jan 23, 2023
@mversic
Copy link
Contributor

mversic commented Jan 27, 2023

The point here is, why do we tolerate invalid transactions in the genesis block? IMHO genesis block should be rejected entirely if it contains even one invalid transaction.

I would like to hear others opinion on this matter. Can you come up with a reason where it's expected to find invalid transaction in the genesis block?

@mversic mversic added good first issue Good for newcomers Chore This is a small task that can be done at any point in time and is easier than others labels Jan 27, 2023
@Erigara
Copy link
Contributor Author

Erigara commented Jan 30, 2023

I can't find reason for such behavior especially when in almost all cases our genesis block has exactly 1 transaction.

@SamHSmith SamHSmith self-assigned this May 29, 2023
SamHSmith added a commit to SamHSmith/iroha that referenced this issue May 29, 2023
SamHSmith added a commit to SamHSmith/iroha that referenced this issue May 29, 2023
SamHSmith added a commit to SamHSmith/iroha that referenced this issue May 29, 2023
Signed-off-by: Sam H. Smith <sam.henning.smith@protonmail.com>
SamHSmith added a commit that referenced this issue May 29, 2023
Signed-off-by: Sam H. Smith <sam.henning.smith@protonmail.com>
@Erigara Erigara reopened this May 30, 2023
@timofeevmd timofeevmd added the QA-confirmed This bug is reproduced and needs a fix label Jun 1, 2023
@timofeevmd
Copy link
Contributor

Done

image.png

appetrosyan pushed a commit that referenced this issue Jun 5, 2023
Signed-off-by: Sam H. Smith <sam.henning.smith@protonmail.com>
@appetrosyan appetrosyan reopened this Jun 5, 2023
@Erigara
Copy link
Contributor Author

Erigara commented Jun 5, 2023

I think we can close this since it was verified by @timofeevmd.

@Erigara Erigara closed this as completed Jun 5, 2023
mversic pushed a commit that referenced this issue Oct 17, 2023
Signed-off-by: Sam H. Smith <sam.henning.smith@protonmail.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Dec 13, 2023
- `iroha`: use `clap` `v4`
- `iroha`: update CLI (`--config`, `--terminal-colors`)
- `iroha`: handle user-provided config file strictly
- `iroha`: parse ENV config after file config
- `iroha_config`: add `genesis.file`, remove `account_*` prefix
- `iroha_config`: move some genesis config validation logic
  from `iroha`
- `iroha_client_cli`: upgrade `clap` to `v4`
- `iroha_genesis`: remove side effects (bail, logs)
- `iroha_genesis`: clarify validation logic (hyperledger-iroha#3075)
- `iroha_genesis`: remove `pub` to guard invariant of `GenesisNetwork`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Dec 15, 2023
- `iroha`: use `clap` `v4`
- `iroha`: update CLI (`--config`, `--terminal-colors`)
- `iroha`: handle user-provided config file strictly
- `iroha`: parse ENV config after file config
- `iroha_config`: add `genesis.file`, remove `account_*` prefix
- `iroha_config`: move some genesis config validation logic
  from `iroha`
- `iroha_client_cli`: upgrade `clap` to `v4`
- `iroha_genesis`: remove side effects (bail, logs)
- `iroha_genesis`: clarify validation logic (hyperledger-iroha#3075)
- `iroha_genesis`: remove `pub` to guard invariant of `GenesisNetwork`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Dec 17, 2023
- `iroha`: use `clap` `v4`
- `iroha`: update CLI (`--config`, `--terminal-colors`)
- `iroha`: handle user-provided config file strictly
- `iroha`: parse ENV config after file config
- `iroha_config`: add `genesis.file`, remove `account_*` prefix
- `iroha_config`: move some genesis config validation logic
  from `iroha`
- `iroha_client_cli`: upgrade `clap` to `v4`
- `iroha_genesis`: remove side effects (bail, logs)
- `iroha_genesis`: clarify validation logic (hyperledger-iroha#3075)
- `iroha_genesis`: remove `pub` to guard invariant of `GenesisNetwork`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
0x009922 added a commit to 0x009922/iroha that referenced this issue Dec 22, 2023
- `iroha`: use `clap` `v4`
- `iroha`: update CLI (`--config`, `--terminal-colors`)
- `iroha`: handle user-provided config file strictly
- `iroha`: parse ENV config after file config
- `iroha_config`: add `genesis.file`, remove `account_*` prefix
- `iroha_config`: move some genesis config validation logic
  from `iroha`
- `iroha_client_cli`: upgrade `clap` to `v4`
- `iroha_genesis`: remove side effects (bail, logs)
- `iroha_genesis`: clarify validation logic (hyperledger-iroha#3075)
- `iroha_genesis`: remove `pub` to guard invariant of `GenesisNetwork`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
0x009922 added a commit that referenced this issue Dec 22, 2023
* [refactor]: refactor cli(s)

- `iroha`: use `clap` `v4`
- `iroha`: update CLI (`--config`, `--terminal-colors`)
- `iroha`: handle user-provided config file strictly
- `iroha`: parse ENV config after file config
- `iroha_config`: add `genesis.file`, remove `account_*` prefix
- `iroha_config`: move some genesis config validation logic
  from `iroha`
- `iroha_client_cli`: upgrade `clap` to `v4`
- `iroha_genesis`: remove side effects (bail, logs)
- `iroha_genesis`: clarify validation logic (#3075)
- `iroha_genesis`: remove `pub` to guard invariant of `GenesisNetwork`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: chore

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: fix & test config

- `iroha_config`: use `PathBuf` when appropriate
- `iroha_config`: fix `Path` behaviour
- `iroha_config`: finally, make `disable_panic_terminal_colors`
  truly optional (#3506)
- `iroha`: resolve all relative paths in config file
- `iroha`: improve config error messages
- `iroha`: add config integration tests

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: test & refactor

- `iroha_client_cli`: adopt `--config` from `iroha`
- `iroha_client_cli`: refactor `--metadata` arg
- `iroha`: extend tests
- update test code overall

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: clippy, tests

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: use `serde_as_str` for paths

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: re-generate peer config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: update `test_env.py`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: remove deprecated option from test config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update README

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: remove obsolete comment

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: update `iroha_swarm`

Now it relies on that `genesis.file` is set in the config file

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: `kagami config peer` + `--genesis-file-in-config`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: chores

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* [feat]: use `PATH` as value name

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: align `StatusFailure` message

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: adopt suggestion in `iroha_client_cli`

#4153 (comment)
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [build]: exclude `genesis.file` from default config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: refine genesis config parse error

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: fix & refactor `test_env.py`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: fix CANNOT_BE_EMPTY message

It is updated with a new version of clap

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: return `disable_panic_terminal_colors: null` to test config

It is needed so that only `iroha_test_config.json` without
defaults layer is valid (will fix on config refactoring)

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: handle configuration properly in `iroha_swarm`

- set `GENESIS_FILE` in env, since `config.json` doesn't have it
- strictly specify `config.json` and `genesis.json` files

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* Update client_cli/src/main.rs

Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* [refactor]: eliminate extra `iroha_config` dependency

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove dead code

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: use `serde_json::json!`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove `disable_panic_terminal_colors` parameter

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: update genesis & its testing

- remove `cfg(test)` behaviour from `GenesisNetwork::new()`
- refactor `impl TestGenesis for Genesis`
  - remove extra `bool` + `Option` invariant
  - allow creating genesis with additional ISIs
- remove `test-utils` feature & `GenesisNetwork::transactions_mut()`
- update related tests
- update error message on signing failure

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove extension check from `Path::default()`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update genesis topology messages

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `Popen`'s `env` instead of global `os.environ`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: typo

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `Partial`/`Full` terminology

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: inherit env from OS

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: link issue #4161

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: format

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: apply lints

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: panic on default path extension

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: update err message

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update docs of `read_config`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

---------

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>
Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Asem-Abdelhady pushed a commit to Asem-Abdelhady/iroha that referenced this issue Jan 9, 2024
…r-iroha#4136: refactor CLIs (hyperledger-iroha#4153)

* [refactor]: refactor cli(s)

- `iroha`: use `clap` `v4`
- `iroha`: update CLI (`--config`, `--terminal-colors`)
- `iroha`: handle user-provided config file strictly
- `iroha`: parse ENV config after file config
- `iroha_config`: add `genesis.file`, remove `account_*` prefix
- `iroha_config`: move some genesis config validation logic
  from `iroha`
- `iroha_client_cli`: upgrade `clap` to `v4`
- `iroha_genesis`: remove side effects (bail, logs)
- `iroha_genesis`: clarify validation logic (hyperledger-iroha#3075)
- `iroha_genesis`: remove `pub` to guard invariant of `GenesisNetwork`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: chore

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: fix & test config

- `iroha_config`: use `PathBuf` when appropriate
- `iroha_config`: fix `Path` behaviour
- `iroha_config`: finally, make `disable_panic_terminal_colors`
  truly optional (hyperledger-iroha#3506)
- `iroha`: resolve all relative paths in config file
- `iroha`: improve config error messages
- `iroha`: add config integration tests

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: test & refactor

- `iroha_client_cli`: adopt `--config` from `iroha`
- `iroha_client_cli`: refactor `--metadata` arg
- `iroha`: extend tests
- update test code overall

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: clippy, tests

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: use `serde_as_str` for paths

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: re-generate peer config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: update `test_env.py`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: remove deprecated option from test config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update README

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: remove obsolete comment

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: update `iroha_swarm`

Now it relies on that `genesis.file` is set in the config file

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: `kagami config peer` + `--genesis-file-in-config`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: chores

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* [feat]: use `PATH` as value name

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: align `StatusFailure` message

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: adopt suggestion in `iroha_client_cli`

hyperledger-iroha#4153 (comment)
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [build]: exclude `genesis.file` from default config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: refine genesis config parse error

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: fix & refactor `test_env.py`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: fix CANNOT_BE_EMPTY message

It is updated with a new version of clap

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: return `disable_panic_terminal_colors: null` to test config

It is needed so that only `iroha_test_config.json` without
defaults layer is valid (will fix on config refactoring)

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: handle configuration properly in `iroha_swarm`

- set `GENESIS_FILE` in env, since `config.json` doesn't have it
- strictly specify `config.json` and `genesis.json` files

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* Update client_cli/src/main.rs

Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* [refactor]: eliminate extra `iroha_config` dependency

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove dead code

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: use `serde_json::json!`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove `disable_panic_terminal_colors` parameter

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: update genesis & its testing

- remove `cfg(test)` behaviour from `GenesisNetwork::new()`
- refactor `impl TestGenesis for Genesis`
  - remove extra `bool` + `Option` invariant
  - allow creating genesis with additional ISIs
- remove `test-utils` feature & `GenesisNetwork::transactions_mut()`
- update related tests
- update error message on signing failure

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove extension check from `Path::default()`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update genesis topology messages

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `Popen`'s `env` instead of global `os.environ`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: typo

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `Partial`/`Full` terminology

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: inherit env from OS

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: link issue hyperledger-iroha#4161

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: format

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: apply lints

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: panic on default path extension

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: update err message

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update docs of `read_config`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

---------

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>
Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Asem-Abdelhady pushed a commit to Asem-Abdelhady/iroha that referenced this issue Jan 22, 2024
…r-iroha#4136: refactor CLIs (hyperledger-iroha#4153)

* [refactor]: refactor cli(s)

- `iroha`: use `clap` `v4`
- `iroha`: update CLI (`--config`, `--terminal-colors`)
- `iroha`: handle user-provided config file strictly
- `iroha`: parse ENV config after file config
- `iroha_config`: add `genesis.file`, remove `account_*` prefix
- `iroha_config`: move some genesis config validation logic
  from `iroha`
- `iroha_client_cli`: upgrade `clap` to `v4`
- `iroha_genesis`: remove side effects (bail, logs)
- `iroha_genesis`: clarify validation logic (hyperledger-iroha#3075)
- `iroha_genesis`: remove `pub` to guard invariant of `GenesisNetwork`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: chore

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: fix & test config

- `iroha_config`: use `PathBuf` when appropriate
- `iroha_config`: fix `Path` behaviour
- `iroha_config`: finally, make `disable_panic_terminal_colors`
  truly optional (hyperledger-iroha#3506)
- `iroha`: resolve all relative paths in config file
- `iroha`: improve config error messages
- `iroha`: add config integration tests

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: test & refactor

- `iroha_client_cli`: adopt `--config` from `iroha`
- `iroha_client_cli`: refactor `--metadata` arg
- `iroha`: extend tests
- update test code overall

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: clippy, tests

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: use `serde_as_str` for paths

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: re-generate peer config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: update `test_env.py`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: remove deprecated option from test config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update README

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: remove obsolete comment

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: update `iroha_swarm`

Now it relies on that `genesis.file` is set in the config file

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: `kagami config peer` + `--genesis-file-in-config`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: chores

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* [feat]: use `PATH` as value name

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: align `StatusFailure` message

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: adopt suggestion in `iroha_client_cli`

hyperledger-iroha#4153 (comment)
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [build]: exclude `genesis.file` from default config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: refine genesis config parse error

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: fix & refactor `test_env.py`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: fix CANNOT_BE_EMPTY message

It is updated with a new version of clap

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: return `disable_panic_terminal_colors: null` to test config

It is needed so that only `iroha_test_config.json` without
defaults layer is valid (will fix on config refactoring)

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: handle configuration properly in `iroha_swarm`

- set `GENESIS_FILE` in env, since `config.json` doesn't have it
- strictly specify `config.json` and `genesis.json` files

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* Update client_cli/src/main.rs

Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* [refactor]: eliminate extra `iroha_config` dependency

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove dead code

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: use `serde_json::json!`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove `disable_panic_terminal_colors` parameter

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: update genesis & its testing

- remove `cfg(test)` behaviour from `GenesisNetwork::new()`
- refactor `impl TestGenesis for Genesis`
  - remove extra `bool` + `Option` invariant
  - allow creating genesis with additional ISIs
- remove `test-utils` feature & `GenesisNetwork::transactions_mut()`
- update related tests
- update error message on signing failure

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove extension check from `Path::default()`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update genesis topology messages

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `Popen`'s `env` instead of global `os.environ`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: typo

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `Partial`/`Full` terminology

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: inherit env from OS

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: link issue hyperledger-iroha#4161

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: format

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: apply lints

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: panic on default path extension

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: update err message

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update docs of `read_config`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

---------

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>
Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: Asem-Abdelhady <asemshawkey@gmail.com>
Asem-Abdelhady pushed a commit to Asem-Abdelhady/iroha that referenced this issue Feb 9, 2024
…r-iroha#4136: refactor CLIs (hyperledger-iroha#4153)

* [refactor]: refactor cli(s)

- `iroha`: use `clap` `v4`
- `iroha`: update CLI (`--config`, `--terminal-colors`)
- `iroha`: handle user-provided config file strictly
- `iroha`: parse ENV config after file config
- `iroha_config`: add `genesis.file`, remove `account_*` prefix
- `iroha_config`: move some genesis config validation logic
  from `iroha`
- `iroha_client_cli`: upgrade `clap` to `v4`
- `iroha_genesis`: remove side effects (bail, logs)
- `iroha_genesis`: clarify validation logic (hyperledger-iroha#3075)
- `iroha_genesis`: remove `pub` to guard invariant of `GenesisNetwork`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: chore

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: fix & test config

- `iroha_config`: use `PathBuf` when appropriate
- `iroha_config`: fix `Path` behaviour
- `iroha_config`: finally, make `disable_panic_terminal_colors`
  truly optional (hyperledger-iroha#3506)
- `iroha`: resolve all relative paths in config file
- `iroha`: improve config error messages
- `iroha`: add config integration tests

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: test & refactor

- `iroha_client_cli`: adopt `--config` from `iroha`
- `iroha_client_cli`: refactor `--metadata` arg
- `iroha`: extend tests
- update test code overall

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: clippy, tests

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: use `serde_as_str` for paths

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: re-generate peer config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: update `test_env.py`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: remove deprecated option from test config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update README

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: remove obsolete comment

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: update `iroha_swarm`

Now it relies on that `genesis.file` is set in the config file

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: `kagami config peer` + `--genesis-file-in-config`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: chores

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* [feat]: use `PATH` as value name

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: align `StatusFailure` message

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: adopt suggestion in `iroha_client_cli`

hyperledger-iroha#4153 (comment)
Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [build]: exclude `genesis.file` from default config

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: refine genesis config parse error

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: fix & refactor `test_env.py`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: fix CANNOT_BE_EMPTY message

It is updated with a new version of clap

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: return `disable_panic_terminal_colors: null` to test config

It is needed so that only `iroha_test_config.json` without
defaults layer is valid (will fix on config refactoring)

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: handle configuration properly in `iroha_swarm`

- set `GENESIS_FILE` in env, since `config.json` doesn't have it
- strictly specify `config.json` and `genesis.json` files

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* Update client_cli/src/main.rs

Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>

* [refactor]: eliminate extra `iroha_config` dependency

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove dead code

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: use `serde_json::json!`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove `disable_panic_terminal_colors` parameter

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: update genesis & its testing

- remove `cfg(test)` behaviour from `GenesisNetwork::new()`
- refactor `impl TestGenesis for Genesis`
  - remove extra `bool` + `Option` invariant
  - allow creating genesis with additional ISIs
- remove `test-utils` feature & `GenesisNetwork::transactions_mut()`
- update related tests
- update error message on signing failure

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: remove extension check from `Path::default()`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update genesis topology messages

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `Popen`'s `env` instead of global `os.environ`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: typo

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `Partial`/`Full` terminology

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: inherit env from OS

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: link issue hyperledger-iroha#4161

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: format

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: apply lints

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [feat]: panic on default path extension

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [test]: update err message

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [docs]: update docs of `read_config`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

---------

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com>
Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chore This is a small task that can be done at any point in time and is easier than others good first issue Good for newcomers iroha2-dev The re-implementation of a BFT hyperledger in RUST QA-confirmed This bug is reproduced and needs a fix question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants