diff --git a/.pending/breaking/sdk/3245-Rename-validato b/.pending/breaking/sdk/3245-Rename-validato new file mode 100644 index 000000000000..3886cfb6c9f4 --- /dev/null +++ b/.pending/breaking/sdk/3245-Rename-validato @@ -0,0 +1 @@ +#3245 Rename validator.GetJailed() to validator.IsJailed() \ No newline at end of file diff --git a/types/staking.go b/types/staking.go index 4decccb20315..fadf57f91355 100644 --- a/types/staking.go +++ b/types/staking.go @@ -61,7 +61,7 @@ func (b BondStatus) Equal(b2 BondStatus) bool { // validator for a delegated proof of stake system type Validator interface { - GetJailed() bool // whether the validator is jailed + IsJailed() bool // whether the validator is jailed GetMoniker() string // moniker of the validator GetStatus() BondStatus // status of the validator GetOperator() ValAddress // operator address to receive/return validators coins diff --git a/x/slashing/handler.go b/x/slashing/handler.go index a710c6b6c478..70a28089d0d0 100644 --- a/x/slashing/handler.go +++ b/x/slashing/handler.go @@ -36,7 +36,7 @@ func handleMsgUnjail(ctx sdk.Context, msg MsgUnjail, k Keeper) sdk.Result { } // cannot be unjailed if not jailed - if !validator.GetJailed() { + if !validator.IsJailed() { return ErrValidatorNotJailed(k.codespace).Result() } diff --git a/x/slashing/handler_test.go b/x/slashing/handler_test.go index 0c0f2f26077b..18e03fba26dd 100644 --- a/x/slashing/handler_test.go +++ b/x/slashing/handler_test.go @@ -55,7 +55,7 @@ func TestCannotUnjailUnlessMeetMinSelfDelegation(t *testing.T) { undelegateMsg := staking.NewMsgUndelegate(sdk.AccAddress(addr), addr, unbondAmt) got = staking.NewHandler(sk)(ctx, undelegateMsg) - require.True(t, sk.Validator(ctx, addr).GetJailed()) + require.True(t, sk.Validator(ctx, addr).IsJailed()) // assert non-jailed validator can't be unjailed got = slh(ctx, NewMsgUnjail(addr)) @@ -106,7 +106,7 @@ func TestJailedValidatorDelegations(t *testing.T) { // verify validator still exists and is jailed validator, found := stakingKeeper.GetValidator(ctx, valAddr) require.True(t, found) - require.True(t, validator.GetJailed()) + require.True(t, validator.IsJailed()) // verify the validator cannot unjail itself got = NewHandler(slashingKeeper)(ctx, NewMsgUnjail(valAddr)) diff --git a/x/slashing/keeper.go b/x/slashing/keeper.go index 8b8360492b6c..35a357748fd7 100644 --- a/x/slashing/keeper.go +++ b/x/slashing/keeper.go @@ -108,7 +108,7 @@ func (k Keeper) handleDoubleSign(ctx sdk.Context, addr crypto.Address, infractio // Jail validator if not already jailed // begin unbonding validator if not already unbonding (tombstone) - if !validator.GetJailed() { + if !validator.IsJailed() { k.validatorSet.Jail(ctx, consAddr) } @@ -172,7 +172,7 @@ func (k Keeper) handleValidatorSignature(ctx sdk.Context, addr crypto.Address, p // if we are past the minimum height and the validator has missed too many blocks, punish them if height > minHeight && signInfo.MissedBlocksCounter > maxMissed { validator := k.validatorSet.ValidatorByConsAddr(ctx, consAddr) - if validator != nil && !validator.GetJailed() { + if validator != nil && !validator.IsJailed() { // Downtime confirmed: slash and jail the validator logger.Info(fmt.Sprintf("Validator %s past min height of %d and below signed blocks threshold of %d", diff --git a/x/slashing/keeper_test.go b/x/slashing/keeper_test.go index e7501e1af637..7b0bd11745d6 100644 --- a/x/slashing/keeper_test.go +++ b/x/slashing/keeper_test.go @@ -51,7 +51,7 @@ func TestHandleDoubleSign(t *testing.T) { keeper.handleDoubleSign(ctx, val.Address(), 0, time.Unix(0, 0), power) // should be jailed - require.True(t, sk.Validator(ctx, operatorAddr).GetJailed()) + require.True(t, sk.Validator(ctx, operatorAddr).IsJailed()) // tokens should be decreased newTokens := sk.Validator(ctx, operatorAddr).GetTokens() diff --git a/x/staking/keeper/slash_test.go b/x/staking/keeper/slash_test.go index 99f68a3320e4..283fc9f672a8 100644 --- a/x/staking/keeper/slash_test.go +++ b/x/staking/keeper/slash_test.go @@ -51,19 +51,19 @@ func TestRevocation(t *testing.T) { // initial state val, found := keeper.GetValidator(ctx, addr) require.True(t, found) - require.False(t, val.GetJailed()) + require.False(t, val.IsJailed()) // test jail keeper.Jail(ctx, consAddr) val, found = keeper.GetValidator(ctx, addr) require.True(t, found) - require.True(t, val.GetJailed()) + require.True(t, val.IsJailed()) // test unjail keeper.Unjail(ctx, consAddr) val, found = keeper.GetValidator(ctx, addr) require.True(t, found) - require.False(t, val.GetJailed()) + require.False(t, val.IsJailed()) } // tests slashUnbondingDelegation diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index b26c8af7186e..e7132ebff3af 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -467,7 +467,7 @@ func (v Validator) PotentialTendermintPower() int64 { var _ sdk.Validator = Validator{} // nolint - for sdk.Validator -func (v Validator) GetJailed() bool { return v.Jailed } +func (v Validator) IsJailed() bool { return v.Jailed } func (v Validator) GetMoniker() string { return v.Description.Moniker } func (v Validator) GetStatus() sdk.BondStatus { return v.Status } func (v Validator) GetOperator() sdk.ValAddress { return v.OperatorAddress }