Merge PR #4502: InvariantRouter -> InvariantRegistry
This commit is contained in:
committed by
Alexander Bezobchuk
parent
86da70d8aa
commit
1a2a54029c
+2
-2
@@ -9,7 +9,7 @@ type Invariant func(ctx Context) error
|
||||
// Invariants defines a group of invariants
|
||||
type Invariants []Invariant
|
||||
|
||||
// expected interface for routing invariants
|
||||
type InvariantRouter interface {
|
||||
// expected interface for registering invariants
|
||||
type InvariantRegistry interface {
|
||||
RegisterRoute(moduleName, route string, invar Invariant)
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ type AppModule interface {
|
||||
AppModuleGenesis
|
||||
|
||||
// registers
|
||||
RegisterInvariants(sdk.InvariantRouter)
|
||||
RegisterInvariants(sdk.InvariantRegistry)
|
||||
|
||||
// routes
|
||||
Route() string
|
||||
@@ -157,7 +157,7 @@ func NewGenesisOnlyAppModule(amg AppModuleGenesis) AppModule {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (GenesisOnlyAppModule) RegisterInvariants(_ sdk.InvariantRouter) {}
|
||||
func (GenesisOnlyAppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// module message route ngame
|
||||
func (GenesisOnlyAppModule) Route() string { return "" }
|
||||
@@ -232,9 +232,9 @@ func (m *Manager) SetOrderEndBlockers(moduleNames ...string) {
|
||||
}
|
||||
|
||||
// register all module routes and module querier routes
|
||||
func (m *Manager) RegisterInvariants(invarRouter sdk.InvariantRouter) {
|
||||
func (m *Manager) RegisterInvariants(ir sdk.InvariantRegistry) {
|
||||
for _, module := range m.Modules {
|
||||
module.RegisterInvariants(invarRouter)
|
||||
module.RegisterInvariants(ir)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ func (AppModule) Name() string {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (AppModule) RegisterInvariants(_ sdk.InvariantRouter) {}
|
||||
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// module message route name
|
||||
func (AppModule) Route() string { return "" }
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// register bank invariants
|
||||
func RegisterInvariants(ir sdk.InvariantRouter, ak auth.AccountKeeper) {
|
||||
func RegisterInvariants(ir sdk.InvariantRegistry, ak auth.AccountKeeper) {
|
||||
ir.RegisterRoute(types.ModuleName, "nonnegative-outstanding",
|
||||
NonnegativeBalanceInvariant(ak))
|
||||
}
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ func (AppModule) Name() string {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRouter) {
|
||||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
|
||||
RegisterInvariants(ir, am.accountKeeper)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ func (AppModule) Name() string {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (AppModule) RegisterInvariants(_ sdk.InvariantRouter) {}
|
||||
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// module querier route name
|
||||
func (AppModule) Route() string {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// register all distribution invariants
|
||||
func RegisterInvariants(ir sdk.InvariantRouter, k Keeper) {
|
||||
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) {
|
||||
ir.RegisterRoute(types.ModuleName, "nonnegative-outstanding",
|
||||
NonNegativeOutstandingInvariant(k))
|
||||
ir.RegisterRoute(types.ModuleName, "can-withdraw",
|
||||
|
||||
@@ -84,7 +84,7 @@ func (AppModule) Name() string {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRouter) {
|
||||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
|
||||
RegisterInvariants(ir, am.keeper)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ func (AppModule) Name() string {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (AppModule) RegisterInvariants(_ sdk.InvariantRouter) {}
|
||||
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// module message route name
|
||||
func (AppModule) Route() string {
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ func (AppModule) Name() string {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (am AppModule) RegisterInvariants(_ sdk.InvariantRouter) {}
|
||||
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// module message route name
|
||||
func (AppModule) Route() string { return "" }
|
||||
|
||||
@@ -90,7 +90,7 @@ func (AppModule) Name() string {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (am AppModule) RegisterInvariants(_ sdk.InvariantRouter) {}
|
||||
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// module message route name
|
||||
func (AppModule) Route() string {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// register all staking invariants
|
||||
func RegisterInvariants(ir sdk.InvariantRouter, k Keeper, f types.FeeCollectionKeeper,
|
||||
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper, f types.FeeCollectionKeeper,
|
||||
d types.DistributionKeeper, am types.AccountKeeper) {
|
||||
|
||||
ir.RegisterRoute(types.ModuleName, "supply",
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ func (AppModule) Name() string {
|
||||
}
|
||||
|
||||
// register invariants
|
||||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRouter) {
|
||||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
|
||||
RegisterInvariants(ir, am.keeper, am.fcKeeper, am.distrKeeper, am.accKeeper)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user