fix old tests
This commit is contained in:
parent
86f07d271d
commit
ec42e66501
|
@ -114,7 +114,7 @@ func TestHandleAbsentValidator(t *testing.T) {
|
|||
|
||||
// validator should have been jailed
|
||||
validator, _ = sk.GetValidatorByPubKey(ctx, val)
|
||||
require.Equal(t, sdk.Unbonded, validator.GetStatus())
|
||||
require.Equal(t, sdk.Unbonding, validator.GetStatus())
|
||||
|
||||
// unrevocation should fail prior to jail expiration
|
||||
got = slh(ctx, NewMsgUnjail(addr))
|
||||
|
@ -161,7 +161,7 @@ func TestHandleAbsentValidator(t *testing.T) {
|
|||
keeper.handleValidatorSignature(ctx, val.Address(), amtInt, false)
|
||||
}
|
||||
validator, _ = sk.GetValidatorByPubKey(ctx, val)
|
||||
require.Equal(t, sdk.Unbonded, validator.GetStatus())
|
||||
require.Equal(t, sdk.Unbonding, validator.GetStatus())
|
||||
}
|
||||
|
||||
// Test a new validator entering the validator set
|
||||
|
@ -230,7 +230,7 @@ func TestHandleAlreadyJailed(t *testing.T) {
|
|||
|
||||
// validator should have been jailed and slashed
|
||||
validator, _ := sk.GetValidatorByPubKey(ctx, val)
|
||||
require.Equal(t, sdk.Unbonded, validator.GetStatus())
|
||||
require.Equal(t, sdk.Unbonding, validator.GetStatus())
|
||||
|
||||
// validator should have been slashed
|
||||
require.Equal(t, int64(amtInt-1), validator.GetTokens().RoundInt64())
|
||||
|
|
|
@ -80,5 +80,5 @@ func TestBeginBlocker(t *testing.T) {
|
|||
// validator should be jailed
|
||||
validator, found := sk.GetValidatorByPubKey(ctx, pk)
|
||||
require.True(t, found)
|
||||
require.Equal(t, sdk.Unbonded, validator.GetStatus())
|
||||
require.Equal(t, sdk.Unbonding, validator.GetStatus())
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ func TestValidatorByPowerIndex(t *testing.T) {
|
|||
keeper.Jail(ctx, keep.PKs[0])
|
||||
validator, found = keeper.GetValidator(ctx, validatorAddr)
|
||||
require.True(t, found)
|
||||
require.Equal(t, sdk.Unbonded, validator.Status) // ensure is unbonded
|
||||
require.Equal(t, int64(500000), validator.Tokens.RoundInt64()) // ensure is unbonded
|
||||
require.Equal(t, sdk.Unbonding, validator.Status) // ensure is unbonding
|
||||
require.Equal(t, int64(500000), validator.Tokens.RoundInt64()) // ensure tokens slashed
|
||||
|
||||
// the old power record should have been deleted as the power changed
|
||||
require.False(t, keep.ValidatorByPowerIndexExists(ctx, keeper, power))
|
||||
|
|
|
@ -137,7 +137,7 @@ func TestUpdateBondedValidatorsDecreaseCliff(t *testing.T) {
|
|||
|
||||
expectedValStatus := map[int]sdk.BondStatus{
|
||||
9: sdk.Bonded, 8: sdk.Bonded, 7: sdk.Bonded, 5: sdk.Bonded, 4: sdk.Bonded,
|
||||
0: sdk.Unbonded, 1: sdk.Unbonded, 2: sdk.Unbonded, 3: sdk.Unbonded, 6: sdk.Unbonded,
|
||||
0: sdk.Unbonding, 1: sdk.Unbonding, 2: sdk.Unbonding, 3: sdk.Unbonding, 6: sdk.Unbonding,
|
||||
}
|
||||
|
||||
// require all the validators have their respective statuses
|
||||
|
@ -145,9 +145,11 @@ func TestUpdateBondedValidatorsDecreaseCliff(t *testing.T) {
|
|||
valAddr := validators[valIdx].Operator
|
||||
val, _ := keeper.GetValidator(ctx, valAddr)
|
||||
|
||||
require.Equal(
|
||||
t, val.GetStatus(), status,
|
||||
fmt.Sprintf("expected validator to have status: %s", sdk.BondStatusToString(status)))
|
||||
assert.Equal(
|
||||
t, status, val.GetStatus(),
|
||||
fmt.Sprintf("expected validator at index %v to have status: %s",
|
||||
valIdx,
|
||||
sdk.BondStatusToString(status)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,8 +612,8 @@ func TestFullValidatorSetPowerChange(t *testing.T) {
|
|||
validators[i], found = keeper.GetValidator(ctx, validators[i].Operator)
|
||||
require.True(t, found)
|
||||
}
|
||||
assert.Equal(t, sdk.Unbonded, validators[0].Status)
|
||||
assert.Equal(t, sdk.Unbonded, validators[1].Status)
|
||||
assert.Equal(t, sdk.Unbonding, validators[0].Status)
|
||||
assert.Equal(t, sdk.Unbonding, validators[1].Status)
|
||||
assert.Equal(t, sdk.Bonded, validators[2].Status)
|
||||
assert.Equal(t, sdk.Bonded, validators[3].Status)
|
||||
assert.Equal(t, sdk.Unbonded, validators[4].Status)
|
||||
|
|
|
@ -161,7 +161,7 @@ func (v Validator) HumanReadableString() (string, error) {
|
|||
resp += fmt.Sprintf("Description: %s\n", v.Description)
|
||||
resp += fmt.Sprintf("Bond Height: %d\n", v.BondHeight)
|
||||
resp += fmt.Sprintf("Unbonding Height: %d\n", v.UnbondingHeight)
|
||||
resp += fmt.Sprintf("Minimum Unbonding Time: %d\n", v.UnbondingMinTime)
|
||||
resp += fmt.Sprintf("Minimum Unbonding Time: %v\n", v.UnbondingMinTime)
|
||||
resp += fmt.Sprintf("Commission: %s\n", v.Commission.String())
|
||||
resp += fmt.Sprintf("Max Commission Rate: %s\n", v.CommissionMax.String())
|
||||
resp += fmt.Sprintf("Commission Change Rate: %s\n", v.CommissionChangeRate.String())
|
||||
|
|
Loading…
Reference in New Issue