diff --git a/baseapp/params.go b/baseapp/params.go index e584fa3fc6bc..9d6f5dd4611a 100644 --- a/baseapp/params.go +++ b/baseapp/params.go @@ -15,12 +15,3 @@ type ParamStore interface { Has(ctx context.Context) (bool, error) Set(ctx context.Context, cp cmtproto.ConsensusParams) error } - -// AppVersionModifier defines the interface fulfilled by BaseApp -// which allows getting and setting it's appVersion field. This -// in turn updates the consensus params that are sent to the -// consensus engine in EndBlock -type AppVersionModifier interface { - SetAppVersion(context.Context, uint64) error - AppVersion(context.Context) (uint64, error) -} diff --git a/core/app/app.go b/core/app/app.go index e77b11dd1400..5bc62bdf1cde 100644 --- a/core/app/app.go +++ b/core/app/app.go @@ -1,6 +1,7 @@ package app import ( + "context" "time" appmodulev2 "cosmossdk.io/core/appmodule/v2" @@ -64,3 +65,12 @@ type TxResult struct { GasUsed uint64 Codespace string } + +// VersionModifier defines the interface fulfilled by BaseApp +// which allows getting and setting it's appVersion field. This +// in turn updates the consensus params that are sent to the +// consensus engine in EndBlock +type VersionModifier interface { + SetAppVersion(context.Context, uint64) error + AppVersion(context.Context) (uint64, error) +} diff --git a/runtime/module.go b/runtime/module.go index 435515e4cb53..ad8aed2b0935 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -15,6 +15,7 @@ import ( reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" "cosmossdk.io/core/address" + "cosmossdk.io/core/app" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/comet" "cosmossdk.io/core/genesis" @@ -281,7 +282,7 @@ func ProvideTransientStoreService(key depinject.ModuleKey, app *AppBuilder) stor return transientStoreService{key: storeKey} } -func ProvideAppVersionModifier(app *AppBuilder) baseapp.AppVersionModifier { +func ProvideAppVersionModifier(app *AppBuilder) app.VersionModifier { return app.app } diff --git a/x/upgrade/depinject.go b/x/upgrade/depinject.go index 29fbce81ad16..08d00cdf843f 100644 --- a/x/upgrade/depinject.go +++ b/x/upgrade/depinject.go @@ -5,6 +5,7 @@ import ( modulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" "cosmossdk.io/core/address" + "cosmossdk.io/core/app" "cosmossdk.io/core/appmodule" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" @@ -12,7 +13,6 @@ import ( "cosmossdk.io/x/upgrade/keeper" "cosmossdk.io/x/upgrade/types" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/server" @@ -39,7 +39,7 @@ type ModuleInputs struct { Environment appmodule.Environment Cdc codec.Codec AddressCodec address.Codec - AppVersionModifier baseapp.AppVersionModifier + AppVersionModifier app.VersionModifier AppOpts servertypes.AppOptions `optional:"true"` } diff --git a/x/upgrade/exported/exported.go b/x/upgrade/exported/exported.go deleted file mode 100644 index efb73e526839..000000000000 --- a/x/upgrade/exported/exported.go +++ /dev/null @@ -1,11 +0,0 @@ -package exported - -import ( - "github.com/cosmos/cosmos-sdk/baseapp" -) - -// AppVersionModifier defines the interface fulfilled by BaseApp -// which allows getting and setting it's appVersion field. This -// in turn updates the consensus params that are sent to the -// consensus engine in EndBlock -type AppVersionModifier baseapp.AppVersionModifier diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index bd957a6de654..e11904e1b4bd 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -14,11 +14,11 @@ import ( "github.com/hashicorp/go-metrics" + "cosmossdk.io/core/app" "cosmossdk.io/core/appmodule" errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" - xp "cosmossdk.io/x/upgrade/exported" "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/codec" @@ -36,7 +36,7 @@ type Keeper struct { skipUpgradeHeights map[int64]bool // map of heights to skip for an upgrade cdc codec.BinaryCodec // App-wide binary codec upgradeHandlers map[string]types.UpgradeHandler // map of plan name to upgrade handler - versionModifier xp.AppVersionModifier // implements setting the protocol version field on BaseApp + versionModifier app.VersionModifier // implements setting the protocol version field on BaseApp downgradeVerified bool // tells if we've already sanity checked that this binary version isn't being used against an old state. authority string // the address capable of executing and canceling an upgrade. Usually the gov module account initVersionMap module.VersionMap // the module version map at init genesis @@ -48,7 +48,14 @@ type Keeper struct { // cdc - the app-wide binary codec // homePath - root directory of the application's config // vs - the interface implemented by baseapp which allows setting baseapp's protocol version field -func NewKeeper(env appmodule.Environment, skipUpgradeHeights map[int64]bool, cdc codec.BinaryCodec, homePath string, vs xp.AppVersionModifier, authority string) *Keeper { +func NewKeeper( + env appmodule.Environment, + skipUpgradeHeights map[int64]bool, + cdc codec.BinaryCodec, + homePath string, + vs app.VersionModifier, + authority string, +) *Keeper { k := &Keeper{ Environment: env, homePath: homePath,