diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000000..e5306c8dc5 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,9 @@ +# This configuration file was automatically generated by Gitpod. +# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) +# and commit this file to your remote git repository to share the goodness with others. + +tasks: + - init: go get && go build ./... && go test ./... && make + command: go run + + diff --git a/app/ante.go b/app/ante.go index 1bca9a8f85..5928b46747 100644 --- a/app/ante.go +++ b/app/ante.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" - channelkeeper "github.com/cosmos/ibc-go/v2/modules/core/04-channel/keeper" - ibcante "github.com/cosmos/ibc-go/v2/modules/core/ante" + ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante" + "github.com/cosmos/ibc-go/v3/modules/core/keeper" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" @@ -16,7 +16,7 @@ import ( type HandlerOptions struct { ante.HandlerOptions - IBCChannelkeeper channelkeeper.Keeper + IBCKeeper *keeper.Keeper WasmConfig *wasmTypes.WasmConfig TXCounterStoreKey sdk.StoreKey } @@ -60,7 +60,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer), ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), ante.NewIncrementSequenceDecorator(options.AccountKeeper), - ibcante.NewAnteDecorator(options.IBCChannelkeeper), + ibcante.NewAnteDecorator(options.IBCKeeper), } return sdk.ChainAnteDecorators(anteDecorators...), nil diff --git a/app/app.go b/app/app.go index b6ba2ddab9..a458acf1e7 100644 --- a/app/app.go +++ b/app/app.go @@ -75,16 +75,25 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v2/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v2/modules/core" - ibcclient "github.com/cosmos/ibc-go/v2/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v2/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - porttypes "github.com/cosmos/ibc-go/v2/modules/core/05-port/types" - ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" + ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" + transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v3/modules/core" + ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client" + ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + ibcmock "github.com/cosmos/ibc-go/v3/testing/mock" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" @@ -183,12 +192,14 @@ var ( params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, ibc.AppModuleBasic{}, + feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, transfer.AppModuleBasic{}, + ibcmock.AppModuleBasic{}, + ica.AppModuleBasic{}, + authzmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, wasm.AppModuleBasic{}, ) @@ -202,6 +213,7 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + icatypes.ModuleName: nil, wasm.ModuleName: {authtypes.Burner}, } ) @@ -226,27 +238,38 @@ type WasmApp struct { memKeys map[string]*sdk.MemoryStoreKey // keepers - accountKeeper authkeeper.AccountKeeper - bankKeeper bankkeeper.Keeper - capabilityKeeper *capabilitykeeper.Keeper - stakingKeeper stakingkeeper.Keeper - slashingKeeper slashingkeeper.Keeper - mintKeeper mintkeeper.Keeper - distrKeeper distrkeeper.Keeper - govKeeper govkeeper.Keeper - crisisKeeper crisiskeeper.Keeper - upgradeKeeper upgradekeeper.Keeper - paramsKeeper paramskeeper.Keeper - ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly - evidenceKeeper evidencekeeper.Keeper - transferKeeper ibctransferkeeper.Keeper - FeeGrantKeeper feegrantkeeper.Keeper - AuthzKeeper authzkeeper.Keeper - wasmKeeper wasm.Keeper - - scopedIBCKeeper capabilitykeeper.ScopedKeeper - scopedTransferKeeper capabilitykeeper.ScopedKeeper - scopedWasmKeeper capabilitykeeper.ScopedKeeper + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.Keeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper crisiskeeper.Keeper + UpgradeKeeper upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + ICAControllerKeeper icacontrollerkeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + EvidenceKeeper evidencekeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + AuthzKeeper authzkeeper.Keeper + WasmKeeper wasm.Keeper + + // make scoped keepers public for test purposes + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper + ScopedICAMockKeeper capabilitykeeper.ScopedKeeper + ScopedWasmKeeper capabilitykeeper.ScopedKeeper + + // make IBC modules public for test purposes + // these modules are never directly routed to by the IBC Router + ICAAuthModule ibcmock.IBCModule // the module manager mm *module.Manager @@ -283,12 +306,26 @@ func NewWasmApp( bApp.SetInterfaceRegistry(interfaceRegistry) keys := sdk.NewKVStoreKeys( - authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, - minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, - feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, + authtypes.StoreKey, + banktypes.StoreKey, + stakingtypes.StoreKey, + minttypes.StoreKey, + distrtypes.StoreKey, + slashingtypes.StoreKey, + govtypes.StoreKey, + paramstypes.StoreKey, + ibchost.StoreKey, + upgradetypes.StoreKey, + evidencetypes.StoreKey, + ibctransfertypes.StoreKey, + capabilitytypes.StoreKey, + feegrant.StoreKey, + authzkeeper.StoreKey, + icacontrollertypes.StoreKey, + icahosttypes.StoreKey, + wasm.StoreKey, ) + tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -303,7 +340,7 @@ func NewWasmApp( memKeys: memKeys, } - app.paramsKeeper = initParamsKeeper( + app.ParamsKeeper = initParamsKeeper( appCodec, legacyAmino, keys[paramstypes.StoreKey], @@ -311,31 +348,41 @@ func NewWasmApp( ) // set the BaseApp's parameter store - bApp.SetParamStore(app.paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable())) + bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable())) // add capability keeper and ScopeToModule for ibc module - app.capabilityKeeper = capabilitykeeper.NewKeeper( + app.CapabilityKeeper = capabilitykeeper.NewKeeper( appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey], ) - scopedIBCKeeper := app.capabilityKeeper.ScopeToModule(ibchost.ModuleName) - scopedTransferKeeper := app.capabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedWasmKeeper := app.capabilityKeeper.ScopeToModule(wasm.ModuleName) - app.capabilityKeeper.Seal() + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + + app.ScopedWasmKeeper = app.CapabilityKeeper.ScopeToModule(wasm.ModuleName) + app.ScopedICAControllerKeeper = app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) + app.ScopedICAHostKeeper = app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do + // not replicate if you do not need to test core IBC or light clients. + app.ScopedIBCMockKeeper = app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName) + app.ScopedICAMockKeeper = app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) + + // seal capability keeper after scoping modules + app.CapabilityKeeper.Seal() // add keepers - app.accountKeeper = authkeeper.NewAccountKeeper( + app.AccountKeeper = authkeeper.NewAccountKeeper( appCodec, keys[authtypes.StoreKey], app.getSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, ) - app.bankKeeper = bankkeeper.NewBaseKeeper( + app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, keys[banktypes.StoreKey], - app.accountKeeper, + app.AccountKeeper, app.getSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(), ) @@ -347,47 +394,47 @@ func NewWasmApp( app.FeeGrantKeeper = feegrantkeeper.NewKeeper( appCodec, keys[feegrant.StoreKey], - app.accountKeeper, + app.AccountKeeper, ) stakingKeeper := stakingkeeper.NewKeeper( appCodec, keys[stakingtypes.StoreKey], - app.accountKeeper, - app.bankKeeper, + app.AccountKeeper, + app.BankKeeper, app.getSubspace(stakingtypes.ModuleName), ) - app.mintKeeper = mintkeeper.NewKeeper( + app.MintKeeper = mintkeeper.NewKeeper( appCodec, keys[minttypes.StoreKey], app.getSubspace(minttypes.ModuleName), &stakingKeeper, - app.accountKeeper, - app.bankKeeper, + app.AccountKeeper, + app.BankKeeper, authtypes.FeeCollectorName, ) - app.distrKeeper = distrkeeper.NewKeeper( + app.DistrKeeper = distrkeeper.NewKeeper( appCodec, keys[distrtypes.StoreKey], app.getSubspace(distrtypes.ModuleName), - app.accountKeeper, - app.bankKeeper, + app.AccountKeeper, + app.BankKeeper, &stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(), ) - app.slashingKeeper = slashingkeeper.NewKeeper( + app.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.getSubspace(slashingtypes.ModuleName), ) - app.crisisKeeper = crisiskeeper.NewKeeper( + app.CrisisKeeper = crisiskeeper.NewKeeper( app.getSubspace(crisistypes.ModuleName), invCheckPeriod, - app.bankKeeper, + app.BankKeeper, authtypes.FeeCollectorName, ) - app.upgradeKeeper = upgradekeeper.NewKeeper( + app.UpgradeKeeper = upgradekeeper.NewKeeper( skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, @@ -397,16 +444,16 @@ func NewWasmApp( // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.stakingKeeper = *stakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks()), + app.StakingKeeper = *stakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.ibcKeeper = ibckeeper.NewKeeper( + app.IBCKeeper = ibckeeper.NewKeeper( appCodec, keys[ibchost.StoreKey], app.getSubspace(ibchost.ModuleName), - app.stakingKeeper, - app.upgradeKeeper, + app.StakingKeeper, + app.UpgradeKeeper, scopedIBCKeeper, ) @@ -414,36 +461,66 @@ func NewWasmApp( govRouter := govtypes.NewRouter() govRouter. AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). - AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)) + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). + AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). + AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) // Create Transfer Keepers - app.transferKeeper = ibctransferkeeper.NewKeeper( - appCodec, - keys[ibctransfertypes.StoreKey], - app.getSubspace(ibctransfertypes.ModuleName), - app.ibcKeeper.ChannelKeeper, - &app.ibcKeeper.PortKeeper, - app.accountKeeper, - app.bankKeeper, - scopedTransferKeeper, + app.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, keys[ibctransfertypes.StoreKey], app.getSubspace(ibctransfertypes.ModuleName), + app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + ) + transferModule := transfer.NewAppModule(app.TransferKeeper) + transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) + + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do + // not replicate if you do not need to test core IBC or light clients. + mockModule := ibcmock.NewAppModule(&app.IBCKeeper.PortKeeper) + mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewMockIBCApp(ibcmock.ModuleName, app.ScopedIBCMockKeeper)) + + app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + appCodec, keys[icacontrollertypes.StoreKey], app.getSubspace(icacontrollertypes.SubModuleName), + app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.ScopedICAControllerKeeper, app.MsgServiceRouter(), + ) + + app.ICAHostKeeper = icahostkeeper.NewKeeper( + appCodec, keys[icahosttypes.StoreKey], app.getSubspace(icahosttypes.SubModuleName), + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, app.ScopedICAHostKeeper, app.MsgServiceRouter(), ) - transferModule := transfer.NewAppModule(app.transferKeeper) - // create static IBC router, add transfer route, then set and seal it + icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper) + + // initialize ICA module with mock module as the authentication module on the controller side + icaAuthModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewMockIBCApp("", app.ScopedICAMockKeeper)) + app.ICAAuthModule = icaAuthModule + + icaControllerIBCModule := icacontroller.NewIBCModule(app.ICAControllerKeeper, icaAuthModule) + icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) + + // initialize ICA module with mock module as the authentication module on the controller side + app.ICAAuthModule = icaAuthModule + + // Create static IBC router, add app routes, then set and seal it ibcRouter := porttypes.NewRouter() - ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferModule) + ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). + AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). + AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerIBCModule). // ica with mock auth module stack route to ica (top level of middleware stack) + AddRoute(ibctransfertypes.ModuleName, transferIBCModule). + AddRoute(ibcmock.ModuleName, mockIBCModule) // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( appCodec, keys[evidencetypes.StoreKey], - &app.stakingKeeper, - app.slashingKeeper, + &app.StakingKeeper, + app.SlashingKeeper, ) - app.evidenceKeeper = *evidenceKeeper + app.EvidenceKeeper = *evidenceKeeper wasmDir := filepath.Join(homePath, "wasm") wasmConfig, err := wasm.ReadWasmConfig(appOpts) @@ -454,18 +531,18 @@ func NewWasmApp( // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks supportedFeatures := "iterator,staking,stargate" - app.wasmKeeper = wasm.NewKeeper( + app.WasmKeeper = wasm.NewKeeper( appCodec, keys[wasm.StoreKey], app.getSubspace(wasm.ModuleName), - app.accountKeeper, - app.bankKeeper, - app.stakingKeeper, - app.distrKeeper, - app.ibcKeeper.ChannelKeeper, - &app.ibcKeeper.PortKeeper, - scopedWasmKeeper, - app.transferKeeper, + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + app.DistrKeeper, + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, + app.ScopedWasmKeeper, + app.TransferKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), wasmDir, @@ -476,17 +553,17 @@ func NewWasmApp( // The gov proposal types can be individually enabled if len(enabledProposals) != 0 { - govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.wasmKeeper, enabledProposals)) + govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals)) } - ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)) - app.ibcKeeper.SetRouter(ibcRouter) + ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper)) + app.IBCKeeper.SetRouter(ibcRouter) - app.govKeeper = govkeeper.NewKeeper( + app.GovKeeper = govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], app.getSubspace(govtypes.ModuleName), - app.accountKeeper, - app.bankKeeper, + app.AccountKeeper, + app.BankKeeper, &stakingKeeper, govRouter, ) @@ -500,79 +577,49 @@ func NewWasmApp( // must be passed by reference here. app.mm = module.NewManager( genutil.NewAppModule( - app.accountKeeper, - app.stakingKeeper, + app.AccountKeeper, + app.StakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig, ), - auth.NewAppModule(appCodec, app.accountKeeper, nil), - vesting.NewAppModule(app.accountKeeper, app.bankKeeper), - bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper), - capability.NewAppModule(appCodec, *app.capabilityKeeper), - gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper), - mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper), - slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), - distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), - staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper), - upgrade.NewAppModule(app.upgradeKeeper), - wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper), - evidence.NewAppModule(app.evidenceKeeper), - feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), - ibc.NewAppModule(app.ibcKeeper), - params.NewAppModule(app.paramsKeeper), + auth.NewAppModule(appCodec, app.AccountKeeper, nil), + vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), + capability.NewAppModule(appCodec, *app.CapabilityKeeper), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + upgrade.NewAppModule(app.UpgradeKeeper), + wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper), + evidence.NewAppModule(app.EvidenceKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + ibc.NewAppModule(app.IBCKeeper), + params.NewAppModule(app.ParamsKeeper), transferModule, - crisis.NewAppModule(&app.crisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them + icaModule, + crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them ) // 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. // NOTE: staking module is required if HistoricalEntries param > 0 + app.mm.SetOrderBeginBlockers( - upgradetypes.ModuleName, - capabilitytypes.ModuleName, - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - govtypes.ModuleName, - crisistypes.ModuleName, - genutiltypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - paramstypes.ModuleName, - vestingtypes.ModuleName, - // additional non simd modules - ibchost.ModuleName, - ibctransfertypes.ModuleName, - wasm.ModuleName, + upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, + evidencetypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, authtypes.ModuleName, + banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, feegrant.ModuleName, + paramstypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, wasm.ModuleName, ) app.mm.SetOrderEndBlockers( - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - minttypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - // additional non simd modules - ibchost.ModuleName, - ibctransfertypes.ModuleName, - wasm.ModuleName, + crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, + minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, + upgradetypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, wasm.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -582,34 +629,23 @@ func NewWasmApp( // can do so safely. // NOTE: wasm module should be at the end as it can call other module functionality direct or via message dispatching during // genesis phase. For example bank transfer, auth account check, staking, ... + + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. app.mm.SetOrderInitGenesis( - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - minttypes.ModuleName, - crisistypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - // additional non simd modules - ibchost.ModuleName, - ibctransfertypes.ModuleName, - // wasm after ibc transfer - wasm.ModuleName, + capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, + slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, + ibchost.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, + icatypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, wasm.ModuleName, ) // Uncomment if you want to set a custom migration order here. // app.mm.SetOrderMigrations(custom order) - app.mm.RegisterInvariants(&app.crisisKeeper) + app.mm.RegisterInvariants(&app.CrisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) @@ -619,26 +655,29 @@ func NewWasmApp( // // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions + app.sm = module.NewSimulationManager( - auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts), - bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper), - capability.NewAppModule(appCodec, *app.capabilityKeeper), - feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper), - mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper), - staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper), - distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), - slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), - params.NewAppModule(app.paramsKeeper), - evidence.NewAppModule(app.evidenceKeeper), - wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper), - ibc.NewAppModule(app.ibcKeeper), + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), + capability.NewAppModule(appCodec, *app.CapabilityKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + params.NewAppModule(app.ParamsKeeper), + evidence.NewAppModule(app.EvidenceKeeper), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper), + ibc.NewAppModule(app.IBCKeeper), transferModule, ) app.sm.RegisterStoreDecoders() + app.sm.RegisterStoreDecoders() + // initialize stores app.MountKVStores(keys) app.MountTransientStores(tkeys) @@ -647,19 +686,19 @@ func NewWasmApp( anteHandler, err := NewAnteHandler( HandlerOptions{ HandlerOptions: ante.HandlerOptions{ - AccountKeeper: app.accountKeeper, - BankKeeper: app.bankKeeper, - FeegrantKeeper: app.FeeGrantKeeper, + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - IBCChannelkeeper: app.ibcKeeper.ChannelKeeper, + IBCKeeper: app.IBCKeeper, WasmConfig: &wasmConfig, TXCounterStoreKey: keys[wasm.StoreKey], }, ) if err != nil { - panic(fmt.Errorf("failed to create AnteHandler: %s", err)) + panic(err) } app.SetAnteHandler(anteHandler) @@ -674,14 +713,17 @@ func NewWasmApp( ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) // Initialize pinned codes in wasmvm as they are not persisted there - if err := app.wasmKeeper.InitializePinnedCodes(ctx); err != nil { + if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil { tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err)) } } - app.scopedIBCKeeper = scopedIBCKeeper - app.scopedTransferKeeper = scopedTransferKeeper - app.scopedWasmKeeper = scopedWasmKeeper + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedTransferKeeper = scopedTransferKeeper + + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do + // note replicate if you do not need to test core IBC or light clients. + return app } @@ -705,7 +747,7 @@ func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci panic(err) } - app.upgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) + app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) return app.mm.InitGenesis(ctx, app.appCodec, genesisState) } @@ -737,7 +779,7 @@ func (app *WasmApp) LegacyAmino() *codec.LegacyAmino { //nolint:staticcheck // // NOTE: This is solely to be used for testing purposes. func (app *WasmApp) getSubspace(moduleName string) paramstypes.Subspace { - subspace, _ := app.paramsKeeper.GetSubspace(moduleName) + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) return subspace } @@ -816,6 +858,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName) + paramsKeeper.Subspace(icahosttypes.SubModuleName) paramsKeeper.Subspace(wasm.ModuleName) return paramsKeeper diff --git a/app/app_test.go b/app/app_test.go index a3bd66ab6f..9a5ec80f88 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -47,7 +47,7 @@ func TestBlockedAddrs(t *testing.T) { for acc := range maccPerms { t.Run(acc, func(t *testing.T) { - require.True(t, gapp.bankKeeper.BlockedAddr(gapp.accountKeeper.GetModuleAddress(acc)), + require.True(t, gapp.BankKeeper.BlockedAddr(gapp.AccountKeeper.GetModuleAddress(acc)), "ensure that blocked addresses are properly set in bank keeper", ) }) diff --git a/app/export.go b/app/export.go index 4740592806..65c0866dfa 100644 --- a/app/export.go +++ b/app/export.go @@ -35,7 +35,7 @@ func (app *WasmApp) ExportAppStateAndValidators( return servertypes.ExportedApp{}, err } - validators, err := staking.WriteValidators(ctx, app.stakingKeeper) + validators, err := staking.WriteValidators(ctx, app.StakingKeeper) return servertypes.ExportedApp{ AppState: appState, Validators: validators, @@ -66,18 +66,18 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ } /* Just to be safe, assert the invariants on current state. */ - app.crisisKeeper.AssertInvariants(ctx) + app.CrisisKeeper.AssertInvariants(ctx) /* Handle fee distribution state. */ // withdraw all validator commission - app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) //nolint:errcheck + app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) //nolint:errcheck return false }) // withdraw all delegator rewards - dels := app.stakingKeeper.GetAllDelegations(ctx) + dels := app.StakingKeeper.GetAllDelegations(ctx) for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { @@ -88,28 +88,28 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ if err != nil { panic(err) } - _, _ = app.distrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) //nolint:errcheck + _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) //nolint:errcheck } // clear validator slash events - app.distrKeeper.DeleteAllValidatorSlashEvents(ctx) + app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) // clear validator historical rewards - app.distrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) // set context height to zero height := ctx.BlockHeight() ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) - feePool := app.distrKeeper.GetFeePool(ctx) + scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + feePool := app.DistrKeeper.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - app.distrKeeper.SetFeePool(ctx, feePool) + app.DistrKeeper.SetFeePool(ctx, feePool) - app.distrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) return false }) @@ -123,8 +123,8 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ if err != nil { panic(err) } - app.distrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr) - app.distrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr) + app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr) + app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr) } // reset context height @@ -133,20 +133,20 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ /* Handle staking state. */ // iterate through redelegations, reset creation height - app.stakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { for i := range red.Entries { red.Entries[i].CreationHeight = 0 } - app.stakingKeeper.SetRedelegation(ctx, red) + app.StakingKeeper.SetRedelegation(ctx, red) return false }) // iterate through unbonding delegations, reset creation height - app.stakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } - app.stakingKeeper.SetUnbondingDelegation(ctx, ubd) + app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) return false }) @@ -158,7 +158,7 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(iter.Key()[1:]) - validator, found := app.stakingKeeper.GetValidator(ctx, addr) + validator, found := app.StakingKeeper.GetValidator(ctx, addr) if !found { panic("expected validator, not found") } @@ -168,13 +168,13 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ validator.Jailed = true } - app.stakingKeeper.SetValidator(ctx, validator) + app.StakingKeeper.SetValidator(ctx, validator) counter++ } iter.Close() - _, err := app.stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { log.Fatal(err) } @@ -182,11 +182,11 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ /* Handle slashing state. */ // reset start height on signing infos - app.slashingKeeper.IterateValidatorSigningInfos( + app.SlashingKeeper.IterateValidatorSigningInfos( ctx, func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { info.StartHeight = 0 - app.slashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) return false }, ) diff --git a/app/sim_test.go b/app/sim_test.go index 25b7134f5e..60daa7aed2 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -25,8 +25,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" diff --git a/app/test_access.go b/app/test_access.go index 8770d713ef..d737a79ebd 100644 --- a/app/test_access.go +++ b/app/test_access.go @@ -12,8 +12,8 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - ibctransferkeeper "github.com/cosmos/ibc-go/v2/modules/apps/transfer/keeper" - ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" "github.com/CosmWasm/wasmd/x/wasm" ) @@ -28,38 +28,35 @@ func NewTestSupport(t testing.TB, app *WasmApp) *TestSupport { } func (s TestSupport) IBCKeeper() *ibckeeper.Keeper { - return s.app.ibcKeeper + return s.app.IBCKeeper } func (s TestSupport) WasmKeeper() wasm.Keeper { - return s.app.wasmKeeper + return s.app.WasmKeeper } func (s TestSupport) AppCodec() codec.Codec { return s.app.appCodec } -func (s TestSupport) ScopedWasmIBCKeeper() capabilitykeeper.ScopedKeeper { - return s.app.scopedWasmKeeper -} func (s TestSupport) ScopeIBCKeeper() capabilitykeeper.ScopedKeeper { - return s.app.scopedIBCKeeper + return s.app.ScopedIBCKeeper } func (s TestSupport) ScopedTransferKeeper() capabilitykeeper.ScopedKeeper { - return s.app.scopedTransferKeeper + return s.app.ScopedTransferKeeper } func (s TestSupport) StakingKeeper() stakingkeeper.Keeper { - return s.app.stakingKeeper + return s.app.StakingKeeper } func (s TestSupport) BankKeeper() bankkeeper.Keeper { - return s.app.bankKeeper + return s.app.BankKeeper } func (s TestSupport) TransferKeeper() ibctransferkeeper.Keeper { - return s.app.transferKeeper + return s.app.TransferKeeper } func (s TestSupport) GetBaseApp() *baseapp.BaseApp { diff --git a/app/test_helpers.go b/app/test_helpers.go index 0639df3eb3..02f4763bbf 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -244,7 +244,7 @@ func createIncrementalAccounts(accNum int) []sdk.AccAddress { // AddTestAddrsFromPubKeys adds the addresses into the WasmApp providing only the public keys. func AddTestAddrsFromPubKeys(app *WasmApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int) { - initCoins := sdk.NewCoins(sdk.NewCoin(app.stakingKeeper.BondDenom(ctx), accAmt)) + initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt)) for _, pk := range pubKeys { initAccountWithCoins(app, ctx, sdk.AccAddress(pk.Address()), initCoins) @@ -266,7 +266,7 @@ func AddTestAddrsIncremental(app *WasmApp, ctx sdk.Context, accNum int, accAmt s func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdk.Int, strategy GenerateAccountStrategy) []sdk.AccAddress { testAddrs := strategy(accNum) - initCoins := sdk.NewCoins(sdk.NewCoin(app.stakingKeeper.BondDenom(ctx), accAmt)) + initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt)) // fill all the addresses with some coins, set the loose pool tokens simultaneously for _, addr := range testAddrs { @@ -277,12 +277,12 @@ func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdk.Int, str } func initAccountWithCoins(app *WasmApp, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) { - err := app.bankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) if err != nil { panic(err) } - err = app.bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) if err != nil { panic(err) } @@ -323,7 +323,7 @@ func TestAddr(addr string, bech string) (sdk.AccAddress, error) { // CheckBalance checks the balance of an account. func CheckBalance(t *testing.T, app *WasmApp, addr sdk.AccAddress, balances sdk.Coins) { ctxCheck := app.BaseApp.NewContext(true, tmproto.Header{}) - require.True(t, balances.IsEqual(app.bankKeeper.GetAllBalances(ctxCheck, addr))) + require.True(t, balances.IsEqual(app.BankKeeper.GetAllBalances(ctxCheck, addr))) } const DefaultGas = 1200000 diff --git a/go.mod b/go.mod index 58b999ea95..8a47a86431 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/CosmWasm/wasmvm v1.0.0-beta10 github.com/cosmos/cosmos-sdk v0.45.1 github.com/cosmos/iavl v0.17.3 - github.com/cosmos/ibc-go/v2 v2.2.0 + github.com/cosmos/ibc-go/v3 v3.0.0 github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 @@ -109,7 +109,7 @@ require ( github.com/tendermint/go-amino v0.16.0 // indirect github.com/zondax/hid v0.9.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect - golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect @@ -123,7 +123,6 @@ require ( replace ( // Use the cosmos-flavored keyring library github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 - // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 // latest grpc doesn't work with with our modified proto compiler, so we need to enforce diff --git a/go.sum b/go.sum index 54fd27098f..01ce45b6e3 100644 --- a/go.sum +++ b/go.sum @@ -223,8 +223,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= -github.com/cosmos/ibc-go/v2 v2.2.0 h1:nqpvElI9ku5oQZtKvLerhZ/UXH7QoL44VBTWwZkS4C8= -github.com/cosmos/ibc-go/v2 v2.2.0/go.mod h1:rAHRlBcRiHPP/JszN+08SJx3pegww9bcVncIb9QLx7I= +github.com/cosmos/ibc-go/v3 v3.0.0 h1:XUNplHVS51Q2gMnTFsFsH9QJ7flsovMamnltKbEgPQ4= +github.com/cosmos/ibc-go/v3 v3.0.0/go.mod h1:Mb+1NXiPOLd+CPFlOC6BKeAUaxXlhuWenMmRiUiSmwY= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= @@ -1043,8 +1043,9 @@ golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 h1:3erb+vDS8lU1sxfDHF4/hhWyaXnhIaO+7RgL4fDZORA= golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1515,7 +1516,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= diff --git a/third_party/proto/ibc/applications/transfer/v1/genesis.proto b/third_party/proto/ibc/applications/transfer/v1/genesis.proto index 73d9fdddf9..0b5c0e0d12 100644 --- a/third_party/proto/ibc/applications/transfer/v1/genesis.proto +++ b/third_party/proto/ibc/applications/transfer/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; import "ibc/applications/transfer/v1/transfer.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/query.proto b/third_party/proto/ibc/applications/transfer/v1/query.proto index f2faa87b83..12876608db 100644 --- a/third_party/proto/ibc/applications/transfer/v1/query.proto +++ b/third_party/proto/ibc/applications/transfer/v1/query.proto @@ -7,7 +7,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/applications/transfer/v1/transfer.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; // Query provides defines the gRPC querier service. service Query { diff --git a/third_party/proto/ibc/applications/transfer/v1/transfer.proto b/third_party/proto/ibc/applications/transfer/v1/transfer.proto index 10ce92f90d..7a99485c58 100644 --- a/third_party/proto/ibc/applications/transfer/v1/transfer.proto +++ b/third_party/proto/ibc/applications/transfer/v1/transfer.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/tx.proto b/third_party/proto/ibc/applications/transfer/v1/tx.proto index dfc480d07a..b8b4e1e75b 100644 --- a/third_party/proto/ibc/applications/transfer/v1/tx.proto +++ b/third_party/proto/ibc/applications/transfer/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v2/packet.proto b/third_party/proto/ibc/applications/transfer/v2/packet.proto index 593392a900..850320df34 100644 --- a/third_party/proto/ibc/applications/transfer/v2/packet.proto +++ b/third_party/proto/ibc/applications/transfer/v2/packet.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v2; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; // FungibleTokenPacketData defines a struct for the packet payload // See FungibleTokenPacketData spec: diff --git a/third_party/proto/ibc/core/channel/v1/channel.proto b/third_party/proto/ibc/core/channel/v1/channel.proto index c7f42dbf99..68c6ec17b1 100644 --- a/third_party/proto/ibc/core/channel/v1/channel.proto +++ b/third_party/proto/ibc/core/channel/v1/channel.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/genesis.proto b/third_party/proto/ibc/core/channel/v1/genesis.proto index 38b57ed6c3..d95c891b6c 100644 --- a/third_party/proto/ibc/core/channel/v1/genesis.proto +++ b/third_party/proto/ibc/core/channel/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/query.proto b/third_party/proto/ibc/core/channel/v1/query.proto index 212cb645a9..ceb13d0009 100644 --- a/third_party/proto/ibc/core/channel/v1/query.proto +++ b/third_party/proto/ibc/core/channel/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"; import "ibc/core/client/v1/client.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/tx.proto b/third_party/proto/ibc/core/channel/v1/tx.proto index dab45080ff..c9322c1def 100644 --- a/third_party/proto/ibc/core/channel/v1/tx.proto +++ b/third_party/proto/ibc/core/channel/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/client/v1/client.proto b/third_party/proto/ibc/core/client/v1/client.proto index 0733770201..91ad0c97e7 100644 --- a/third_party/proto/ibc/core/client/v1/client.proto +++ b/third_party/proto/ibc/core/client/v1/client.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/client/v1/genesis.proto b/third_party/proto/ibc/core/client/v1/genesis.proto index 6668f2cad6..0ca29d224b 100644 --- a/third_party/proto/ibc/core/client/v1/genesis.proto +++ b/third_party/proto/ibc/core/client/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "ibc/core/client/v1/client.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/core/client/v1/query.proto b/third_party/proto/ibc/core/client/v1/query.proto index b6f8eb4744..91a906fe54 100644 --- a/third_party/proto/ibc/core/client/v1/query.proto +++ b/third_party/proto/ibc/core/client/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/client/v1/tx.proto b/third_party/proto/ibc/core/client/v1/tx.proto index 82df96dec0..06dbfbd0df 100644 --- a/third_party/proto/ibc/core/client/v1/tx.proto +++ b/third_party/proto/ibc/core/client/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/commitment/v1/commitment.proto b/third_party/proto/ibc/core/commitment/v1/commitment.proto index b460b9a1e4..f0118b7165 100644 --- a/third_party/proto/ibc/core/commitment/v1/commitment.proto +++ b/third_party/proto/ibc/core/commitment/v1/commitment.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.commitment.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/23-commitment/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types"; import "gogoproto/gogo.proto"; import "confio/proofs.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/connection.proto b/third_party/proto/ibc/core/connection/v1/connection.proto index 74c39e26e3..7fd2a6909a 100644 --- a/third_party/proto/ibc/core/connection/v1/connection.proto +++ b/third_party/proto/ibc/core/connection/v1/connection.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/commitment/v1/commitment.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/genesis.proto b/third_party/proto/ibc/core/connection/v1/genesis.proto index ec5be64285..1a53422c94 100644 --- a/third_party/proto/ibc/core/connection/v1/genesis.proto +++ b/third_party/proto/ibc/core/connection/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/connection/v1/connection.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/query.proto b/third_party/proto/ibc/core/connection/v1/query.proto index d668c3d28d..f28578f5fc 100644 --- a/third_party/proto/ibc/core/connection/v1/query.proto +++ b/third_party/proto/ibc/core/connection/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/tx.proto b/third_party/proto/ibc/core/connection/v1/tx.proto index 9d4e577e21..e7e09c84cf 100644 --- a/third_party/proto/ibc/core/connection/v1/tx.proto +++ b/third_party/proto/ibc/core/connection/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/port/v1/query.proto b/third_party/proto/ibc/core/port/v1/query.proto index 3c7fb7cb90..4ae44a5db7 100644 --- a/third_party/proto/ibc/core/port/v1/query.proto +++ b/third_party/proto/ibc/core/port/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.port.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/05-port/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/core/types/v1/genesis.proto b/third_party/proto/ibc/core/types/v1/genesis.proto index e39f6cdbba..fbddbf3035 100644 --- a/third_party/proto/ibc/core/types/v1/genesis.proto +++ b/third_party/proto/ibc/core/types/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.types.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/genesis.proto"; diff --git a/third_party/proto/ibc/lightclients/localhost/v1/localhost.proto b/third_party/proto/ibc/lightclients/localhost/v1/localhost.proto index 4fe05b7857..4305680154 100644 --- a/third_party/proto/ibc/lightclients/localhost/v1/localhost.proto +++ b/third_party/proto/ibc/lightclients/localhost/v1/localhost.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.localhost.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/light-clients/09-localhost/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/light-clients/09-localhost/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/lightclients/solomachine/v1/solomachine.proto b/third_party/proto/ibc/lightclients/solomachine/v1/solomachine.proto index b9b8a3a2af..c279f5e728 100644 --- a/third_party/proto/ibc/lightclients/solomachine/v1/solomachine.proto +++ b/third_party/proto/ibc/lightclients/solomachine/v1/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/legacy/v100"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/legacy/v100"; import "ibc/core/connection/v1/connection.proto"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto b/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto index 0c8c638c13..e626c18ac6 100644 --- a/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto +++ b/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v2; -option go_package = "github.com/cosmos/ibc-go/v2/modules/light-clients/06-solomachine/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/light-clients/06-solomachine/types"; import "ibc/core/connection/v1/connection.proto"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto index 54e229b28d..ac39341dbf 100644 --- a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto +++ b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.tendermint.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types"; import "tendermint/types/validator.proto"; import "tendermint/types/types.proto"; diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index 2e9e9b71f9..9604337b87 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -3,15 +3,15 @@ package wasm import ( "math" - ibcexported "github.com/cosmos/ibc-go/v2/modules/core/exported" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v2/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" types "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -77,16 +77,16 @@ func (i IBCHandler) OnChanOpenTry( portID, channelID string, chanCap *capabilitytypes.Capability, counterParty channeltypes.Counterparty, - version, counterpartyVersion string, -) error { + counterpartyVersion string, +) (string, error) { // ensure port, version, capability if err := ValidateChannelParams(channelID); err != nil { - return err + return "", err } contractAddr, err := ContractFromPortID(portID) if err != nil { - return sdkerrors.Wrapf(err, "contract port id") + return "", sdkerrors.Wrapf(err, "contract port id") } msg := wasmvmtypes.IBCChannelOpenMsg{ @@ -95,7 +95,7 @@ func (i IBCHandler) OnChanOpenTry( Endpoint: wasmvmtypes.IBCEndpoint{PortID: portID, ChannelID: channelID}, CounterpartyEndpoint: wasmvmtypes.IBCEndpoint{PortID: counterParty.PortId, ChannelID: counterParty.ChannelId}, Order: order.String(), - Version: version, + Version: counterpartyVersion, ConnectionID: connectionHops[0], // At the moment this list must be of length 1. In the future multi-hop channels may be supported. }, CounterpartyVersion: counterpartyVersion, @@ -104,7 +104,7 @@ func (i IBCHandler) OnChanOpenTry( err = i.keeper.OnOpenChannel(ctx, contractAddr, msg) if err != nil { - return err + return "", err } // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos // (ie chainA and chainB both call ChanOpenInit before one of them calls ChanOpenTry) @@ -113,16 +113,17 @@ func (i IBCHandler) OnChanOpenTry( if !i.keeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { // Only claim channel capability passed back by IBC module if we do not already own it if err := i.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return sdkerrors.Wrap(err, "claim capability") + return "", sdkerrors.Wrap(err, "claim capability") } } - return nil + return counterpartyVersion, nil } // OnChanOpenAck implements the IBCModule interface func (i IBCHandler) OnChanOpenAck( ctx sdk.Context, portID, channelID string, + counterpartyChannelID string, counterpartyVersion string, ) error { contractAddr, err := ContractFromPortID(portID) @@ -133,6 +134,8 @@ func (i IBCHandler) OnChanOpenAck( if !ok { return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) } + channelInfo.Counterparty.ChannelId = counterpartyChannelID + i.channelKeeper.SetChannel(ctx, portID, channelID, channelInfo) msg := wasmvmtypes.IBCChannelConnectMsg{ OpenAck: &wasmvmtypes.IBCOpenAck{ Channel: toWasmVMChannel(portID, channelID, channelInfo), diff --git a/x/wasm/ibc_reflect_test.go b/x/wasm/ibc_reflect_test.go index 91a0647f57..16a10c8b74 100644 --- a/x/wasm/ibc_reflect_test.go +++ b/x/wasm/ibc_reflect_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/assert" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/stretchr/testify/require" diff --git a/x/wasm/ibc_test.go b/x/wasm/ibc_test.go index 7540b523a0..767ccbe9aa 100644 --- a/x/wasm/ibc_test.go +++ b/x/wasm/ibc_test.go @@ -4,8 +4,8 @@ import ( "testing" wasmvmtypes "github.com/CosmWasm/wasmvm/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/stretchr/testify/assert" ) diff --git a/x/wasm/ibctesting/chain.go b/x/wasm/ibctesting/chain.go index f7f468b38a..3158663826 100644 --- a/x/wasm/ibctesting/chain.go +++ b/x/wasm/ibctesting/chain.go @@ -20,16 +20,16 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v2/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" - "github.com/cosmos/ibc-go/v2/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" - "github.com/cosmos/ibc-go/v2/modules/core/types" - ibctmtypes "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types" - ibctesting "github.com/cosmos/ibc-go/v2/testing" - "github.com/cosmos/ibc-go/v2/testing/mock" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + "github.com/cosmos/ibc-go/v3/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + "github.com/cosmos/ibc-go/v3/modules/core/types" + ibctmtypes "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" + "github.com/cosmos/ibc-go/v3/testing/mock" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/tmhash" diff --git a/x/wasm/ibctesting/coordinator.go b/x/wasm/ibctesting/coordinator.go index 13a0fcbc1d..5e2fb55662 100644 --- a/x/wasm/ibctesting/coordinator.go +++ b/x/wasm/ibctesting/coordinator.go @@ -6,9 +6,9 @@ import ( "testing" "time" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibctesting "github.com/cosmos/ibc-go/v3/testing" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" diff --git a/x/wasm/ibctesting/endpoint.go b/x/wasm/ibctesting/endpoint.go index e39ebdb9a7..722013daa1 100644 --- a/x/wasm/ibctesting/endpoint.go +++ b/x/wasm/ibctesting/endpoint.go @@ -3,18 +3,18 @@ package ibctesting import ( "fmt" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + ibctesting "github.com/cosmos/ibc-go/v3/testing" // sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v2/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" - "github.com/cosmos/ibc-go/v2/modules/core/exported" - ibctmtypes "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + "github.com/cosmos/ibc-go/v3/modules/core/exported" + ibctmtypes "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types" ) // Endpoint is a which represents a channel endpoint and its associated @@ -418,7 +418,7 @@ func (endpoint *Endpoint) WriteAcknowledgement(ack exported.Acknowledgement, pac channelCap := endpoint.Chain.GetChannelCapability(packet.GetDestPort(), packet.GetDestChannel()) // no need to send message, acting as a handler - err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(endpoint.Chain.GetContext(), channelCap, packet, ack.Acknowledgement()) + err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(endpoint.Chain.GetContext(), channelCap, packet, ack) if err != nil { return err } diff --git a/x/wasm/ibctesting/event_utils.go b/x/wasm/ibctesting/event_utils.go index 5188d8a8a8..6463515ffa 100644 --- a/x/wasm/ibctesting/event_utils.go +++ b/x/wasm/ibctesting/event_utils.go @@ -4,8 +4,8 @@ import ( "strconv" "strings" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" abci "github.com/tendermint/tendermint/abci/types" ) diff --git a/x/wasm/ibctesting/path.go b/x/wasm/ibctesting/path.go index 29ac881e46..2ce5e044a6 100644 --- a/x/wasm/ibctesting/path.go +++ b/x/wasm/ibctesting/path.go @@ -5,7 +5,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" ) // Path contains two endpoints representing two chains connected over IBC diff --git a/x/wasm/ibctesting/wasm.go b/x/wasm/ibctesting/wasm.go index 4b661be1d9..6957f63404 100644 --- a/x/wasm/ibctesting/wasm.go +++ b/x/wasm/ibctesting/wasm.go @@ -10,7 +10,7 @@ import ( wasmd "github.com/CosmWasm/wasmd/app" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + ibctesting "github.com/cosmos/ibc-go/v3/testing" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/golang/protobuf/proto" //nolint diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go index 9e4ab35f55..c138e5ed00 100644 --- a/x/wasm/keeper/handler_plugin.go +++ b/x/wasm/keeper/handler_plugin.go @@ -9,8 +9,8 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/handler_plugin_encoders.go b/x/wasm/keeper/handler_plugin_encoders.go index 624af0d187..e8e49d4fe2 100644 --- a/x/wasm/keeper/handler_plugin_encoders.go +++ b/x/wasm/keeper/handler_plugin_encoders.go @@ -12,9 +12,9 @@ import ( distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/handler_plugin_encoders_test.go b/x/wasm/keeper/handler_plugin_encoders_test.go index 67417be002..ead9bd0834 100644 --- a/x/wasm/keeper/handler_plugin_encoders_test.go +++ b/x/wasm/keeper/handler_plugin_encoders_test.go @@ -5,9 +5,9 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/golang/protobuf/proto" "github.com/stretchr/testify/assert" diff --git a/x/wasm/keeper/handler_plugin_test.go b/x/wasm/keeper/handler_plugin_test.go index 2b9e59f0c7..6684f0100d 100644 --- a/x/wasm/keeper/handler_plugin_test.go +++ b/x/wasm/keeper/handler_plugin_test.go @@ -11,9 +11,9 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v2/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/keeper/ibc.go b/x/wasm/keeper/ibc.go index 5d52d72a44..f6f928df62 100644 --- a/x/wasm/keeper/ibc.go +++ b/x/wasm/keeper/ibc.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/query_plugins.go b/x/wasm/keeper/query_plugins.go index 26d63ad5dc..dc6ebeada0 100644 --- a/x/wasm/keeper/query_plugins.go +++ b/x/wasm/keeper/query_plugins.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/CosmWasm/wasmd/x/wasm/types" diff --git a/x/wasm/keeper/query_plugins_test.go b/x/wasm/keeper/query_plugins_test.go index f10f3ca1c5..edde68444b 100644 --- a/x/wasm/keeper/query_plugins_test.go +++ b/x/wasm/keeper/query_plugins_test.go @@ -10,7 +10,7 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index d609771c77..f9fa1da658 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -53,11 +53,11 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/ibc-go/v2/modules/apps/transfer" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v2/modules/core" - ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" + "github.com/cosmos/ibc-go/v3/modules/apps/transfer" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v3/modules/core" + ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" diff --git a/x/wasm/keeper/wasmtesting/mock_keepers.go b/x/wasm/keeper/wasmtesting/mock_keepers.go index 2d2c99f21a..4295b24ef0 100644 --- a/x/wasm/keeper/wasmtesting/mock_keepers.go +++ b/x/wasm/keeper/wasmtesting/mock_keepers.go @@ -3,8 +3,8 @@ package wasmtesting import ( sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v2/modules/core/exported" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -16,6 +16,7 @@ type MockChannelKeeper struct { ChanCloseInitFn func(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error GetAllChannelsFn func(ctx sdk.Context) []channeltypes.IdentifiedChannel IterateChannelsFn func(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) + SetChannelFn func(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel) } func (m *MockChannelKeeper) GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) { @@ -60,6 +61,13 @@ func (m *MockChannelKeeper) IterateChannels(ctx sdk.Context, cb func(channeltype m.IterateChannelsFn(ctx, cb) } +func (m *MockChannelKeeper) SetChannel(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel) { + if m.GetChannelFn == nil { + panic("not supposed to be called!") + } + m.SetChannelFn(ctx, portID, channelID, channel) +} + func MockChannelKeeperIterator(s []channeltypes.IdentifiedChannel) func(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) { return func(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) { for _, channel := range s { diff --git a/x/wasm/relay_pingpong_test.go b/x/wasm/relay_pingpong_test.go index c7e832122c..ca06d876ff 100644 --- a/x/wasm/relay_pingpong_test.go +++ b/x/wasm/relay_pingpong_test.go @@ -5,15 +5,15 @@ import ( "fmt" "testing" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/relay_test.go b/x/wasm/relay_test.go index 6786272148..6e70332c65 100644 --- a/x/wasm/relay_test.go +++ b/x/wasm/relay_test.go @@ -10,10 +10,10 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go index 873e906e0f..0cdd4d80e0 100644 --- a/x/wasm/types/expected_keepers.go +++ b/x/wasm/types/expected_keepers.go @@ -8,9 +8,9 @@ import ( capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - connectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v2/modules/core/exported" + connectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" ) // BankViewKeeper defines a subset of methods implemented by the cosmos-sdk bank keeper @@ -75,6 +75,7 @@ type ChannelKeeper interface { ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error GetAllChannels(ctx sdk.Context) (channels []channeltypes.IdentifiedChannel) IterateChannels(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) + SetChannel(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel) } // ClientKeeper defines the expected IBC client keeper