Skip to content

Commit

Permalink
mainnet upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
kkast committed Apr 30, 2024
1 parent 4fb97f0 commit 239d74f
Show file tree
Hide file tree
Showing 4 changed files with 622 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"

"github.com/notional-labs/composable/v6/app/upgrades/v6_6_2"
"github.com/notional-labs/composable/v6/app/upgrades/v6_6_3"

nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -148,7 +148,7 @@ var (
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{v6_6_2.Upgrade}
Upgrades = []upgrades.Upgrade{v6_6_3.Upgrade}
Forks = []upgrades.Fork{}
)

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

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

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

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

import (
"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types"
ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types"

"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/upgrades"
bech32authmigration "github.com/notional-labs/composable/v6/bech32-migration/auth"
bech32govmigration "github.com/notional-labs/composable/v6/bech32-migration/gov"
bech32IbcHooksMigration "github.com/notional-labs/composable/v6/bech32-migration/ibchooks"
bench32ibctransfermiddleware "github.com/notional-labs/composable/v6/bech32-migration/ibctransfermiddleware"
bech32icamigration "github.com/notional-labs/composable/v6/bech32-migration/ica"
bech32mintmigration "github.com/notional-labs/composable/v6/bech32-migration/mint"
bech32PfmMigration "github.com/notional-labs/composable/v6/bech32-migration/pfmmiddleware"
bech32slashingmigration "github.com/notional-labs/composable/v6/bech32-migration/slashing"
bech32stakingmigration "github.com/notional-labs/composable/v6/bech32-migration/staking"
bech32transfermiddlewaremigration "github.com/notional-labs/composable/v6/bech32-migration/transfermiddleware"
bech32WasmMigration "github.com/notional-labs/composable/v6/bech32-migration/wasm"
transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
_ upgrades.BaseAppParamManager,
codec codec.Codec,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
keys := keepers.GetKVStoreKey()
// Migration prefix
ctx.Logger().Info("First step: Migrate addresses stored in bech32 form to use new prefix")
bech32stakingmigration.MigrateAddressBech32(ctx, keys[stakingtypes.StoreKey], codec)
bech32stakingmigration.MigrateUnbonding(ctx, keys[stakingtypes.StoreKey], codec)
bech32slashingmigration.MigrateAddressBech32(ctx, keys[slashingtypes.StoreKey], codec)
bech32govmigration.MigrateAddressBech32(ctx, keys[govtypes.StoreKey], codec)
bech32authmigration.MigrateAddressBech32(ctx, keys[authtypes.StoreKey], codec)
bech32icamigration.MigrateAddressBech32(ctx, keys[icahosttypes.StoreKey], codec)
bech32mintmigration.MigrateAddressBech32(ctx, keys[minttypes.StoreKey], codec)
bech32transfermiddlewaremigration.MigrateAddressBech32(ctx, keys[transfermiddlewaretypes.StoreKey], codec)
bech32WasmMigration.MigrateAddressBech32(ctx, keys[wasm.StoreKey], codec)
bech32PfmMigration.MigrateAddressBech32(ctx, keys[routertypes.StoreKey], codec, keepers)
bench32ibctransfermiddleware.MigrateAddressBech32(ctx, keys[ibctransfermiddlewaretypes.StoreKey], codec)
bech32IbcHooksMigration.MigrateAddressBech32(ctx, keys[ibchookstypes.StoreKey], codec)
return mm.RunMigrations(ctx, configurator, vm)
}
}
Loading

0 comments on commit 239d74f

Please sign in to comment.