diff --git a/app/helpers/test_helpers.go b/app/helpers/test_helpers.go index 05fd5f7f2..e84edbf0d 100644 --- a/app/helpers/test_helpers.go +++ b/app/helpers/test_helpers.go @@ -2,7 +2,6 @@ package helpers import ( "encoding/json" - "fmt" "testing" "time" @@ -12,7 +11,6 @@ import ( dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" - tmrand "github.com/cometbft/cometbft/libs/rand" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -59,10 +57,7 @@ type EmptyAppOptions struct{} func (EmptyAppOptions) Get(_ string) interface{} { return nil } func NewContextForApp(app composable.ComposableApp) sdk.Context { - ctx := app.BaseApp.NewContext(false, tmproto.Header{ - ChainID: fmt.Sprintf("test-chain-%s", tmrand.Str(4)), - Height: 1, - }) + ctx := app.BaseApp.NewContext(false) return ctx } diff --git a/app/ibctesting/simapp/export.go b/app/ibctesting/simapp/export.go index 8515cc0f4..df6d8da75 100644 --- a/app/ibctesting/simapp/export.go +++ b/app/ibctesting/simapp/export.go @@ -28,7 +28,11 @@ func (app *SimApp) ExportAppStateAndValidators( app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.mm.ExportGenesis(ctx, app.appCodec) + genState, err := app.mm.ExportGenesis(ctx, app.appCodec) + if err != nil { + return servertypes.ExportedApp{}, err + } + appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err diff --git a/app/ibctesting/simapp/simd/main.go b/app/ibctesting/simapp/simd/main.go index e2d387dcf..059efd2e1 100644 --- a/app/ibctesting/simapp/simd/main.go +++ b/app/ibctesting/simapp/simd/main.go @@ -11,7 +11,7 @@ import ( ) func main() { - rootCmd, _ := cmd.NewRootCmd() + rootCmd := cmd.NewRootCmd() if err := svrcmd.Execute(rootCmd, "simd", simapp.DefaultNodeHome); err != nil { switch e := err.(type) { diff --git a/app/ibctesting/simapp/upgrades/upgrades.go b/app/ibctesting/simapp/upgrades/upgrades.go index 8c2307fe8..a0b580eb4 100644 --- a/app/ibctesting/simapp/upgrades/upgrades.go +++ b/app/ibctesting/simapp/upgrades/upgrades.go @@ -1,9 +1,10 @@ package upgrades import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" + "context" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/types/module" ) const ( @@ -17,7 +18,7 @@ func CreateDefaultUpgradeHandler( mm *module.Manager, configurator module.Configurator, ) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/app/ibctesting/simapp/upgrades/v6/upgrades.go b/app/ibctesting/simapp/upgrades/v6/upgrades.go index ecffdb30f..94b155184 100644 --- a/app/ibctesting/simapp/upgrades/v6/upgrades.go +++ b/app/ibctesting/simapp/upgrades/v6/upgrades.go @@ -1,13 +1,15 @@ package v6 import ( + "context" + storetypes "cosmossdk.io/store/types" 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" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + sdk "github.com/cosmos/cosmos-sdk/types" v6 "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/migrations/v6" ) @@ -26,8 +28,9 @@ func CreateUpgradeHandler( capabilityKeeper *capabilitykeeper.Keeper, moduleName string, ) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - if err := v6.MigrateICS27ChannelCapability(ctx, cdc, capabilityStoreKey, capabilityKeeper, moduleName); err != nil { + return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + sdkctx := sdk.UnwrapSDKContext(ctx) + if err := v6.MigrateICS27ChannelCapability(sdkctx, cdc, capabilityStoreKey, capabilityKeeper, moduleName); err != nil { return nil, err } diff --git a/app/ibctesting/simapp/upgrades/v7/upgrades.go b/app/ibctesting/simapp/upgrades/v7/upgrades.go index ecdc9330c..e567ff770 100644 --- a/app/ibctesting/simapp/upgrades/v7/upgrades.go +++ b/app/ibctesting/simapp/upgrades/v7/upgrades.go @@ -1,10 +1,11 @@ package v7 import ( + "context" + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" consensusparamskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" @@ -12,6 +13,8 @@ import ( clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper" ibctmmigrations "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint/migrations" + + sdk "github.com/cosmos/cosmos-sdk/types" ) const ( @@ -28,14 +31,15 @@ func CreateUpgradeHandler( consensusParamsKeeper consensusparamskeeper.Keeper, paramsKeeper paramskeeper.Keeper, ) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { // OPTIONAL: prune expired tendermint consensus states to save storage space - if _, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, cdc, clientKeeper); err != nil { + sdkctx := sdk.UnwrapSDKContext(ctx) + if _, err := ibctmmigrations.PruneExpiredConsensusStates(sdkctx, cdc, clientKeeper); err != nil { return nil, err } legacyBaseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - baseapp.MigrateParams(ctx, legacyBaseAppSubspace, &consensusParamsKeeper) + baseapp.MigrateParams(sdkctx, legacyBaseAppSubspace, &consensusParamsKeeper.ParamsStore) return mm.RunMigrations(ctx, configurator, vm) } diff --git a/app/upgrades/centauri/constants.go b/app/upgrades/centauri/constants.go deleted file mode 100644 index d72c6a944..000000000 --- a/app/upgrades/centauri/constants.go +++ /dev/null @@ -1,6 +0,0 @@ -package centauri - -const ( - // UpgradeName defines the on-chain upgrade name for the Centauri upgrade. - UpgradeName = "centauri" -) diff --git a/app/upgrades/centauri/readme.md b/app/upgrades/centauri/readme.md deleted file mode 100644 index ccacc30b1..000000000 --- a/app/upgrades/centauri/readme.md +++ /dev/null @@ -1,11 +0,0 @@ -## Migrate Chain Prefix from Banksy to Centauri -As part of our system upgrade, we need to migrate the chain prefix from Banksy to Centauri. - -To start the migration process, we will need to follow these steps: - -1. Update the node software: We need to update the node software to the latest version that supports the Centauri chain prefix. -2. Backup the your consensus key data: Before we start the migration process, it is important to backup all the data . Make sure that your `priv_validator_key.json` is backup. -3. Stop the current node: When the block heigh reach `150500`. Validator need to stop their node. -4. Start the new node: Once the configuration is complete, we can start the new node with the `Centauri` prefix. - -By following these steps, we can ensure a smooth and successful migration from Banksy to Centauri. If you have any questions or concerns, please don't hesitate to contact our support team. \ No newline at end of file diff --git a/app/upgrades/centauri/upgrade.go b/app/upgrades/centauri/upgrade.go deleted file mode 100644 index a257ab096..000000000 --- a/app/upgrades/centauri/upgrade.go +++ /dev/null @@ -1,52 +0,0 @@ -package centauri - -import ( - "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" - "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" - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "cosmossdk.io/x/upgrade/types" - - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - - bech32authmigration "github.com/notional-labs/composable/v6/bech32-migration/auth" - bech32govmigration "github.com/notional-labs/composable/v6/bech32-migration/gov" - bech32slashingmigration "github.com/notional-labs/composable/v6/bech32-migration/slashing" - bech32stakingmigration "github.com/notional-labs/composable/v6/bech32-migration/staking" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - keys map[string]*storetypes.KVStoreKey, codec codec.Codec, - slashingKeeper *slashingkeeper.Keeper, - govkeeper *govkeeper.Keeper, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // Migration prefix - ctx.Logger().Info("First step: Migrate addresses stored in bech32 form to use new prefix") - bech32stakingmigration.MigrateAddressBech32(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) - - // Slashing params change - newParamsSet := slashingKeeper.GetParams(ctx) - newParamsSet.SlashFractionDowntime = math.LegacyNewDecWithPrec(1, 5) - slashingKeeper.SetParams(ctx, newParamsSet) - - // Gov params change: minium deposit - newGovParamsSet := govkeeper.GetParams(ctx) - newGovParamsSet.MinInitialDepositRatio = sdk.NewDecWithPrec(1, 2).String() // this is 1% - govkeeper.SetParams(ctx, newGovParamsSet) - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/reward/constants.go b/app/upgrades/reward/constants.go deleted file mode 100644 index 18a12fb9e..000000000 --- a/app/upgrades/reward/constants.go +++ /dev/null @@ -1,6 +0,0 @@ -package v4 - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "reward" -) diff --git a/app/upgrades/reward/upgrade.go b/app/upgrades/reward/upgrade.go deleted file mode 100644 index 86de7ecc3..000000000 --- a/app/upgrades/reward/upgrade.go +++ /dev/null @@ -1,46 +0,0 @@ -package v4 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - mintkeeper "github.com/notional-labs/composable/v6/x/mint/keeper" - tfmwkeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" -) - -var listAllowedRelayAddress = []string{ - "centauri1eqv3xl0vk0md74qukfghfff4z3axsp29rr9c85", - "centauri1av6x9sll0yx4anske424jtgxejnrgqv6j6tjjt", - "centauri1c8sxuxfgj5qj0l9gehs7any7s8mmx03qd7yd3f", - "centauri17qv55sj9rgxs722wkkg0gewjv45msem90v6fpw", -} - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - tfmwKeeper tfmwkeeper.Keeper, - mintKeeper mintkeeper.Keeper, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // Add relayer address to store - for _, allowedRelayAddress := range listAllowedRelayAddress { - tfmwKeeper.SetAllowRlyAddress(ctx, allowedRelayAddress) - } - - // enable staking reward - mintParam := mintKeeper.GetParams(ctx) - maxTokenPerYear, _ := sdk.NewIntFromString("99999999000000000000") - minTokenPerYear, _ := sdk.NewIntFromString("99999999000000000000") - - mintParam.MaxTokenPerYear = maxTokenPerYear - mintParam.MinTokenPerYear = minTokenPerYear - - err := mintKeeper.SetParams(ctx, mintParam) - if err != nil { - return vm, err - } - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/types.go b/app/upgrades/types.go index a0b110159..c2abaf1a1 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -2,11 +2,11 @@ package upgrades import ( store "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" types "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/notional-labs/composable/v6/app/keepers" ) @@ -14,8 +14,8 @@ import ( // BaseAppParamManager defines an interrace that BaseApp is expected to fullfil // that allows upgrade handlers to modify BaseApp parameters. type BaseAppParamManager interface { - GetConsensusParams(ctx sdk.Context) *types.ConsensusParams - StoreConsensusParams(ctx sdk.Context, cp *types.ConsensusParams) + GetConsensusParams(ctx sdk.Context) types.ConsensusParams + StoreConsensusParams(ctx sdk.Context, cp types.ConsensusParams) error } // Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal diff --git a/app/upgrades/v4/constants.go b/app/upgrades/v4/constants.go deleted file mode 100644 index 5929acbce..000000000 --- a/app/upgrades/v4/constants.go +++ /dev/null @@ -1,25 +0,0 @@ -package v4 - -import ( - store "cosmossdk.io/store/types" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" - - "github.com/notional-labs/composable/v6/app/upgrades" - ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types" - ratelimitmoduletypes "github.com/notional-labs/composable/v6/x/ratelimit/types" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v4" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{wasmtypes.StoreKey, ibchookstypes.StoreKey, ratelimitmoduletypes.StoreKey, icahosttypes.StoreKey}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v4/upgrade.go b/app/upgrades/v4/upgrade.go deleted file mode 100644 index a6f132e3e..000000000 --- a/app/upgrades/v4/upgrade.go +++ /dev/null @@ -1,35 +0,0 @@ -package v4 - -import ( - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" - tfmdtypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - _ codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // Add params for transfer middleware - transmiddlewareParams := tfmdtypes.DefaultParams() - keepers.TransferMiddlewareKeeper.SetParams(ctx, transmiddlewareParams) - - // Add params for wasmd - var wasmdParams wasmtypes.Params - wasmdParams.CodeUploadAccess = wasmtypes.AccessConfig{Permission: wasmtypes.AccessTypeNobody} - wasmdParams.InstantiateDefaultPermission = wasmtypes.AccessTypeNobody - keepers.WasmKeeper.SetParams(ctx, wasmdParams) - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v4_5/constants.go b/app/upgrades/v4_5/constants.go deleted file mode 100644 index 032f1f01f..000000000 --- a/app/upgrades/v4_5/constants.go +++ /dev/null @@ -1,15 +0,0 @@ -package v45 - -import "github.com/notional-labs/composable/v6/app/upgrades" - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v4_5" - UpgradeHeight = 967554 -) - -var Fork = upgrades.Fork{ - UpgradeName: UpgradeName, - UpgradeHeight: UpgradeHeight, - BeginForkLogic: RunForkLogic, -} diff --git a/app/upgrades/v4_5/fork.go b/app/upgrades/v4_5/fork.go deleted file mode 100644 index e99be6bdc..000000000 --- a/app/upgrades/v4_5/fork.go +++ /dev/null @@ -1,60 +0,0 @@ -package v45 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/authz" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - - "github.com/notional-labs/composable/v6/app/keepers" -) - -func RunForkLogic(ctx sdk.Context, appKeepers *keepers.AppKeepers) { - for i := 0; i < 100; i++ { - fmt.Println("Switching to v4_5 code") - } - - // Specifying the whole list instead of adding and removing. Less fragile. - hostParams := icahosttypes.Params{ - HostEnabled: true, - AllowMessages: []string{ - // Change: Normal Msg - sdk.MsgTypeURL(&banktypes.MsgSend{}), - sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}), - sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}), - sdk.MsgTypeURL(&stakingtypes.MsgCreateValidator{}), - sdk.MsgTypeURL(&stakingtypes.MsgEditValidator{}), - sdk.MsgTypeURL(&distrtypes.MsgWithdrawDelegatorReward{}), - sdk.MsgTypeURL(&distrtypes.MsgSetWithdrawAddress{}), - sdk.MsgTypeURL(&distrtypes.MsgWithdrawValidatorCommission{}), - sdk.MsgTypeURL(&distrtypes.MsgFundCommunityPool{}), - sdk.MsgTypeURL(&govtypes.MsgVote{}), - sdk.MsgTypeURL(&authz.MsgExec{}), - sdk.MsgTypeURL(&authz.MsgGrant{}), - sdk.MsgTypeURL(&authz.MsgRevoke{}), - - // Change: Added MsgTrasnsfer - sdk.MsgTypeURL(&ibctransfertypes.MsgTransfer{}), - sdk.MsgTypeURL(&banktypes.MsgSend{}), - sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}), - sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}), - sdk.MsgTypeURL(&stakingtypes.MsgCreateValidator{}), - sdk.MsgTypeURL(&stakingtypes.MsgEditValidator{}), - - // Change: Added MsgUndelegate - sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}), - sdk.MsgTypeURL(&distrtypes.MsgWithdrawDelegatorReward{}), - sdk.MsgTypeURL(&distrtypes.MsgSetWithdrawAddress{}), - sdk.MsgTypeURL(&distrtypes.MsgWithdrawValidatorCommission{}), - sdk.MsgTypeURL(&distrtypes.MsgFundCommunityPool{}), - sdk.MsgTypeURL(&govtypes.MsgVote{}), - }, - } - appKeepers.ICAHostKeeper.SetParams(ctx, hostParams) -} diff --git a/app/upgrades/v4_5_1/constants.go b/app/upgrades/v4_5_1/constants.go deleted file mode 100644 index fec6f73b6..000000000 --- a/app/upgrades/v4_5_1/constants.go +++ /dev/null @@ -1,18 +0,0 @@ -package v4_5_1 - -import "github.com/notional-labs/composable/v6/app/upgrades" - -const ( - // UpgradeName defines the on-chain upgrade name for the Composable v5 upgrade. - UpgradeName = "v4_5_1" - - // UpgradeHeight defines the block height at which the Composable v6 upgrade is - // triggered. - UpgradeHeight = 1127000 -) - -var Fork = upgrades.Fork{ - UpgradeName: UpgradeName, - UpgradeHeight: UpgradeHeight, - BeginForkLogic: RunForkLogic, -} diff --git a/app/upgrades/v4_5_1/fork.go b/app/upgrades/v4_5_1/fork.go deleted file mode 100644 index fc413b7ae..000000000 --- a/app/upgrades/v4_5_1/fork.go +++ /dev/null @@ -1,28 +0,0 @@ -package v4_5_1 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/notional-labs/composable/v6/app/keepers" - rateLimitKeeper "github.com/notional-labs/composable/v6/x/ratelimit/keeper" -) - -func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { - ctx.Logger().Info("Applying v5 upgrade" + - "Remove Rate Limit", - ) - - RemoveRateLimit(ctx, &keepers.RatelimitKeeper) -} - -func RemoveRateLimit(ctx sdk.Context, rlKeeper *rateLimitKeeper.Keeper) { - // Get all current rate limit - rateLimits := rlKeeper.GetAllRateLimits(ctx) - // Remove Rate limit - for _, rateLimit := range rateLimits { - err := rlKeeper.RemoveRateLimit(ctx, rateLimit.Path.Denom, rateLimit.Path.ChannelID) - if err != nil { - panic(err) - } - } -} diff --git a/app/upgrades/v5/constants.go b/app/upgrades/v5/constants.go deleted file mode 100644 index 663369c4a..000000000 --- a/app/upgrades/v5/constants.go +++ /dev/null @@ -1,20 +0,0 @@ -package v5 - -import ( - store "cosmossdk.io/store/types" - "github.com/notional-labs/composable/v6/app/upgrades" - txboundary "github.com/notional-labs/composable/v6/x/tx-boundary/types" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v5" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{txboundary.ModuleName}, - }, -} diff --git a/app/upgrades/v5/upgrade.go b/app/upgrades/v5/upgrade.go deleted file mode 100644 index dbd109a17..000000000 --- a/app/upgrades/v5/upgrade.go +++ /dev/null @@ -1,155 +0,0 @@ -package v5 - -import ( - "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" - "github.com/notional-labs/composable/v6/x/ratelimit/types" -) - -const ( - // https://github.com/cosmos/chain-registry/blob/master/composable/assetlist.json - uatom = "ibc/EF48E6B1A1A19F47ECAEA62F5670C37C0580E86A9E88498B7E393EB6F49F33C0" - dot = "ibc/3CC19CEC7E5A3E90E78A5A9ECC5A0E2F8F826A375CF1E096F4515CF09DA3E366" - ksm = "ibc/EE9046745AEC0E8302CB7ED9D5AD67F528FB3B7AE044B247FB0FB293DBDA35E9" - usdt = "ibc/F3EC9F834E57DF704FA3AEAF14E8391C2E58397FE56960AD70E67562990D8265" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - _ codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // add min amount for rate limit - rlKeeper := keepers.RatelimitKeeper - // add uatom - uatomRateLimit, found := rlKeeper.GetRateLimit(ctx, uatom, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, uatom) - // Create and store the rate limit object - path := types.Path{ - Denom: uatom, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 24, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - uatomRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(1282_000_000), // decimal 6 - } - rlKeeper.SetRateLimit(ctx, uatomRateLimit) - } else { - uatomRateLimit.MinRateLimitAmount = sdk.NewInt(1282_000_000) - rlKeeper.SetRateLimit(ctx, uatomRateLimit) - } - // add dot - dotRateLimit, found := rlKeeper.GetRateLimit(ctx, dot, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, dot) - // Create and store the rate limit object - path := types.Path{ - Denom: dot, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 24, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - dotRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(22_670_000_000_000), // decimal 10 - } - rlKeeper.SetRateLimit(ctx, dotRateLimit) - } else { - dotRateLimit.MinRateLimitAmount = sdk.NewInt(22_670_000_000_000) - rlKeeper.SetRateLimit(ctx, dotRateLimit) - } - // add ksm - ksmRateLimit, found := rlKeeper.GetRateLimit(ctx, ksm, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, ksm) - // Create and store the rate limit object - path := types.Path{ - Denom: ksm, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 24, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - ksmRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(510_000_000_000_000), // decimal 12 - } - rlKeeper.SetRateLimit(ctx, ksmRateLimit) - } else { - ksmRateLimit.MinRateLimitAmount = sdk.NewInt(510_000_000_000_000) - rlKeeper.SetRateLimit(ctx, ksmRateLimit) - } - // add usdt - usdtRateLimit, found := rlKeeper.GetRateLimit(ctx, usdt, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, usdt) - // Create and store the rate limit object - path := types.Path{ - Denom: usdt, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 24, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - usdtRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(10_000_000_000), // decimal 6 - } - rlKeeper.SetRateLimit(ctx, usdtRateLimit) - } else { - usdtRateLimit.MinRateLimitAmount = sdk.NewInt(10_000_000_000) - rlKeeper.SetRateLimit(ctx, usdtRateLimit) - } - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v5_1_0/constants.go b/app/upgrades/v5_1_0/constants.go deleted file mode 100644 index aa9a6bf30..000000000 --- a/app/upgrades/v5_1_0/constants.go +++ /dev/null @@ -1,18 +0,0 @@ -package v5_1_0 - -import "github.com/notional-labs/composable/v6/app/upgrades" - -const ( - // UpgradeName defines the on-chain upgrade name for the Composable v5 upgrade. - UpgradeName = "v5_1_0" - - // UpgradeHeight defines the block height at which the Composable v6 upgrade is - // triggered. - UpgradeHeight = 1536990 -) - -var Fork = upgrades.Fork{ - UpgradeName: UpgradeName, - UpgradeHeight: UpgradeHeight, - BeginForkLogic: RunForkLogic, -} diff --git a/app/upgrades/v5_1_0/fork.go b/app/upgrades/v5_1_0/fork.go deleted file mode 100644 index 771d3c696..000000000 --- a/app/upgrades/v5_1_0/fork.go +++ /dev/null @@ -1,61 +0,0 @@ -package v5_1_0 - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/notional-labs/composable/v6/app/keepers" - rateLimitKeeper "github.com/notional-labs/composable/v6/x/ratelimit/keeper" - "github.com/notional-labs/composable/v6/x/ratelimit/types" -) - -const uosmo = "ibc/47BD209179859CDE4A2806763D7189B6E6FE13A17880FE2B42DE1E6C1E329E23" - -func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { - ctx.Logger().Info("Applying v5_1_0 upgrade" + - "Fix Rate Limit With Osmosis Token", - ) - - FixRateLimit(ctx, &keepers.RatelimitKeeper) -} - -func FixRateLimit(ctx sdk.Context, rlKeeper *rateLimitKeeper.Keeper) { - uosmoRateLimit, found := rlKeeper.GetRateLimit(ctx, uosmo, "channel-2") - if !found { - channelValue := rlKeeper.GetChannelValue(ctx, uosmo) - // Create and store the rate limit object - path := types.Path{ - Denom: uosmo, - ChannelID: "channel-2", - } - quota := types.Quota{ - MaxPercentSend: sdk.NewInt(30), - MaxPercentRecv: sdk.NewInt(30), - DurationHours: 24, - } - flow := types.Flow{ - Inflow: math.ZeroInt(), - Outflow: math.ZeroInt(), - ChannelValue: channelValue, - } - uosmoRateLimit = types.RateLimit{ - Path: &path, - Quota: "a, - Flow: &flow, - MinRateLimitAmount: sdk.NewInt(1), // decimal 6 - } - rlKeeper.SetRateLimit(ctx, uosmoRateLimit) - } else { - uosmoRateLimit.MinRateLimitAmount = sdk.NewInt(1) - rlKeeper.SetRateLimit(ctx, uosmoRateLimit) - } - - // double check - allRateLiit := rlKeeper.GetAllRateLimits(ctx) - for _, ratelimit := range allRateLiit { - if ratelimit.MinRateLimitAmount.IsNil() { - ratelimit.MinRateLimitAmount = sdk.NewInt(1) - rlKeeper.SetRateLimit(ctx, ratelimit) - } - } -} diff --git a/app/upgrades/v5_2_0/constants.go b/app/upgrades/v5_2_0/constants.go deleted file mode 100644 index b09071c2d..000000000 --- a/app/upgrades/v5_2_0/constants.go +++ /dev/null @@ -1,18 +0,0 @@ -package v5_2_0 - -import "github.com/notional-labs/composable/v6/app/upgrades" - -const ( - // UpgradeName defines the on-chain upgrade name for the Composable v5 upgrade. - UpgradeName = "v5_2_0" - - // UpgradeHeight defines the block height at which the Composable v6 upgrade is - // triggered. - UpgradeHeight = 1771900 -) - -var Fork = upgrades.Fork{ - UpgradeName: UpgradeName, - UpgradeHeight: UpgradeHeight, - BeginForkLogic: RunForkLogic, -} diff --git a/app/upgrades/v5_2_0/fork.go b/app/upgrades/v5_2_0/fork.go deleted file mode 100644 index a4ffbc8d6..000000000 --- a/app/upgrades/v5_2_0/fork.go +++ /dev/null @@ -1,83 +0,0 @@ -//nolint:all -package v5_2_0 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/notional-labs/composable/v6/app/keepers" - - wasm08types "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" -) - -const ( - newWasmCodeID = "ad84ee3292e28b4e46da16974c118d40093e1a6e28a083f2f045f68fde7fb575" - subjectClientId = "08-wasm-5" - substituteClientId = "08-wasm-133" -) - -func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { - ctx.Logger().Info("Applying v5_2_0 upgrade" + - "Upgrade 08-wasm contract", - ) - - UpdateWasmContract(ctx, keepers.IBCKeeper) - - err := ClientUpdate(ctx, keepers.IBCKeeper.Codec(), keepers.IBCKeeper, subjectClientId, substituteClientId) - if err != nil { - panic(err) - } -} - -func UpdateWasmContract(ctx sdk.Context, ibckeeper *ibckeeper.Keeper) { - unknownClientState, found := ibckeeper.ClientKeeper.GetClientState(ctx, subjectClientId) - if !found { - panic("substitute client client not found ") - } - - clientState, ok := unknownClientState.(*wasm08types.ClientState) - if !ok { - panic("cannot update client") - } - - code, err := transfertypes.ParseHexHash(newWasmCodeID) - if err != nil { - panic(err) - } - - clientState.CodeId = code - - ibckeeper.ClientKeeper.SetClientState(ctx, subjectClientId, clientState) -} - -func ClientUpdate(ctx sdk.Context, codec codec.BinaryCodec, ibckeeper *ibckeeper.Keeper, subjectClientId string, substituteClientId string) error { - subjectClientState, found := ibckeeper.ClientKeeper.GetClientState(ctx, subjectClientId) - if !found { - return sdkerrors.Wrapf(clienttypes.ErrClientNotFound, "subject client with ID %s", subjectClientId) - } - - subjectClientStore := ibckeeper.ClientKeeper.ClientStore(ctx, subjectClientId) - - substituteClientState, found := ibckeeper.ClientKeeper.GetClientState(ctx, substituteClientId) - if !found { - return sdkerrors.Wrapf(clienttypes.ErrClientNotFound, "substitute client with ID %s", substituteClientId) - } - - substituteClientStore := ibckeeper.ClientKeeper.ClientStore(ctx, substituteClientId) - - if status := ibckeeper.ClientKeeper.GetClientStatus(ctx, substituteClientState, substituteClientId); status != exported.Active { - return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "substitute client is not Active, status is %s", status) - } - - if err := subjectClientState.CheckSubstituteAndUpdateState(ctx, codec, subjectClientStore, substituteClientStore, substituteClientState); err != nil { - return err - } - - ctx.Logger().Info("client updated after hark fork passed", "client-id", subjectClientId) - - return nil -} diff --git a/app/upgrades/v6/constants.go b/app/upgrades/v6/constants.go deleted file mode 100644 index 4a695a94e..000000000 --- a/app/upgrades/v6/constants.go +++ /dev/null @@ -1,20 +0,0 @@ -package v6 - -import ( - store "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/x/authz" - "github.com/notional-labs/composable/v6/app/upgrades" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{authz.ModuleName}, - }, -} diff --git a/app/upgrades/v6/upgrade.go b/app/upgrades/v6/upgrade.go deleted file mode 100644 index 35f2611b8..000000000 --- a/app/upgrades/v6/upgrade.go +++ /dev/null @@ -1,24 +0,0 @@ -package v6 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - "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, - cdc codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_4/constants.go b/app/upgrades/v6_4/constants.go deleted file mode 100644 index 22df8fa0e..000000000 --- a/app/upgrades/v6_4/constants.go +++ /dev/null @@ -1,22 +0,0 @@ -package v6_4 - -import ( - store "cosmossdk.io/store/types" - - "github.com/notional-labs/composable/v6/app/upgrades" - customstmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{customstmiddleware.StoreKey}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6_4/upgrade.go b/app/upgrades/v6_4/upgrade.go deleted file mode 100644 index 61c74f958..000000000 --- a/app/upgrades/v6_4/upgrade.go +++ /dev/null @@ -1,28 +0,0 @@ -package v6_4 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" - customstmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - _ codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // Add params for custom middleware - custommiddlewareparams := customstmiddleware.Params{BlocksPerEpoch: 360, AllowUnbondAfterEpochProgressBlockNumber: 0} - keepers.StakingMiddlewareKeeper.SetParams(ctx, custommiddlewareparams) - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_4_4/constants.go b/app/upgrades/v6_4_4/constants.go deleted file mode 100644 index dac6950a1..000000000 --- a/app/upgrades/v6_4_4/constants.go +++ /dev/null @@ -1,15 +0,0 @@ -package v6_4_4 - -import ( - "github.com/notional-labs/composable/v6/app/upgrades" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_47" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, -} diff --git a/app/upgrades/v6_4_4/upgrade.go b/app/upgrades/v6_4_4/upgrade.go deleted file mode 100644 index 85c9d22ad..000000000 --- a/app/upgrades/v6_4_4/upgrade.go +++ /dev/null @@ -1,23 +0,0 @@ -package v6_4_4 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - "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, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_4_5/constants.go b/app/upgrades/v6_4_5/constants.go deleted file mode 100644 index 55b602bb3..000000000 --- a/app/upgrades/v6_4_5/constants.go +++ /dev/null @@ -1,15 +0,0 @@ -package v6_4_5 - -import ( - "github.com/notional-labs/composable/v6/app/upgrades" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_55" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, -} diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go deleted file mode 100644 index 08c1044ec..000000000 --- a/app/upgrades/v6_4_5/upgrade.go +++ /dev/null @@ -1,27 +0,0 @@ -package v6_4_5 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - "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, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - BrokenProposals := [3]uint64{2, 6, 11} - for _, proposal := range BrokenProposals { - keepers.GovKeeper.DeleteProposal(ctx, proposal) - } - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_4_6/constants.go b/app/upgrades/v6_4_6/constants.go deleted file mode 100644 index 327580123..000000000 --- a/app/upgrades/v6_4_6/constants.go +++ /dev/null @@ -1,22 +0,0 @@ -package v6_4_6 - -import ( - store "cosmossdk.io/store/types" - - "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_5" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{ibctransfermiddleware.StoreKey}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6_4_6/upgrade.go b/app/upgrades/v6_4_6/upgrade.go deleted file mode 100644 index df8e0f354..000000000 --- a/app/upgrades/v6_4_6/upgrade.go +++ /dev/null @@ -1,28 +0,0 @@ -package v6_4_6 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - _ codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // Add params for custom middleware - custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() - keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_4_7/constants.go b/app/upgrades/v6_4_7/constants.go deleted file mode 100644 index eb7009629..000000000 --- a/app/upgrades/v6_4_7/constants.go +++ /dev/null @@ -1,21 +0,0 @@ -package v6_4_7 - -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 = "v6_4_6" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6_4_7/upgrade.go b/app/upgrades/v6_4_7/upgrade.go deleted file mode 100644 index e81f7bee5..000000000 --- a/app/upgrades/v6_4_7/upgrade.go +++ /dev/null @@ -1,23 +0,0 @@ -package v6_4_7 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - "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, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_4_8/constants.go b/app/upgrades/v6_4_8/constants.go deleted file mode 100644 index 9b246ad84..000000000 --- a/app/upgrades/v6_4_8/constants.go +++ /dev/null @@ -1,21 +0,0 @@ -package v6_4_8 - -import ( - store "cosmossdk.io/store/types" - "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_8" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{ibctransfermiddleware.StoreKey}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6_4_8/upgrade.go b/app/upgrades/v6_4_8/upgrade.go deleted file mode 100644 index 176e950ce..000000000 --- a/app/upgrades/v6_4_8/upgrade.go +++ /dev/null @@ -1,47 +0,0 @@ -package v6_4_8 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "cosmossdk.io/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - _ codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() - keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) - - // remove broken proposals - BrokenProposals := [3]uint64{2, 6, 11} - for _, proposal_id := range BrokenProposals { - _, ok := keepers.GovKeeper.GetProposal(ctx, proposal_id) - if ok { - keepers.GovKeeper.DeleteProposal(ctx, proposal_id) - } - - } - - // burn extra ppica in escrow account - // this ppica is unused because it is a native token stored in escrow account - // it was unnecessarily minted to match pica escrowed on picasso to ppica minted - // in genesis, to make initial native ppica transferrable to picasso - amount, ok := sdk.NewIntFromString("1066669217167120000000") - if ok { - coins := sdk.Coins{sdk.NewCoin("ppica", amount)} - keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32("centauri12k2pyuylm9t7ugdvz67h9pg4gmmvhn5vmvgw48"), "gov", coins) - keepers.BankKeeper.BurnCoins(ctx, "gov", coins) - } - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_4_9/constants.go b/app/upgrades/v6_4_9/constants.go deleted file mode 100644 index a66425181..000000000 --- a/app/upgrades/v6_4_9/constants.go +++ /dev/null @@ -1,20 +0,0 @@ -package v6_4_9 - -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 = "v6_4_9" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6_4_9/upgrade.go b/app/upgrades/v6_4_9/upgrade.go deleted file mode 100644 index c1d26976d..000000000 --- a/app/upgrades/v6_4_9/upgrade.go +++ /dev/null @@ -1,23 +0,0 @@ -package v6_4_9 - -import ( - upgradetypes "cosmossdk.io/x/upgrade/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/cosmos/cosmos-sdk/codec" - "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, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_4_91/constants.go b/app/upgrades/v6_4_91/constants.go deleted file mode 100644 index ccbfd3c4f..000000000 --- a/app/upgrades/v6_4_91/constants.go +++ /dev/null @@ -1,20 +0,0 @@ -package v6_4_91 - -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 = "v6_4_91" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6_4_91/upgrade.go b/app/upgrades/v6_4_91/upgrade.go deleted file mode 100644 index 0755ae8ea..000000000 --- a/app/upgrades/v6_4_91/upgrade.go +++ /dev/null @@ -1,23 +0,0 @@ -package v6_4_91 - -import ( - upgradetypes "cosmossdk.io/x/upgrade/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/cosmos/cosmos-sdk/codec" - "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, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v6_5_0/constants.go b/app/upgrades/v6_5_0/constants.go deleted file mode 100644 index 4ce8eca11..000000000 --- a/app/upgrades/v6_5_0/constants.go +++ /dev/null @@ -1,21 +0,0 @@ -package v6_5_0 - -import ( - store "cosmossdk.io/store/types" - "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_5_0" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{ibctransfermiddleware.StoreKey}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6_5_0/upgrade.go b/app/upgrades/v6_5_0/upgrade.go deleted file mode 100644 index 3a1d6830b..000000000 --- a/app/upgrades/v6_5_0/upgrade.go +++ /dev/null @@ -1,47 +0,0 @@ -package v6_5_0 - -import ( - upgradetypes "cosmossdk.io/x/upgrade/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - _ codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() - keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) - - // remove broken proposals - BrokenProposals := [3]uint64{2, 6, 11} - for _, proposal_id := range BrokenProposals { - _, ok := keepers.GovKeeper.GetProposal(ctx, proposal_id) - if ok { - keepers.GovKeeper.DeleteProposal(ctx, proposal_id) - } - - } - - // burn extra ppica in escrow account - // this ppica is unused because it is a native token stored in escrow account - // it was unnecessarily minted to match pica escrowed on picasso to ppica minted - // in genesis, to make initial native ppica transferrable to picasso - amount, ok := sdk.NewIntFromString("1066669217167120000000") - if ok { - coins := sdk.Coins{sdk.NewCoin("ppica", amount)} - keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32("centauri12k2pyuylm9t7ugdvz67h9pg4gmmvhn5vmvgw48"), "gov", coins) - keepers.BankKeeper.BurnCoins(ctx, "gov", coins) - } - return mm.RunMigrations(ctx, configurator, vm) - } -}