Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
uhyunpark committed Feb 23, 2024
1 parent efffad3 commit adecf77
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions x/staking/keeper/delegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,11 +1186,11 @@ func TestProbonoDelegationToConsensusPower_Settlus(t *testing.T) {
addrVals := simapp.ConvertAddrsToValAddrs(addrDels)

bondDenom := app.StakingKeeper.BondDenom(ctx)
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)

startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 1)
startCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, startTokens))

notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
require.NoError(t, testutil.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins))
app.AccountKeeper.SetModuleAccount(ctx, notBondedPool)

Expand Down Expand Up @@ -1233,12 +1233,19 @@ func TestProbonoDelegationToConsensusPower_Settlus(t *testing.T) {

// after ProbonoDelegationToConsensusPower, the community pool should be reduced by the amount of the delegation
err := app.StakingKeeper.ProbonoDelegationToConsensusPower(ctx, validator)
// end block
staking.EndBlocker(ctx, app.StakingKeeper)
require.NoError(t, err)

// execute end block
staking.EndBlocker(ctx, app.StakingKeeper)

val := app.StakingKeeper.Validator(ctx, addrVals[0])

// community pool reduced to 10 * power to 1 * power
require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(startTokens)}}, app.DistrKeeper.GetFeePool(ctx).CommunityPool)
require.Equal(t, newPower, validator.GetBondedTokens())

//set back power reduction
// validator's bonded token updated to new power reduction
require.Equal(t, newPower, val.GetBondedTokens())

//set back power reduction for other tests
sdk.DefaultPowerReduction = oldPower
}

0 comments on commit adecf77

Please sign in to comment.