Skip to content

Commit

Permalink
keep UpgradeModule
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Aug 18, 2023
1 parent 6aef95e commit 952c619
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

* [#17421](https://github.com/cosmos/cosmos-sdk/pull/17421) Remove `appmodule.UpgradeModule` and add `appmodule.HasPreBlocker` interface.
* [#17421](https://github.com/cosmos/cosmos-sdk/pull/17421) Add `appmodule.HasPreBlocker` interface.

## [v0.10.0](https://github.com/cosmos/cosmos-sdk/releases/tag/core%2Fv0.10.0)

Expand Down
7 changes: 7 additions & 0 deletions core/appmodule/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,10 @@ type HasEndBlocker interface {
// a block.
EndBlock(context.Context) error
}

// UpgradeModule is the extension interface that upgrade module should implement to differentiate
// it from other modules, migration handler need ensure the upgrade module's migration is executed
// before the rest of the modules.
type UpgradeModule interface {
IsUpgradeModule()
}
1 change: 1 addition & 0 deletions docs/docs/building-modules/01-module-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The above interfaces are mostly embedding smaller interfaces (extension interfac
* [`appmodule.HasEndBlocker`](#hasendblocker): The extension interface that contains information about the `AppModule` and `EndBlock`.
* [`appmodule.HasPrecommit`](#hasprecommit): The extension interface that contains information about the `AppModule` and `Precommit`.
* [`appmodule.HasPrepareCheckState`](#haspreparecheckstate): The extension interface that contains information about the `AppModule` and `PrepareCheckState`.
* [`appmodule.UpgradeModule`]: The extension interface that signify if the `AppModule` if the module is an upgrade module.
* [`appmodule.HasService` / `module.HasServices`](#hasservices): The extension interface for modules to register services.
* [`module.HasABCIEndblock`](#hasabciendblock): The extension interface that contains information about the `AppModule`, `EndBlock` and returns an updated validator set.
* (legacy) [`module.HasInvariants`](#hasinvariants): The extension interface for registering invariants.
Expand Down
5 changes: 5 additions & 0 deletions types/module/mock_appmodule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ type CoreAppModule interface {
appmodule.HasPrecommit
appmodule.HasPrepareCheckState
}

type CoreUpgradeAppModule interface {
CoreAppModule
appmodule.UpgradeModule
}
3 changes: 3 additions & 0 deletions x/upgrade/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ func (am AppModule) BeginBlock(ctx context.Context) error {
return nil
}

// IsUpgradeModule implements the module.UpgradeModule interface.
func (am AppModuleBasic) IsUpgradeModule() {}

//
// App Wiring Setup
//
Expand Down

0 comments on commit 952c619

Please sign in to comment.