Fix testcases & update changelog
This commit is contained in:
parent
5b1e2a3786
commit
86b79b9c84
|
@ -16,6 +16,7 @@ BREAKING CHANGES
|
||||||
|
|
||||||
* Remove go-wire, use go-amino
|
* Remove go-wire, use go-amino
|
||||||
* Gaia simple-staking bond and unbond functions replaced
|
* Gaia simple-staking bond and unbond functions replaced
|
||||||
|
* [stake] Delegator bonds now store the height at which they were updated
|
||||||
* [store] Add `SubspaceIterator` and `ReverseSubspaceIterator` to `KVStore` interface
|
* [store] Add `SubspaceIterator` and `ReverseSubspaceIterator` to `KVStore` interface
|
||||||
* [basecoin] NewBasecoinApp takes a `dbm.DB` and uses namespaced DBs for substores
|
* [basecoin] NewBasecoinApp takes a `dbm.DB` and uses namespaced DBs for substores
|
||||||
* All module keepers now require a codespace, see basecoin or democoin for usage
|
* All module keepers now require a codespace, see basecoin or democoin for usage
|
||||||
|
|
|
@ -76,7 +76,10 @@ func TestIncrementsMsgDelegate(t *testing.T) {
|
||||||
|
|
||||||
// just send the same msgbond multiple times
|
// just send the same msgbond multiple times
|
||||||
msgDelegate := newTestMsgDelegate(delegatorAddr, candidateAddr, bondAmount)
|
msgDelegate := newTestMsgDelegate(delegatorAddr, candidateAddr, bondAmount)
|
||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
|
ctx = ctx.WithBlockHeight(int64(i))
|
||||||
|
|
||||||
got := handleMsgDelegate(ctx, msgDelegate, keeper)
|
got := handleMsgDelegate(ctx, msgDelegate, keeper)
|
||||||
require.True(t, got.IsOK(), "expected msg %d to be ok, got %v", i, got)
|
require.True(t, got.IsOK(), "expected msg %d to be ok, got %v", i, got)
|
||||||
|
|
||||||
|
@ -90,6 +93,8 @@ func TestIncrementsMsgDelegate(t *testing.T) {
|
||||||
expLiabilities := int64(i+2) * bondAmount // (1 self delegation)
|
expLiabilities := int64(i+2) * bondAmount // (1 self delegation)
|
||||||
expDelegatorAcc := initBond - expBond
|
expDelegatorAcc := initBond - expBond
|
||||||
|
|
||||||
|
require.Equal(t, bond.Height, int64(i), "Incorrect bond height")
|
||||||
|
|
||||||
gotBond := bond.Shares.Evaluate()
|
gotBond := bond.Shares.Evaluate()
|
||||||
gotLiabilities := candidate.Liabilities.Evaluate()
|
gotLiabilities := candidate.Liabilities.Evaluate()
|
||||||
gotDelegatorAcc := accMapper.GetAccount(ctx, delegatorAddr).GetCoins().AmountOf(params.BondDenom)
|
gotDelegatorAcc := accMapper.GetAccount(ctx, delegatorAddr).GetCoins().AmountOf(params.BondDenom)
|
||||||
|
|
|
@ -143,15 +143,6 @@ func TestBond(t *testing.T) {
|
||||||
assert.True(t, found)
|
assert.True(t, found)
|
||||||
assert.True(t, bondsEqual(bond1to1, resBond))
|
assert.True(t, bondsEqual(bond1to1, resBond))
|
||||||
|
|
||||||
// test height
|
|
||||||
ctx = ctx.WithBlockHeight(10)
|
|
||||||
keeper.setDelegatorBond(ctx, bond1to1)
|
|
||||||
resBond, found = keeper.GetDelegatorBond(ctx, addrDels[0], addrVals[0])
|
|
||||||
assert.True(t, found)
|
|
||||||
assert.Equal(t, resBond.Height, 10)
|
|
||||||
ctx = ctx.WithBlockHeight(0)
|
|
||||||
keeper.setDelegatorBond(ctx, bond1to1)
|
|
||||||
|
|
||||||
// add some more records
|
// add some more records
|
||||||
keeper.setCandidate(ctx, candidates[1])
|
keeper.setCandidate(ctx, candidates[1])
|
||||||
keeper.setCandidate(ctx, candidates[2])
|
keeper.setCandidate(ctx, candidates[2])
|
||||||
|
|
Loading…
Reference in New Issue