Linter, enable simulated distribution msgs again

This commit is contained in:
Christopher Goes 2018-10-19 03:21:11 +02:00
parent 42ae2671c2
commit 4779359e29
5 changed files with 11 additions and 7 deletions

View File

@ -107,9 +107,9 @@ func testAndRunTxs(app *GaiaApp) []simulation.WeightedOperation {
{5, authsim.SimulateDeductFee(app.accountMapper, app.feeCollectionKeeper)},
{100, banksim.SingleInputSendMsg(app.accountMapper, app.bankKeeper)},
{50, distributionsim.SimulateMsgSetWithdrawAddress(app.accountMapper, app.distrKeeper)},
//{50, distributionsim.SimulateMsgWithdrawDelegatorRewardsAll(app.accountMapper, app.distrKeeper)},
//{50, distributionsim.SimulateMsgWithdrawDelegatorReward(app.accountMapper, app.distrKeeper)},
//{50, distributionsim.SimulateMsgWithdrawValidatorRewardsAll(app.accountMapper, app.distrKeeper)},
{50, distributionsim.SimulateMsgWithdrawDelegatorRewardsAll(app.accountMapper, app.distrKeeper)},
{50, distributionsim.SimulateMsgWithdrawDelegatorReward(app.accountMapper, app.distrKeeper)},
{50, distributionsim.SimulateMsgWithdrawValidatorRewardsAll(app.accountMapper, app.distrKeeper)},
{5, govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, app.stakeKeeper)},
{100, govsim.SimulateMsgDeposit(app.govKeeper, app.stakeKeeper)},
{100, stakesim.SimulateMsgCreateValidator(app.accountMapper, app.stakeKeeper)},

View File

@ -46,6 +46,7 @@ func (fck FeeCollectionKeeper) setCollectedFees(ctx sdk.Context, coins sdk.Coins
store.Set(collectedFeesKey, bz)
}
// add collected fees (mostly exposed for simulation...)
func (fck FeeCollectionKeeper) AddCollectedFees(ctx sdk.Context, coins sdk.Coins) sdk.Coins {
newCoins := fck.GetCollectedFees(ctx).Plus(coins)
fck.setCollectedFees(ctx, newCoins)

View File

@ -49,11 +49,11 @@ func TestFeeCollectionKeeperAdd(t *testing.T) {
require.True(t, fck.GetCollectedFees(ctx).IsEqual(emptyCoins))
// add oneCoin and check that pool is now oneCoin
fck.addCollectedFees(ctx, oneCoin)
fck.AddCollectedFees(ctx, oneCoin)
require.True(t, fck.GetCollectedFees(ctx).IsEqual(oneCoin))
// add oneCoin again and check that pool is now twoCoins
fck.addCollectedFees(ctx, oneCoin)
fck.AddCollectedFees(ctx, oneCoin)
require.True(t, fck.GetCollectedFees(ctx).IsEqual(twoCoins))
}

View File

@ -35,7 +35,10 @@ func SimulateDeductFee(m auth.AccountMapper, f auth.FeeCollectionKeeper) simulat
}
coins := sdk.Coins{sdk.NewCoin(initCoins[denomIndex].Denom, amt)}
stored.SetCoins(initCoins.Minus(coins))
err = stored.SetCoins(initCoins.Minus(coins))
if err != nil {
panic(err)
}
m.SetAccount(ctx, stored)
f.AddCollectedFees(ctx, coins)

View File

@ -64,7 +64,7 @@ func TestStakeWithRandomMessages(t *testing.T) {
}, []simulation.RandSetup{
Setup(mapp, stakeKeeper),
}, []simulation.Invariant{
AllInvariants(bankKeeper, stakeKeeper, distrKeeper, mapp.AccountMapper),
AllInvariants(bankKeeper, stakeKeeper, feeCollectionKeeper, distrKeeper, mapp.AccountMapper),
}, 10, 100,
false,
)