Cosmos-sdk: InitializeTestLCD timeouts when nValidators > 1

Created on 14 Sep 2018  Â·  3Comments  Â·  Source: cosmos/cosmos-sdk

Summary of Bug

Can't run test LCD on because it timeouts when setting out nValidators > 2

Steps to Reproduce

On client/lcd/lcd_test.go I defined:

cleanup, pks, port := InitializeTestLCD(t, 2, []sdk.AccAddress{addr})

Which after 60s timeouts:

E[09-14|13:03:51.561] Couldn't connect to any seeds                module=p2p 
LADDR tcp://0.0.0.0:54870
E[09-14|13:04:21.565] Couldn't connect to any seeds                module=p2p
Tests timed out after 60000ms

After printing different steps in the code it seems that the error comes from this part of the function:

https://github.com/cosmos/cosmos-sdk/blob/b5f8350dffe9d5ce2c44d1ffa9707e84ecff6f4b/client/lcd/test_helpers.go#L190-L193


For Admin Use

  • [x] Not duplicate issue
  • [x] Appropriate labels applied
  • [x] Appropriate contributors tagged
  • [x] Contributor assigned/self-assigned
REST bug tests

Most helpful comment

GaiaAppGenState allocates equal power to initial validators:
https://github.com/cosmos/cosmos-sdk/blob/416181be60f32750178c24be52c9ebf15ce9a25b/cmd/gaia/app/genesis.go#L200

So node does not start when nValidator > 1. Also see https://github.com/cosmos/cosmos-sdk/pull/1373#issuecomment-404699243.

I think we can write something like TestGaiaAppGenState, which allocates voting power depending on its input.

All 3 comments

GaiaAppGenState allocates equal power to initial validators:
https://github.com/cosmos/cosmos-sdk/blob/416181be60f32750178c24be52c9ebf15ce9a25b/cmd/gaia/app/genesis.go#L200

So node does not start when nValidator > 1. Also see https://github.com/cosmos/cosmos-sdk/pull/1373#issuecomment-404699243.

I think we can write something like TestGaiaAppGenState, which allocates voting power depending on its input.

@mossid also genesis.go has a very low test coverage (51.2%)

So ended up digging a long time into this (both TM SDK) and @mossid is correct, It boils down to GaiaAppGenState (because init chainer on TM relay gets called which sends the app state that has equal power for each validator). So I'll be writing a test version of that.

Also throughout this process, I've realized the genesis logic and implementation as well as the higher level commands calling it, is pretty convoluted, messy and complex.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ssssssu12 picture ssssssu12  Â·  3Comments

jackzampolin picture jackzampolin  Â·  3Comments

cwgoes picture cwgoes  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

ValarDragon picture ValarDragon  Â·  3Comments