From 0160771d525a43f2d80b1ac25db973108c722263 Mon Sep 17 00:00:00 2001 From: Assaf Morami Date: Thu, 6 Oct 2022 08:00:17 +0300 Subject: [PATCH] v1.5 upgrade handler --- .gitignore | 3 ++- app/app.go | 3 ++- app/upgrades/v1.5/upgrades.go | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 app/upgrades/v1.5/upgrades.go diff --git a/.gitignore b/.gitignore index 57427ff66..9f8a1c814 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,5 @@ x/compute/internal/keeper/testdata/ibc.wasm x/compute/internal/keeper/testdata/static-too-high-initial-memory.wasm x/compute/internal/keeper/testdata/too-high-initial-memory.wasm x/compute/internal/keeper/testdata/v1-contract.wasm -/github.com \ No newline at end of file +/github.com +third_party/build \ No newline at end of file diff --git a/app/app.go b/app/app.go index 98bab2f09..cfcf36c7e 100644 --- a/app/app.go +++ b/app/app.go @@ -33,6 +33,7 @@ import ( "github.com/scrtlabs/SecretNetwork/app/upgrades" v1_3 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.3" v1_4 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.4" + v1_5 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.4" icaauthtypes "github.com/scrtlabs/SecretNetwork/x/mauth/types" "github.com/cosmos/cosmos-sdk/version" @@ -114,7 +115,7 @@ var ( distrtypes.ModuleName: true, } - Upgrades = []upgrades.Upgrade{v1_3.Upgrade, v1_4.Upgrade} + Upgrades = []upgrades.Upgrade{v1_3.Upgrade, v1_4.Upgrade, v1_5.Upgrade} ) // Verify app interface at compile time diff --git a/app/upgrades/v1.5/upgrades.go b/app/upgrades/v1.5/upgrades.go new file mode 100644 index 000000000..16d713e93 --- /dev/null +++ b/app/upgrades/v1.5/upgrades.go @@ -0,0 +1,26 @@ +package v1_4 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/scrtlabs/SecretNetwork/app/keepers" + "github.com/scrtlabs/SecretNetwork/app/upgrades" +) + +const UpgradeName = "v1.5" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} + +func CreateUpgradeHandler(mm *module.Manager, keepers *keepers.SecretAppKeepers, configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("Running module migrations for v1.5...") + return mm.RunMigrations(ctx, configurator, vm) + } +}