Skip to content

Commit 07eebe3

Browse files
chore(baseapp): deprecate invariants (backport #24664) (#24714)
Co-authored-by: Alex | Interchain Labs <[email protected]>
1 parent fa2c766 commit 07eebe3

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
3636

3737
# Changelog
3838

39-
## [v0.53.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.0) - 2025-04-29
39+
## [v0.53.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.0) - 2025-04-29
4040

4141
### Features
4242

types/invariant.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@ import "fmt"
66
// The invariant returns a descriptive message about what happened
77
// and a boolean indicating whether the invariant has been broken.
88
// The simulator will then halt and print the logs.
9+
//
10+
// Deprecated: the Invariant type is deprecated and will be removed once x/crisis is removed.
911
type Invariant func(ctx Context) (string, bool)
1012

1113
// Invariants defines a group of invariants
14+
//
15+
// Deprecated: the Invariants type is deprecated and will be removed once x/crisis is removed.
1216
type Invariants []Invariant
1317

1418
// expected interface for registering invariants
19+
//
20+
// Deprecated: the InvariantRegistry type is deprecated and will be removed once x/crisis is removed.
1521
type InvariantRegistry interface {
1622
RegisterRoute(moduleName, route string, invar Invariant)
1723
}
1824

1925
// FormatInvariant returns a standardized invariant message.
26+
//
27+
// Deprecated: the FormatInvariant type is deprecated and will be removed once x/crisis is removed.
2028
func FormatInvariant(module, name, msg string) string {
2129
return fmt.Sprintf("%s: %s invariant\n%s\n", module, name, msg)
2230
}

types/module/module.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ type AppModule interface {
210210
// Deprecated: this will be removed in the next Cosmos SDK release.
211211
type HasInvariants interface {
212212
// RegisterInvariants registers module invariants.
213-
RegisterInvariants(sdk.InvariantRegistry)
213+
RegisterInvariants(sdk.InvariantRegistry) // nolint: staticcheck // deprecated interface
214214
}
215215

216216
// HasServices is the interface for modules to register services.
@@ -268,6 +268,8 @@ func (GenesisOnlyAppModule) IsOnePerModuleType() {}
268268
func (GenesisOnlyAppModule) IsAppModule() {}
269269

270270
// RegisterInvariants is a placeholder function register no invariants
271+
//
272+
// Deprecated: this function will be removed when x/crisis and invariants are removed from the cosmos SDK.
271273
func (GenesisOnlyAppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
272274

273275
// ConsensusVersion implements AppModule/ConsensusVersion.

0 commit comments

Comments
 (0)