-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix typo in val_state_change.go (#728)
* fix: typo in val_state_change.go * test: add test for panic in UnbondingToUnbonded function * chore: add changelog * test: change test code to check both cases check unbonding to unbonded from unbonded status and bonded status * test: delete duplicated update validator * chore: fix typo in changelog * chore: change logic to use range * chore: change pr number
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package keeper_test | ||
|
||
import ( | ||
"github.com/line/lbm-sdk/x/staking/keeper" | ||
"github.com/line/lbm-sdk/x/staking/types" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestUnbondingToUnbondedPanic(t *testing.T) { | ||
app, ctx, _, _, validators := initValidators(t, 100, 2, []int64{0, 100}) | ||
|
||
for i, validator := range validators { | ||
validators[i] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, false) | ||
} | ||
|
||
assert.Equal(t, validators[0].Status, types.Unbonded) | ||
assert.Equal(t, validators[1].Status, types.Bonded) | ||
|
||
// unbond validator which is in unbonded status | ||
require.Panics(t, func() { | ||
app.StakingKeeper.UnbondingToUnbonded(ctx, validators[0]) | ||
}) | ||
|
||
// unbond validator which is in bonded status | ||
require.Panics(t, func() { | ||
app.StakingKeeper.UnbondingToUnbonded(ctx, validators[1]) | ||
}) | ||
} |