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

refactor!: remove ICA #194

Merged
merged 2 commits into from
Nov 25, 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
35 changes: 0 additions & 35 deletions app/const.go
Original file line number Diff line number Diff line change
@@ -1,44 +1,9 @@
package milkyway

const (
// FeeDeductionGasAmount is a estimated gas amount of fee payment
FeeDeductionGasAmount = 50_000

// AccountAddressPrefix is the prefix of bech32 encoded address
AccountAddressPrefix = "milk"

// appName is the application name
appName = "milkyway"

// EnvPrefix is environment variable prefix for the app
EnvPrefix = "MILKYWAY"

// CoinType is the Cosmos Chain's coin type as defined in SLIP44 (https://github.com/satoshilabs/slips/blob/master/slip-0044.md)
CoinType = 118

authzMsgExec = "/cosmos.authz.v1beta1.MsgExec"
authzMsgGrant = "/cosmos.authz.v1beta1.MsgGrant"
authzMsgRevoke = "/cosmos.authz.v1beta1.MsgRevoke"
bankMsgSend = "/cosmos.bank.v1beta1.MsgSend"
bankMsgMultiSend = "/cosmos.bank.v1beta1.MsgMultiSend"
feegrantMsgGrantAllowance = "/cosmos.feegrant.v1beta1.MsgGrantAllowance"
feegrantMsgRevokeAllowance = "/cosmos.feegrant.v1beta1.MsgRevokeAllowance"
groupCreateGroup = "/cosmos.group.v1.MsgCreateGroup"
groupUpdateGroupMember = "/cosmos.group.v1.MsgUpdateGroupMember"
groupUpdateGroupAdmin = "/cosmos.group.v1.MsgUpdateGroupAdmin"
groupUpdateGroupMetadata = "/cosmos.group.v1.MsgUpdateGroupMetadata"
groupCreateGroupPolicy = "/cosmos.group.v1.MsgCreateGroupPolicy"
groupUpdateGroupPolicyAdmin = "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin"
groupUpdateGroupPolicyDecisionPolicy = "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy"
groupSubmitProposal = "/cosmos.group.v1.MsgSubmitProposal"
groupWithdrawProposal = "/cosmos.group.v1.MsgWithdrawProposal"
groupVote = "/cosmos.group.v1.MsgVote"
groupExec = "/cosmos.group.v1.MsgExec"
groupLeaveGroup = "/cosmos.group.v1.MsgLeaveGroup"
transferMsgTransfer = "/ibc.applications.transfer.v1.MsgTransfer"
nftTransferMsgTransfer = "/ibc.applications.nft_transfer.v1.MsgNftTransfer"
sftTransferMsgTransfer = "/ibc.applications.sft_transfer.v1.MsgSftTransfer"
moveMsgPublishModuleBundle = "/initia.move.v1.MsgPublish"
moveMsgExecuteEntryFunction = "/initia.move.v1.MsgExecute"
moveMsgExecuteScript = "/initia.move.v1.MsgScript"
)
51 changes: 0 additions & 51 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/module"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
icagenesistypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/genesis/types"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctypes "github.com/cosmos/ibc-go/v8/modules/core/types"
)
Expand All @@ -40,7 +36,6 @@ type GenesisState map[string]json.RawMessage
// NewDefaultGenesisState generates the default state for the application.
func NewDefaultGenesisState(cdc codec.Codec, mbm module.BasicManager) GenesisState {
return GenesisState(mbm.DefaultGenesis(cdc)).
ConfigureICA(cdc).
ConfigureIBCAllowedClients(cdc).
AddMarketData(cdc)
}
Expand Down Expand Up @@ -81,52 +76,6 @@ func (genState GenesisState) AddMarketData(cdc codec.JSONCodec) GenesisState {
return genState
}

func (genState GenesisState) ConfigureICA(cdc codec.JSONCodec) GenesisState {
// create ICS27 Controller submodule params
controllerParams := icacontrollertypes.Params{
ControllerEnabled: true,
}

// create ICS27 Host submodule params
hostParams := icahosttypes.Params{
HostEnabled: true,
AllowMessages: []string{
authzMsgExec,
authzMsgGrant,
authzMsgRevoke,
bankMsgSend,
bankMsgMultiSend,
feegrantMsgGrantAllowance,
feegrantMsgRevokeAllowance,
groupCreateGroup,
groupCreateGroupPolicy,
groupExec,
groupLeaveGroup,
groupSubmitProposal,
groupUpdateGroupAdmin,
groupUpdateGroupMember,
groupUpdateGroupPolicyAdmin,
groupUpdateGroupPolicyDecisionPolicy,
groupVote,
groupWithdrawProposal,
transferMsgTransfer,
nftTransferMsgTransfer,
sftTransferMsgTransfer,
moveMsgPublishModuleBundle,
moveMsgExecuteEntryFunction,
moveMsgExecuteScript,
},
}

var icaGenState icagenesistypes.GenesisState
cdc.MustUnmarshalJSON(genState[icatypes.ModuleName], &icaGenState)
icaGenState.ControllerGenesisState.Params = controllerParams
icaGenState.HostGenesisState.Params = hostParams
genState[icatypes.ModuleName] = cdc.MustMarshalJSON(&icaGenState)

return genState
}

func (genState GenesisState) ConfigureIBCAllowedClients(cdc codec.JSONCodec) GenesisState {
var ibcGenesis ibctypes.GenesisState
cdc.MustUnmarshalJSON(genState[ibcexported.ModuleName], &ibcGenesis)
Expand Down
71 changes: 8 additions & 63 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ import (
ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee"
ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper"
ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
Expand Down Expand Up @@ -139,12 +132,10 @@ type AppKeepers struct {
FeeMarketKeeper *feemarketkeeper.Keeper

// IBC
IBCKeeper *ibckeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
ICAControllerKeeper icacontrollerkeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
PFMRouterKeeper *pfmrouterkeeper.Keeper
RateLimitKeeper *ratelimitkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
PFMRouterKeeper *pfmrouterkeeper.Keeper
RateLimitKeeper *ratelimitkeeper.Keeper

// ICS
ProviderKeeper icsproviderkeeper.Keeper
Expand All @@ -159,20 +150,17 @@ type AppKeepers struct {
LiquidVestingKeeper *liquidvestingkeeper.Keeper

// Modules
ICAModule ica.AppModule
IBCFeeKeeper ibcfeekeeper.Keeper
TransferModule transfer.AppModule
PFMRouterModule pfmrouter.AppModule
RateLimitModule ratelimit.AppModule
ProviderModule icsprovider.AppModule

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedICSproviderkeeper capabilitykeeper.ScopedKeeper
scopedWasmKeeper capabilitykeeper.ScopedKeeper
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICSproviderkeeper capabilitykeeper.ScopedKeeper
scopedWasmKeeper capabilitykeeper.ScopedKeeper
}

func NewAppKeeper(
Expand Down Expand Up @@ -225,8 +213,6 @@ func NewAppKeeper(
)

appKeepers.ScopedIBCKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
appKeepers.ScopedICAHostKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
appKeepers.ScopedICAControllerKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
appKeepers.ScopedTransferKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
appKeepers.ScopedICSproviderkeeper = appKeepers.CapabilityKeeper.ScopeToModule(providertypes.ModuleName)
appKeepers.scopedWasmKeeper = appKeepers.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName)
Expand Down Expand Up @@ -480,23 +466,6 @@ func NewAppKeeper(
appKeepers.IBCKeeper.PortKeeper, appKeepers.AccountKeeper, appKeepers.BankKeeper,
)

// ICA Host keeper
appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec,
appKeepers.keys[icahosttypes.StoreKey],
appKeepers.GetSubspace(icahosttypes.SubModuleName),
appKeepers.IBCKeeper.ChannelKeeper, // ICS4Wrapper
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
appKeepers.ScopedICAHostKeeper,
bApp.MsgServiceRouter(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

// required since ibc-go v7.5.0
appKeepers.ICAHostKeeper.WithQueryRouter(bApp.GRPCQueryRouter())

govAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String()

// Create RateLimit keeper
Expand All @@ -510,19 +479,6 @@ func NewAppKeeper(
appKeepers.IBCFeeKeeper, // ICS4Wrapper
)

// ICA Controller keeper
appKeepers.ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
appCodec,
appKeepers.keys[icacontrollertypes.StoreKey],
appKeepers.GetSubspace(icacontrollertypes.SubModuleName),
appKeepers.IBCKeeper.ChannelKeeper, // ICS4Wrapper
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCKeeper.PortKeeper,
appKeepers.ScopedICAControllerKeeper,
bApp.MsgServiceRouter(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

// PFMRouterKeeper must be created before TransferKeeper
appKeepers.PFMRouterKeeper = pfmrouterkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -682,7 +638,6 @@ func NewAppKeeper(
)

// Middleware Stacks
appKeepers.ICAModule = ica.NewAppModule(&appKeepers.ICAControllerKeeper, &appKeepers.ICAHostKeeper)
appKeepers.TransferModule = transfer.NewAppModule(appKeepers.TransferKeeper)
appKeepers.PFMRouterModule = pfmrouter.NewAppModule(appKeepers.PFMRouterKeeper, appKeepers.GetSubspace(pfmroutertypes.ModuleName))
appKeepers.RateLimitModule = ratelimit.NewAppModule(appCodec, *appKeepers.RateLimitKeeper)
Expand Down Expand Up @@ -725,20 +680,12 @@ func NewAppKeeper(
appKeepers.IBCFeeKeeper,
)

// Create ICAHost Stack
var icaHostStack porttypes.IBCModule = icahost.NewIBCModule(appKeepers.ICAHostKeeper)

var icaControllerStack porttypes.IBCModule
icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, appKeepers.ICAControllerKeeper)

var wasmStack porttypes.IBCModule
wasmStack = wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCFeeKeeper)
wasmStack = ibcfee.NewIBCMiddleware(wasmStack, appKeepers.IBCFeeKeeper)

// Create IBC Router & seal
ibcRouter := porttypes.NewRouter().
AddRoute(icahosttypes.SubModuleName, icaHostStack).
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(ibctransfertypes.ModuleName, transferStack).
AddRoute(providertypes.ModuleName, appKeepers.ProviderModule).
AddRoute(wasmtypes.ModuleName, wasmStack)
Expand Down Expand Up @@ -774,8 +721,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable()) //nolint: staticcheck // SA1019
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(pfmroutertypes.ModuleName).WithKeyTable(pfmroutertypes.ParamKeyTable())
paramsKeeper.Subspace(ratelimittypes.ModuleName).WithKeyTable(ratelimittypes.ParamKeyTable())
paramsKeeper.Subspace(providertypes.ModuleName).WithKeyTable(providertypes.ParamKeyTable())
Expand Down
4 changes: 0 additions & 4 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"
ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
Expand Down Expand Up @@ -62,8 +60,6 @@ func (appKeepers *AppKeepers) GenerateKeys() {
evidencetypes.StoreKey,
ibctransfertypes.StoreKey,
ibcfeetypes.StoreKey,
icahosttypes.StoreKey,
icacontrollertypes.StoreKey,
capabilitytypes.StoreKey,
feegrant.StoreKey,
authzkeeper.StoreKey,
Expand Down
2 changes: 0 additions & 2 deletions app/keepers/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
pfmrouter "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward"
ratelimit "github.com/cosmos/ibc-apps/modules/rate-limiting/v8"
"github.com/cosmos/ibc-go/modules/capability"
ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"
ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee"
"github.com/cosmos/ibc-go/v8/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
Expand Down Expand Up @@ -69,7 +68,6 @@ var AppModuleBasics = module.NewBasicManager(
// IBC Modules
ibcfee.AppModuleBasic{},
transfer.AppModuleBasic{},
ica.AppModuleBasic{},
pfmrouter.AppModuleBasic{},
ratelimit.AppModuleBasic{},
icsprovider.AppModuleBasic{},
Expand Down
7 changes: 0 additions & 7 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types"
"github.com/cosmos/ibc-go/modules/capability"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee"
ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
Expand Down Expand Up @@ -86,7 +85,6 @@ import (
var MaccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
icatypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
Expand Down Expand Up @@ -148,7 +146,6 @@ func appModules(
// IBC Modules
ibcfee.NewAppModule(app.IBCFeeKeeper),
app.TransferModule,
app.ICAModule,
app.PFMRouterModule,
app.RateLimitModule,
app.ProviderModule,
Expand Down Expand Up @@ -206,7 +203,6 @@ func simulationModules(
wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ibc.NewAppModule(app.IBCKeeper),
app.TransferModule,
app.ICAModule,

// MilkyWay modules
services.NewAppModule(appCodec, app.ServicesKeeper, app.AccountKeeper, app.BankKeeper),
Expand Down Expand Up @@ -238,7 +234,6 @@ func orderBeginBlockers() []string {
crisistypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
pfmroutertypes.ModuleName,
ratelimittypes.ModuleName,
ibcfeetypes.ModuleName,
Expand Down Expand Up @@ -281,7 +276,6 @@ func orderEndBlockers() []string {
stakingtypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
pfmroutertypes.ModuleName,
ratelimittypes.ModuleName,
capabilitytypes.ModuleName,
Expand Down Expand Up @@ -337,7 +331,6 @@ func orderInitBlockers() []string {
genutiltypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
Expand Down
18 changes: 0 additions & 18 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,6 @@
}
}
},
{
"url": "./tmp-swagger-gen/ibc/applications/interchain_accounts/controller/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "IBCInterChainAccountsControllerParams",
"InterchainAccount": "IBCInterChainAccountsControllerInterChainAccount"
}
}
},
{
"url": "./tmp-swagger-gen/ibc/applications/interchain_accounts/host/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "IBCInterChainAccountsHostParams",
"InterchainAccount": "IBCInterChainAccountsHostInterChainAccount"
}
}
},
{
"url": "./tmp-swagger-gen/ibc/applications/fee/v1/query.swagger.json",
"operationIds": {
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading
Loading