x/capability: remove alias.go usage (#6438)
This commit is contained in:
parent
6e9ffc1a0e
commit
8cf8098861
|
@ -21,6 +21,8 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/auth/ante"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/crisis"
|
||||
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
|
||||
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
|
||||
|
@ -136,7 +138,7 @@ type SimApp struct {
|
|||
// keepers
|
||||
AccountKeeper auth.AccountKeeper
|
||||
BankKeeper bank.Keeper
|
||||
CapabilityKeeper *capability.Keeper
|
||||
CapabilityKeeper *capabilitykeeper.Keeper
|
||||
StakingKeeper stakingkeeper.Keeper
|
||||
SlashingKeeper slashingkeeper.Keeper
|
||||
MintKeeper mintkeeper.Keeper
|
||||
|
@ -150,8 +152,8 @@ type SimApp struct {
|
|||
TransferKeeper ibctransferkeeper.Keeper
|
||||
|
||||
// make scoped keepers public for test purposes
|
||||
ScopedIBCKeeper capability.ScopedKeeper
|
||||
ScopedTransferKeeper capability.ScopedKeeper
|
||||
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
|
||||
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
|
||||
|
||||
// the module manager
|
||||
mm *module.Manager
|
||||
|
@ -177,10 +179,10 @@ func NewSimApp(
|
|||
auth.StoreKey, bank.StoreKey, stakingtypes.StoreKey,
|
||||
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
|
||||
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
|
||||
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capability.StoreKey,
|
||||
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
|
||||
)
|
||||
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
|
||||
memKeys := sdk.NewMemoryStoreKeys(capability.MemStoreKey)
|
||||
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
||||
|
||||
app := &SimApp{
|
||||
BaseApp: bApp,
|
||||
|
@ -208,7 +210,7 @@ func NewSimApp(
|
|||
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(std.ConsensusParamsKeyTable()))
|
||||
|
||||
// add capability keeper and ScopeToModule for ibc module
|
||||
app.CapabilityKeeper = capability.NewKeeper(appCodec, keys[capability.StoreKey], memKeys[capability.MemStoreKey])
|
||||
app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])
|
||||
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
|
||||
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
|
||||
|
||||
|
@ -321,7 +323,7 @@ func NewSimApp(
|
|||
// so that other modules that want to create or claim capabilities afterwards in InitChain
|
||||
// can do so safely.
|
||||
app.mm.SetOrderInitGenesis(
|
||||
capability.ModuleName, auth.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, bank.ModuleName,
|
||||
capabilitytypes.ModuleName, auth.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, bank.ModuleName,
|
||||
slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName,
|
||||
ibchost.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, ibctransfertypes.ModuleName,
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
|
||||
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
|
@ -161,7 +161,7 @@ func TestAppImportExport(t *testing.T) {
|
|||
{app.keys[paramtypes.StoreKey], newApp.keys[paramtypes.StoreKey], [][]byte{}},
|
||||
{app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}},
|
||||
{app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}},
|
||||
{app.keys[capability.StoreKey], newApp.keys[capability.StoreKey], [][]byte{}},
|
||||
{app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}},
|
||||
{app.keys[ibchost.StoreKey], newApp.keys[ibchost.StoreKey], [][]byte{}},
|
||||
{app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}},
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package capability
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
)
|
||||
|
||||
// DONTCOVER
|
||||
|
||||
const (
|
||||
ModuleName = types.ModuleName
|
||||
StoreKey = types.StoreKey
|
||||
MemStoreKey = types.MemStoreKey
|
||||
)
|
||||
|
||||
var (
|
||||
NewKeeper = keeper.NewKeeper
|
||||
NewCapability = types.NewCapability
|
||||
RevCapabilityKey = types.RevCapabilityKey
|
||||
FwdCapabilityKey = types.FwdCapabilityKey
|
||||
KeyIndex = types.KeyIndex
|
||||
KeyPrefixIndexCapability = types.KeyPrefixIndexCapability
|
||||
ErrCapabilityTaken = types.ErrCapabilityTaken
|
||||
ErrOwnerClaimed = types.ErrOwnerClaimed
|
||||
ErrCapabilityNotOwned = types.ErrCapabilityNotOwned
|
||||
RegisterCodec = types.RegisterCodec
|
||||
NewOwner = types.NewOwner
|
||||
NewCapabilityOwners = types.NewCapabilityOwners
|
||||
)
|
||||
|
||||
type (
|
||||
Keeper = keeper.Keeper
|
||||
ScopedKeeper = keeper.ScopedKeeper
|
||||
Capability = types.Capability
|
||||
Owners = types.CapabilityOwners
|
||||
GenesisState = types.GenesisState
|
||||
GenesisOwners = types.GenesisOwners
|
||||
)
|
|
@ -2,11 +2,13 @@ package capability
|
|||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
)
|
||||
|
||||
// InitGenesis initializes the capability module's state from a provided genesis
|
||||
// state.
|
||||
func InitGenesis(ctx sdk.Context, k Keeper, genState GenesisState) {
|
||||
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
|
||||
k.SetIndex(ctx, genState.Index)
|
||||
|
||||
// set owners for each index and initialize capability
|
||||
|
@ -17,9 +19,9 @@ func InitGenesis(ctx sdk.Context, k Keeper, genState GenesisState) {
|
|||
}
|
||||
|
||||
// ExportGenesis returns the capability module's exported genesis.
|
||||
func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState {
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
||||
index := k.GetLatestIndex(ctx)
|
||||
owners := []GenesisOwners{}
|
||||
owners := []types.GenesisOwners{}
|
||||
|
||||
for i := uint64(1); i < index; i++ {
|
||||
capabilityOwners, ok := k.GetOwners(ctx, i)
|
||||
|
@ -27,14 +29,14 @@ func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState {
|
|||
continue
|
||||
}
|
||||
|
||||
genOwner := GenesisOwners{
|
||||
genOwner := types.GenesisOwners{
|
||||
Index: i,
|
||||
Owners: capabilityOwners,
|
||||
}
|
||||
owners = append(owners, genOwner)
|
||||
}
|
||||
|
||||
return GenesisState{
|
||||
return types.GenesisState{
|
||||
Index: index,
|
||||
Owners: owners,
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
|
@ -30,7 +29,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
|||
cdc := app.AppCodec()
|
||||
|
||||
// create new keeper so we can define custom scoping before init and seal
|
||||
keeper := keeper.NewKeeper(cdc, app.GetKey(capability.StoreKey), app.GetMemKey(capability.MemStoreKey))
|
||||
keeper := keeper.NewKeeper(cdc, app.GetKey(types.StoreKey), app.GetMemKey(types.MemStoreKey))
|
||||
|
||||
suite.app = app
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, abci.Header{Height: 1})
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
)
|
||||
|
@ -40,12 +41,12 @@ func NewAppModuleBasic(cdc codec.Marshaler) AppModuleBasic {
|
|||
|
||||
// Name returns the capability module's name.
|
||||
func (AppModuleBasic) Name() string {
|
||||
return ModuleName
|
||||
return types.ModuleName
|
||||
}
|
||||
|
||||
// RegisterCodec registers the capability module's types to the provided codec.
|
||||
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) {
|
||||
RegisterCodec(cdc)
|
||||
types.RegisterCodec(cdc)
|
||||
}
|
||||
|
||||
// DefaultGenesis returns the capability module's default genesis state.
|
||||
|
@ -57,7 +58,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage {
|
|||
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessage) error {
|
||||
var genState types.GenesisState
|
||||
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", ModuleName, err)
|
||||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||
}
|
||||
return genState.Validate()
|
||||
}
|
||||
|
@ -79,10 +80,10 @@ func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command { ret
|
|||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
||||
keeper Keeper
|
||||
keeper keeper.Keeper
|
||||
}
|
||||
|
||||
func NewAppModule(cdc codec.Marshaler, keeper Keeper) AppModule {
|
||||
func NewAppModule(cdc codec.Marshaler, keeper keeper.Keeper) AppModule {
|
||||
return AppModule{
|
||||
AppModuleBasic: NewAppModuleBasic(cdc),
|
||||
keeper: keeper,
|
||||
|
@ -111,7 +112,7 @@ func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
|||
// InitGenesis performs the capability module's genesis initialization It returns
|
||||
// no validator updates.
|
||||
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, gs json.RawMessage) []abci.ValidatorUpdate {
|
||||
var genState GenesisState
|
||||
var genState types.GenesisState
|
||||
// Initialize global index to index in genesis state
|
||||
cdc.MustUnmarshalJSON(gs, &genState)
|
||||
|
||||
|
@ -152,7 +153,7 @@ func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
|
|||
|
||||
// RegisterStoreDecoder registers a decoder for capability module's types
|
||||
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
|
||||
sdr[StoreKey] = simulation.NewDecodeStore(am.cdc)
|
||||
sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc)
|
||||
}
|
||||
|
||||
// WeightedOperations returns the all the gov module operations with their respective weights.
|
||||
|
|
|
@ -9,7 +9,8 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
|
||||
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
||||
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
||||
|
@ -25,14 +26,14 @@ type Keeper struct {
|
|||
portKeeper types.PortKeeper
|
||||
authKeeper types.AccountKeeper
|
||||
bankKeeper types.BankKeeper
|
||||
scopedKeeper capability.ScopedKeeper
|
||||
scopedKeeper capabilitykeeper.ScopedKeeper
|
||||
}
|
||||
|
||||
// NewKeeper creates a new IBC transfer Keeper instance
|
||||
func NewKeeper(
|
||||
cdc codec.Marshaler, key sdk.StoreKey,
|
||||
channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper,
|
||||
authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, scopedKeeper capability.ScopedKeeper,
|
||||
authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
|
||||
) Keeper {
|
||||
|
||||
// ensure ibc transfer module account is set
|
||||
|
@ -110,6 +111,6 @@ func (k Keeper) SetPort(ctx sdk.Context, portID string) {
|
|||
|
||||
// ClaimCapability allows the transfer module that can claim a capability that IBC module
|
||||
// passes to it
|
||||
func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capability.Capability, name string) error {
|
||||
func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error {
|
||||
return k.scopedKeeper.ClaimCapability(ctx, cap, name)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/client/cli"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/client/rest"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/keeper"
|
||||
|
@ -184,7 +184,7 @@ func (am AppModule) OnChanOpenInit(
|
|||
connectionHops []string,
|
||||
portID string,
|
||||
channelID string,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
counterparty channeltypes.Counterparty,
|
||||
version string,
|
||||
) error {
|
||||
|
@ -215,7 +215,7 @@ func (am AppModule) OnChanOpenTry(
|
|||
connectionHops []string,
|
||||
portID,
|
||||
channelID string,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
counterparty channeltypes.Counterparty,
|
||||
version,
|
||||
counterpartyVersion string,
|
||||
|
|
|
@ -3,7 +3,7 @@ package types
|
|||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
||||
|
@ -29,9 +29,9 @@ type BankKeeper interface {
|
|||
type ChannelKeeper interface {
|
||||
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
|
||||
GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
|
||||
SendPacket(ctx sdk.Context, channelCap *capability.Capability, packet channelexported.PacketI) error
|
||||
PacketExecuted(ctx sdk.Context, chanCap *capability.Capability, packet channelexported.PacketI, acknowledgement []byte) error
|
||||
ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capability.Capability) error
|
||||
SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet channelexported.PacketI) error
|
||||
PacketExecuted(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet channelexported.PacketI, acknowledgement []byte) error
|
||||
ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
|
||||
}
|
||||
|
||||
// ClientKeeper defines the expected IBC client keeper
|
||||
|
@ -46,5 +46,5 @@ type ConnectionKeeper interface {
|
|||
|
||||
// PortKeeper defines the expected IBC port keeper
|
||||
type PortKeeper interface {
|
||||
BindPort(ctx sdk.Context, portID string) *capability.Capability
|
||||
BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package channel
|
|||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
)
|
||||
|
||||
// HandleMsgChannelOpenInit defines the sdk.Handler for MsgChannelOpenInit
|
||||
func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capability.Capability, msg *MsgChannelOpenInit) (*sdk.Result, *capability.Capability, error) {
|
||||
func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *MsgChannelOpenInit) (*sdk.Result, *capabilitytypes.Capability, error) {
|
||||
capKey, err := k.ChanOpenInit(
|
||||
ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortID, msg.ChannelID,
|
||||
portCap, msg.Channel.Counterparty, msg.Channel.Version,
|
||||
|
@ -38,7 +38,7 @@ func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capabil
|
|||
}
|
||||
|
||||
// HandleMsgChannelOpenTry defines the sdk.Handler for MsgChannelOpenTry
|
||||
func HandleMsgChannelOpenTry(ctx sdk.Context, k keeper.Keeper, portCap *capability.Capability, msg *MsgChannelOpenTry) (*sdk.Result, *capability.Capability, error) {
|
||||
func HandleMsgChannelOpenTry(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *MsgChannelOpenTry) (*sdk.Result, *capabilitytypes.Capability, error) {
|
||||
capKey, err := k.ChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortID, msg.ChannelID,
|
||||
portCap, msg.Channel.Counterparty, msg.Channel.Version, msg.CounterpartyVersion, msg.ProofInit, msg.ProofHeight,
|
||||
)
|
||||
|
@ -67,7 +67,7 @@ func HandleMsgChannelOpenTry(ctx sdk.Context, k keeper.Keeper, portCap *capabili
|
|||
}
|
||||
|
||||
// HandleMsgChannelOpenAck defines the sdk.Handler for MsgChannelOpenAck
|
||||
func HandleMsgChannelOpenAck(ctx sdk.Context, k keeper.Keeper, channelCap *capability.Capability, msg *MsgChannelOpenAck) (*sdk.Result, error) {
|
||||
func HandleMsgChannelOpenAck(ctx sdk.Context, k keeper.Keeper, channelCap *capabilitytypes.Capability, msg *MsgChannelOpenAck) (*sdk.Result, error) {
|
||||
err := k.ChanOpenAck(
|
||||
ctx, msg.PortID, msg.ChannelID, channelCap, msg.CounterpartyVersion, msg.ProofTry, msg.ProofHeight,
|
||||
)
|
||||
|
@ -93,7 +93,7 @@ func HandleMsgChannelOpenAck(ctx sdk.Context, k keeper.Keeper, channelCap *capab
|
|||
}
|
||||
|
||||
// HandleMsgChannelOpenConfirm defines the sdk.Handler for MsgChannelOpenConfirm
|
||||
func HandleMsgChannelOpenConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *capability.Capability, msg *MsgChannelOpenConfirm) (*sdk.Result, error) {
|
||||
func HandleMsgChannelOpenConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *capabilitytypes.Capability, msg *MsgChannelOpenConfirm) (*sdk.Result, error) {
|
||||
err := k.ChanOpenConfirm(ctx, msg.PortID, msg.ChannelID, channelCap, msg.ProofAck, msg.ProofHeight)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -117,7 +117,7 @@ func HandleMsgChannelOpenConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *c
|
|||
}
|
||||
|
||||
// HandleMsgChannelCloseInit defines the sdk.Handler for MsgChannelCloseInit
|
||||
func HandleMsgChannelCloseInit(ctx sdk.Context, k keeper.Keeper, channelCap *capability.Capability, msg *MsgChannelCloseInit) (*sdk.Result, error) {
|
||||
func HandleMsgChannelCloseInit(ctx sdk.Context, k keeper.Keeper, channelCap *capabilitytypes.Capability, msg *MsgChannelCloseInit) (*sdk.Result, error) {
|
||||
err := k.ChanCloseInit(ctx, msg.PortID, msg.ChannelID, channelCap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -141,7 +141,7 @@ func HandleMsgChannelCloseInit(ctx sdk.Context, k keeper.Keeper, channelCap *cap
|
|||
}
|
||||
|
||||
// HandleMsgChannelCloseConfirm defines the sdk.Handler for MsgChannelCloseConfirm
|
||||
func HandleMsgChannelCloseConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *capability.Capability, msg *MsgChannelCloseConfirm) (*sdk.Result, error) {
|
||||
func HandleMsgChannelCloseConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *capabilitytypes.Capability, msg *MsgChannelCloseConfirm) (*sdk.Result, error) {
|
||||
err := k.ChanCloseConfirm(ctx, msg.PortID, msg.ChannelID, channelCap, msg.ProofInit, msg.ProofHeight)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
|
||||
|
@ -37,10 +37,10 @@ func (k Keeper) ChanOpenInit(
|
|||
connectionHops []string,
|
||||
portID,
|
||||
channelID string,
|
||||
portCap *capability.Capability,
|
||||
portCap *capabilitytypes.Capability,
|
||||
counterparty types.Counterparty,
|
||||
version string,
|
||||
) (*capability.Capability, error) {
|
||||
) (*capabilitytypes.Capability, error) {
|
||||
// channel identifier and connection hop length checked on msg.ValidateBasic()
|
||||
_, found := k.GetChannel(ctx, portID, channelID)
|
||||
if found {
|
||||
|
@ -87,13 +87,13 @@ func (k Keeper) ChanOpenTry(
|
|||
connectionHops []string,
|
||||
portID,
|
||||
channelID string,
|
||||
portCap *capability.Capability,
|
||||
portCap *capabilitytypes.Capability,
|
||||
counterparty types.Counterparty,
|
||||
version,
|
||||
counterpartyVersion string,
|
||||
proofInit []byte,
|
||||
proofHeight uint64,
|
||||
) (*capability.Capability, error) {
|
||||
) (*capabilitytypes.Capability, error) {
|
||||
// channel identifier and connection hop length checked on msg.ValidateBasic()
|
||||
previousChannel, found := k.GetChannel(ctx, portID, channelID)
|
||||
if found && !(previousChannel.State == types.INIT &&
|
||||
|
@ -167,7 +167,7 @@ func (k Keeper) ChanOpenAck(
|
|||
ctx sdk.Context,
|
||||
portID,
|
||||
channelID string,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
counterpartyVersion string,
|
||||
proofTry []byte,
|
||||
proofHeight uint64,
|
||||
|
@ -235,7 +235,7 @@ func (k Keeper) ChanOpenConfirm(
|
|||
ctx sdk.Context,
|
||||
portID,
|
||||
channelID string,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
proofAck []byte,
|
||||
proofHeight uint64,
|
||||
) error {
|
||||
|
@ -305,7 +305,7 @@ func (k Keeper) ChanCloseInit(
|
|||
ctx sdk.Context,
|
||||
portID,
|
||||
channelID string,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
) error {
|
||||
if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) {
|
||||
return sdkerrors.Wrap(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel")
|
||||
|
@ -346,7 +346,7 @@ func (k Keeper) ChanCloseConfirm(
|
|||
ctx sdk.Context,
|
||||
portID,
|
||||
channelID string,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
proofInit []byte,
|
||||
proofHeight uint64,
|
||||
) error {
|
||||
|
|
|
@ -3,7 +3,7 @@ package keeper_test
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||
|
@ -12,7 +12,7 @@ import (
|
|||
func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
counterparty := types.NewCounterparty(testPort2, testChannel2)
|
||||
|
||||
var portCap *capability.Capability
|
||||
var portCap *capabilitytypes.Capability
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
suite.chainA.createConnection(
|
||||
|
@ -38,7 +38,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
|||
testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA,
|
||||
connection.INIT,
|
||||
)
|
||||
portCap = capability.NewCapability(3)
|
||||
portCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
|||
counterparty := types.NewCounterparty(testPort1, testChannel1)
|
||||
channelKey := host.KeyChannel(testPort1, testChannel1)
|
||||
|
||||
var portCap *capability.Capability
|
||||
var portCap *capabilitytypes.Capability
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
suite.chainA.CreateClient(suite.chainB)
|
||||
|
@ -129,7 +129,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
|||
suite.chainB.createConnection(
|
||||
testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connection.OPEN)
|
||||
suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, types.INIT, types.ORDERED, testConnectionIDA)
|
||||
portCap = capability.NewCapability(3)
|
||||
portCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
|||
func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
channelKey := host.KeyChannel(testPort2, testChannel2)
|
||||
|
||||
var channelCap *capability.Capability
|
||||
var channelCap *capabilitytypes.Capability
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
suite.chainA.CreateClient(suite.chainB)
|
||||
|
@ -263,7 +263,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
|||
testPort2, testChannel2, testPort1, testChannel1, types.TRYOPEN,
|
||||
types.ORDERED, testConnectionIDA,
|
||||
)
|
||||
channelCap = capability.NewCapability(3)
|
||||
channelCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
|||
func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||
channelKey := host.KeyChannel(testPort2, testChannel2)
|
||||
|
||||
var channelCap *capability.Capability
|
||||
var channelCap *capabilitytypes.Capability
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
suite.chainA.CreateClient(suite.chainB)
|
||||
|
@ -384,7 +384,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
|||
)
|
||||
suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2,
|
||||
types.TRYOPEN, types.ORDERED, testConnectionIDA)
|
||||
channelCap = capability.NewCapability(3)
|
||||
channelCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
|||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestChanCloseInit() {
|
||||
var channelCap *capability.Capability
|
||||
var channelCap *capabilitytypes.Capability
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
suite.chainB.CreateClient(suite.chainA)
|
||||
|
@ -468,7 +468,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() {
|
|||
testPort1, testChannel1, testPort2, testChannel2, types.OPEN,
|
||||
types.ORDERED, testConnectionIDA,
|
||||
)
|
||||
channelCap = capability.NewCapability(3)
|
||||
channelCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() {
|
|||
func (suite *KeeperTestSuite) TestChanCloseConfirm() {
|
||||
channelKey := host.KeyChannel(testPort1, testChannel1)
|
||||
|
||||
var channelCap *capability.Capability
|
||||
var channelCap *capabilitytypes.Capability
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
suite.chainA.CreateClient(suite.chainB)
|
||||
|
|
|
@ -10,7 +10,8 @@ import (
|
|||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||
|
@ -23,14 +24,14 @@ type Keeper struct {
|
|||
clientKeeper types.ClientKeeper
|
||||
connectionKeeper types.ConnectionKeeper
|
||||
portKeeper types.PortKeeper
|
||||
scopedKeeper capability.ScopedKeeper
|
||||
scopedKeeper capabilitykeeper.ScopedKeeper
|
||||
}
|
||||
|
||||
// NewKeeper creates a new IBC channel Keeper instance
|
||||
func NewKeeper(
|
||||
cdc codec.Marshaler, key sdk.StoreKey,
|
||||
clientKeeper types.ClientKeeper, connectionKeeper types.ConnectionKeeper,
|
||||
portKeeper types.PortKeeper, scopedKeeper capability.ScopedKeeper,
|
||||
portKeeper types.PortKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
|
||||
) Keeper {
|
||||
return Keeper{
|
||||
storeKey: key,
|
||||
|
@ -317,7 +318,7 @@ func (k Keeper) GetAllChannels(ctx sdk.Context) (channels []types.IdentifiedChan
|
|||
}
|
||||
|
||||
// LookupModuleByChannel will return the IBCModule along with the capability associated with a given channel defined by its portID and channelID
|
||||
func (k Keeper) LookupModuleByChannel(ctx sdk.Context, portID, channelID string) (string, *capability.Capability, error) {
|
||||
func (k Keeper) LookupModuleByChannel(ctx sdk.Context, portID, channelID string) (string, *capabilitytypes.Capability, error) {
|
||||
modules, cap, err := k.scopedKeeper.LookupModules(ctx, host.ChannelCapabilityPath(portID, channelID))
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
||||
|
@ -20,7 +20,7 @@ import (
|
|||
// chain.
|
||||
func (k Keeper) SendPacket(
|
||||
ctx sdk.Context,
|
||||
channelCap *capability.Capability,
|
||||
channelCap *capabilitytypes.Capability,
|
||||
packet exported.PacketI,
|
||||
) error {
|
||||
if err := packet.ValidateBasic(); err != nil {
|
||||
|
@ -219,7 +219,7 @@ func (k Keeper) RecvPacket(
|
|||
// CONTRACT: this function must be called in the IBC handler
|
||||
func (k Keeper) PacketExecuted(
|
||||
ctx sdk.Context,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
packet exported.PacketI,
|
||||
acknowledgement []byte,
|
||||
) error {
|
||||
|
@ -402,7 +402,7 @@ func (k Keeper) AcknowledgePacket(
|
|||
// CONTRACT: this function must be called in the IBC handler
|
||||
func (k Keeper) AcknowledgementExecuted(
|
||||
ctx sdk.Context,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
packet exported.PacketI,
|
||||
) error {
|
||||
// sanity check
|
||||
|
@ -460,7 +460,7 @@ func (k Keeper) AcknowledgementExecuted(
|
|||
// and must be handled at the application level.
|
||||
func (k Keeper) CleanupPacket(
|
||||
ctx sdk.Context,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
packet exported.PacketI,
|
||||
proof []byte,
|
||||
proofHeight,
|
||||
|
|
|
@ -3,7 +3,7 @@ package keeper_test
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
transfertypes "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
|
||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
||||
|
@ -15,7 +15,7 @@ func (suite *KeeperTestSuite) TestSendPacket() {
|
|||
counterparty := types.NewCounterparty(testPort2, testChannel2)
|
||||
var packet exported.PacketI
|
||||
|
||||
var channelCap *capability.Capability
|
||||
var channelCap *capabilitytypes.Capability
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp)
|
||||
|
@ -89,7 +89,7 @@ func (suite *KeeperTestSuite) TestSendPacket() {
|
|||
suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connection.OPEN)
|
||||
suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, types.OPEN, types.ORDERED, testConnectionIDA)
|
||||
suite.chainB.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainB.GetContext(), testPort1, testChannel1, 1)
|
||||
channelCap = capability.NewCapability(3)
|
||||
channelCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ func (suite *KeeperTestSuite) TestPacketExecuted() {
|
|||
counterparty := types.NewCounterparty(testPort2, testChannel2)
|
||||
var packet types.Packet
|
||||
|
||||
var channelCap *capability.Capability
|
||||
var channelCap *capabilitytypes.Capability
|
||||
testCases := []testCase{
|
||||
{"success: UNORDERED", func() {
|
||||
packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp)
|
||||
|
@ -229,7 +229,7 @@ func (suite *KeeperTestSuite) TestPacketExecuted() {
|
|||
packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp)
|
||||
suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, types.OPEN, types.UNORDERED, testConnectionIDA)
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainA.GetContext(), testPort2, testChannel2, 1)
|
||||
channelCap = capability.NewCapability(3)
|
||||
channelCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ func (suite *KeeperTestSuite) TestAcknowledgementExecuted() {
|
|||
|
||||
var (
|
||||
packet types.Packet
|
||||
chanCap *capability.Capability
|
||||
chanCap *capabilitytypes.Capability
|
||||
)
|
||||
|
||||
testCases := []testCase{
|
||||
|
@ -393,7 +393,7 @@ func (suite *KeeperTestSuite) TestAcknowledgementExecuted() {
|
|||
{"incorrect capability", func() {
|
||||
packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), sequence, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp)
|
||||
suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, types.OPEN, types.ORDERED, testConnectionIDA)
|
||||
chanCap = capability.NewCapability(100)
|
||||
chanCap = capabilitytypes.NewCapability(100)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
|
@ -119,7 +119,7 @@ func (k Keeper) TimeoutPacket(
|
|||
// CONTRACT: this function must be called in the IBC handler
|
||||
func (k Keeper) TimeoutExecuted(
|
||||
ctx sdk.Context,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
packet exported.PacketI,
|
||||
) error {
|
||||
channel, found := k.GetChannel(ctx, packet.GetSourcePort(), packet.GetSourceChannel())
|
||||
|
@ -166,7 +166,7 @@ func (k Keeper) TimeoutExecuted(
|
|||
// never be received (even if the timeoutHeight has not yet been reached).
|
||||
func (k Keeper) TimeoutOnClose(
|
||||
ctx sdk.Context,
|
||||
chanCap *capability.Capability,
|
||||
chanCap *capabilitytypes.Capability,
|
||||
packet exported.PacketI,
|
||||
proof,
|
||||
proofClosed []byte,
|
||||
|
|
|
@ -3,7 +3,7 @@ package keeper_test
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||
|
@ -111,7 +111,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() {
|
|||
|
||||
var (
|
||||
packet types.Packet
|
||||
chanCap *capability.Capability
|
||||
chanCap *capabilitytypes.Capability
|
||||
)
|
||||
|
||||
testCases := []testCase{
|
||||
|
@ -124,7 +124,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() {
|
|||
{"incorrect capability", func() {
|
||||
packet = types.NewPacket(newMockTimeoutPacket().GetBytes(), 1, testPort1, testChannel1, testPort2, testChannel2, timeoutHeight, disabledTimeoutTimestamp)
|
||||
suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, types.OPEN, types.ORDERED, testConnectionIDA)
|
||||
chanCap = capability.NewCapability(100)
|
||||
chanCap = capabilitytypes.NewCapability(100)
|
||||
}, false},
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package types
|
|||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
||||
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
|
||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||
|
@ -73,5 +73,5 @@ type ConnectionKeeper interface {
|
|||
|
||||
// PortKeeper expected account IBC port keeper
|
||||
type PortKeeper interface {
|
||||
Authenticate(ctx sdk.Context, key *capability.Capability, portID string) bool
|
||||
Authenticate(ctx sdk.Context, key *capabilitytypes.Capability, portID string) bool
|
||||
}
|
||||
|
|
|
@ -6,18 +6,19 @@ import (
|
|||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||
)
|
||||
|
||||
// Keeper defines the IBC connection keeper
|
||||
type Keeper struct {
|
||||
scopedKeeper capability.ScopedKeeper
|
||||
scopedKeeper capabilitykeeper.ScopedKeeper
|
||||
}
|
||||
|
||||
// NewKeeper creates a new IBC connection Keeper instance
|
||||
func NewKeeper(sck capability.ScopedKeeper) Keeper {
|
||||
func NewKeeper(sck capabilitykeeper.ScopedKeeper) Keeper {
|
||||
return Keeper{
|
||||
scopedKeeper: sck,
|
||||
}
|
||||
|
@ -38,7 +39,7 @@ func (k Keeper) isBound(ctx sdk.Context, portID string) bool {
|
|||
// Ports must be bound statically when the chain starts in `app.go`.
|
||||
// The capability must then be passed to a module which will need to pass
|
||||
// it as an extra parameter when calling functions on the IBC module.
|
||||
func (k *Keeper) BindPort(ctx sdk.Context, portID string) *capability.Capability {
|
||||
func (k *Keeper) BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability {
|
||||
if err := host.PortIdentifierValidator(portID); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ func (k *Keeper) BindPort(ctx sdk.Context, portID string) *capability.Capability
|
|||
// by checking if the memory address of the capability was previously
|
||||
// generated and bound to the port (provided as a parameter) which the capability
|
||||
// is being authenticated against.
|
||||
func (k Keeper) Authenticate(ctx sdk.Context, key *capability.Capability, portID string) bool {
|
||||
func (k Keeper) Authenticate(ctx sdk.Context, key *capabilitytypes.Capability, portID string) bool {
|
||||
if err := host.PortIdentifierValidator(portID); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
@ -69,7 +70,7 @@ func (k Keeper) Authenticate(ctx sdk.Context, key *capability.Capability, portID
|
|||
}
|
||||
|
||||
// LookupModuleByPort will return the IBCModule along with the capability associated with a given portID
|
||||
func (k Keeper) LookupModuleByPort(ctx sdk.Context, portID string) (string, *capability.Capability, error) {
|
||||
func (k Keeper) LookupModuleByPort(ctx sdk.Context, portID string) (string, *capabilitytypes.Capability, error) {
|
||||
modules, cap, err := k.scopedKeeper.LookupModules(ctx, host.PortPath(portID))
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
|
|
|
@ -3,7 +3,7 @@ package types
|
|||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
)
|
||||
|
||||
|
@ -16,7 +16,7 @@ type IBCModule interface {
|
|||
connectionHops []string,
|
||||
portID string,
|
||||
channelID string,
|
||||
channelCap *capability.Capability,
|
||||
channelCap *capabilitytypes.Capability,
|
||||
counterParty channeltypes.Counterparty,
|
||||
version string,
|
||||
) error
|
||||
|
@ -27,7 +27,7 @@ type IBCModule interface {
|
|||
connectionHops []string,
|
||||
portID,
|
||||
channelID string,
|
||||
channelCap *capability.Capability,
|
||||
channelCap *capabilitytypes.Capability,
|
||||
counterparty channeltypes.Counterparty,
|
||||
version,
|
||||
counterpartyVersion string,
|
||||
|
|
|
@ -3,7 +3,7 @@ package keeper
|
|||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
||||
|
@ -24,7 +24,7 @@ type Keeper struct {
|
|||
|
||||
// NewKeeper creates a new ibc Keeper
|
||||
func NewKeeper(
|
||||
aminoCdc *codec.Codec, cdc codec.Marshaler, key sdk.StoreKey, stakingKeeper client.StakingKeeper, scopedKeeper capability.ScopedKeeper,
|
||||
aminoCdc *codec.Codec, cdc codec.Marshaler, key sdk.StoreKey, stakingKeeper client.StakingKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
|
||||
) *Keeper {
|
||||
clientKeeper := client.NewKeeper(aminoCdc, key, stakingKeeper)
|
||||
connectionKeeper := connection.NewKeeper(aminoCdc, cdc, key, clientKeeper)
|
||||
|
|
Loading…
Reference in New Issue