Merge PR #2162: Add loose/bonded token supply invariants back to simulation
This commit is contained in:
parent
e7134e8742
commit
f7cb351dd1
|
@ -39,6 +39,7 @@ BREAKING CHANGES
|
||||||
* [x/stake] [#1013] TendermintUpdates now uses transient store
|
* [x/stake] [#1013] TendermintUpdates now uses transient store
|
||||||
* [x/gov] [#2195] Governance uses BFT Time
|
* [x/gov] [#2195] Governance uses BFT Time
|
||||||
* [x/gov] \#2256 Removed slashing for governance non-voting validators
|
* [x/gov] \#2256 Removed slashing for governance non-voting validators
|
||||||
|
* [simulation] \#2162 Added back correct supply invariants
|
||||||
|
|
||||||
* SDK
|
* SDK
|
||||||
* [core] [\#1807](https://github.com/cosmos/cosmos-sdk/issues/1807) Switch from use of rational to decimal
|
* [core] [\#1807](https://github.com/cosmos/cosmos-sdk/issues/1807) Switch from use of rational to decimal
|
||||||
|
|
|
@ -34,7 +34,7 @@ func AllInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) simula
|
||||||
func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) simulation.Invariant {
|
func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) simulation.Invariant {
|
||||||
return func(app *baseapp.BaseApp) error {
|
return func(app *baseapp.BaseApp) error {
|
||||||
ctx := app.NewContext(false, abci.Header{})
|
ctx := app.NewContext(false, abci.Header{})
|
||||||
//pool := k.GetPool(ctx)
|
pool := k.GetPool(ctx)
|
||||||
|
|
||||||
loose := sdk.ZeroInt()
|
loose := sdk.ZeroInt()
|
||||||
bonded := sdk.ZeroDec()
|
bonded := sdk.ZeroDec()
|
||||||
|
@ -59,14 +59,14 @@ func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) sim
|
||||||
})
|
})
|
||||||
|
|
||||||
// Loose tokens should equal coin supply plus unbonding delegations plus tokens on unbonded validators
|
// Loose tokens should equal coin supply plus unbonding delegations plus tokens on unbonded validators
|
||||||
// XXX TODO https://github.com/cosmos/cosmos-sdk/issues/2063#issuecomment-413720872
|
if pool.LooseTokens.RoundInt64() != loose.Int64() {
|
||||||
// require.True(t, pool.LooseTokens.RoundInt64() == loose.Int64(), "expected loose tokens to equal total steak held by accounts - pool.LooseTokens: %v, sum of account tokens: %v\nlog: %s",
|
return fmt.Errorf("expected loose tokens to equal total steak held by accounts - pool.LooseTokens: %v, sum of account tokens: %v", pool.LooseTokens.RoundInt64(), loose.Int64())
|
||||||
// pool.LooseTokens.RoundInt64(), loose.Int64(), log)
|
}
|
||||||
|
|
||||||
// Bonded tokens should equal sum of tokens with bonded validators
|
// Bonded tokens should equal sum of tokens with bonded validators
|
||||||
// XXX TODO https://github.com/cosmos/cosmos-sdk/issues/2063#issuecomment-413720872
|
if pool.BondedTokens.RoundInt64() != bonded.RoundInt64() {
|
||||||
// require.True(t, pool.BondedTokens.RoundInt64() == bonded.RoundInt64(), "expected bonded tokens to equal total steak held by bonded validators - pool.BondedTokens: %v, sum of bonded validator tokens: %v\nlog: %s",
|
return fmt.Errorf("expected bonded tokens to equal total steak held by bonded validators - pool.BondedTokens: %v, sum of bonded validator tokens: %v", pool.BondedTokens.RoundInt64(), bonded.RoundInt64())
|
||||||
// pool.BondedTokens.RoundInt64(), bonded.RoundInt64(), log)
|
}
|
||||||
|
|
||||||
// TODO Inflation check on total supply
|
// TODO Inflation check on total supply
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue