chore(baseapp): deprecate invariants (backport #24664) (#24714)

Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
This commit is contained in:
mergify[bot] 2025-05-08 17:05:02 +00:00 committed by GitHub
parent fa2c766025
commit 07eebe392e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View File

@ -36,7 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
# Changelog
## [v0.53.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.0) - 2025-04-29
## [v0.53.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.0) - 2025-04-29
### Features

View File

@ -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)
}

View File

@ -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.