From 00cee72b4481388042bd14e67b119e98da454445 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 22 May 2023 10:22:01 +0200 Subject: [PATCH 01/20] feat!: connect app version with consensus params in end block --- baseapp/abci.go | 3 ++- baseapp/abci_test.go | 3 ++- baseapp/baseapp.go | 20 +++++++++----- baseapp/options.go | 21 ++++++++++++--- simapp/app_test.go | 2 -- x/upgrade/abci_test.go | 3 +-- x/upgrade/exported/exported.go | 13 +++++++--- x/upgrade/keeper/keeper.go | 46 ++++----------------------------- x/upgrade/keeper/keeper_test.go | 14 ++++------ x/upgrade/module.go | 20 ++++++-------- x/upgrade/types/keys.go | 3 +-- 11 files changed, 65 insertions(+), 83 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 123f23197039..5f42abe23105 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -1,6 +1,7 @@ package baseapp import ( + "context" "crypto/sha256" "errors" "fmt" @@ -135,7 +136,7 @@ func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo { return abci.ResponseInfo{ Data: app.name, Version: app.version, - AppVersion: app.appVersion, + AppVersion: app.AppVersion(context.Background()), LastBlockHeight: lastCommitID.Version, LastBlockAppHash: lastCommitID.Hash, } diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index 674a209b3a08..3460a901e963 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -2,6 +2,7 @@ package baseapp_test import ( "bytes" + "context" "errors" "fmt" "strings" @@ -41,7 +42,7 @@ func TestABCI_Info(t *testing.T) { require.Equal(t, t.Name(), res.GetData()) require.Equal(t, int64(0), res.LastBlockHeight) require.Equal(t, []uint8(nil), res.LastBlockAppHash) - require.Equal(t, suite.baseApp.AppVersion(), res.AppVersion) + require.Equal(t, suite.baseApp.AppVersion(context.Background()), res.AppVersion) } func TestABCI_InitChain(t *testing.T) { diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index bffe143f6d54..3f42d13f1819 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -1,6 +1,7 @@ package baseapp import ( + "context" "fmt" "sort" "strconv" @@ -126,10 +127,6 @@ type BaseApp struct { // application's version string version string - // application's protocol version that increments on every upgrade - // if BaseApp is passed to the upgrade keeper's NewKeeper method. - appVersion uint64 - // recovery handler for app.runTx method runTxRecoveryMiddleware recoveryMiddleware @@ -199,8 +196,19 @@ func (app *BaseApp) Name() string { } // AppVersion returns the application's protocol version. -func (app *BaseApp) AppVersion() uint64 { - return app.appVersion +func (app *BaseApp) AppVersion(ctx context.Context) uint64 { + if app.paramStore == nil { + return 0 + } + + cp, err := app.paramStore.Get(ctx) + if err != nil { + panic(err) + } + if cp.Version == nil { + return 0 + } + return cp.Version.App } // Version returns the application's version string. diff --git a/baseapp/options.go b/baseapp/options.go index c30488df4ee7..88b510c182ea 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -1,6 +1,8 @@ package baseapp import ( + "context" + "errors" "fmt" "io" @@ -122,9 +124,22 @@ func (app *BaseApp) SetVersion(v string) { app.version = v } -// SetProtocolVersion sets the application's protocol version -func (app *BaseApp) SetProtocolVersion(v uint64) { - app.appVersion = v +// SetAppVersion sets the application's version this is used as part of the +// header in blocks and is returned to the consensus engine in EndBlock. +func (app *BaseApp) SetAppVersion(ctx context.Context, v uint64) error { + if app.paramStore == nil { + return errors.New("param store must be set to set app version") + } + + cp, err := app.paramStore.Get(ctx) + if err != nil { + return err + } + cp.Version.App = v + if err := app.paramStore.Set(ctx, cp); err != nil { + return err + } + return nil } func (app *BaseApp) SetDB(db dbm.DB) { diff --git a/simapp/app_test.go b/simapp/app_test.go index 28268ab416dc..99e32ebb53fa 100644 --- a/simapp/app_test.go +++ b/simapp/app_test.go @@ -269,8 +269,6 @@ func TestUpgradeStateOnGenesis(t *testing.T) { require.Equal(t, vm[v], i.ConsensusVersion()) } } - - require.NotNil(t, app.UpgradeKeeper.GetVersionSetter()) } // TestMergedRegistry tests that fetching the gogo/protov2 merged registry diff --git a/x/upgrade/abci_test.go b/x/upgrade/abci_test.go index c3ccf4a0871a..4ed0f4437911 100644 --- a/x/upgrade/abci_test.go +++ b/x/upgrade/abci_test.go @@ -53,8 +53,7 @@ func setupTest(t *testing.T, height int64, skip map[int64]bool) *TestSuite { s.encCfg.TxConfig.TxDecoder(), ) - s.keeper = keeper.NewKeeper(skip, key, s.encCfg.Codec, t.TempDir(), nil, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - s.keeper.SetVersionSetter(s.baseApp) + s.keeper = keeper.NewKeeper(skip, key, s.encCfg.Codec, t.TempDir(), s.baseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) s.ctx = testCtx.Ctx.WithBlockHeader(cmtproto.Header{Time: time.Now(), Height: height}) diff --git a/x/upgrade/exported/exported.go b/x/upgrade/exported/exported.go index 859f7fe1f011..4571b1f9c888 100644 --- a/x/upgrade/exported/exported.go +++ b/x/upgrade/exported/exported.go @@ -1,7 +1,12 @@ package exported -// ProtocolVersionSetter defines the interface fulfilled by BaseApp -// which allows setting it's appVersion field. -type ProtocolVersionSetter interface { - SetProtocolVersion(uint64) +import "context" + +// 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 } diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 143f8225fd5e..2b9f7b5fe2bc 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -36,7 +36,7 @@ type Keeper struct { storeKey storetypes.StoreKey // key to access x/upgrade store cdc codec.BinaryCodec // App-wide binary codec upgradeHandlers map[string]types.UpgradeHandler // map of plan name to upgrade handler - versionSetter xp.ProtocolVersionSetter // implements setting the protocol version field on BaseApp + versionModifier xp.AppVersionModifier // 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,14 +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(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authority string) *Keeper { +func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.AppVersionModifier, authority string) *Keeper { k := &Keeper{ homePath: homePath, skipUpgradeHeights: skipUpgradeHeights, storeKey: storeKey, cdc: cdc, upgradeHandlers: map[string]types.UpgradeHandler{}, - versionSetter: vs, + versionModifier: vs, authority: authority, } @@ -66,16 +66,6 @@ func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, return k } -// SetVersionSetter sets the interface implemented by baseapp which allows setting baseapp's protocol version field -func (k *Keeper) SetVersionSetter(vs xp.ProtocolVersionSetter) { - k.versionSetter = vs -} - -// GetVersionSetter gets the protocol version field of baseapp -func (k *Keeper) GetVersionSetter() xp.ProtocolVersionSetter { - return k.versionSetter -} - // SetInitVersionMap sets the initial version map. // This is only used in app wiring and should not be used in any other context. func (k *Keeper) SetInitVersionMap(vm module.VersionMap) { @@ -95,28 +85,6 @@ func (k Keeper) SetUpgradeHandler(name string, upgradeHandler types.UpgradeHandl k.upgradeHandlers[name] = upgradeHandler } -// setProtocolVersion sets the protocol version to state -func (k Keeper) setProtocolVersion(ctx sdk.Context, v uint64) { - store := ctx.KVStore(k.storeKey) - versionBytes := make([]byte, 8) - binary.BigEndian.PutUint64(versionBytes, v) - store.Set([]byte{types.ProtocolVersionByte}, versionBytes) -} - -// getProtocolVersion gets the protocol version from state -func (k Keeper) getProtocolVersion(ctx sdk.Context) uint64 { - store := ctx.KVStore(k.storeKey) - ok := store.Has([]byte{types.ProtocolVersionByte}) - if ok { - pvBytes := store.Get([]byte{types.ProtocolVersionByte}) - protocolVersion := binary.BigEndian.Uint64(pvBytes) - - return protocolVersion - } - // default value - return 0 -} - // SetModuleVersionMap saves a given version map to state func (k Keeper) SetModuleVersionMap(ctx sdk.Context, vm module.VersionMap) { if len(vm) > 0 { @@ -376,12 +344,8 @@ func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) { k.SetModuleVersionMap(ctx, updatedVM) // incremement the protocol version and set it in state and baseapp - nextProtocolVersion := k.getProtocolVersion(ctx) + 1 - k.setProtocolVersion(ctx, nextProtocolVersion) - if k.versionSetter != nil { - // set protocol version on BaseApp - k.versionSetter.SetProtocolVersion(nextProtocolVersion) - } + nextProtocolVersion := k.versionModifier.AppVersion(ctx) + 1 + k.versionModifier.SetAppVersion(ctx, nextProtocolVersion) // Must clear IBC state after upgrade is applied as it is stored separately from the upgrade plan. // This will prevent resubmission of upgrade msg after upgrade is already completed. diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 0e699806d18b..124e769e7bee 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "context" "path/filepath" "testing" "time" @@ -53,11 +54,7 @@ func (s *KeeperTestSuite) SetupTest() { skipUpgradeHeights := make(map[int64]bool) homeDir := filepath.Join(s.T().TempDir(), "x_upgrade_keeper_test") - s.upgradeKeeper = keeper.NewKeeper(skipUpgradeHeights, key, s.encCfg.Codec, homeDir, nil, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - s.upgradeKeeper.SetVersionSetter(s.baseApp) - - vs := s.upgradeKeeper.GetVersionSetter() - s.Require().Equal(vs, s.baseApp) + s.upgradeKeeper = keeper.NewKeeper(skipUpgradeHeights, key, s.encCfg.Codec, homeDir, s.baseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) s.Require().Equal(testCtx.Ctx.Logger().With("module", "x/"+types.ModuleName), s.upgradeKeeper.Logger(testCtx.Ctx)) s.T().Log("home dir:", homeDir) @@ -228,8 +225,7 @@ func (s *KeeperTestSuite) TestIsSkipHeight() { ok := s.upgradeKeeper.IsSkipHeight(11) s.Require().False(ok) skip := map[int64]bool{skipOne: true} - upgradeKeeper := keeper.NewKeeper(skip, s.key, s.encCfg.Codec, s.T().TempDir(), nil, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - upgradeKeeper.SetVersionSetter(s.baseApp) + upgradeKeeper := keeper.NewKeeper(skip, s.key, s.encCfg.Codec, s.T().TempDir(), s.baseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) s.Require().True(upgradeKeeper.IsSkipHeight(9)) s.Require().False(upgradeKeeper.IsSkipHeight(10)) } @@ -251,7 +247,7 @@ func (s *KeeperTestSuite) TestDowngradeVerified() { // Test that the protocol version successfully increments after an // upgrade and is successfully set on BaseApp's appVersion. func (s *KeeperTestSuite) TestIncrementProtocolVersion() { - oldProtocolVersion := s.baseApp.AppVersion() + oldProtocolVersion := s.baseApp.AppVersion(context.Background()) res := s.upgradeKeeper.HasHandler("dummy") s.Require().False(res) dummyPlan := types.Plan{ @@ -267,7 +263,7 @@ func (s *KeeperTestSuite) TestIncrementProtocolVersion() { s.upgradeKeeper.SetUpgradeHandler("dummy", func(_ sdk.Context, _ types.Plan, vm module.VersionMap) (module.VersionMap, error) { return vm, nil }) s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan) - upgradedProtocolVersion := s.baseApp.AppVersion() + upgradedProtocolVersion := s.baseApp.AppVersion(context.Background()) s.Require().Equal(oldProtocolVersion+1, upgradedProtocolVersion) } diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 77938040fbf3..da4020bb410b 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -17,15 +17,14 @@ import ( store "cosmossdk.io/store/types" "cosmossdk.io/x/upgrade/client/cli" + xp "cosmossdk.io/x/upgrade/exported" "cosmossdk.io/x/upgrade/keeper" "cosmossdk.io/x/upgrade/types" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -177,10 +176,11 @@ func init() { type ModuleInputs struct { depinject.In - Config *modulev1.Module - Key *store.KVStoreKey - Cdc codec.Codec - AddressCodec address.Codec + Config *modulev1.Module + Key *store.KVStoreKey + Cdc codec.Codec + AddressCodec address.Codec + AppVersionModifier xp.AppVersionModifier AppOpts servertypes.AppOptions `optional:"true"` } @@ -191,7 +191,6 @@ type ModuleOutputs struct { UpgradeKeeper *keeper.Keeper Module appmodule.AppModule GovHandler govv1beta1.HandlerRoute - BaseAppOption runtime.BaseAppOption } func ProvideModule(in ModuleInputs) ModuleOutputs { @@ -215,14 +214,11 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { } // set the governance module account as the authority for conducting upgrades - k := keeper.NewKeeper(skipUpgradeHeights, in.Key, in.Cdc, homePath, nil, authority.String()) - baseappOpt := func(app *baseapp.BaseApp) { - k.SetVersionSetter(app) - } + k := keeper.NewKeeper(skipUpgradeHeights, in.Key, in.Cdc, homePath, in.AppVersionModifier, authority.String()) m := NewAppModule(k, in.AddressCodec) gh := govv1beta1.HandlerRoute{RouteKey: types.RouterKey, Handler: NewSoftwareUpgradeProposalHandler(k)} - return ModuleOutputs{UpgradeKeeper: k, Module: m, GovHandler: gh, BaseAppOption: baseappOpt} + return ModuleOutputs{UpgradeKeeper: k, Module: m, GovHandler: gh} } func PopulateVersionMap(upgradeKeeper *keeper.Keeper, modules map[string]appmodule.AppModule) { diff --git a/x/upgrade/types/keys.go b/x/upgrade/types/keys.go index bf11e6512fad..b03c5b350694 100644 --- a/x/upgrade/types/keys.go +++ b/x/upgrade/types/keys.go @@ -23,8 +23,7 @@ const ( // VersionMapByte is a prefix to look up module names (key) and versions (value) VersionMapByte = 0x2 - // ProtocolVersionByte is a prefix to look up Protocol Version - ProtocolVersionByte = 0x3 + // 0x3 is reserved. It was previously used to set and get the app version // KeyUpgradedIBCState is the key under which upgraded ibc state is stored in the upgrade store KeyUpgradedIBCState = "upgradedIBCState" From bfec2f81adf3cbd1cf0ec35a724e7dd530fff08d Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 22 May 2023 15:40:31 +0200 Subject: [PATCH 02/20] add migration and bump to version 3 --- x/upgrade/keeper/migrations.go | 25 +++++++++++++++++++++++++ x/upgrade/module.go | 6 +++++- x/upgrade/types/keys.go | 3 ++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/x/upgrade/keeper/migrations.go b/x/upgrade/keeper/migrations.go index 206623af2b1a..7b9cb6cd8b76 100644 --- a/x/upgrade/keeper/migrations.go +++ b/x/upgrade/keeper/migrations.go @@ -2,6 +2,7 @@ package keeper import ( "encoding/binary" + "fmt" "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" @@ -42,3 +43,27 @@ func migrateDoneUpgradeKeys(ctx sdk.Context, storeKey storetypes.StoreKey) error } return nil } + +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return migrateAppVersion(ctx, m.keeper) +} + +func migrateAppVersion(ctx sdk.Context, keeper *Keeper) error { + if keeper.versionModifier == nil { + return fmt.Errorf("version modifier is not set") + } + store := ctx.KVStore(keeper.storeKey) + // if the key was never set then we don't need to + if !store.Has([]byte{types.LegacyProtocolVersionByte}) { + return nil + } + versionBytes := store.Get([]byte{types.LegacyProtocolVersionByte}) + appVersion := binary.BigEndian.Uint64(versionBytes) + + if err := keeper.versionModifier.SetAppVersion(ctx, appVersion); err != nil { + return fmt.Errorf("error migration app version: %w", err) + } + + store.Delete([]byte{types.LegacyProtocolVersionByte}) + return nil +} diff --git a/x/upgrade/module.go b/x/upgrade/module.go index da4020bb410b..3ff4ece5b9ba 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -39,7 +39,7 @@ func init() { } // ConsensusVersion defines the current x/upgrade module consensus version. -const ConsensusVersion uint64 = 2 +const ConsensusVersion uint64 = 3 var _ module.AppModuleBasic = AppModuleBasic{} @@ -115,6 +115,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err != nil { panic(fmt.Sprintf("failed to migrate x/%s from version 1 to 2: %v", types.ModuleName, err)) } + err = cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3) + if err != nil { + panic(fmt.Sprintf("failed to migrate x/%s from version 2 to 3: %v", types.ModuleName, err)) + } } // InitGenesis is ignored, no sense in serializing future upgrades diff --git a/x/upgrade/types/keys.go b/x/upgrade/types/keys.go index b03c5b350694..2f5ae01fad7e 100644 --- a/x/upgrade/types/keys.go +++ b/x/upgrade/types/keys.go @@ -23,7 +23,8 @@ const ( // VersionMapByte is a prefix to look up module names (key) and versions (value) VersionMapByte = 0x2 - // 0x3 is reserved. It was previously used to set and get the app version + // LegacyProtocolVersionByte was the prefix to look up Protocol Version (AppVersion) + LegacyProtocolVersionByte = 0x3 // KeyUpgradedIBCState is the key under which upgraded ibc state is stored in the upgrade store KeyUpgradedIBCState = "upgradedIBCState" From 6dedbc067df613a76da27eeeee1e6870dcad93cb Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 23 May 2023 10:48:19 +0200 Subject: [PATCH 03/20] fix some of the broken tests --- baseapp/abci.go | 6 +++++- baseapp/abci_test.go | 8 ++++++-- baseapp/baseapp.go | 10 +++++----- x/upgrade/abci_test.go | 22 +++++++++++++++++++++ x/upgrade/exported/exported.go | 2 +- x/upgrade/keeper/keeper.go | 14 +++++++++++--- x/upgrade/keeper/keeper_test.go | 34 ++++++++++++++++++++++++++++++--- x/upgrade/keeper/migrations.go | 11 ++++++++--- x/upgrade/types/keys.go | 3 --- 9 files changed, 89 insertions(+), 21 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 5f42abe23105..6626faab6016 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -132,11 +132,15 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC // Info implements the ABCI interface. func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo { lastCommitID := app.cms.LastCommitID() + appVersion, err := app.AppVersion(context.Background()) + if err != nil { + panic(err) + } return abci.ResponseInfo{ Data: app.name, Version: app.version, - AppVersion: app.AppVersion(context.Background()), + AppVersion: appVersion, LastBlockHeight: lastCommitID.Version, LastBlockAppHash: lastCommitID.Hash, } diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index 3460a901e963..bb69bd37e225 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -2,7 +2,6 @@ package baseapp_test import ( "bytes" - "context" "errors" "fmt" "strings" @@ -12,6 +11,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmttypes "github.com/cometbft/cometbft/types" "github.com/cosmos/gogoproto/jsonpb" "github.com/stretchr/testify/require" @@ -34,6 +34,8 @@ import ( func TestABCI_Info(t *testing.T) { suite := NewBaseAppSuite(t) + ctx := suite.baseApp.NewContext(true, cmtproto.Header{}) + suite.baseApp.StoreConsensusParams(ctx, cmttypes.DefaultConsensusParams().ToProto()) reqInfo := abci.RequestInfo{} res := suite.baseApp.Info(reqInfo) @@ -42,7 +44,9 @@ func TestABCI_Info(t *testing.T) { require.Equal(t, t.Name(), res.GetData()) require.Equal(t, int64(0), res.LastBlockHeight) require.Equal(t, []uint8(nil), res.LastBlockAppHash) - require.Equal(t, suite.baseApp.AppVersion(context.Background()), res.AppVersion) + appVersion, err := suite.baseApp.AppVersion(ctx) + require.NoError(t, err) + require.Equal(t, appVersion, res.AppVersion) } func TestABCI_InitChain(t *testing.T) { diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 3f42d13f1819..742f86803508 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -196,19 +196,19 @@ func (app *BaseApp) Name() string { } // AppVersion returns the application's protocol version. -func (app *BaseApp) AppVersion(ctx context.Context) uint64 { +func (app *BaseApp) AppVersion(ctx context.Context) (uint64, error) { if app.paramStore == nil { - return 0 + return 0, errors.New("app.paramStore is nil") } cp, err := app.paramStore.Get(ctx) if err != nil { - panic(err) + return 0, fmt.Errorf("getting consensus params: %w", err) } if cp.Version == nil { - return 0 + return 0, nil } - return cp.Version.App + return cp.Version.App, nil } // Version returns the application's version string. diff --git a/x/upgrade/abci_test.go b/x/upgrade/abci_test.go index 4ed0f4437911..0438865786db 100644 --- a/x/upgrade/abci_test.go +++ b/x/upgrade/abci_test.go @@ -1,6 +1,7 @@ package upgrade_test import ( + "context" "errors" "os" "testing" @@ -10,6 +11,7 @@ import ( "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmttypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/baseapp" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/testutil" @@ -52,6 +54,7 @@ func setupTest(t *testing.T, height int64, skip map[int64]bool) *TestSuite { testCtx.DB, s.encCfg.TxConfig.TxDecoder(), ) + s.baseApp.SetParamStore(¶mStore{params: cmttypes.DefaultConsensusParams().ToProto()}) s.keeper = keeper.NewKeeper(skip, key, s.encCfg.Codec, t.TempDir(), s.baseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) @@ -549,3 +552,22 @@ func TestDowngradeVerification(t *testing.T) { } } } + +type paramStore struct { + params cmtproto.ConsensusParams +} + +var _ baseapp.ParamStore = (*paramStore)(nil) + +func (ps paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error { + ps.params = value + return nil +} + +func (ps paramStore) Has(_ context.Context) (bool, error) { + return true, nil +} + +func (ps paramStore) Get(_ context.Context) (cmtproto.ConsensusParams, error) { + return ps.params, nil +} diff --git a/x/upgrade/exported/exported.go b/x/upgrade/exported/exported.go index 4571b1f9c888..e648fd510a57 100644 --- a/x/upgrade/exported/exported.go +++ b/x/upgrade/exported/exported.go @@ -8,5 +8,5 @@ import "context" // consensus engine in EndBlock type AppVersionModifier interface { SetAppVersion(context.Context, uint64) error - AppVersion(context.Context) uint64 + AppVersion(context.Context) (uint64, error) } diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 2b9f7b5fe2bc..7dbf33f17b0c 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -343,9 +343,17 @@ func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) { k.SetModuleVersionMap(ctx, updatedVM) - // incremement the protocol version and set it in state and baseapp - nextProtocolVersion := k.versionModifier.AppVersion(ctx) + 1 - k.versionModifier.SetAppVersion(ctx, nextProtocolVersion) + // incremement the app version and set it in state and baseapp + if k.versionModifier != nil { + currentAppVersion, err := k.versionModifier.AppVersion(ctx) + if err != nil { + panic(err) + } + + if err := k.versionModifier.SetAppVersion(ctx, currentAppVersion + 1); err != nil { + panic(err) + } + } // Must clear IBC state after upgrade is applied as it is stored separately from the upgrade plan. // This will prevent resubmission of upgrade msg after upgrade is already completed. diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 124e769e7bee..c1fa149a628e 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -2,11 +2,13 @@ package keeper_test import ( "context" + "fmt" "path/filepath" "testing" "time" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmttypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/suite" "cosmossdk.io/log" @@ -43,6 +45,7 @@ func (s *KeeperTestSuite) SetupTest() { key := storetypes.NewKVStoreKey(types.StoreKey) s.key = key testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) + s.ctx = testCtx.Ctx.WithBlockHeader(cmtproto.Header{Time: time.Now(), Height: 10}) s.baseApp = baseapp.NewBaseApp( "upgrade", @@ -50,6 +53,10 @@ func (s *KeeperTestSuite) SetupTest() { testCtx.DB, s.encCfg.TxConfig.TxDecoder(), ) + s.baseApp.SetParamStore(¶mStore{params: cmttypes.DefaultConsensusParams().ToProto()}) + appVersion, err := s.baseApp.AppVersion(context.Background()) + s.Require().NoError(err) + s.Require().Equal(uint64(0), appVersion) skipUpgradeHeights := make(map[int64]bool) @@ -59,7 +66,6 @@ func (s *KeeperTestSuite) SetupTest() { s.Require().Equal(testCtx.Ctx.Logger().With("module", "x/"+types.ModuleName), s.upgradeKeeper.Logger(testCtx.Ctx)) s.T().Log("home dir:", homeDir) s.homeDir = homeDir - s.ctx = testCtx.Ctx.WithBlockHeader(cmtproto.Header{Time: time.Now(), Height: 10}) s.msgSrvr = keeper.NewMsgServerImpl(s.upgradeKeeper) s.addrs = simtestutil.CreateIncrementalAccounts(1) @@ -247,7 +253,8 @@ func (s *KeeperTestSuite) TestDowngradeVerified() { // Test that the protocol version successfully increments after an // upgrade and is successfully set on BaseApp's appVersion. func (s *KeeperTestSuite) TestIncrementProtocolVersion() { - oldProtocolVersion := s.baseApp.AppVersion(context.Background()) + oldProtocolVersion, err := s.baseApp.AppVersion(context.Background()) + s.Require().NoError(err) res := s.upgradeKeeper.HasHandler("dummy") s.Require().False(res) dummyPlan := types.Plan{ @@ -262,8 +269,10 @@ func (s *KeeperTestSuite) TestIncrementProtocolVersion() { ) s.upgradeKeeper.SetUpgradeHandler("dummy", func(_ sdk.Context, _ types.Plan, vm module.VersionMap) (module.VersionMap, error) { return vm, nil }) + fmt.Println("TestIncrementProtocolVersion") s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan) - upgradedProtocolVersion := s.baseApp.AppVersion(context.Background()) + upgradedProtocolVersion, err := s.baseApp.AppVersion(context.Background()) + s.Require().NoError(err) s.Require().Equal(oldProtocolVersion+1, upgradedProtocolVersion) } @@ -368,3 +377,22 @@ func (s *KeeperTestSuite) TestLastCompletedUpgradeOrdering() { func TestKeeperTestSuite(t *testing.T) { suite.Run(t, new(KeeperTestSuite)) } + +type paramStore struct { + params cmtproto.ConsensusParams +} + +var _ baseapp.ParamStore = (*paramStore)(nil) + +func (ps paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error { + ps.params = value + return nil +} + +func (ps paramStore) Has(_ context.Context) (bool, error) { + return true, nil +} + +func (ps paramStore) Get(_ context.Context) (cmtproto.ConsensusParams, error) { + return ps.params, nil +} diff --git a/x/upgrade/keeper/migrations.go b/x/upgrade/keeper/migrations.go index 7b9cb6cd8b76..99ebb9918a64 100644 --- a/x/upgrade/keeper/migrations.go +++ b/x/upgrade/keeper/migrations.go @@ -11,6 +11,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +const ( + // LegacyProtocolVersionByte was the prefix to look up Protocol Version (AppVersion) + LegacyProtocolVersionByte = 0x3 +) + // Migrator is a struct for handling in-place store migrations. type Migrator struct { keeper *Keeper @@ -54,16 +59,16 @@ func migrateAppVersion(ctx sdk.Context, keeper *Keeper) error { } store := ctx.KVStore(keeper.storeKey) // if the key was never set then we don't need to - if !store.Has([]byte{types.LegacyProtocolVersionByte}) { + if !store.Has([]byte{LegacyProtocolVersionByte}) { return nil } - versionBytes := store.Get([]byte{types.LegacyProtocolVersionByte}) + versionBytes := store.Get([]byte{LegacyProtocolVersionByte}) appVersion := binary.BigEndian.Uint64(versionBytes) if err := keeper.versionModifier.SetAppVersion(ctx, appVersion); err != nil { return fmt.Errorf("error migration app version: %w", err) } - store.Delete([]byte{types.LegacyProtocolVersionByte}) + store.Delete([]byte{LegacyProtocolVersionByte}) return nil } diff --git a/x/upgrade/types/keys.go b/x/upgrade/types/keys.go index 2f5ae01fad7e..2920aafaf614 100644 --- a/x/upgrade/types/keys.go +++ b/x/upgrade/types/keys.go @@ -23,9 +23,6 @@ const ( // VersionMapByte is a prefix to look up module names (key) and versions (value) VersionMapByte = 0x2 - // LegacyProtocolVersionByte was the prefix to look up Protocol Version (AppVersion) - LegacyProtocolVersionByte = 0x3 - // KeyUpgradedIBCState is the key under which upgraded ibc state is stored in the upgrade store KeyUpgradedIBCState = "upgradedIBCState" From e7f45a009bab24bf45cf53eae9fb0a31eedc3b4c Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 23 May 2023 10:55:16 +0200 Subject: [PATCH 04/20] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49d60ef0ab8e..cf8a804e87ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -127,6 +127,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/staking) [#14590](https://github.com/cosmos/cosmos-sdk/pull/14590) `MsgUndelegateResponse` now includes undelegated amount. `x/staking` module's `keeper.Undelegate` now returns 3 values (completionTime,undelegateAmount,error) instead of 2. * (x/staking) (#15731) (https://github.com/cosmos/cosmos-sdk/pull/15731) Introducing a new index to retrieve the delegations by validator efficiently. * (baseapp) [#15930](https://github.com/cosmos/cosmos-sdk/pull/15930) change vote info provided by prepare and process proposal to the one in the block +* (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) upgrade module no longer stores the app version but gets and sets the app version stored in the `ParamStore` of baseapp. ### API Breaking Changes @@ -214,7 +215,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * `simulation.NewOperationMsg` is now 2-arity instead of 3-arity with the obsolete argument `codec.ProtoCodec` removed. * The field `OperationMsg.Msg` is now of type `[]byte` instead of `json.RawMessage`. * (cli) [#16209](https://github.com/cosmos/cosmos-sdk/pull/16209) Add API `StartCmdWithOptions` to create customized start command. - +* (baseapp) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) `SetProtocolVersion` has been renamed to `SetAppVersion`. It now updates the consensus params in baseapp's `ParamStore`. ### Client Breaking Changes From b0bdf3b5e9d926815ed8f1e6b635864aaaa44876 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 24 May 2023 16:30:11 +0200 Subject: [PATCH 05/20] fix info call --- baseapp/abci.go | 18 ++++++++++++++---- baseapp/abci_test.go | 7 +++++++ baseapp/params.go | 11 +++++++++++ runtime/module.go | 5 +++++ x/upgrade/exported/exported.go | 9 ++++----- x/upgrade/module.go | 4 ++-- 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 6626faab6016..4609bce7535f 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -1,7 +1,6 @@ package baseapp import ( - "context" "crypto/sha256" "errors" "fmt" @@ -132,9 +131,20 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC // Info implements the ABCI interface. func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo { lastCommitID := app.cms.LastCommitID() - appVersion, err := app.AppVersion(context.Background()) - if err != nil { - panic(err) + qms := app.qms + if qms == nil { + qms = app.cms.(storetypes.MultiStore) + } + appVersion := InitialAppVersion + if lastCommitID.Version > 0 { + ctx, err := app.CreateQueryContext(lastCommitID.Version, false) + if err != nil { + panic(err) + } + appVersion, err = app.AppVersion(ctx) + if err != nil { + panic(err) + } } return abci.ResponseInfo{ diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index bb69bd37e225..00ad71fb2130 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -47,6 +47,13 @@ func TestABCI_Info(t *testing.T) { appVersion, err := suite.baseApp.AppVersion(ctx) require.NoError(t, err) require.Equal(t, appVersion, res.AppVersion) + + header := cmtproto.Header{Height: 1} + suite.baseApp.BeginBlock(abci.RequestBeginBlock{Header: header}) + suite.baseApp.Commit() + require.NoError(t, suite.baseApp.SetAppVersion(ctx, 1)) + res = suite.baseApp.Info(reqInfo) + require.Equal(t, uint64(1), res.AppVersion) } func TestABCI_InitChain(t *testing.T) { diff --git a/baseapp/params.go b/baseapp/params.go index 329ec1255b6f..0c39a95a3811 100644 --- a/baseapp/params.go +++ b/baseapp/params.go @@ -6,6 +6,8 @@ import ( cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" ) +const InitialAppVersion uint64 = 0 + // ParamStore defines the interface the parameter store used by the BaseApp must // fulfill. type ParamStore interface { @@ -13,3 +15,12 @@ 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/runtime/module.go b/runtime/module.go index c4ca32e8009f..2c1fe6d6f4f5 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -69,6 +69,7 @@ func init() { ProvideHeaderInfoService, ProvideCometInfoService, ProvideBasicManager, + ProvideAppVersionModifier, ), appmodule.Invoke(SetupAppBuilder), ) @@ -246,6 +247,10 @@ func ProvideBasicManager(app *AppBuilder) module.BasicManager { return app.app.basicManager } +func ProvideAppVersionModifier(app *AppBuilder) baseapp.AppVersionModifier { + return app.app +} + // globalAccAddressCodec is a temporary address codec that we will use until we // can populate it with the correct bech32 prefixes without depending on the global. type globalAccAddressCodec struct{} diff --git a/x/upgrade/exported/exported.go b/x/upgrade/exported/exported.go index e648fd510a57..efb73e526839 100644 --- a/x/upgrade/exported/exported.go +++ b/x/upgrade/exported/exported.go @@ -1,12 +1,11 @@ package exported -import "context" +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 interface { - SetAppVersion(context.Context, uint64) error - AppVersion(context.Context) (uint64, error) -} +type AppVersionModifier baseapp.AppVersionModifier diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 3ff4ece5b9ba..1790cd3f12c0 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -17,10 +17,10 @@ import ( store "cosmossdk.io/store/types" "cosmossdk.io/x/upgrade/client/cli" - xp "cosmossdk.io/x/upgrade/exported" "cosmossdk.io/x/upgrade/keeper" "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -184,7 +184,7 @@ type ModuleInputs struct { Key *store.KVStoreKey Cdc codec.Codec AddressCodec address.Codec - AppVersionModifier xp.AppVersionModifier + AppVersionModifier baseapp.AppVersionModifier AppOpts servertypes.AppOptions `optional:"true"` } From d2f714dca1ab6bea02ec1a5acd11d11db6be4784 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 24 May 2023 16:35:48 +0200 Subject: [PATCH 06/20] fix imports --- baseapp/abci_test.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index a40ec6cf1f90..785ed839185e 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -7,14 +7,7 @@ import ( "strings" "testing" - dbm "github.com/cosmos/cosmos-db" - - abci "github.com/cometbft/cometbft/abci/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - cmttypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/jsonpb" - "github.com/stretchr/testify/require" - + errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" pruningtypes "cosmossdk.io/store/pruning/types" @@ -23,6 +16,7 @@ import ( storetypes "cosmossdk.io/store/types" abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmttypes "github.com/cometbft/cometbft/types" dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/gogoproto/jsonpb" "github.com/stretchr/testify/require" From eb97ef570cf9834279f3cb444c23156c494baac7 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 8 Jun 2023 16:45:55 +0200 Subject: [PATCH 07/20] incorporate suggestions --- baseapp/abci.go | 4 ---- baseapp/abci_test.go | 9 ++++----- x/upgrade/keeper/migrations.go | 20 ++++++++++++++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 4446cf27667d..befd4cb5af58 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -138,10 +138,6 @@ func (app *BaseApp) InitChain(req *abci.RequestInitChain) (*abci.ResponseInitCha func (app *BaseApp) Info(req *abci.RequestInfo) (*abci.ResponseInfo, error) { lastCommitID := app.cms.LastCommitID() - qms := app.qms - if qms == nil { - qms = app.cms.(storetypes.MultiStore) - } appVersion := InitialAppVersion if lastCommitID.Version > 0 { ctx, err := app.CreateQueryContext(lastCommitID.Version, false) diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index bcc41ce3751a..24bac2f07721 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -8,7 +8,6 @@ import ( "strings" "testing" - errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" @@ -36,7 +35,7 @@ import ( func TestABCI_Info(t *testing.T) { suite := NewBaseAppSuite(t) - ctx := suite.baseApp.NewContext(true, cmtproto.Header{}) + ctx := suite.baseApp.NewContext(true) suite.baseApp.StoreConsensusParams(ctx, cmttypes.DefaultConsensusParams().ToProto()) reqInfo := abci.RequestInfo{} @@ -51,11 +50,11 @@ func TestABCI_Info(t *testing.T) { require.NoError(t, err) require.Equal(t, appVersion, res.AppVersion) - header := cmtproto.Header{Height: 1} - suite.baseApp.BeginBlock(abci.RequestBeginBlock{Header: header}) + suite.baseApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1}) suite.baseApp.Commit() require.NoError(t, suite.baseApp.SetAppVersion(ctx, 1)) - res = suite.baseApp.Info(reqInfo) + res, err = suite.baseApp.Info(&reqInfo) + require.NoError(t, err) require.Equal(t, uint64(1), res.AppVersion) } diff --git a/x/upgrade/keeper/migrations.go b/x/upgrade/keeper/migrations.go index 06b00165253e..72304a04b675 100644 --- a/x/upgrade/keeper/migrations.go +++ b/x/upgrade/keeper/migrations.go @@ -54,6 +54,9 @@ func migrateDoneUpgradeKeys(ctx sdk.Context, storeService storetypes.KVStoreServ return nil } +// Migrate2to3 migrates from version 2 to 3. +// It takes the legacy protocol version and if it exists, uses it to set +// the app version (of the baseapp) func (m Migrator) Migrate2to3(ctx sdk.Context) error { return migrateAppVersion(ctx, m.keeper) } @@ -62,12 +65,21 @@ func migrateAppVersion(ctx sdk.Context, keeper *Keeper) error { if keeper.versionModifier == nil { return fmt.Errorf("version modifier is not set") } - store := ctx.KVStore(keeper.storeKey) - // if the key was never set then we don't need to - if !store.Has([]byte{LegacyProtocolVersionByte}) { + + store := keeper.storeService.OpenKVStore(ctx) + // if the key was never set then we don't need to migrate anything + exists, err := store.Has([]byte{LegacyProtocolVersionByte}) + if err != nil { + return fmt.Errorf("error checking if legacy protocol version key exists: %w", err) + } + if !exists { return nil } - versionBytes := store.Get([]byte{LegacyProtocolVersionByte}) + + versionBytes, err := store.Get([]byte{LegacyProtocolVersionByte}) + if err != nil { + return fmt.Errorf("error getting legacy protocol version: %w", err) + } appVersion := binary.BigEndian.Uint64(versionBytes) if err := keeper.versionModifier.SetAppVersion(ctx, appVersion); err != nil { From a7a90ea6ebf07d6f37962d1ade2d4854b99e45a9 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 8 Jun 2023 16:48:36 +0200 Subject: [PATCH 08/20] add a comment for applying upgrades --- x/upgrade/keeper/keeper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 047213b2fecf..6bbe3c85621a 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -416,6 +416,7 @@ func (k Keeper) HasHandler(name string) bool { } // ApplyUpgrade will execute the handler associated with the Plan and mark the plan as done. +// If successful, it will increment the app version and clear the IBC state func (k Keeper) ApplyUpgrade(ctx context.Context, plan types.Plan) error { handler := k.upgradeHandlers[plan.Name] if handler == nil { From 0142d23f318910e107b17e69b846c900ba8f541b Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 8 Jun 2023 16:57:11 +0200 Subject: [PATCH 09/20] add nil check --- baseapp/options.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/baseapp/options.go b/baseapp/options.go index 2b58ea621e3b..853370a832b1 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -131,6 +131,9 @@ func (app *BaseApp) SetAppVersion(ctx context.Context, v uint64) error { if err != nil { return err } + if cp.Version == nil { + return errors.New("version is not set in param store") + } cp.Version.App = v if err := app.paramStore.Set(ctx, cp); err != nil { return err From 05aa9e2b9cf7b2ee3a45649418f3458060300c3c Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 12 Jun 2023 14:22:37 +0200 Subject: [PATCH 10/20] lint --- x/upgrade/abci_test.go | 2 +- x/upgrade/keeper/keeper_test.go | 2 +- x/upgrade/keeper/migrations.go | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/x/upgrade/abci_test.go b/x/upgrade/abci_test.go index b3830fcf2a2d..58787e2feb8e 100644 --- a/x/upgrade/abci_test.go +++ b/x/upgrade/abci_test.go @@ -550,7 +550,7 @@ type paramStore struct { var _ baseapp.ParamStore = (*paramStore)(nil) -func (ps paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error { +func (ps *paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error { ps.params = value return nil } diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 8e2c5ddd1710..cd9db99f9aa5 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -394,7 +394,7 @@ type paramStore struct { var _ baseapp.ParamStore = (*paramStore)(nil) -func (ps paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error { +func (ps *paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error { ps.params = value return nil } diff --git a/x/upgrade/keeper/migrations.go b/x/upgrade/keeper/migrations.go index 72304a04b675..f6a514654c90 100644 --- a/x/upgrade/keeper/migrations.go +++ b/x/upgrade/keeper/migrations.go @@ -86,6 +86,5 @@ func migrateAppVersion(ctx sdk.Context, keeper *Keeper) error { return fmt.Errorf("error migration app version: %w", err) } - store.Delete([]byte{LegacyProtocolVersionByte}) - return nil + return store.Delete([]byte{LegacyProtocolVersionByte}) } From b73d6daa6077d5ffe554cc094ac436aae472a742 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 13 Jun 2023 15:35:34 +0200 Subject: [PATCH 11/20] fix test --- x/upgrade/keeper/keeper.go | 5 +++-- x/upgrade/keeper/keeper_test.go | 15 +++++++++------ x/upgrade/module.go | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 6bbe3c85621a..eb6bd77544fd 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -406,6 +406,7 @@ func (k Keeper) GetUpgradePlan(ctx context.Context) (plan types.Plan, err error) func (k Keeper) setDone(ctx context.Context, name string) error { store := k.storeService.OpenKVStore(ctx) sdkCtx := sdk.UnwrapSDKContext(ctx) + fmt.Println("setting done", "height", sdkCtx.HeaderInfo().Height, "name", name) return store.Set(encodeDoneKey(name, sdkCtx.HeaderInfo().Height), []byte{1}) } @@ -442,11 +443,11 @@ func (k Keeper) ApplyUpgrade(ctx context.Context, plan types.Plan) error { if k.versionModifier != nil { currentAppVersion, err := k.versionModifier.AppVersion(ctx) if err != nil { - panic(err) + return err } if err := k.versionModifier.SetAppVersion(ctx, currentAppVersion+1); err != nil { - panic(err) + return err } } diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index cd9db99f9aa5..106bea0ad4ee 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -4,7 +4,6 @@ import ( "context" "path/filepath" "testing" - "time" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" cmttypes "github.com/cometbft/cometbft/types" @@ -47,7 +46,7 @@ func (s *KeeperTestSuite) SetupTest() { storeService := runtime.NewKVStoreService(key) s.key = key testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) - s.ctx = testCtx.Ctx.WithBlockHeader(cmtproto.Header{Time: time.Now(), Height: 10}) + s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Height: 10}) s.baseApp = baseapp.NewBaseApp( "upgrade", @@ -297,7 +296,7 @@ func (s *KeeperTestSuite) TestMigrations() { Height: 123450000, } - s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan) + s.Require().NoError(s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan)) vm, err := s.upgradeKeeper.GetModuleVersionMap(s.ctx) s.Require().Equal(vmBefore["bank"]+1, vm["bank"]) s.Require().NoError(err) @@ -317,10 +316,12 @@ func (s *KeeperTestSuite) TestLastCompletedUpgrade() { return vm, nil }) - keeper.ApplyUpgrade(s.ctx, types.Plan{ + require.True(keeper.HasHandler("test0")) + err = keeper.ApplyUpgrade(s.ctx, types.Plan{ Name: "test0", Height: 10, }) + require.NoError(err) s.T().Log("verify valid upgrade name and height") name, height, err = keeper.GetLastCompletedUpgrade(s.ctx) @@ -333,10 +334,11 @@ func (s *KeeperTestSuite) TestLastCompletedUpgrade() { }) newCtx := s.ctx.WithHeaderInfo(header.Info{Height: 15}) - keeper.ApplyUpgrade(newCtx, types.Plan{ + err = keeper.ApplyUpgrade(newCtx, types.Plan{ Name: "test1", Height: 15, }) + require.NoError(err) s.T().Log("verify valid upgrade name and height with multiple upgrades") name, height, err = keeper.GetLastCompletedUpgrade(newCtx) @@ -356,10 +358,11 @@ func (s *KeeperTestSuite) TestLastCompletedUpgradeOrdering() { return vm, nil }) - keeper.ApplyUpgrade(s.ctx, types.Plan{ + err := keeper.ApplyUpgrade(s.ctx, types.Plan{ Name: "test-v0.9", Height: 10, }) + require.NoError(err) name, height, err := keeper.GetLastCompletedUpgrade(s.ctx) require.Equal("test-v0.9", name) diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 716c564181ef..1a5d094eddf6 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -153,7 +153,7 @@ func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage { } // ValidateGenesis is always successful, as we ignore the value -func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, config client.TxEncodingConfig, _ json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error { return nil } @@ -187,7 +187,7 @@ type ModuleInputs struct { depinject.In Config *modulev1.Module - StoreService store.KVStoreService + StoreService store.KVStoreService Cdc codec.Codec AddressCodec address.Codec AppVersionModifier baseapp.AppVersionModifier From a01073e557f1bb2d6f2bb56a57589741eef3ee91 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 14 Jun 2023 14:32:40 +0200 Subject: [PATCH 12/20] fix e2e test --- tests/e2e/upgrade/cli_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/upgrade/cli_test.go b/tests/e2e/upgrade/cli_test.go index fee20ee5541a..8259f333b03a 100644 --- a/tests/e2e/upgrade/cli_test.go +++ b/tests/e2e/upgrade/cli_test.go @@ -19,7 +19,6 @@ func TestE2ETestSuite(t *testing.T) { app := simapp.Setup(t, false) ctx := app.BaseApp.NewContext(false) - app.UpgradeKeeper.SetVersionSetter(app.BaseApp) app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) suite.Run(t, NewE2ETestSuite(cfg, app.UpgradeKeeper, ctx)) From 2337db9ff490e541c84e99e8ae547505d7dbac98 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Fri, 16 Jun 2023 15:43:25 +0200 Subject: [PATCH 13/20] use errors instead of panics --- baseapp/abci.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index befd4cb5af58..95afb312a81b 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -142,11 +142,11 @@ func (app *BaseApp) Info(req *abci.RequestInfo) (*abci.ResponseInfo, error) { if lastCommitID.Version > 0 { ctx, err := app.CreateQueryContext(lastCommitID.Version, false) if err != nil { - panic(err) + return nil, fmt.Errorf("creating query context: %w", err) } appVersion, err = app.AppVersion(ctx) if err != nil { - panic(err) + return nil, fmt.Errorf("getting app version: %w", err) } } From 1991f40f3c4a2d536c84a9c4ce0badc210b1c67c Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 10 Aug 2023 18:49:16 +0200 Subject: [PATCH 14/20] lint --- baseapp/abci_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index a7315b7d25e3..6cae698a2791 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -47,7 +47,8 @@ import ( func TestABCI_Info(t *testing.T) { suite := NewBaseAppSuite(t) ctx := suite.baseApp.NewContext(true) - suite.baseApp.StoreConsensusParams(ctx, cmttypes.DefaultConsensusParams().ToProto()) + err := suite.baseApp.StoreConsensusParams(ctx, cmttypes.DefaultConsensusParams().ToProto()) + require.NoError(t, err) reqInfo := abci.RequestInfo{} res, err := suite.baseApp.Info(&reqInfo) @@ -61,8 +62,10 @@ func TestABCI_Info(t *testing.T) { require.NoError(t, err) require.Equal(t, appVersion, res.AppVersion) - suite.baseApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1}) - suite.baseApp.Commit() + _, err = suite.baseApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1}) + require.NoError(t, err) + _, err = suite.baseApp.Commit() + require.NoError(t, err) require.NoError(t, suite.baseApp.SetAppVersion(ctx, 1)) res, err = suite.baseApp.Info(&reqInfo) require.NoError(t, err) From 37b73a54314a2e8fccf4333e0fd0322a50da2022 Mon Sep 17 00:00:00 2001 From: Marko Date: Fri, 18 Aug 2023 16:36:21 +0200 Subject: [PATCH 15/20] Update baseapp/baseapp.go Co-authored-by: Aleksandr Bezobchuk --- baseapp/baseapp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index d0a1b38d7125..25edd5af1f08 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -243,7 +243,7 @@ func (app *BaseApp) AppVersion(ctx context.Context) (uint64, error) { cp, err := app.paramStore.Get(ctx) if err != nil { - return 0, fmt.Errorf("getting consensus params: %w", err) + return 0, fmt.Errorf("failed to get consensus params: %w", err) } if cp.Version == nil { return 0, nil From f12fb7c04a2495b4a9c4e8519f16eb25acc0305a Mon Sep 17 00:00:00 2001 From: Marko Date: Fri, 18 Aug 2023 16:36:30 +0200 Subject: [PATCH 16/20] Update baseapp/options.go Co-authored-by: Aleksandr Bezobchuk --- baseapp/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baseapp/options.go b/baseapp/options.go index e0e8120edfbc..aac814642774 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -140,7 +140,7 @@ func (app *BaseApp) SetAppVersion(ctx context.Context, v uint64) error { cp, err := app.paramStore.Get(ctx) if err != nil { - return err + return fmt.Errorf("failed to get consensus params: %w", err) } if cp.Version == nil { return errors.New("version is not set in param store") From dbe58bb2209294dd0a54ca6121d0cda98d4a3532 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 28 Aug 2023 14:40:22 +0200 Subject: [PATCH 17/20] lint-fix, go mod replace --- baseapp/abci_test.go | 8 ++--- x/upgrade/go.mod | 6 ++-- x/upgrade/go.sum | 82 ++++++++++++++------------------------------ 3 files changed, 31 insertions(+), 65 deletions(-) diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index 65ab3612fd7e..9169804fa1cf 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -13,8 +13,12 @@ import ( "testing" "time" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/secp256k1" cmtprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmttypes "github.com/cometbft/cometbft/types" + dbm "github.com/cosmos/cosmos-db" protoio "github.com/cosmos/gogoproto/io" "github.com/cosmos/gogoproto/jsonpb" "github.com/cosmos/gogoproto/proto" @@ -28,10 +32,6 @@ import ( "cosmossdk.io/store/snapshots" snapshottypes "cosmossdk.io/store/snapshots/types" storetypes "cosmossdk.io/store/types" - abci "github.com/cometbft/cometbft/abci/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - cmttypes "github.com/cometbft/cometbft/types" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil" diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 456fba7b300f..7f1d5e73f203 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -8,7 +8,7 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.0 - cosmossdk.io/store v1.0.0-alpha.1 + cosmossdk.io/store v1.0.0-alpha.1.0.20230728080422-54ed7dab3982 github.com/cometbft/cometbft v0.38.0-rc3 github.com/cosmos/cosmos-db v1.0.0 github.com/cosmos/cosmos-proto v1.0.0-beta.3 @@ -178,6 +178,4 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. -// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 -replace github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 +replace github.com/cosmos/cosmos-sdk => ../../. diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 9b22f6cfeb16..749eac8ffae8 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -201,8 +201,8 @@ cosmossdk.io/log v1.2.0 h1:BbykkDsutXPSy8RojFB3KZEWyvMsToLy0ykb/ZhsLqQ= cosmossdk.io/log v1.2.0/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/store v1.0.0-alpha.1 h1:/151XxAgm0tiKuYrtJzMG61lf6enpPuP+D/hIN8cRjQ= -cosmossdk.io/store v1.0.0-alpha.1/go.mod h1:ejgU9GhRGMNBduVnDwC3RyhOmu4uKlNQlTiJgPmbDkI= +cosmossdk.io/store v1.0.0-alpha.1.0.20230728080422-54ed7dab3982 h1:61YFeW2AhwwPfoJWzNJWvVubCj32sm5jZkJfraS9pDQ= +cosmossdk.io/store v1.0.0-alpha.1.0.20230728080422-54ed7dab3982/go.mod h1:QAF9zeRa/9ghuv7E8NS9SzWqRbgVNwH/dZwGhYDHUjI= cosmossdk.io/x/tx v0.9.1 h1:9pmmXA9Vs4qdouOFnzhsdsff2mif0f0kylMq5xTGhRI= cosmossdk.io/x/tx v0.9.1/go.mod h1:/YFGTXG6+kyihd8YbfuJiXHV4R/mIMm2uvVzo80CIhA= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -272,9 +272,6 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg= github.com/bufbuild/protocompile v0.5.1/go.mod h1:G5iLmavmF4NsYtpZFvE3B/zFch2GIY8+wjsYLR/lc40= -github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= -github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -288,9 +285,6 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= @@ -347,8 +341,6 @@ github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0 github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= -github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230713093628-90d9a75d4125 h1:2aGCqfxWf2AAvLOUHaRiByle6n0FPRdeOF/62JTldh0= -github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230713093628-90d9a75d4125/go.mod h1:LME6v5XztqVK7/1uTQj/G6ZJdosJEz24rKaPYk+WbqI= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -432,15 +424,14 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4 github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= -github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -459,13 +450,16 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= -github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= -github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= -github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= @@ -475,8 +469,8 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -725,9 +719,6 @@ github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -739,8 +730,9 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -856,7 +848,6 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N7Xxu0= github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= @@ -984,8 +975,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= @@ -998,11 +987,12 @@ github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -1048,9 +1038,6 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= -golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1065,8 +1052,6 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1108,7 +1093,6 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1172,9 +1156,6 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1218,7 +1199,6 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1312,24 +1292,18 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1343,9 +1317,6 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1416,7 +1387,6 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E= golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1661,7 +1631,6 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -1711,7 +1680,6 @@ nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0 pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= From d523bb9c9a423021378f29074599635032affbfc Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 28 Aug 2023 14:50:47 +0200 Subject: [PATCH 18/20] fix upgrade tests --- baseapp/baseapp.go | 3 --- x/upgrade/abci_test.go | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index d19a4f8ff417..953ed69258dc 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -529,9 +529,6 @@ func (app *BaseApp) GetConsensusParams(ctx sdk.Context) cmtproto.ConsensusParams // StoreConsensusParams sets the consensus parameters to the BaseApp's param // store. -// -// NOTE: We're explicitly not storing the CometBFT app_version in the param store. -// It's stored instead in the x/upgrade store, with its own bump logic. func (app *BaseApp) StoreConsensusParams(ctx sdk.Context, cp cmtproto.ConsensusParams) error { if app.paramStore == nil { return errors.New("cannot store consensus params with no params store set") diff --git a/x/upgrade/abci_test.go b/x/upgrade/abci_test.go index c10948c20883..599cf9d202cd 100644 --- a/x/upgrade/abci_test.go +++ b/x/upgrade/abci_test.go @@ -11,11 +11,11 @@ import ( "cosmossdk.io/core/header" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/stretchr/testify/require" "cosmossdk.io/x/upgrade" "cosmossdk.io/x/upgrade/keeper" "cosmossdk.io/x/upgrade/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/baseapp" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" @@ -121,6 +121,8 @@ func setupTest(t *testing.T, height int64, skip map[int64]bool) *TestSuite { s.encCfg.TxConfig.TxDecoder(), ) + s.baseApp.SetParamStore(¶mStore{params: cmtproto.ConsensusParams{Version: &cmtproto.VersionParams{App: 1}}}) + s.keeper = keeper.NewKeeper(skip, storeService, s.encCfg.Codec, t.TempDir(), s.baseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now(), Height: height}) From 60f3164311b11b9cb7d8bc9d4d91b310db93dcaa Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Tue, 29 Aug 2023 09:02:45 +0200 Subject: [PATCH 19/20] fix lint --- baseapp/abci.go | 4 ++-- x/upgrade/keeper/keeper_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index ee106796834e..cae600d95b5f 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -153,11 +153,11 @@ func (app *BaseApp) Info(req *abci.RequestInfo) (*abci.ResponseInfo, error) { if lastCommitID.Version > 0 { ctx, err := app.CreateQueryContext(lastCommitID.Version, false) if err != nil { - return nil, fmt.Errorf("creating query context: %w", err) + return nil, fmt.Errorf("failed creating query context: %w", err) } appVersion, err = app.AppVersion(ctx) if err != nil { - return nil, fmt.Errorf("getting app version: %w", err) + return nil, fmt.Errorf("failed getting app version: %w", err) } } diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index ed207f4addcd..ae3a14ab773c 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -273,7 +273,8 @@ func (s *KeeperTestSuite) TestIncrementProtocolVersion() { s.Require().EqualError(err, "ApplyUpgrade should never be called without first checking HasHandler") s.upgradeKeeper.SetUpgradeHandler("dummy", func(_ context.Context, _ types.Plan, vm module.VersionMap) (module.VersionMap, error) { return vm, nil }) - s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan) + err = s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan) + s.Require().NoError(err) upgradedProtocolVersion, err := s.baseApp.AppVersion(s.ctx) s.Require().NoError(err) From 61f3fc0f6a638fa2686a3345d361bbade4df90cd Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Tue, 29 Aug 2023 09:23:32 +0200 Subject: [PATCH 20/20] lint --- x/upgrade/abci_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x/upgrade/abci_test.go b/x/upgrade/abci_test.go index 599cf9d202cd..3dc134d96b98 100644 --- a/x/upgrade/abci_test.go +++ b/x/upgrade/abci_test.go @@ -7,6 +7,9 @@ import ( "testing" "time" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" "cosmossdk.io/log" @@ -14,8 +17,6 @@ import ( "cosmossdk.io/x/upgrade" "cosmossdk.io/x/upgrade/keeper" "cosmossdk.io/x/upgrade/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/baseapp" addresscodec "github.com/cosmos/cosmos-sdk/codec/address"