From 99efde2b525a5efa8a22a0814ef4d1469b35540f Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Fri, 26 Oct 2018 00:25:26 -0700 Subject: [PATCH] Fix staking slashUnbondingDelegation bug; fixes simulator failure #9 --- Makefile | 2 +- x/stake/keeper/slash.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0699e897dc7c..b36ef61d4d28 100644 --- a/Makefile +++ b/Makefile @@ -169,7 +169,7 @@ test_sim_gaia_nondeterminism: test_sim_gaia_fast: @echo "Running quick Gaia simulation. This may take several minutes..." - @go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=400 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=1 -v -timeout 24h + @go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=400 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=9 -v -timeout 24h test_sim_gaia_multi_seed: @echo "Running multi-seed Gaia simulation. This may take awhile!" diff --git a/x/stake/keeper/slash.go b/x/stake/keeper/slash.go index 294ae9a9fd82..5879428f2bec 100644 --- a/x/stake/keeper/slash.go +++ b/x/stake/keeper/slash.go @@ -181,7 +181,7 @@ func (k Keeper) slashUnbondingDelegation(ctx sdk.Context, unbondingDelegation ty // Burn loose tokens // Ref https://github.com/cosmos/cosmos-sdk/pull/1278#discussion_r198657760 - pool.LooseTokens = pool.LooseTokens.Sub(slashAmount) + pool.LooseTokens = pool.LooseTokens.Sub(sdk.NewDecFromInt(unbondingSlashAmount)) k.SetPool(ctx, pool) }