hyperledger-archives / iroha

Iroha - A simple, decentralized ledger
http://iroha.tech
Apache License 2.0
988 stars 297 forks source link

Wrong order for params in adding assets #1691

Closed Baptiste-Leterrier closed 5 years ago

Baptiste-Leterrier commented 6 years ago

Testing the adding assets part give this error

[warning] CommandService Stateless invalid tx: 0 AddAssetQuantity: [[Wrongly formed asset_id, passed value: 'admin@test'. Field should match regex '[a-z_0-9]{1,32}\#([a-zA-Z]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?' Amount must be greater than 0, passed value: 0 ]]
, hash: 2985e58d6b2abe1c10515143f868a9b5582fa3484a3625286cb034926daffdbb

This is the "logical order" shown in tutorial:

1. Detach role from account (detach)
2. Add new role to account (apnd_role)
3. Create new role (crt_role)
4. Set account key/value detail (set_acc_kv)
5. Transfer Assets (tran_ast)
6. Grant permission over your account (grant_perm)
7. Subtract Assets Quantity from Account (sub_ast_qty)
8. Set Account Quorum (set_qrm)
9. Remove Signatory (rem_sign)
10. Create Domain (crt_dmn)
11. Revoke permission from account (revoke_perm)
12. Create Account (crt_acc)
13. Add Signatory to Account (add_sign)
14. Create Asset (crt_ast)
15. Add Peer to Iroha Network (add_peer)
16. Add Asset Quantity (add_ast_qty)
0. Back (b)
> : 16
Account Id: admin@test
Asset Id: skc#test
Amount to to add, e.g 123.456: 100
Command is formed. Choose what to do:
1. Add one more command to the transaction (add)
2. Send to Iroha peer (send)
3. Go back and start a new transaction (b)
4. Save as json file (save)
> : 2
Peer address (127.0.0.1): 
Peer port (50051): 
[2018-08-29 08:12:09.453813981][th:33][info] TransactionResponseHandler Transaction successfully sent
Congratulation, your transaction was accepted for processing.
Its hash is 2985e58d6b2abe1c10515143f868a9b5582fa3484a3625286cb034926daffdbb
--------------------

This is the good params order:

Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 1
Forming a new transactions, choose command to add: 
1. Detach role from account (detach)
2. Add new role to account (apnd_role)
3. Create new role (crt_role)
4. Set account key/value detail (set_acc_kv)
5. Transfer Assets (tran_ast)
6. Grant permission over your account (grant_perm)
7. Subtract Assets Quantity from Account (sub_ast_qty)
8. Set Account Quorum (set_qrm)
9. Remove Signatory (rem_sign)
10. Create Domain (crt_dmn)
11. Revoke permission from account (revoke_perm)
12. Create Account (crt_acc)
13. Add Signatory to Account (add_sign)
14. Create Asset (crt_ast)
15. Add Peer to Iroha Network (add_peer)
16. Add Asset Quantity (add_ast_qty)
0. Back (b)
> : 16
Account Id (admin@test): skc#test <------ asset name#domain
Asset Id (skc#test): 100 <----- actual asset quantity
Amount to to add, e.g 123.456 (100): <----- don't know what's used for
Command is formed. Choose what to do:
1. Add one more command to the transaction (add)
2. Send to Iroha peer (send)
3. Go back and start a new transaction (b)
4. Save as json file (save)
> : 2
Peer address (127.0.0.1): 
Peer port (50051): 
[2018-08-29 08:16:35.944531628][th:33][info] TransactionResponseHandler Transaction successfully sent
Congratulation, your transaction was accepted for processing.
Its hash is af8f1ee8573b6ba59ed3d984df57b162ea5813b0b922536eac55bf78fd394b8b
--------------------

Assets is added to current account you are connected with (here admin@test)

kristophor commented 5 years ago

the command only takes 2 parameters, need to add account ID or simply remove account ID from parameter description.

InteractiveTransactionCli::parseAddAssetQuantity(
    std::vector<std::string> params) {
  auto asset_id = params[0];
  auto amount = params[1];
  return generator_.generateAddAssetQuantity(asset_id, amount);
}
kristophor commented 5 years ago

the cli code was updated on Sept 18 but from the Iroha document that git clone -b develop https://github.com/hyperledger/iroha --depth=1 is getting the code from develop branch that doesn't contain this code.

it seems like the code is not merged.

neewy commented 5 years ago

@kristophor we have issues with branches now. They are confusing, as our current development branch is dev. We cannot fix this until holidays are over, as HL IT team is away.

kristophor commented 5 years ago

ok lets update the document to reflect from dev branch instead of develop branch then

LiraLemur commented 5 years ago

ok lets update the document to reflect from dev branch instead of develop branch then

@kristophor Hi! I changed the develop to master in documentation (master is being updated regularly now and there is no issue with it). Please try to use it.

We are moving the issues to Jira now, I'll also move this issue there: https://jira.hyperledger.org/browse/IR-198

And if any questions remain, please contact us in chat: https://chat.hyperledger.org/channel/iroha

Baptiste-Leterrier commented 5 years ago

Glad I could help :D my very first very little contribution !

l4l commented 5 years ago

I guess it now can be closed