From dea3c33f18aefeea248ee9ec96a85c46463dc1a4 Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Fri, 29 Mar 2024 13:44:51 +0700 Subject: [PATCH 01/10] fix duplicate keys --- app/keepers/keepers.go | 8 ++++---- app/keepers/keys.go | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 8e7099e0..96434db0 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -540,13 +540,13 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypesv1.ParamKeyTable()) //nolint:staticcheck paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) paramsKeeper.Subspace(ratelimitmoduletypes.ModuleName) - paramsKeeper.Subspace(icqtypes.ModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) + paramsKeeper.Subspace(icqtypes.ModuleName).WithKeyTable(icqtypes.ParamKeyTable()) + paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) paramsKeeper.Subspace(wasm08types.ModuleName) paramsKeeper.Subspace(wasmtypes.ModuleName) - paramsKeeper.Subspace(transfermiddlewaretypes.ModuleName) + paramsKeeper.Subspace(transfermiddlewaretypes.ModuleName).WithKeyTable(transfermiddlewaretypes.ParamKeyTable()) paramsKeeper.Subspace(stakingmiddlewaretypes.ModuleName) paramsKeeper.Subspace(ibctransfermiddlewaretypes.ModuleName) diff --git a/app/keepers/keys.go b/app/keepers/keys.go index 7d616793..e185abde 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -23,12 +23,10 @@ import ( paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v8/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" - ibchost "github.com/cosmos/ibc-go/v8/modules/core/exported" - - routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types" ratelimitmoduletypes "github.com/notional-labs/composable/v6/x/ratelimit/types" @@ -55,7 +53,7 @@ func (appKeepers *AppKeepers) GenerateKeys() { // Cosmos-SDK modules each have a "key" that allows the application to reference what they've stored on the chain. appKeepers.keys = storetypes.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, + govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, circuittypes.StoreKey, ibctransfertypes.StoreKey, From 9b4484ffb10185412c7a8641230185cd098da711 Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Fri, 29 Mar 2024 14:13:44 +0700 Subject: [PATCH 02/10] update wasm --- app/app.go | 8 ++++---- app/keepers/keepers.go | 16 +++++++++------- app/keepers/wasm.go | 3 +++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/app.go b/app/app.go index 983985ba..0d983f57 100644 --- a/app/app.go +++ b/app/app.go @@ -17,6 +17,7 @@ import ( "github.com/cosmos/gogoproto/proto" wasm08 "github.com/cosmos/ibc-go/modules/light-clients/08-wasm" wasm08keeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" wasm08types "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" @@ -90,7 +91,6 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v8/modules/core" - ibchost "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" customibctransfer "github.com/notional-labs/composable/v6/custom/ibc-transfer" customstaking "github.com/notional-labs/composable/v6/custom/staking" @@ -408,7 +408,7 @@ func NewComposableApp( evidencetypes.ModuleName, stakingtypes.ModuleName, vestingtypes.ModuleName, - ibchost.ModuleName, + ibcexported.ModuleName, ibctransfertypes.ModuleName, routertypes.ModuleName, transfermiddlewaretypes.ModuleName, @@ -446,6 +446,7 @@ func NewComposableApp( distrtypes.ModuleName, slashingtypes.ModuleName, vestingtypes.ModuleName, + ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, @@ -453,7 +454,6 @@ func NewComposableApp( group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, - ibchost.ModuleName, routertypes.ModuleName, transfermiddlewaretypes.ModuleName, txBoundaryTypes.ModuleName, @@ -486,7 +486,7 @@ func NewComposableApp( govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, - ibchost.ModuleName, + ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 96434db0..22c8aa5c 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -4,6 +4,7 @@ import ( circuitkeeper "cosmossdk.io/x/circuit/keeper" circuittypes "cosmossdk.io/x/circuit/types" "fmt" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" "path/filepath" "strings" @@ -69,7 +70,6 @@ import ( icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v8/keeper" icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v8/types" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client" ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" customibctransferkeeper "github.com/notional-labs/composable/v6/custom/ibc-transfer/keeper" @@ -149,7 +149,7 @@ type AppKeepers struct { AuthzKeeper authzkeeper.Keeper GroupKeeper groupkeeper.Keeper Wasm08Keeper wasm08Keeper.Keeper // TODO: use this name ? - WasmKeeper wasm.Keeper + WasmKeeper wasmkeeper.Keeper IBCHooksKeeper *ibchookskeeper.Keeper Ics20WasmHooks *ibc_hooks.WasmHooks HooksICS4Wrapper ibc_hooks.ICS4Middleware @@ -465,8 +465,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( // by granting the governance module the right to execute the message. // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter.AddRoute(govtypes.RouterKey, govtypesv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper)) + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper)) govKeeper := *govkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(appKeepers.keys[govtypes.StoreKey]), appKeepers.AccountKeeper, appKeepers.BankKeeper, @@ -485,7 +484,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ibcRouter := porttypes.NewRouter() ibcRouter.AddRoute(ibctransfertypes.ModuleName, hooksTransferMiddleware) ibcRouter.AddRoute(icqtypes.ModuleName, icqIBCModule) - ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper)) + ibcRouter.AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper)) ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostStack) // this line is used by starport scaffolding # ibc/app/router @@ -527,9 +526,14 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) // register the IBC key tables for legacy param subspaces + + // register the key tables for legacy param subspaces keyTable := ibcclienttypes.ParamKeyTable() keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) + paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) paramsKeeper.Subspace(authtypes.ModuleName) paramsKeeper.Subspace(banktypes.ModuleName) @@ -540,10 +544,8 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypesv1.ParamKeyTable()) //nolint:staticcheck paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) paramsKeeper.Subspace(ratelimitmoduletypes.ModuleName) paramsKeeper.Subspace(icqtypes.ModuleName).WithKeyTable(icqtypes.ParamKeyTable()) - paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) paramsKeeper.Subspace(wasm08types.ModuleName) paramsKeeper.Subspace(wasmtypes.ModuleName) paramsKeeper.Subspace(transfermiddlewaretypes.ModuleName).WithKeyTable(transfermiddlewaretypes.ParamKeyTable()) diff --git a/app/keepers/wasm.go b/app/keepers/wasm.go index 50bc1565..168c3e6f 100644 --- a/app/keepers/wasm.go +++ b/app/keepers/wasm.go @@ -10,5 +10,8 @@ func AllCapabilities() []string { "stargate", "cosmwasm_1_1", "cosmwasm_1_2", + "cosmwasm_1_3", + "cosmwasm_1_4", + "cosmwasm_2_0", } } From f2132e57791a49d28b586316d2763ac29f3e76a1 Mon Sep 17 00:00:00 2001 From: kienn6034 Date: Fri, 29 Mar 2024 16:22:37 +0700 Subject: [PATCH 03/10] feat: add store upgrades upgrade handler --- app/app.go | 14 +++++++++++--- app/keepers/keepers.go | 7 ++++--- app/upgrades/v7_0_0/constants.go | 7 +++++++ app/upgrades/v7_0_0/upgrade.go | 2 -- go.mod | 8 ++++---- go.sum | 2 ++ scripts/test-upgrade.sh | 4 ++-- 7 files changed, 30 insertions(+), 14 deletions(-) diff --git a/app/app.go b/app/app.go index 0d983f57..68a2aa4d 100644 --- a/app/app.go +++ b/app/app.go @@ -1,13 +1,14 @@ package app import ( - "cosmossdk.io/x/circuit" - circuittypes "cosmossdk.io/x/circuit/types" "fmt" "io" "os" "path/filepath" + "cosmossdk.io/x/circuit" + circuittypes "cosmossdk.io/x/circuit/types" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/std" authante "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -513,7 +514,14 @@ func NewComposableApp( app.mm.RegisterInvariants(app.CrisisKeeper) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.mm.RegisterServices(app.configurator) + + fmt.Println("registering services") + err = app.mm.RegisterServices(app.configurator) + if err != nil { + panic(err) + } + + fmt.Println("done registering services") app.setupUpgradeHandlers() diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 22c8aa5c..bc648970 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -1,13 +1,14 @@ package keepers import ( + "fmt" + "path/filepath" + "strings" + circuitkeeper "cosmossdk.io/x/circuit/keeper" circuittypes "cosmossdk.io/x/circuit/types" - "fmt" icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - "path/filepath" - "strings" "cosmossdk.io/log" diff --git a/app/upgrades/v7_0_0/constants.go b/app/upgrades/v7_0_0/constants.go index 5b13f658..69d5e9be 100644 --- a/app/upgrades/v7_0_0/constants.go +++ b/app/upgrades/v7_0_0/constants.go @@ -4,6 +4,9 @@ import ( store "cosmossdk.io/store/types" circuittypes "cosmossdk.io/x/circuit/types" "github.com/notional-labs/composable/v6/app/upgrades" + + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" ) const ( @@ -17,6 +20,10 @@ var Upgrade = upgrades.Upgrade{ StoreUpgrades: store.StoreUpgrades{ Added: []string{ circuittypes.ModuleName, + + icacontrollertypes.StoreKey, + + authzkeeper.StoreKey, }, Deleted: []string{"alliance"}, }, diff --git a/app/upgrades/v7_0_0/upgrade.go b/app/upgrades/v7_0_0/upgrade.go index 9e050820..6f081c35 100644 --- a/app/upgrades/v7_0_0/upgrade.go +++ b/app/upgrades/v7_0_0/upgrade.go @@ -2,7 +2,6 @@ package v7_0_0 import ( "context" - "fmt" upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -20,7 +19,6 @@ func CreateUpgradeHandler( keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - fmt.Println("start v7.0.0 upgrade") return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/go.mod b/go.mod index 090d9df8..baa322ef 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( cosmossdk.io/client/v2 v2.0.0-beta.1 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/tools/confix v0.1.1 // indirect - cosmossdk.io/x/circuit v0.1.0 // indirect + cosmossdk.io/x/circuit v0.1.0 github.com/Abirdcfly/dupword v0.0.11 // indirect github.com/Antonboom/errname v0.1.9 // indirect github.com/Antonboom/nilnil v0.1.3 // indirect @@ -364,10 +364,10 @@ replace ( github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.50.5 - // github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 - github.com/cosmos/ibc-go/modules/light-clients/08-wasm => /Users/hoank/resource/notional/ibc-go/modules/light-clients/08-wasm + github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 + // github.com/cosmos/ibc-go/modules/light-clients/08-wasm => /Users/hoank/resource/notional/ibc-go/modules/light-clients/08-wasm - github.com/cosmos/ibc-go/v8 => /Users/hoank/resource/notional/ibc-go + github.com/cosmos/ibc-go/v8 => /Users/kien6034/go/pkg/mod/github.com/cosmos/ibc-go/v8@v8.0.0 // use cosmos-compatible protobufs github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index 43c4c864..6d0854ec 100644 --- a/go.sum +++ b/go.sum @@ -1399,6 +1399,8 @@ github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACp github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= +github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 h1:XKnqm3lM0mj7VYUpRrdbu4Pf01oz8spFr5rKEZIt4lk= +github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0= github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= diff --git a/scripts/test-upgrade.sh b/scripts/test-upgrade.sh index 05cd2da2..ff6e83a2 100755 --- a/scripts/test-upgrade.sh +++ b/scripts/test-upgrade.sh @@ -151,9 +151,9 @@ sleep 1 # run new node echo -e "\n\n=> =>continue running nodes after upgrade" if [[ "$OSTYPE" == "darwin"* ]]; then - CONTINUE="true" screen -L -dmS centaurid bash scripts/localnode.sh _build/new/centaurid $DENOM + CONTINUE="true" bash scripts/localnode.sh _build/new/centaurid $DENOM else - CONTINUE="true" screen -L -dmS centaurid bash scripts/localnode.sh _build/new/centaurid $DENOM + CONTINUE="true" bash scripts/localnode.sh _build/new/centaurid $DENOM fi sleep 5 From ad1a374757e64796d736e7ab7c88c5f147c63bf3 Mon Sep 17 00:00:00 2001 From: kienn6034 Date: Fri, 29 Mar 2024 16:29:51 +0700 Subject: [PATCH 04/10] upgrade handler: remove authz --- app/upgrades/v7_0_0/constants.go | 3 --- go.mod | 2 -- 2 files changed, 5 deletions(-) diff --git a/app/upgrades/v7_0_0/constants.go b/app/upgrades/v7_0_0/constants.go index 69d5e9be..7fe4436d 100644 --- a/app/upgrades/v7_0_0/constants.go +++ b/app/upgrades/v7_0_0/constants.go @@ -5,7 +5,6 @@ import ( circuittypes "cosmossdk.io/x/circuit/types" "github.com/notional-labs/composable/v6/app/upgrades" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" ) @@ -22,8 +21,6 @@ var Upgrade = upgrades.Upgrade{ circuittypes.ModuleName, icacontrollertypes.StoreKey, - - authzkeeper.StoreKey, }, Deleted: []string{"alliance"}, }, diff --git a/go.mod b/go.mod index baa322ef..a4d12e8c 100644 --- a/go.mod +++ b/go.mod @@ -367,8 +367,6 @@ replace ( github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 // github.com/cosmos/ibc-go/modules/light-clients/08-wasm => /Users/hoank/resource/notional/ibc-go/modules/light-clients/08-wasm - github.com/cosmos/ibc-go/v8 => /Users/kien6034/go/pkg/mod/github.com/cosmos/ibc-go/v8@v8.0.0 - // use cosmos-compatible protobufs github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 From 40659aa9c7ccf74cc8c3e9fc9dc6511c653d0c01 Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Fri, 29 Mar 2024 17:50:42 +0700 Subject: [PATCH 05/10] refactor --- app/app.go | 50 ++++++++++++++++------------------ app/keepers/keepers.go | 3 +- app/upgrades/v7_0_0/upgrade.go | 10 +++++++ go.mod | 2 +- go.sum | 6 ++-- 5 files changed, 40 insertions(+), 31 deletions(-) diff --git a/app/app.go b/app/app.go index 68a2aa4d..de4416b2 100644 --- a/app/app.go +++ b/app/app.go @@ -321,7 +321,6 @@ func NewComposableApp( skipUpgradeHeights, homePath, ) - app.setupUpgradeStoreLoaders() app.InitNormalKeepers( logger, appCodec, @@ -520,7 +519,6 @@ func NewComposableApp( if err != nil { panic(err) } - fmt.Println("done registering services") app.setupUpgradeHandlers() @@ -727,9 +725,28 @@ func (app *ComposableApp) SimulationManager() *module.SimulationManager { return app.sm } -// configure store loader that checks if version == upgradeHeight and applies store upgrades -func (app *ComposableApp) setupUpgradeStoreLoaders() { +func (app *ComposableApp) customPreUpgradeHandler(_ upgradetypes.Plan) { + // switch upgradeInfo.Name { + // default: + // } +} + +func (app *ComposableApp) setupUpgradeHandlers() { + for _, upgrade := range Upgrades { + app.UpgradeKeeper.SetUpgradeHandler( + upgrade.UpgradeName, + upgrade.CreateUpgradeHandler( + app.mm, + app.configurator, + app.BaseApp, + app.AppCodec(), + &app.AppKeepers, + ), + ) + } + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + fmt.Println("setupUpgradeHandlers", upgradeInfo) if err != nil { panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) } @@ -739,36 +756,17 @@ func (app *ComposableApp) setupUpgradeStoreLoaders() { } currentHeight := app.CommitMultiStore().LastCommitID().Version + fmt.Println("currentHeight", currentHeight) if upgradeInfo.Height == currentHeight+1 { app.customPreUpgradeHandler(upgradeInfo) } for _, upgrade := range Upgrades { - upgrade := upgrade + fmt.Println(upgrade.UpgradeName, upgradeInfo.Name) if upgradeInfo.Name == upgrade.UpgradeName { app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades)) + break } } } - -func (app *ComposableApp) customPreUpgradeHandler(_ upgradetypes.Plan) { - // switch upgradeInfo.Name { - // default: - // } -} - -func (app *ComposableApp) setupUpgradeHandlers() { - for _, upgrade := range Upgrades { - app.UpgradeKeeper.SetUpgradeHandler( - upgrade.UpgradeName, - upgrade.CreateUpgradeHandler( - app.mm, - app.configurator, - app.BaseApp, - app.AppCodec(), - &app.AppKeepers, - ), - ) - } -} diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index bc648970..4be4e60a 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -2,6 +2,7 @@ package keepers import ( "fmt" + "github.com/cosmos/cosmos-sdk/x/params" "path/filepath" "strings" @@ -47,7 +48,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - "github.com/cosmos/cosmos-sdk/x/params" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" @@ -284,7 +284,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.ScopedIBCKeeper, govModAddress, ) - // ICA Host keeper appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, appKeepers.keys[icahosttypes.StoreKey], appKeepers.GetSubspace(icahosttypes.SubModuleName), diff --git a/app/upgrades/v7_0_0/upgrade.go b/app/upgrades/v7_0_0/upgrade.go index 6f081c35..3ef662d1 100644 --- a/app/upgrades/v7_0_0/upgrade.go +++ b/app/upgrades/v7_0_0/upgrade.go @@ -2,6 +2,9 @@ package v7_0_0 import ( "context" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -19,6 +22,13 @@ func CreateUpgradeHandler( keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + fmt.Println("Start v7.0.0 upgrade") + clientKeeper := keepers.IBCKeeper.ClientKeeper + oldCtx := sdk.UnwrapSDKContext(ctx) + params := clientKeeper.GetParams(oldCtx) + params.AllowedClients = append(params.AllowedClients, types.Wasm) + clientKeeper.SetParams(oldCtx, params) + return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/go.mod b/go.mod index a4d12e8c..a928b230 100644 --- a/go.mod +++ b/go.mod @@ -364,7 +364,7 @@ replace ( github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.50.5 - github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 + github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240329093800-163b10569c21 // github.com/cosmos/ibc-go/modules/light-clients/08-wasm => /Users/hoank/resource/notional/ibc-go/modules/light-clients/08-wasm // use cosmos-compatible protobufs diff --git a/go.sum b/go.sum index 6d0854ec..07059d17 100644 --- a/go.sum +++ b/go.sum @@ -836,6 +836,8 @@ github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0 h1:nKP2+Rzlz2iyvTosY5mvP+ github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0/go.mod h1:D3Q380FpWRFtmUQWLosPxachi6w24Og2t5u/Tww5wtY= github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg= +github.com/cosmos/ibc-go/v8 v8.0.0/go.mod h1:C6IiJom0F3cIQCD5fKwVPDrDK9j/xTu563AWuOmXois= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= @@ -1399,8 +1401,8 @@ github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACp github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 h1:XKnqm3lM0mj7VYUpRrdbu4Pf01oz8spFr5rKEZIt4lk= -github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0= +github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240329093800-163b10569c21 h1:ktll354VVdwDzBrBw+30L7CWeSpQVzLzUyBAiDGCLuA= +github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240329093800-163b10569c21/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0= github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= From fbd6f67bb3410ac5ffadbca7a5dc2a77f3cb6df6 Mon Sep 17 00:00:00 2001 From: kienn6034 Date: Fri, 29 Mar 2024 19:47:39 +0700 Subject: [PATCH 06/10] feat: add preblocker --- app/app.go | 14 ++++++++++++++ app/upgrades/v7_0_0/upgrade.go | 3 +++ go.mod | 3 ++- go.sum | 4 ---- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index 68a2aa4d..93efeb7f 100644 --- a/app/app.go +++ b/app/app.go @@ -396,6 +396,10 @@ func NewComposableApp( app.basicModuleManger.RegisterLegacyAminoCodec(legacyAmino) app.basicModuleManger.RegisterInterfaces(interfaceRegistry) + app.mm.SetOrderPreBlockers( + upgradetypes.ModuleName, + ) + // During begin block slashing happens after distr.BeginBlocker so that // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. @@ -557,6 +561,7 @@ func NewComposableApp( // initialize BaseApp app.SetInitChainer(app.InitChainer) + app.SetPreBlocker(app.PreBlocker) app.SetBeginBlocker(app.BeginBlocker) app.SetAnteHandler(ante.NewAnteHandler( @@ -628,17 +633,24 @@ func (app *ComposableApp) GetTxConfig() client.TxConfig { // BeginBlocker application updates every begin block func (app *ComposableApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + fmt.Println("begin block") BeginBlockForks(ctx, app) return app.mm.BeginBlock(ctx) } // EndBlocker application updates every end block func (app *ComposableApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { + fmt.Println("end block") return app.mm.EndBlock(ctx) } +func (app *ComposableApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + return app.mm.PreBlock(ctx) +} + // InitChainer application update at chain initialization func (app *ComposableApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { + fmt.Println("init chainner") var genesisState GenesisState if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) @@ -760,6 +772,8 @@ func (app *ComposableApp) customPreUpgradeHandler(_ upgradetypes.Plan) { func (app *ComposableApp) setupUpgradeHandlers() { for _, upgrade := range Upgrades { + fmt.Println("setting upgrade handler for", upgrade.UpgradeName) + app.UpgradeKeeper.SetUpgradeHandler( upgrade.UpgradeName, upgrade.CreateUpgradeHandler( diff --git a/app/upgrades/v7_0_0/upgrade.go b/app/upgrades/v7_0_0/upgrade.go index 6f081c35..4ba1c388 100644 --- a/app/upgrades/v7_0_0/upgrade.go +++ b/app/upgrades/v7_0_0/upgrade.go @@ -2,6 +2,7 @@ package v7_0_0 import ( "context" + "fmt" upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -18,7 +19,9 @@ func CreateUpgradeHandler( _ codec.Codec, keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { + fmt.Println("upgrade: Creating upgrade handler for v7_0_0") return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + fmt.Println("Running upgrade handler for v7_0_0") return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/go.mod b/go.mod index a4d12e8c..66364e8f 100644 --- a/go.mod +++ b/go.mod @@ -356,13 +356,14 @@ require ( replace ( cosmossdk.io/core => cosmossdk.io/core v0.11.0 + // Use the keyring specified by the cosmos-sdk github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 // lock wasmvm so we do not break the grandpa contract // TODO: check wasm vm compatibility with grandpa contract github.com/CosmWasm/wasmvm => github.com/CosmWasm/wasmvm v1.5.2 - github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.50.5 + github.com/cosmos/cosmos-sdk => /Users/kien6034/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.5 github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 // github.com/cosmos/ibc-go/modules/light-clients/08-wasm => /Users/hoank/resource/notional/ibc-go/modules/light-clients/08-wasm diff --git a/go.sum b/go.sum index 6d0854ec..5a82fe30 100644 --- a/go.sum +++ b/go.sum @@ -639,8 +639,6 @@ cosmossdk.io/x/nft v0.1.0 h1:VhcsFiEK33ODN27kxKLa0r/CeFd8laBfbDBwYqCyYCM= cosmossdk.io/x/nft v0.1.0/go.mod h1:ec4j4QAO4mJZ+45jeYRnW7awLHby1JZANqe1hNZ4S3g= cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= -cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= -cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -819,8 +817,6 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= -github.com/cosmos/cosmos-sdk v0.50.5 h1:MOEi+DKYgW67YaPgB+Pf+nHbD3V9S/ayitRKJYLfGIA= -github.com/cosmos/cosmos-sdk v0.50.5/go.mod h1:oV/k6GJgXV9QPoM2fsYDPPsyPBgQbdotv532O6Mz1OQ= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= From b003379515c4aa004819200188f4a53a6670ac3b Mon Sep 17 00:00:00 2001 From: kienn6034 Date: Sat, 30 Mar 2024 01:02:09 +0700 Subject: [PATCH 07/10] feat: fix staking instore migration --- app/app.go | 1 + custom/staking/module.go | 5 +++++ go.sum | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/app/app.go b/app/app.go index 93efeb7f..677a47c4 100644 --- a/app/app.go +++ b/app/app.go @@ -358,6 +358,7 @@ func NewComposableApp( app.AccountKeeper, app.StakingKeeper, app, encodingConfig.TxConfig, ), + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), custombankmodule.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), diff --git a/custom/staking/module.go b/custom/staking/module.go index 8a18bff0..f7704962 100644 --- a/custom/staking/module.go +++ b/custom/staking/module.go @@ -44,6 +44,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { stakingtypes.RegisterQueryServer(cfg.QueryServer(), querier) m := stakingkeeper.NewMigrator(&am.keeper.Keeper, am.subspace) + fmt.Println("Registering migrations for x/staking: staking 1->2") if err := cfg.RegisterMigration(stakingtypes.ModuleName, 1, m.Migrate1to2); err != nil { panic(fmt.Sprintf("failed to migrate x/staking from version 1 to 2: %v", err)) } @@ -55,4 +56,8 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(stakingtypes.ModuleName, 3, m.Migrate3to4); err != nil { panic(fmt.Sprintf("failed to migrate x/staking from version 3 to 4: %v", err)) } + + if err := cfg.RegisterMigration(stakingtypes.ModuleName, 4, m.Migrate4to5); err != nil { + panic(fmt.Sprintf("failed to migrate x/staking from version 4 to 5: %v", err)) + } } diff --git a/go.sum b/go.sum index 5a82fe30..b46e6d23 100644 --- a/go.sum +++ b/go.sum @@ -639,6 +639,8 @@ cosmossdk.io/x/nft v0.1.0 h1:VhcsFiEK33ODN27kxKLa0r/CeFd8laBfbDBwYqCyYCM= cosmossdk.io/x/nft v0.1.0/go.mod h1:ec4j4QAO4mJZ+45jeYRnW7awLHby1JZANqe1hNZ4S3g= cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= +cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= +cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -832,6 +834,8 @@ github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0 h1:nKP2+Rzlz2iyvTosY5mvP+ github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0/go.mod h1:D3Q380FpWRFtmUQWLosPxachi6w24Og2t5u/Tww5wtY= github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg= +github.com/cosmos/ibc-go/v8 v8.0.0/go.mod h1:C6IiJom0F3cIQCD5fKwVPDrDK9j/xTu563AWuOmXois= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= From f88a6491c622435b95700f8883f87c6d76b44a9c Mon Sep 17 00:00:00 2001 From: kienn6034 Date: Sat, 30 Mar 2024 01:07:56 +0700 Subject: [PATCH 08/10] fix: instore migration for ibctransfer --- custom/ibc-transfer/module.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom/ibc-transfer/module.go b/custom/ibc-transfer/module.go index a3464cf7..88de731e 100644 --- a/custom/ibc-transfer/module.go +++ b/custom/ibc-transfer/module.go @@ -48,4 +48,12 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(types.ModuleName, 2, m.MigrateTotalEscrowForDenom); err != nil { panic(fmt.Sprintf("failed to migrate transfer app from version 2 to 3: %v", err)) } + + if err := cfg.RegisterMigration(types.ModuleName, 3, m.MigrateParams); err != nil { + panic(fmt.Errorf("failed to migrate transfer app version 3 to 4 (self-managed params migration): %v", err)) + } + + if err := cfg.RegisterMigration(types.ModuleName, 4, m.MigrateDenomMetadata); err != nil { + panic(fmt.Errorf("failed to migrate transfer app from version 4 to 5 (set denom metadata migration): %v", err)) + } } From b0f07e31dc0aaeadc1d89ee7aa26f8f67d6094e5 Mon Sep 17 00:00:00 2001 From: kienn6034 Date: Sat, 30 Mar 2024 01:22:31 +0700 Subject: [PATCH 09/10] chore: remove debug println --- app/app.go | 7 ------- app/upgrades/v7_0_0/upgrade.go | 3 --- custom/staking/module.go | 1 - go.mod | 4 +--- go.sum | 2 ++ 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/app/app.go b/app/app.go index 677a47c4..060b15fc 100644 --- a/app/app.go +++ b/app/app.go @@ -520,14 +520,11 @@ func NewComposableApp( app.mm.RegisterInvariants(app.CrisisKeeper) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - fmt.Println("registering services") err = app.mm.RegisterServices(app.configurator) if err != nil { panic(err) } - fmt.Println("done registering services") - app.setupUpgradeHandlers() // create the simulation manager and define the order of the modules for deterministic simulations @@ -634,14 +631,12 @@ func (app *ComposableApp) GetTxConfig() client.TxConfig { // BeginBlocker application updates every begin block func (app *ComposableApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { - fmt.Println("begin block") BeginBlockForks(ctx, app) return app.mm.BeginBlock(ctx) } // EndBlocker application updates every end block func (app *ComposableApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { - fmt.Println("end block") return app.mm.EndBlock(ctx) } @@ -651,7 +646,6 @@ func (app *ComposableApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlo // InitChainer application update at chain initialization func (app *ComposableApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { - fmt.Println("init chainner") var genesisState GenesisState if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) @@ -773,7 +767,6 @@ func (app *ComposableApp) customPreUpgradeHandler(_ upgradetypes.Plan) { func (app *ComposableApp) setupUpgradeHandlers() { for _, upgrade := range Upgrades { - fmt.Println("setting upgrade handler for", upgrade.UpgradeName) app.UpgradeKeeper.SetUpgradeHandler( upgrade.UpgradeName, diff --git a/app/upgrades/v7_0_0/upgrade.go b/app/upgrades/v7_0_0/upgrade.go index 4ba1c388..6f081c35 100644 --- a/app/upgrades/v7_0_0/upgrade.go +++ b/app/upgrades/v7_0_0/upgrade.go @@ -2,7 +2,6 @@ package v7_0_0 import ( "context" - "fmt" upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -19,9 +18,7 @@ func CreateUpgradeHandler( _ codec.Codec, keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { - fmt.Println("upgrade: Creating upgrade handler for v7_0_0") return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - fmt.Println("Running upgrade handler for v7_0_0") return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/custom/staking/module.go b/custom/staking/module.go index f7704962..736e215a 100644 --- a/custom/staking/module.go +++ b/custom/staking/module.go @@ -44,7 +44,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { stakingtypes.RegisterQueryServer(cfg.QueryServer(), querier) m := stakingkeeper.NewMigrator(&am.keeper.Keeper, am.subspace) - fmt.Println("Registering migrations for x/staking: staking 1->2") if err := cfg.RegisterMigration(stakingtypes.ModuleName, 1, m.Migrate1to2); err != nil { panic(fmt.Sprintf("failed to migrate x/staking from version 1 to 2: %v", err)) } diff --git a/go.mod b/go.mod index 66364e8f..04cdcbf1 100644 --- a/go.mod +++ b/go.mod @@ -359,14 +359,12 @@ replace ( // Use the keyring specified by the cosmos-sdk github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 + // lock wasmvm so we do not break the grandpa contract // TODO: check wasm vm compatibility with grandpa contract github.com/CosmWasm/wasmvm => github.com/CosmWasm/wasmvm v1.5.2 - github.com/cosmos/cosmos-sdk => /Users/kien6034/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.5 - github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 - // github.com/cosmos/ibc-go/modules/light-clients/08-wasm => /Users/hoank/resource/notional/ibc-go/modules/light-clients/08-wasm // use cosmos-compatible protobufs github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index b46e6d23..d9fbcd11 100644 --- a/go.sum +++ b/go.sum @@ -819,6 +819,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= +github.com/cosmos/cosmos-sdk v0.50.5 h1:MOEi+DKYgW67YaPgB+Pf+nHbD3V9S/ayitRKJYLfGIA= +github.com/cosmos/cosmos-sdk v0.50.5/go.mod h1:oV/k6GJgXV9QPoM2fsYDPPsyPBgQbdotv532O6Mz1OQ= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= From a36ea8d8c05b5e09e2deff49423b39e50ae8d708 Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Sat, 30 Mar 2024 09:27:36 +0700 Subject: [PATCH 10/10] bump 08-wasm --- app/upgrades/v7_0_0/constants.go | 1 - go.mod | 2 +- go.sum | 4 ++-- scripts/localnode.sh | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/upgrades/v7_0_0/constants.go b/app/upgrades/v7_0_0/constants.go index 7fe4436d..df8ee317 100644 --- a/app/upgrades/v7_0_0/constants.go +++ b/app/upgrades/v7_0_0/constants.go @@ -19,7 +19,6 @@ var Upgrade = upgrades.Upgrade{ StoreUpgrades: store.StoreUpgrades{ Added: []string{ circuittypes.ModuleName, - icacontrollertypes.StoreKey, }, Deleted: []string{"alliance"}, diff --git a/go.mod b/go.mod index 04cdcbf1..9bcfb4bc 100644 --- a/go.mod +++ b/go.mod @@ -364,7 +364,7 @@ replace ( // TODO: check wasm vm compatibility with grandpa contract github.com/CosmWasm/wasmvm => github.com/CosmWasm/wasmvm v1.5.2 - github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240328152744-0f9d4a916102 + github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240330020027-fa949b150972 // use cosmos-compatible protobufs github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index 07059d17..be4dea16 100644 --- a/go.sum +++ b/go.sum @@ -1401,8 +1401,8 @@ github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACp github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240329093800-163b10569c21 h1:ktll354VVdwDzBrBw+30L7CWeSpQVzLzUyBAiDGCLuA= -github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240329093800-163b10569c21/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0= +github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240330020027-fa949b150972 h1:nrxV6i6FBnMUwmx3Aqun7111xfOCFEIO9oetf5EVxEM= +github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240330020027-fa949b150972/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0= github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= diff --git a/scripts/localnode.sh b/scripts/localnode.sh index 7ae87a5e..d2749373 100755 --- a/scripts/localnode.sh +++ b/scripts/localnode.sh @@ -77,7 +77,7 @@ $SED_BINARY -i -e 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' $ $SED_BINARY -i 's/minimum-gas-prices = "0.25upica"/minimum-gas-prices = "0.0upica"/' $HOME_DIR/config/app.toml ## Adjust block time -$SED_BINARY -i 's/timeout_commit = "5s"/timeout_commit = "500ms"/' $HOME_DIR/config/config.toml +$SED_BINARY -i 's/timeout_commit = "5s"/timeout_commit = "1000ms"/' $HOME_DIR/config/config.toml