Skip to content

Commit

Permalink
Merge pull request #271 from terra-money/feat/v2.10/pfm/upgrade
Browse files Browse the repository at this point in the history
feat: upgrade pfm
  • Loading branch information
emidev98 authored Mar 6, 2024
2 parents 318e591 + 0f41b7f commit a695b40
Show file tree
Hide file tree
Showing 10 changed files with 434 additions and 289 deletions.
5 changes: 3 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)),
Expand Down
6 changes: 3 additions & 3 deletions app/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -248,7 +248,7 @@ func (s *AppGenesisTestSuite) TestMigration() {
"interchainquery": 1,
"mint": 2,
"mock": 0,
"packetfowardmiddleware": 1,
"packetfowardmiddleware": 2,
"params": 1,
"slashing": 3,
"staking": 4,
Expand Down
26 changes: 12 additions & 14 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -108,7 +108,7 @@ var ModuleBasics = module.NewBasicManager(
vesting.AppModuleBasic{},
ica.AppModuleBasic{},
ibcfee.AppModuleBasic{},
router.AppModuleBasic{},
packetforward.AppModuleBasic{},
authzmodule.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
ibchooks.AppModuleBasic{},
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -183,7 +183,7 @@ var initGenesisOrder = []string{
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
routertypes.ModuleName,
packetforwardtypes.ModuleName,
tokenfactorytypes.ModuleName,
ibchookstypes.ModuleName,
wasmtypes.ModuleName,
Expand Down Expand Up @@ -215,7 +215,7 @@ var beginBlockersOrder = []string{
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
routertypes.ModuleName,
packetforwardtypes.ModuleName,
ibchookstypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
Expand Down Expand Up @@ -247,7 +247,7 @@ var endBlockerOrder = []string{
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
routertypes.ModuleName,
packetforwardtypes.ModuleName,
ibchookstypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
Expand Down
4 changes: 2 additions & 2 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@
}
},
{
"url": "./tmp-swagger-gen/router/v1/query.swagger.json",
"url": "./tmp-swagger-gen/packetforward/v1/query.swagger.json",
"tags" : {
"add" : ["5.IBC"]
},
"operationIds": {
"rename": {
"Params": "IBCRouterParams"
"Params": "IBCPacketforwardParams"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading

0 comments on commit a695b40

Please sign in to comment.