Skip to content

Commit

Permalink
Merge PR cosmos#4502: InvariantRouter -> InvariantRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
rigelrozanski authored and alexanderbez committed Jun 6, 2019
1 parent 86da70d commit 1a2a540
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions types/invariant.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
8 changes: 4 additions & 4 deletions types/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type AppModule interface {
AppModuleGenesis

// registers
RegisterInvariants(sdk.InvariantRouter)
RegisterInvariants(sdk.InvariantRegistry)

// routes
Route() string
Expand All @@ -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 "" }
Expand Down Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion x/auth/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 "" }
Expand Down
2 changes: 1 addition & 1 deletion x/bank/invariants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion x/bank/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion x/crisis/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion x/distribution/keeper/invariants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion x/distribution/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion x/gov/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion x/mint/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 "" }
Expand Down
2 changes: 1 addition & 1 deletion x/slashing/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion x/staking/keeper/invariants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion x/staking/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 1a2a540

Please sign in to comment.