From 351de9af3bf369526ae71294245d5b75d2a228d9 Mon Sep 17 00:00:00 2001 From: SpekalsG3 Date: Wed, 20 Nov 2024 14:49:57 +0500 Subject: [PATCH] feat(stargate-queries): add upgrade handler --- app/app_upgrades.go | 4 +++- app/upgrades/10_0_0/upgrades.go | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 app/upgrades/10_0_0/upgrades.go diff --git a/app/app_upgrades.go b/app/app_upgrades.go index a146e4d7..f65013e3 100644 --- a/app/app_upgrades.go +++ b/app/app_upgrades.go @@ -7,6 +7,7 @@ import ( "github.com/archway-network/archway/app/upgrades" upgrade_0_6 "github.com/archway-network/archway/app/upgrades/06" + upgrade10_0_0 "github.com/archway-network/archway/app/upgrades/10_0_0" upgrade1_0_0_rc_4 "github.com/archway-network/archway/app/upgrades/1_0_0_rc_4" upgrade2_0_0 "github.com/archway-network/archway/app/upgrades/2_0_0" upgrade3_0_0 "github.com/archway-network/archway/app/upgrades/3_0_0" @@ -30,7 +31,8 @@ var Upgrades = []upgrades.Upgrade{ upgrade6_0_0.Upgrade, // v6.0.0 upgrade7_0_0.Upgrade, // v7.0.0 // upgrade8_0_0.Upgrade, // v8.0.0: was reserved for a consensus breaking wasmd upgrade - upgrade9_0_0.Upgrade, // v9.0.0 + upgrade9_0_0.Upgrade, // v9.0.0 + upgrade10_0_0.Upgrade, // v10.0.0 // constantine only constantineupgrades.WASMD_50_Amino_Patch, diff --git a/app/upgrades/10_0_0/upgrades.go b/app/upgrades/10_0_0/upgrades.go new file mode 100644 index 00000000..6e7c7a68 --- /dev/null +++ b/app/upgrades/10_0_0/upgrades.go @@ -0,0 +1,41 @@ +package upgrade8_0_0 + +import ( + "context" + wasmdTypes "github.com/CosmWasm/wasmd/x/wasm/types" + + storetypes "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/archway-network/archway/app/keepers" + "github.com/archway-network/archway/app/upgrades" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +const Name = "v10.0.0" +const NameAsciiArt = ` + # ### ### + # # ## # # # # + # # # # # # # + # # # # # # + ### # ### # ### + +` + +var Upgrade = upgrades.Upgrade{ + UpgradeName: Name, + CreateUpgradeHandler: func(mm *module.Manager, cfg module.Configurator, keepers keepers.ArchwayKeepers) upgradetypes.UpgradeHandler { + return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + migrations, err := mm.RunMigrations(ctx, cfg, fromVM) + if err != nil { + return nil, err + } + + sdk.UnwrapSDKContext(ctx).Logger().Info(upgrades.ArchwayLogo + NameAsciiArt) + return migrations, nil + } + }, + StoreUpgrades: storetypes.StoreUpgrades{ + Added: []string{wasmdTypes.StoreKey}, + }, +}