Merge PR #2394: Split up UpdateValidator into distinct state transitions applied only in EndBlock

This commit is contained in:
Rigel
2018-10-03 18:37:06 +02:00
committed by Christopher Goes
parent a7fabbea16
commit 324bdaf55d
24 changed files with 855 additions and 1123 deletions
+7 -2
View File
@@ -71,8 +71,8 @@ func TestQueryValidators(t *testing.T) {
validators[i], pool, _ = validators[i].AddTokensFromDel(pool, amt)
}
keeper.SetPool(ctx, pool)
validators[0] = keeper.UpdateValidator(ctx, validators[0])
validators[1] = keeper.UpdateValidator(ctx, validators[1])
keeper.SetValidator(ctx, validators[0])
keeper.SetValidator(ctx, validators[1])
// Query Validators
queriedValidators := keeper.GetValidators(ctx, params.MaxValidators)
@@ -114,9 +114,14 @@ func TestQueryDelegation(t *testing.T) {
// Create Validators and Delegation
val1 := types.NewValidator(addrVal1, pk1, types.Description{})
keeper.SetValidator(ctx, val1)
pool := keeper.GetPool(ctx)
keeper.SetValidatorByPowerIndex(ctx, val1, pool)
keeper.Delegate(ctx, addrAcc2, sdk.NewCoin("steak", sdk.NewInt(20)), val1, true)
// apply TM updates
keeper.ApplyAndReturnValidatorSetUpdates(ctx)
// Query Delegator bonded validators
queryParams := newTestDelegatorQuery(addrAcc2)
bz, errRes := cdc.MarshalJSON(queryParams)