refactor next
This commit is contained in:
parent
3f319c2578
commit
8ecd5b8954
|
@ -387,41 +387,40 @@ func TestIncrementsMsgDelegate(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
func TestEditValidatorDecreaseMinSelfDelegation(t *testing.T) {
|
||||||
//func TestEditValidatorDecreaseMinSelfDelegation(t *testing.T) {
|
initPower := int64(100)
|
||||||
// validatorAddr := sdk.ValAddress(Addrs[0])
|
initBond := sdk.TokensFromConsensusPower(100)
|
||||||
//
|
app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 1, 1000000000)
|
||||||
// initPower := int64(100)
|
|
||||||
// initBond := sdk.TokensFromConsensusPower(100)
|
validatorAddr := valAddrs[0]
|
||||||
// ctx, _, _, keeper, _ := CreateTestInput(t, false, initPower)
|
handler := staking.NewHandler(app.StakingKeeper)
|
||||||
// handler := NewHandler(keeper)
|
|
||||||
//
|
// create validator
|
||||||
// // create validator
|
msgCreateValidator := NewTestMsgCreateValidator(validatorAddr, PKs[0], initBond)
|
||||||
// msgCreateValidator := NewTestMsgCreateValidator(validatorAddr, PKs[0], initBond)
|
msgCreateValidator.MinSelfDelegation = sdk.NewInt(2)
|
||||||
// msgCreateValidator.MinSelfDelegation = sdk.NewInt(2)
|
res, err := handler(ctx, msgCreateValidator)
|
||||||
// res, err := handler(ctx, msgCreateValidator)
|
require.NoError(t, err)
|
||||||
// require.NoError(t, err)
|
require.NotNil(t, res)
|
||||||
// require.NotNil(t, res)
|
|
||||||
//
|
// must end-block
|
||||||
// // must end-block
|
updates := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx)
|
||||||
// updates := keeper.ApplyAndReturnValidatorSetUpdates(ctx)
|
require.Equal(t, 1, len(updates))
|
||||||
// require.Equal(t, 1, len(updates))
|
|
||||||
//
|
// verify the self-delegation exists
|
||||||
// // verify the self-delegation exists
|
bond, found := app.StakingKeeper.GetDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr)
|
||||||
// bond, found := keeper.GetDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr)
|
require.True(t, found)
|
||||||
// require.True(t, found)
|
gotBond := bond.Shares.RoundInt()
|
||||||
// gotBond := bond.Shares.RoundInt()
|
require.Equal(t, initBond, gotBond,
|
||||||
// require.Equal(t, initBond, gotBond,
|
"initBond: %v\ngotBond: %v\nbond: %v\n",
|
||||||
// "initBond: %v\ngotBond: %v\nbond: %v\n",
|
initBond, gotBond, bond)
|
||||||
// initBond, gotBond, bond)
|
|
||||||
//
|
newMinSelfDelegation := sdk.OneInt()
|
||||||
// newMinSelfDelegation := sdk.OneInt()
|
msgEditValidator := types.NewMsgEditValidator(validatorAddr, types.Description{}, nil, &newMinSelfDelegation)
|
||||||
// msgEditValidator := NewMsgEditValidator(validatorAddr, Description{}, nil, &newMinSelfDelegation)
|
res, err = handler(ctx, msgEditValidator)
|
||||||
// res, err = handler(ctx, msgEditValidator)
|
require.Error(t, err)
|
||||||
// require.Error(t, err)
|
require.Nil(t, res)
|
||||||
// require.Nil(t, res)
|
}
|
||||||
//}
|
|
||||||
//
|
|
||||||
//func TestEditValidatorIncreaseMinSelfDelegationBeyondCurrentBond(t *testing.T) {
|
//func TestEditValidatorIncreaseMinSelfDelegationBeyondCurrentBond(t *testing.T) {
|
||||||
// validatorAddr := sdk.ValAddress(Addrs[0])
|
// validatorAddr := sdk.ValAddress(Addrs[0])
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue