Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upstream v2.10 to v2.11 #276

Merged
merged 14 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 7 additions & 2 deletions app/upgrade_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
alliancetypes "github.com/terra-money/alliance/x/alliance/types"
terraappconfig "github.com/terra-money/core/v2/app/config"
v2_10 "github.com/terra-money/core/v2/app/upgrades/v2.10"
v2_2_0 "github.com/terra-money/core/v2/app/upgrades/v2.2.0"
v2_3_0 "github.com/terra-money/core/v2/app/upgrades/v2.3.0"
v2_4 "github.com/terra-money/core/v2/app/upgrades/v2.4"
Expand Down Expand Up @@ -89,11 +90,12 @@
app.GetModuleManager(),
app.GetConfigurator(),
app.GetAppCodec(),
app.Keepers.ICQKeeper,
),
)
app.Keepers.UpgradeKeeper.SetUpgradeHandler(
terraappconfig.Upgrade2_10,
v2_9.CreateUpgradeHandler(
v2_10.CreateUpgradeHandler(
app.GetModuleManager(),
app.GetConfigurator(),
app.GetAppCodec(),
Expand Down Expand Up @@ -129,7 +131,10 @@
storeUpgrades := storetypes.StoreUpgrades{Added: []string{icqtypes.StoreKey}}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
} else if upgradeInfo.Name == terraappconfig.Upgrade2_9 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{Deleted: []string{"builder"}}
storeUpgrades := storetypes.StoreUpgrades{Deleted: []string{"builder"}, Added: []string{icqtypes.StoreKey}}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))

Check warning on line 135 in app/upgrade_handler.go

View check run for this annotation

Codecov / codecov/patch

app/upgrade_handler.go#L134-L135

Added lines #L134 - L135 were not covered by tests
} else if upgradeInfo.Name == terraappconfig.Upgrade2_10 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{}

Check warning on line 137 in app/upgrade_handler.go

View check run for this annotation

Codecov / codecov/patch

app/upgrade_handler.go#L137

Added line #L137 was not covered by tests
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}
8 changes: 8 additions & 0 deletions app/upgrades/v2.9/upgrade.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package v2_9

import (
icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v7/keeper"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand All @@ -11,8 +14,13 @@ func CreateUpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
cdc codec.Codec,
icqkeeper icqkeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// Interchain Queries
icqParams := icqtypes.NewParams(true, nil)
icqkeeper.SetParams(ctx, icqParams)

return mm.RunMigrations(ctx, cfg, fromVM)
}
}
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
Loading