2019-06-20 13:37:57 +00:00
|
|
|
package app
|
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// import (
|
|
|
|
// "fmt"
|
|
|
|
// "time"
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// abci "github.com/tendermint/tendermint/abci/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
// )
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// func (app *App) assertRuntimeInvariants() {
|
|
|
|
// ctx := app.NewContext(false, abci.Header{Height: app.LastBlockHeight() + 1})
|
|
|
|
// app.assertRuntimeInvariantsOnContext(ctx)
|
|
|
|
// }
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// func (app *App) assertRuntimeInvariantsOnContext(ctx sdk.Context) {
|
|
|
|
// start := time.Now()
|
|
|
|
// invarRoutes := app.crisisKeeper.Routes()
|
|
|
|
// for _, ir := range invarRoutes {
|
|
|
|
// if err := ir.Invar(ctx); err != nil {
|
|
|
|
// panic(fmt.Errorf("invariant broken: %s\n"+
|
|
|
|
// "\tCRITICAL please submit the following transaction:\n"+
|
|
|
|
// "\t\t kvcli tx crisis invariant-broken %v %v", err, ir.ModuleName, ir.Route))
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// end := time.Now()
|
|
|
|
// diff := end.Sub(start)
|
|
|
|
// app.BaseApp.Logger().With("module", "invariants").Info(
|
|
|
|
// "Asserted all invariants", "duration", diff, "height", app.LastBlockHeight())
|
|
|
|
// }
|