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

Gentx doesn't work in 4.1.0 #768

Closed
4 tasks
AdityaSripal opened this issue Mar 15, 2021 · 7 comments
Closed
4 tasks

Gentx doesn't work in 4.1.0 #768

AdityaSripal opened this issue Mar 15, 2021 · 7 comments

Comments

@AdityaSripal
Copy link
Member

AdityaSripal commented Mar 15, 2021

Summary of Bug

Trying to use gentx to start single node testnet fails consistently. There was a single time where I did something different and got the chain to start but have not been able to replicate since. Running through the setup below consistently fails for me when it shouldn't on both Ubuntu and Mac.

Version

4.1.0
commit: 72ced60

Steps to Reproduce

# You can run all of these commands from your home directory
cd $HOME

# Initialize the genesis.json file that will help you to bootstrap the network
gaiad init --chain-id=testing testing

# Create a key to hold your validator account
gaiad keys add validator

# Add that key into the genesis.app_state.accounts array in the genesis file
# NOTE: this command lets you set the number of coins. Make sure this account has some coins
# with the genesis.app_state.staking.params.bond_denom denom, the default is staking
gaiad add-genesis-account $(gaiad keys show validator -a) 1000000000stake,1000000000validatortoken

# Generate the transaction that creates your validator
gaiad gentx validator 100000stake --chain-id=testing

# Add the generated bonding transaction to the genesis file
gaiad collect-gentxs

# Now its safe to start `gaiad`
gaiad start

Output:

 gaiad start
7:12PM INF starting ABCI with Tendermint
7:12PM INF Starting multiAppConn service impl=multiAppConn module=proxy
7:12PM INF Starting localClient service connection=query impl=localClient module=abci-client
7:12PM INF Starting localClient service connection=snapshot impl=localClient module=abci-client
7:12PM INF Starting localClient service connection=mempool impl=localClient module=abci-client
7:12PM INF Starting localClient service connection=consensus impl=localClient module=abci-client
7:12PM INF Starting EventBus service impl=EventBus module=events
7:12PM INF Starting PubSub service impl=PubSub module=pubsub
7:12PM INF Starting IndexerService service impl=IndexerService module=txindex
7:12PM INF ABCI Handshake App Info hash= height=0 module=consensus protocol-version=0 software-version=
7:12PM INF ABCI Replay Blocks appHeight=0 module=consensus stateHeight=0 storeHeight=0
7:12PM INF asserting crisis invariants inv=0/11 module=x/crisis name=distribution/nonnegative-outstanding
7:12PM INF asserting crisis invariants inv=1/11 module=x/crisis name=distribution/can-withdraw
7:12PM INF asserting crisis invariants inv=2/11 module=x/crisis name=distribution/reference-count
7:12PM INF asserting crisis invariants inv=3/11 module=x/crisis name=distribution/module-account
7:12PM INF asserting crisis invariants inv=4/11 module=x/crisis name=bank/nonnegative-outstanding
7:12PM INF asserting crisis invariants inv=5/11 module=x/crisis name=bank/total-supply
7:12PM INF asserting crisis invariants inv=6/11 module=x/crisis name=gov/module-account
7:12PM INF asserting crisis invariants inv=7/11 module=x/crisis name=staking/module-accounts
7:12PM INF asserting crisis invariants inv=8/11 module=x/crisis name=staking/nonnegative-power
7:12PM INF asserting crisis invariants inv=9/11 module=x/crisis name=staking/positive-delegation
7:12PM INF asserting crisis invariants inv=10/11 module=x/crisis name=staking/delegator-shares
7:12PM INF asserted all invariants duration=0.630247 height=0 module=x/crisis
7:12PM INF created new capability module=ibc name=ports/transfer
7:12PM INF port binded module=x/ibc/port port=transfer
7:12PM INF claimed capability capability=1 module=transfer name=ports/transfer
Error: error during handshake: error on replay: validator set is nil in genesis and still empty after InitChain

Here is the gentx in genesis file:

"gen_txs": [
  {   
    "body": {
      "messages": [
        {   
          "@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
          "description": {
            "moniker": "validator",
            "identity": "", 
            "website": "", 
            "security_contact": "", 
            "details": ""
          },  
          "commission": {
            "rate": "0.100000000000000000",
            "max_rate": "0.200000000000000000",
            "max_change_rate": "0.010000000000000000"
          },  
          "min_self_delegation": "1",
          "delegator_address": "cosmos1tk9stx7tvjkjcxuvjhxulh9sqnn4ngvjxnphtk",
          "validator_address": "cosmosvaloper1tk9stx7tvjkjcxuvjhxulh9sqnn4ngvjr84z89",
          "pubkey": {
            "@type": "/cosmos.crypto.ed25519.PubKey",
            "key": "ow25wG7B99NTiQezC3YIOllHnMKAZRxZmfb0R0Tao9Y="
          },  
          "value": {
            "denom": "stake",
            "amount": "10000"
          }   
        }   
      ],  
      "memo": "[email protected]:26656",
      "timeout_height": "0",
      "extension_options": [], 
      "non_critical_extension_options": []
    },  
    "auth_info": {
      "signer_infos": [
        {   
          "public_key": {
            "@type": "/cosmos.crypto.secp256k1.PubKey",
            "key": "AiAcDCCnkQoKqtbOYduodAv40nPZ/2lZApV0cDftHJ7n"
          },  
          "mode_info": {
            "single": {
              "mode": "SIGN_MODE_DIRECT"
            }   
          },  
          "sequence": "0" 
        }   
      ],  
      "fee": {
        "amount": [], 
        "gas_limit": "200000",
        "payer": "", 
        "granter": ""
      }   
    },  
    "signatures": [
      "B7Em81OToOVmPpHM7KWug+Yf1xUvJzl7SkcyPUAW0pIhhW0GPICmiDq38F0BRQmsmvxnS8vpdGYJRtbnZZbPsg=="
    ]   
  }   
]   

cc: @colin-axner


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@AdityaSripal
Copy link
Member Author

I think there might be something pathologically wrong about my setup because this happens for me even for versions 4.0.2 and v3.1.0. Would be good to see if others run into the same issue

@colin-axner
Copy link
Contributor

colin-axner commented Mar 16, 2021

@AdityaSripal I think you forgot to use the --chain-id flag

I think it needs to be gaiad gentx validator 100000stake --chain-id testing

@colin-axner
Copy link
Contributor

Can you post your exact steps to reproduce?

I get

gaiad gentx validator 100000stake
Error: required flag(s) "chain-id" not set
Usage:
  gaiad gentx [key_name] [amount] [flags]

Which tells me the above steps aren't exact. I ran into this same issue, and I thought using the right chain-id fixed it, but I cannot remember

@AdityaSripal
Copy link
Member Author

Ahh yes I pass in --chain-id=testing

@AdityaSripal
Copy link
Member Author

Tried again and it still fails for me, each time I call rm -rf ~/.gaia in order to start over

@colin-axner
Copy link
Contributor

Ohh, I think I remember now. I think you need to run gaiad unsafe-reset-all. I'll look into why this is

@colin-axner
Copy link
Contributor

I figured it out. You aren't bonding enough of the total supply to start the chain. I think the error is a little misleading.

Once I modified your gentx to use the full genesis account balance and did unsafe-reset-all (otherwise you will be stuck on the old init genesis logic), the chain started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants