chore(baseapp): deprecate invariants (#24664)
This commit is contained in:
@@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
* (x/nft) [#24575](https://github.com/cosmos/cosmos-sdk/pull/24575) Deprecate the `x/nft` module in the Cosmos SDK repository. This module will not be maintained to the extent that our core modules will and will be kept in a [legacy repo](https://github.com/cosmos/cosmos-legacy).
|
||||
* (x/group) [#24571](https://github.com/cosmos/cosmos-sdk/pull/24571) Deprecate the `x/group` module in the Cosmos SDK repository. This module will not be maintained to the extent that our core modules will and will be kept in a [legacy repo](https://github.com/cosmos/cosmos-legacy).
|
||||
* (types) [#24664](https://github.com/cosmos/cosmos-sdk/pull/24664) Deprecate the `Invariant` type in the Cosmos SDK.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
@@ -6,17 +6,25 @@ import "fmt"
|
||||
// The invariant returns a descriptive message about what happened
|
||||
// and a boolean indicating whether the invariant has been broken.
|
||||
// The simulator will then halt and print the logs.
|
||||
//
|
||||
// Deprecated: the Invariant type is deprecated and will be removed once x/crisis is removed.
|
||||
type Invariant func(ctx Context) (string, bool)
|
||||
|
||||
// Invariants defines a group of invariants
|
||||
//
|
||||
// Deprecated: the Invariants type is deprecated and will be removed once x/crisis is removed.
|
||||
type Invariants []Invariant
|
||||
|
||||
// expected interface for registering invariants
|
||||
//
|
||||
// Deprecated: the InvariantRegistry type is deprecated and will be removed once x/crisis is removed.
|
||||
type InvariantRegistry interface {
|
||||
RegisterRoute(moduleName, route string, invar Invariant)
|
||||
}
|
||||
|
||||
// FormatInvariant returns a standardized invariant message.
|
||||
//
|
||||
// Deprecated: the FormatInvariant type is deprecated and will be removed once x/crisis is removed.
|
||||
func FormatInvariant(module, name, msg string) string {
|
||||
return fmt.Sprintf("%s: %s invariant\n%s\n", module, name, msg)
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ type AppModule interface {
|
||||
// Deprecated: this will be removed in the next Cosmos SDK release.
|
||||
type HasInvariants interface {
|
||||
// RegisterInvariants registers module invariants.
|
||||
RegisterInvariants(sdk.InvariantRegistry)
|
||||
RegisterInvariants(sdk.InvariantRegistry) // nolint: staticcheck // deprecated interface
|
||||
}
|
||||
|
||||
// HasServices is the interface for modules to register services.
|
||||
@@ -268,6 +268,8 @@ func (GenesisOnlyAppModule) IsOnePerModuleType() {}
|
||||
func (GenesisOnlyAppModule) IsAppModule() {}
|
||||
|
||||
// RegisterInvariants is a placeholder function register no invariants
|
||||
//
|
||||
// Deprecated: this function will be removed when x/crisis and invariants are removed from the cosmos SDK.
|
||||
func (GenesisOnlyAppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// ConsensusVersion implements AppModule/ConsensusVersion.
|
||||
|
||||
Reference in New Issue
Block a user