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

[feature] #2899: Add multi-instructions subcommand into client_cli #2918

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

pesterev
Copy link
Contributor

@pesterev pesterev commented Oct 27, 2022

Signed-off-by: Vladimir Pesterev pesterev@pm.me

Description of the Change

More details about the suggestion you can find here.

I spent some time trying to reuse GenesisTransactions format (configs/peer/genesis.json) but it's a bad way cause demand depends on iroha_core and a lot of boilerplate code being converted. But I noticed that we can just use Serialize/Deserialize which already implemented for Instructions and use those traits to represent instructions as JSON. As a result, I got a way to make a more convenient and simple implementation of this command.

Issue

Closes #2899

Benefits

Submit multiple instructions using one command

Possible Drawbacks

None

Usage Examples or Tests

Save these instructions into a file:

[
    {
        "Register": {
            "Identifiable": {
                "NewDomain": {
                    "id": "neverland",
                    "logo": null,
                    "metadata": {}
                }
            }
        }
    },
    {
        "Register": {
            "Identifiable": {
                "NewAccount": {
                    "id": "steve@neverland",
                    "signatories": [
                        "ed0120cc25624d62896d3a0bfd8940f928dc2abf27cc57cefeb442aa96d9081aae58a1"
                    ],
                    "metadata": {}
                }
            }
        }
    },
    {
        "Register": {
            "Identifiable": {
                "NewAssetDefinition": {
                    "id": "sapporo#neverland",
                    "value_type": "Quantity",
                    "mintable": "Infinitely",
                    "metadata": {}
                }
            }
        }
    },
    {
        "Mint": {
            "object": {
                "U32": 1010
            },
            "destination_id": {
                "Id": {
                    "AssetId": "sapporo##steve@neverland"
                }
            }
        }
    }
]

And then pass to client_cli like this:

cat ./test.json | ./iroha_client_cli json

@github-actions github-actions bot added the iroha2-dev The re-implementation of a BFT hyperledger in RUST label Oct 27, 2022
@pesterev pesterev force-pushed the multi-instr-json branch 2 times, most recently from 5e8bcd3 to c678b36 Compare October 27, 2022 08:25
@pesterev pesterev changed the title [feature] #2899: Add multi-instructions subcommand into [feature] #2899: Add multi-instructions subcommand into client_cli Oct 27, 2022
@codecov
Copy link

codecov bot commented Oct 27, 2022

Codecov Report

Merging #2918 (c678b36) into iroha2-dev (a16d9c3) will decrease coverage by 5.43%.
The diff coverage is 70.18%.

❗ Current head c678b36 differs from pull request most recent head 5591db0. Consider uploading reports for the commit 5591db0 to get more accurate results

@@              Coverage Diff               @@
##           iroha2-dev    #2918      +/-   ##
==============================================
- Coverage       67.61%   62.18%   -5.44%     
==============================================
  Files             140      168      +28     
  Lines           26173    29958    +3785     
==============================================
+ Hits            17696    18628     +932     
- Misses           8477    11330    +2853     
Impacted Files Coverage Δ
actor/src/actor_id.rs 90.00% <ø> (ø)
actor/src/deadlock.rs 85.93% <ø> (-14.07%) ⬇️
cli/derive/src/lib.rs 92.30% <ø> (+17.58%) ⬆️
cli/src/event.rs 0.00% <0.00%> (-41.87%) ⬇️
cli/src/main.rs 1.09% <0.00%> (-0.26%) ⬇️
cli/src/stream.rs 0.00% <ø> (-81.40%) ⬇️
client/src/http.rs 51.16% <0.00%> (+3.33%) ⬆️
client/src/http_default.rs 40.17% <0.00%> (-20.01%) ⬇️
client_cli/src/main.rs 0.25% <0.00%> (-0.01%) ⬇️
config/base/src/runtime_upgrades.rs 49.42% <0.00%> (ø)
... and 224 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

appetrosyan
appetrosyan previously approved these changes Oct 27, 2022
@appetrosyan
Copy link
Contributor

Short and sweet. Excellent.

Erigara
Erigara previously approved these changes Oct 28, 2022
Copy link
Contributor

@Erigara Erigara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Probably need to update docs too.

…nto 'client_cli'

Signed-off-by: Vladimir Pesterev <pesterev@pm.me>
@appetrosyan appetrosyan merged commit afdc4a3 into hyperledger-iroha:iroha2-dev Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants