Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Create Account fails with "Attempted to access the value of an uninitialized optional object" #1955

Closed
hantuzun opened this issue Dec 16, 2018 · 2 comments
Labels
cli command line interface

Comments

@hantuzun
Copy link

I've successfully followed the steps in https://iroha.readthedocs.io/en/latest/getting_started/index.html

And I'm able to send a number of transactions. However, creating an account through always fails with "Attempted to access the value of an uninitialized optional object".

Could this be broken in develop at the moment?

Reproducing steps

docker network create iroha-network
docker run --name some-postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=mysecretpassword \
-p 5432:5432 \
--network=iroha-network \
-d postgres:9.5
docker run -it --name iroha \
-p 50051:50051 \
-v $(pwd)/iroha/example:/opt/iroha_data \
-v blockstore:/tmp/block_store \
--network=iroha-network \
--entrypoint=/bin/bash \
hyperledger/iroha:develop

Then:

irohad --config config.docker --genesis_block genesis.block --keypair_name node0

In another shell tab:

docker exec -it iroha /bin/bash
iroha-cli -account_name admin@test

Welcome to Iroha-Cli.
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 (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)
> : 12

Account Name: new

Domain Id: test

Public Key: 3MfszkSPLhkKSBrsfKIe5S7aVG5mC0gg9JdtATIVcJc=

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_optional_access> >'
  what():  Attempted to access the value of an uninitialized optional object.
Aborted

Configuration

cat config.docker
{
  "block_store_path" : "/tmp/block_store/",
  "torii_port" : 50051,
  "internal_port" : 10001,
  "pg_opt" : "host=some-postgres port=5432 user=postgres password=mysecretpassword",
  "max_proposal_size" : 10,
  "proposal_delay" : 5000,
  "vote_delay" : 5000,
  "mst_enable" : false
}
cat genesis.block
{
   "payload":{
      "transactions":[
         {
            "payload":{
               "reducedPayload":{
                  "commands":[
                     {
                        "addPeer":{
                           "peer":{
                              "address":"0.0.0.0:10001",
                              "peerKey":"vd1YQE0TFeDrJ5AsXXyOsGAsFiOPAFdz30BrwZEwiSk="
                           }
                        }
                     },
                     {
                        "createRole":{
                           "roleName":"admin",
                           "permissions":[
                              "can_add_peer",
                              "can_add_signatory",
                              "can_create_account",
                              "can_create_domain",
                              "can_get_all_acc_ast",
                              "can_get_all_acc_ast_txs",
                              "can_get_all_acc_detail",
                              "can_get_all_acc_txs",
                              "can_get_all_accounts",
                              "can_get_all_signatories",
                              "can_get_all_txs",
                              "can_get_blocks",
                              "can_get_roles",
                              "can_read_assets",
                              "can_remove_signatory",
                              "can_set_quorum"
                           ]
                        }
                     },
                     {
                        "createRole":{
                           "roleName":"user",
                           "permissions":[
                              "can_add_signatory",
                              "can_get_my_acc_ast",
                              "can_get_my_acc_ast_txs",
                              "can_get_my_acc_detail",
                              "can_get_my_acc_txs",
                              "can_get_my_account",
                              "can_get_my_signatories",
                              "can_get_my_txs",
                              "can_grant_can_add_my_signatory",
                              "can_grant_can_remove_my_signatory",
                              "can_grant_can_set_my_account_detail",
                              "can_grant_can_set_my_quorum",
                              "can_grant_can_transfer_my_assets",
                              "can_receive",
                              "can_remove_signatory",
                              "can_set_quorum",
                              "can_transfer"
                           ]
                        }
                     },
                     {
                        "createRole":{
                           "roleName":"money_creator",
                           "permissions":[
                              "can_add_asset_qty",
                              "can_create_asset",
                              "can_receive",
                              "can_transfer"
                           ]
                        }
                     },
                     {
                        "createDomain":{
                           "domainId":"test",
                           "defaultRole":"user"
                        }
                     },
                     {
                        "createAsset":{
                           "assetName":"coin",
                           "domainId":"test",
                           "precision":2
                        }
                     },
                     {
                        "createAccount":{
                           "accountName":"admin",
                           "domainId":"test",
                           "publicKey":"MToH5jhHdu2VRHcQ0V5ZFIRzzPwFKmgTF6cqafKkmRA="
                        }
                     },
                     {
                        "createAccount":{
                           "accountName":"test",
                           "domainId":"test",
                           "publicKey":"cW/lBfafGFEaGwg5Faqf9z7zbmaIGZ85WXUNs4uPS/w="
                        }
                     },
                     {
                        "appendRole":{
                           "accountId":"admin@test",
                           "roleName":"admin"
                        }
                     },
                     {
                        "appendRole":{
                           "accountId":"admin@test",
                           "roleName":"money_creator"
                        }
                     }
                  ],
                  "quorum":1
               }
            }
         }
      ],
      "txNumber":1,
      "height":"1",
      "prevBlockHash":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
   }
}
@LiraLemur
Copy link
Contributor

Thank you for reporting this, indeed, there is an issue with develop branch at the moment.
Please use dev branch or master branch - they are up-to-date.

And if you encounter any issues, please contact us here: https://chat.hyperledger.org/channel/iroha

@l4l l4l added the cli command line interface label Jan 19, 2019
@l4l
Copy link
Contributor

l4l commented Jan 19, 2019

Indeed, CLI component is stale and might not work. We haven't some plans on that yet, but still it is possible to use different language bindings. Since it would be changed at some time anyway I'm closing an issue

@l4l l4l closed this as completed Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli command line interface
Development

No branches or pull requests

3 participants