* changelog * ... * decimal func working * decimal complete, untested * fixing tests * decimal compile errors resolved * test compile errors * precision multiplier test * 1% laptop battery * fixed TestNewDecFromStr * equalities working * fix bankers round chop * ... * working, some decimal issues resolved * fix rounding error * rounding works * decimal works * ... * deleted rational * rational conversion working * revert changelog * code compiles (not tests) * went through all NewDec, made sure they were converted from NewRat properly * test debugging * all testing bugs besides the json marshalling fixed * json unmarshal * lint * document update * fix lcd test * cli test fix * mostly undo Dece -> Rate * val comments * Efficiency improvements This now caches all of the precision multipliers (as they were all used in non-mutative functions), and caches the precisionInt calculation. (Now it just copies the already calculated value) * Cache another precisionInt() call. * Improve banker rounding efficiency * remove defer, make negation in-place. * chris val comments * bez comments * Aditya comments * ... * val comments * rebasing start * ... * compiling * tests pass * cli fix * anton, cwgoes, val comments * val and jae comments * type * undo reuse quo
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package stake
|
|
|
|
//// test if is a gotValidator from the last update
|
|
//func TestGetTotalPrecommitVotingPower(t *testing.T) {
|
|
//ctx, _, keeper := createTestInput(t, false, 0)
|
|
|
|
//amts := []int64{10000, 1000, 100, 10, 1}
|
|
//var candidatesIn [5]Candidate
|
|
//for i, amt := range amts {
|
|
//candidatesIn[i] = NewCandidate(addrVals[i], pks[i], Description{})
|
|
//candidatesIn[i].BondedShares = sdk.NewDec(amt)
|
|
//candidatesIn[i].DelegatorShares = sdk.NewDec(amt)
|
|
//keeper.setCandidate(ctx, candidatesIn[i])
|
|
//}
|
|
|
|
//// test that an empty gotValidator set doesn't have any gotValidators
|
|
//gotValidators := keeper.GetValidators(ctx)
|
|
//require.Equal(t, 5, len(gotValidators))
|
|
|
|
//totPow := keeper.GetTotalPrecommitVotingPower(ctx)
|
|
//exp := sdk.NewDec(11111)
|
|
//require.True(t, exp.Equal(totPow), "exp %v, got %v", exp, totPow)
|
|
|
|
//// set absent gotValidators to be the 1st and 3rd record sorted by pubKey address
|
|
//ctx = ctx.WithAbsentValidators([]int32{1, 3})
|
|
//totPow = keeper.GetTotalPrecommitVotingPower(ctx)
|
|
|
|
//// XXX verify that this order should infact exclude these two records
|
|
//exp = sdk.NewDec(11100)
|
|
//require.True(t, exp.Equal(totPow), "exp %v, got %v", exp, totPow)
|
|
//}
|