diff --git a/types/invariant.go b/types/invariant.go index 01209d1784..3a87904adc 100644 --- a/types/invariant.go +++ b/types/invariant.go @@ -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) } diff --git a/types/module/module.go b/types/module/module.go index 162c0c6ec2..ca2f0ed3ff 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -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) } } diff --git a/x/auth/module.go b/x/auth/module.go index e406499e21..e9bdf61d72 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -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 "" } diff --git a/x/bank/invariants.go b/x/bank/invariants.go index bd1528aa6e..c183c9ebb4 100644 --- a/x/bank/invariants.go +++ b/x/bank/invariants.go @@ -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)) } diff --git a/x/bank/module.go b/x/bank/module.go index 3e63d415e5..2499c2e9ab 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -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) } diff --git a/x/crisis/module.go b/x/crisis/module.go index 1ccf0feba7..c3dd7a41f5 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -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 { diff --git a/x/distribution/keeper/invariants.go b/x/distribution/keeper/invariants.go index 0814c876b8..568db2848e 100644 --- a/x/distribution/keeper/invariants.go +++ b/x/distribution/keeper/invariants.go @@ -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", diff --git a/x/distribution/module.go b/x/distribution/module.go index 392e7f90a5..a915c49b89 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -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) } diff --git a/x/gov/module.go b/x/gov/module.go index ab4ba9ba32..73db7cdeb2 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -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 { diff --git a/x/mint/module.go b/x/mint/module.go index fcea355c18..41a47ac41c 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -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 "" } diff --git a/x/slashing/module.go b/x/slashing/module.go index 873a750e6f..c8771c1609 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -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 { diff --git a/x/staking/keeper/invariants.go b/x/staking/keeper/invariants.go index a572d9197b..df4c69216b 100644 --- a/x/staking/keeper/invariants.go +++ b/x/staking/keeper/invariants.go @@ -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", diff --git a/x/staking/module.go b/x/staking/module.go index a624b55318..527c50ed16 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -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) }