Merge PR: Fix lcd test unexpected slashing in TestBonding

This commit is contained in:
frog power 4000 2019-02-22 09:08:33 -05:00 committed by Christopher Goes
parent 0611d2eda2
commit b823203839
2 changed files with 12 additions and 2 deletions

View File

@ -69,6 +69,8 @@ decoded automatically.
### SDK
* \#3559 fix occasional failing due to non-determinism in lcd test TestBonding
where validator is unexpectedly slashed throwing off test calculations
* [\#3411] Include the `RequestInitChain.Time` in the block header init during
`InitChain`.

View File

@ -545,10 +545,18 @@ func TestBonding(t *testing.T) {
require.Equal(t, resultTx.Height, txs[0].Height)
// query delegations, unbondings and redelegations from validator and delegator
rdShares := rdTokens.ToDec()
delegatorDels = getDelegatorDelegations(t, port, addr)
require.Len(t, delegatorDels, 1)
require.Equal(t, rdShares, delegatorDels[0].GetShares())
require.Equal(t, operAddrs[1], delegatorDels[0].ValidatorAddr)
// because the second validator never signs during these tests, if this
// this test takes a long time to run, eventually this second validator
// will get slashed, meaning that it's exchange rate is no-longer 1-to-1,
// hence we utilize the exchange rate in the following test
validator2 := getValidator(t, port, operAddrs[1])
delTokensAfterRedelegation := delegatorDels[0].GetShares().Mul(validator2.DelegatorShareExRate())
require.Equal(t, rdTokens.ToDec(), delTokensAfterRedelegation)
redelegation := getRedelegations(t, port, addr, operAddrs[0], operAddrs[1])
require.Len(t, redelegation, 1)