Skip to content

Commit

Permalink
feat: add v7.0.3 upgrade handler (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 authored Jun 12, 2024
1 parent 378b55f commit febf499
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
5 changes: 2 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank"

"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/upgrades/v7_0_1"

// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"cosmossdk.io/x/evidence"
evidencetypes "cosmossdk.io/x/evidence/types"
Expand Down Expand Up @@ -133,6 +131,7 @@ import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

upgrades "github.com/notional-labs/composable/v6/app/upgrades"
"github.com/notional-labs/composable/v6/app/upgrades/v7_0_3"
ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types"
stakingmiddlewaretypes "github.com/notional-labs/composable/v6/x/stakingmiddleware/types"
)
Expand All @@ -152,7 +151,7 @@ var (
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{v7_0_1.Upgrade}
Upgrades = []upgrades.Upgrade{v7_0_3.Upgrade}
Forks = []upgrades.Fork{}
)

Expand Down
20 changes: 20 additions & 0 deletions app/upgrades/v7_0_3/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package v7_0_3

import (
store "cosmossdk.io/store/types"
"github.com/notional-labs/composable/v6/app/upgrades"
)

const (
// UpgradeName defines the on-chain upgrade name for the composable upgrade.
UpgradeName = "v7_0_3"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
Deleted: []string{},
},
}
25 changes: 25 additions & 0 deletions app/upgrades/v7_0_3/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package v7_0_3

import (
"context"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/upgrades"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
_ upgrades.BaseAppParamManager,
codec codec.Codec,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(goCtx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
return mm.RunMigrations(ctx, configurator, vm)
}
}
9 changes: 2 additions & 7 deletions scripts/test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
# the upgrade is a fork, "true" otherwise
FORK=${FORK:-"false"}

OLD_VERSION=v6.6.41
OLD_VERSION=v7_0_2
UPGRADE_WAIT=${UPGRADE_WAIT:-20}
HOME=mytestnet
ROOT=$(pwd)
DENOM=ppica
CHAIN_ID=localpica
SOFTWARE_UPGRADE_NAME="v7_0_1"
ADDITIONAL_PRE_SCRIPTS=""
ADDITIONAL_AFTER_SCRIPTS=""
SOFTWARE_UPGRADE_NAME="v6_6_1"
ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/v_6_4_8/pre-script.sh"
ADDITIONAL_AFTER_SCRIPTS="./scripts/upgrade/v_6_4_8/post-script.sh"
SOFTWARE_UPGRADE_NAME="v7_0_3"

SLEEP_TIME=1

Expand Down

0 comments on commit febf499

Please sign in to comment.