From e0fc40decd808e7182da841151785a22c44d6b82 Mon Sep 17 00:00:00 2001 From: emidev98 Date: Wed, 6 Mar 2024 09:20:17 +0200 Subject: [PATCH] feat: upgrade pfm --- app/app.go | 5 +++-- app/genesis_test.go | 4 ++-- app/keepers/keepers.go | 26 ++++++++++++-------------- app/keepers/keys.go | 4 ++-- app/modules.go | 14 +++++++------- go.mod | 2 +- go.sum | 2 ++ 7 files changed, 29 insertions(+), 28 deletions(-) diff --git a/app/app.go b/app/app.go index 76c649e8..fb20cffb 100644 --- a/app/app.go +++ b/app/app.go @@ -72,7 +72,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router" + "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" @@ -452,7 +453,7 @@ func (app *TerraApp) SimulationManager() *module.SimulationManager { ibctransfer.NewAppModule(app.Keepers.TransferKeeper), ibcfee.NewAppModule(app.Keepers.IBCFeeKeeper), ica.NewAppModule(&app.Keepers.ICAControllerKeeper, &app.Keepers.ICAHostKeeper), - router.NewAppModule(&app.Keepers.RouterKeeper), + packetforward.NewAppModule(&app.Keepers.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)), customwasmodule.NewAppModule(appCodec, &app.Keepers.WasmKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.BaseApp.MsgServiceRouter(), app.Keepers.GetSubspace(wasmtypes.ModuleName)), alliance.NewAppModule(appCodec, app.Keepers.AllianceKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.interfaceRegistry, app.Keepers.GetSubspace(alliancetypes.ModuleName)), feeshare.NewAppModule(app.Keepers.FeeShareKeeper, app.Keepers.AccountKeeper, app.GetSubspace(feesharetypes.ModuleName)), diff --git a/app/genesis_test.go b/app/genesis_test.go index 9ec8bc3a..b2f5d07c 100644 --- a/app/genesis_test.go +++ b/app/genesis_test.go @@ -26,7 +26,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router" + "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward" icq "github.com/cosmos/ibc-apps/modules/async-icq/v7" ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7" ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" @@ -215,7 +215,7 @@ func (s *AppGenesisTestSuite) TestMigration() { "ibchooks": ibchooks.AppModule{}.ConsensusVersion(), "interchainaccounts": ica.AppModule{}.ConsensusVersion(), "mint": mint.AppModule{}.ConsensusVersion(), - "packetfowardmiddleware": router.AppModule{}.ConsensusVersion(), + "packetfowardmiddleware": packetforward.AppModule{}.ConsensusVersion(), "params": params.AppModule{}.ConsensusVersion(), "slashing": slashing.AppModule{}.ConsensusVersion(), "staking": staking.AppModule{}.ConsensusVersion(), diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index ea5613fb..f826ae20 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -6,7 +6,6 @@ import ( "path/filepath" - "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router" ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -55,8 +54,9 @@ import ( upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - routerkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/keeper" - routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types" + "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward" + packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" icq "github.com/cosmos/ibc-apps/modules/async-icq/v7" icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" @@ -105,8 +105,6 @@ import ( _ "github.com/terra-money/core/v2/client/docs/statik" ) -var wasmCapabilities = "iterator,staking,stargate,token_factory,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4" - // module account permissions var maccPerms = map[string][]string{ authtypes.FeeCollectorName: nil, @@ -152,7 +150,7 @@ type TerraAppKeepers struct { ICAControllerKeeper icacontrollerkeeper.Keeper ICAHostKeeper icahostkeeper.Keeper IBCFeeKeeper ibcfeekeeper.Keeper - RouterKeeper routerkeeper.Keeper + PacketForwardKeeper packetforwardkeeper.Keeper TokenFactoryKeeper tokenfactorykeeper.Keeper AllianceKeeper alliancekeeper.Keeper FeeShareKeeper feesharekeeper.Keeper @@ -369,22 +367,22 @@ func NewTerraAppKeepers( transferIBCModule := ibctransfer.NewIBCModule(keepers.TransferKeeper) hooksTransferStack := ibchooks.NewIBCMiddleware(&transferIBCModule, &keepers.HooksICS4Wrapper) - keepers.RouterKeeper = *routerkeeper.NewKeeper( + keepers.PacketForwardKeeper = *packetforwardkeeper.NewKeeper( appCodec, - keepers.keys[routertypes.StoreKey], - keepers.GetSubspace(routertypes.ModuleName), + keepers.keys[packetforwardtypes.StoreKey], keepers.TransferKeeper, keepers.IBCKeeper.ChannelKeeper, keepers.DistrKeeper, keepers.BankKeeper, keepers.IBCKeeper.ChannelKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - keepers.TransferStack = router.NewIBCMiddleware( + keepers.TransferStack = packetforward.NewIBCMiddleware( hooksTransferStack, - &keepers.RouterKeeper, + &keepers.PacketForwardKeeper, 5, - routerkeeper.DefaultForwardTransferPacketTimeoutTimestamp, - routerkeeper.DefaultRefundTransferPacketTimeoutTimestamp, + packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, + packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, ) keepers.ICQKeeper = icqkeeper.NewKeeper( appCodec, @@ -563,7 +561,7 @@ func (app *TerraAppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legacyA paramsKeeper.Subspace(ibcexported.ModuleName) paramsKeeper.Subspace(icahosttypes.SubModuleName) paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(routertypes.ModuleName).WithKeyTable(routertypes.ParamKeyTable()) + paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable()) paramsKeeper.Subspace(icqtypes.ModuleName) // Custom Modules diff --git a/app/keepers/keys.go b/app/keepers/keys.go index d02540e9..51a44e77 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -27,7 +27,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" @@ -57,7 +57,7 @@ func (keepers *TerraAppKeepers) GenerateKeys() { govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey, feegrant.StoreKey, - icahosttypes.StoreKey, icacontrollertypes.StoreKey, routertypes.StoreKey, + icahosttypes.StoreKey, icacontrollertypes.StoreKey, packetforwardtypes.StoreKey, consensusparamtypes.StoreKey, tokenfactorytypes.StoreKey, wasmtypes.StoreKey, ibcfeetypes.StoreKey, ibchookstypes.StoreKey, crisistypes.StoreKey, alliancetypes.StoreKey, feesharetypes.StoreKey, icqtypes.StoreKey, diff --git a/app/modules.go b/app/modules.go index caa50720..ef723723 100644 --- a/app/modules.go +++ b/app/modules.go @@ -39,8 +39,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/upgrade" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router" - routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types" + "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types" ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" @@ -108,7 +108,7 @@ var ModuleBasics = module.NewBasicManager( vesting.AppModuleBasic{}, ica.AppModuleBasic{}, ibcfee.AppModuleBasic{}, - router.AppModuleBasic{}, + packetforward.AppModuleBasic{}, authzmodule.AppModuleBasic{}, tokenfactory.AppModuleBasic{}, ibchooks.AppModuleBasic{}, @@ -147,7 +147,7 @@ func appModules(app *TerraApp, encodingConfig terrappsparams.EncodingConfig, ski ibctransfer.NewAppModule(app.Keepers.TransferKeeper), ibcfee.NewAppModule(app.Keepers.IBCFeeKeeper), ica.NewAppModule(&app.Keepers.ICAControllerKeeper, &app.Keepers.ICAHostKeeper), - router.NewAppModule(&app.Keepers.RouterKeeper), + packetforward.NewAppModule(&app.Keepers.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)), customwasmodule.NewAppModule(app.appCodec, &app.Keepers.WasmKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), ibchooks.NewAppModule(app.Keepers.AccountKeeper), tokenfactory.NewAppModule(app.Keepers.TokenFactoryKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)), @@ -183,7 +183,7 @@ var initGenesisOrder = []string{ ibctransfertypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, - routertypes.ModuleName, + packetforwardtypes.ModuleName, tokenfactorytypes.ModuleName, ibchookstypes.ModuleName, wasmtypes.ModuleName, @@ -215,7 +215,7 @@ var beginBlockersOrder = []string{ ibctransfertypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, - routertypes.ModuleName, + packetforwardtypes.ModuleName, ibchookstypes.ModuleName, wasmtypes.ModuleName, tokenfactorytypes.ModuleName, @@ -247,7 +247,7 @@ var endBlockerOrder = []string{ ibctransfertypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, - routertypes.ModuleName, + packetforwardtypes.ModuleName, ibchookstypes.ModuleName, wasmtypes.ModuleName, tokenfactorytypes.ModuleName, diff --git a/go.mod b/go.mod index b1db8720..cbd2ef00 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/cosmos/cosmos-sdk v0.47.5 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.1-0.20231012160012-d0f49580a238 + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3-0.20240228213828-cce7f56d000b github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 github.com/cosmos/ibc-go/v7 v7.3.1 diff --git a/go.sum b/go.sum index 8c1217c4..6b6814b0 100644 --- a/go.sum +++ b/go.sum @@ -402,6 +402,8 @@ github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.1-0.20231012160012-d0f49580a238 h1:vc9zQUjiYctU3q4uF5usbl2JUqaa3F6bEyboNKOKyBk= github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.1-0.20231012160012-d0f49580a238/go.mod h1:WO/xWf+I8m+9PZsBkwZkEREZIW24j90Sz2yOsXU3B9U= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3-0.20240228213828-cce7f56d000b h1:VwhHRRIPdMshBMb2TP7xrkY4Ee8CJWsHZvucYeJ56no= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3-0.20240228213828-cce7f56d000b/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s= github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 h1:mMHedP3Q+mz5gpOWNz0P+X8hxPdamylrBKc/P2cFakA= github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0/go.mod h1:/P6l2bWo2AR3rrsfs0DHuFZO3Imzb93sxFD3ihrIgw4= github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 h1:pCxyhIxgWTabAQC5UerkITraHG3SwajdLKKMCFDWCv4=