remove alias.go from channel (#6569)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
colin axner 2020-07-01 20:25:23 +02:00 committed by GitHub
parent 1ad7d83a31
commit 2658175b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 82 additions and 225 deletions

View File

@ -12,8 +12,8 @@ import (
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"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)
@ -68,7 +68,7 @@ func (k Keeper) GetTransferAccount(ctx sdk.Context) authtypes.ModuleAccountI {
func (k Keeper) PacketExecuted(ctx sdk.Context, packet channelexported.PacketI, acknowledgement []byte) error {
chanCap, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(packet.GetDestPort(), packet.GetDestChannel()))
if !ok {
return sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "channel capability could not be retrieved for packet")
return sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "channel capability could not be retrieved for packet")
}
return k.channelKeeper.PacketExecuted(ctx, chanCap, packet, acknowledgement)
}
@ -79,7 +79,7 @@ func (k Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error {
capName := host.ChannelCapabilityPath(portID, channelID)
chanCap, ok := k.scopedKeeper.GetCapability(ctx, capName)
if !ok {
return sdkerrors.Wrapf(channel.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
return sdkerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
}
return k.channelKeeper.ChanCloseInit(ctx, portID, channelID, chanCap)
}

View File

@ -25,7 +25,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/simulation"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
@ -202,7 +201,7 @@ func (am AppModule) OnChanOpenInit(
// Claim channel capability passed back by IBC module
if err := am.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
return sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, err.Error())
return sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, err.Error())
}
// TODO: escrow
@ -238,7 +237,7 @@ func (am AppModule) OnChanOpenTry(
// Claim channel capability passed back by IBC module
if err := am.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
return sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, err.Error())
return sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, err.Error())
}
// TODO: escrow

View File

@ -4,7 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
)
@ -34,7 +34,7 @@ var (
func init() {
RegisterCodec(amino)
channel.RegisterCodec(amino)
channeltypes.RegisterCodec(amino)
commitmenttypes.RegisterCodec(amino)
amino.Seal()
}

View File

@ -1,146 +0,0 @@
package channel
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper
import (
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
)
const (
AttributeKeyConnectionID = types.AttributeKeyConnectionID
AttributeKeyPortID = types.AttributeKeyPortID
AttributeKeyChannelID = types.AttributeKeyChannelID
AttributeCounterpartyPortID = types.AttributeCounterpartyPortID
AttributeCounterpartyChannelID = types.AttributeCounterpartyChannelID
EventTypeSendPacket = types.EventTypeSendPacket
EventTypeRecvPacket = types.EventTypeRecvPacket
EventTypeAcknowledgePacket = types.EventTypeAcknowledgePacket
EventTypeTimeoutPacket = types.EventTypeTimeoutPacket
AttributeKeyData = types.AttributeKeyData
AttributeKeyAck = types.AttributeKeyAck
AttributeKeyTimeoutHeight = types.AttributeKeyTimeoutHeight
AttributeKeyTimeoutTimestamp = types.AttributeKeyTimeoutTimestamp
AttributeKeySequence = types.AttributeKeySequence
AttributeKeySrcPort = types.AttributeKeySrcPort
AttributeKeySrcChannel = types.AttributeKeySrcChannel
AttributeKeyDstPort = types.AttributeKeyDstPort
AttributeKeyDstChannel = types.AttributeKeyDstChannel
SubModuleName = types.SubModuleName
StoreKey = types.StoreKey
RouterKey = types.RouterKey
QuerierRoute = types.QuerierRoute
QueryAllChannels = types.QueryAllChannels
QueryChannel = types.QueryChannel
QueryConnectionChannels = types.QueryConnectionChannels
QueryPacketCommitments = types.QueryPacketCommitments
QueryUnrelayedAcknowledgements = types.QueryUnrelayedAcknowledgements
QueryUnrelayedPacketSends = types.QueryUnrelayedPacketSends
UNINITIALIZED = types.UNINITIALIZED
INIT = types.INIT
TRYOPEN = types.TRYOPEN
OPEN = types.OPEN
CLOSED = types.CLOSED
NONE = types.NONE
UNORDERED = types.UNORDERED
ORDERED = types.ORDERED
)
var (
// functions aliases
NewChannel = types.NewChannel
NewCounterparty = types.NewCounterparty
NewIdentifiedChannel = types.NewIdentifiedChannel
RegisterCodec = types.RegisterCodec
RegisterInterfaces = types.RegisterInterfaces
NewPacketAckCommitment = types.NewPacketAckCommitment
NewPacketSequence = types.NewPacketSequence
NewGenesisState = types.NewGenesisState
DefaultGenesisState = types.DefaultGenesisState
NewMsgChannelOpenInit = types.NewMsgChannelOpenInit
NewMsgChannelOpenTry = types.NewMsgChannelOpenTry
NewMsgChannelOpenAck = types.NewMsgChannelOpenAck
NewMsgChannelOpenConfirm = types.NewMsgChannelOpenConfirm
NewMsgChannelCloseInit = types.NewMsgChannelCloseInit
NewMsgChannelCloseConfirm = types.NewMsgChannelCloseConfirm
NewMsgPacket = types.NewMsgPacket
NewMsgTimeout = types.NewMsgTimeout
NewMsgAcknowledgement = types.NewMsgAcknowledgement
CommitPacket = types.CommitPacket
CommitAcknowledgement = types.CommitAcknowledgement
NewPacket = types.NewPacket
NewChannelResponse = types.NewChannelResponse
NewQueryAllChannelsParams = types.NewQueryAllChannelsParams
NewQueryConnectionChannelsParams = types.NewQueryConnectionChannelsParams
NewQueryPacketCommitmentsParams = types.NewQueryPacketCommitmentsParams
NewQueryUnrelayedPacketsParams = types.NewQueryUnrelayedPacketsParams
NewPacketResponse = types.NewPacketResponse
NewRecvResponse = types.NewRecvResponse
NewKeeper = keeper.NewKeeper
QuerierChannels = keeper.QuerierChannels
QuerierConnectionChannels = keeper.QuerierConnectionChannels
QuerierPacketCommitments = keeper.QuerierPacketCommitments
QuerierUnrelayedAcknowledgements = keeper.QuerierUnrelayedAcknowledgements
QuerierUnrelayedPacketSends = keeper.QuerierUnrelayedPacketSends
// variable aliases
SubModuleCdc = types.SubModuleCdc
ErrChannelExists = types.ErrChannelExists
ErrChannelNotFound = types.ErrChannelNotFound
ErrInvalidChannel = types.ErrInvalidChannel
ErrInvalidChannelState = types.ErrInvalidChannelState
ErrInvalidChannelOrdering = types.ErrInvalidChannelOrdering
ErrInvalidCounterparty = types.ErrInvalidCounterparty
ErrInvalidChannelCapability = types.ErrInvalidChannelCapability
ErrChannelCapabilityNotFound = types.ErrChannelCapabilityNotFound
ErrSequenceSendNotFound = types.ErrSequenceSendNotFound
ErrSequenceReceiveNotFound = types.ErrSequenceReceiveNotFound
ErrSequenceAckNotFound = types.ErrSequenceAckNotFound
ErrInvalidPacket = types.ErrInvalidPacket
ErrPacketTimeout = types.ErrPacketTimeout
ErrTooManyConnectionHops = types.ErrTooManyConnectionHops
ErrAcknowledgementTooLong = types.ErrAcknowledgementTooLong
EventTypeChannelOpenInit = types.EventTypeChannelOpenInit
EventTypeChannelOpenTry = types.EventTypeChannelOpenTry
EventTypeChannelOpenAck = types.EventTypeChannelOpenAck
EventTypeChannelOpenConfirm = types.EventTypeChannelOpenConfirm
EventTypeChannelCloseInit = types.EventTypeChannelCloseInit
EventTypeChannelCloseConfirm = types.EventTypeChannelCloseConfirm
AttributeValueCategory = types.AttributeValueCategory
)
// nolint: golint
type (
IdentifiedChannel = types.IdentifiedChannel
ClientKeeper = types.ClientKeeper
ConnectionKeeper = types.ConnectionKeeper
PortKeeper = types.PortKeeper
PacketAckCommitment = types.PacketAckCommitment
PacketSequence = types.PacketSequence
GenesisState = types.GenesisState
ChannelResponse = types.ChannelResponse
QueryAllChannelsParams = types.QueryAllChannelsParams
QueryConnectionChannelsParams = types.QueryConnectionChannelsParams
QueryPacketCommitmentsParams = types.QueryPacketCommitmentsParams
QueryUnrelayedPacketsParams = types.QueryUnrelayedPacketsParams
PacketResponse = types.PacketResponse
RecvResponse = types.RecvResponse
State = types.State
Order = types.Order
MsgChannelOpenInit = types.MsgChannelOpenInit
MsgChannelOpenTry = types.MsgChannelOpenTry
MsgChannelOpenAck = types.MsgChannelOpenAck
MsgChannelOpenConfirm = types.MsgChannelOpenConfirm
MsgChannelCloseInit = types.MsgChannelCloseInit
MsgChannelCloseConfirm = types.MsgChannelCloseConfirm
MsgPacket = types.MsgPacket
MsgTimeout = types.MsgTimeout
MsgAcknowledgement = types.MsgAcknowledgement
Channel = types.Channel
Counterparty = types.Counterparty
Packet = types.Packet
Keeper = keeper.Keeper
)

View File

@ -2,13 +2,15 @@ package channel
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
)
// InitGenesis initializes the ibc channel submodule's state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k Keeper, gs GenesisState) {
func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
for _, channel := range gs.Channels {
ch := NewChannel(channel.State, channel.Ordering, channel.Counterparty, channel.ConnectionHops, channel.Version)
ch := types.NewChannel(channel.State, channel.Ordering, channel.Counterparty, channel.ConnectionHops, channel.Version)
k.SetChannel(ctx, channel.PortID, channel.ID, ch)
}
for _, ack := range gs.Acknowledgements {
@ -29,8 +31,8 @@ func InitGenesis(ctx sdk.Context, k Keeper, gs GenesisState) {
}
// ExportGenesis returns the ibc channel submodule's exported genesis.
func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState {
return GenesisState{
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
return types.GenesisState{
Channels: k.GetAllChannels(ctx),
Acknowledgements: k.GetAllPacketAcks(ctx),
Commitments: k.GetAllPacketCommitments(ctx),

View File

@ -8,7 +8,7 @@ import (
)
// HandleMsgChannelOpenInit defines the sdk.Handler for MsgChannelOpenInit
func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *MsgChannelOpenInit) (*sdk.Result, *capabilitytypes.Capability, error) {
func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *types.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 *capabilitytypes.Capability, msg *MsgChannelOpenTry) (*sdk.Result, *capabilitytypes.Capability, error) {
func HandleMsgChannelOpenTry(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *types.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 *capabilitytypes.Capability, msg *MsgChannelOpenAck) (*sdk.Result, error) {
func HandleMsgChannelOpenAck(ctx sdk.Context, k keeper.Keeper, channelCap *capabilitytypes.Capability, msg *types.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 *capabilitytypes.Capability, msg *MsgChannelOpenConfirm) (*sdk.Result, error) {
func HandleMsgChannelOpenConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *capabilitytypes.Capability, msg *types.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 *capabilitytypes.Capability, msg *MsgChannelCloseInit) (*sdk.Result, error) {
func HandleMsgChannelCloseInit(ctx sdk.Context, k keeper.Keeper, channelCap *capabilitytypes.Capability, msg *types.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 *capabilitytypes.Capability, msg *MsgChannelCloseConfirm) (*sdk.Result, error) {
func HandleMsgChannelCloseConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *capabilitytypes.Capability, msg *types.MsgChannelCloseConfirm) (*sdk.Result, error) {
err := k.ChanCloseConfirm(ctx, msg.PortID, msg.ChannelID, channelCap, msg.ProofInit, msg.ProofHeight)
if err != nil {
return nil, err

View File

@ -7,11 +7,12 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/client/cli"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/client/rest"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
)
// Name returns the IBC connection ICS name
func Name() string {
return SubModuleName
return types.SubModuleName
}
// GetTxCmd returns the root tx command for the IBC connections.

View File

@ -6,7 +6,7 @@ import (
lite "github.com/tendermint/tendermint/lite2"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
@ -246,13 +246,13 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() {
}
func (suite *TendermintTestSuite) TestVerifyChannelState() {
counterparty := channel.NewCounterparty(testPortID, testChannelID)
ch := channel.NewChannel(channel.OPEN, channel.ORDERED, counterparty, []string{testConnectionID}, "1.0.0")
counterparty := channeltypes.NewCounterparty(testPortID, testChannelID)
ch := channeltypes.NewChannel(channeltypes.OPEN, channeltypes.ORDERED, counterparty, []string{testConnectionID}, "1.0.0")
testCases := []struct {
name string
clientState ibctmtypes.ClientState
channel channel.Channel
channel channeltypes.Channel
consensusState ibctmtypes.ConsensusState
prefix commitmenttypes.MerklePrefix
proof []byte

View File

@ -2,7 +2,7 @@ package types_test
import (
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
"github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
)
@ -130,13 +130,13 @@ func (suite *LocalhostTestSuite) TestVerifyConnectionState() {
}
func (suite *LocalhostTestSuite) TestVerifyChannelState() {
counterparty := channel.NewCounterparty(testPortID, testChannelID)
ch := channel.NewChannel(channel.OPEN, channel.ORDERED, counterparty, []string{testConnectionID}, "1.0.0")
counterparty := channeltypes.NewCounterparty(testPortID, testChannelID)
ch := channeltypes.NewChannel(channeltypes.OPEN, channeltypes.ORDERED, counterparty, []string{testConnectionID}, "1.0.0")
testCases := []struct {
name string
clientState types.ClientState
channel channel.Channel
channel channeltypes.Channel
prefix commitmenttypes.MerklePrefix
proof []byte
expPass bool

View File

@ -4,7 +4,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
)
// ProofVerificationDecorator handles messages that contains application specific packet types,
@ -12,11 +13,11 @@ import (
// MsgUpdateClients are also handled here to perform atomic multimsg transaction
type ProofVerificationDecorator struct {
clientKeeper clientkeeper.Keeper
channelKeeper channel.Keeper
channelKeeper channelkeeper.Keeper
}
// NewProofVerificationDecorator constructs new ProofverificationDecorator
func NewProofVerificationDecorator(clientKeeper clientkeeper.Keeper, channelKeeper channel.Keeper) ProofVerificationDecorator {
func NewProofVerificationDecorator(clientKeeper clientkeeper.Keeper, channelKeeper channelkeeper.Keeper) ProofVerificationDecorator {
return ProofVerificationDecorator{
clientKeeper: clientKeeper,
channelKeeper: channelKeeper,
@ -31,11 +32,11 @@ func (pvr ProofVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim
switch msg := msg.(type) {
case clientexported.MsgUpdateClient:
_, err = pvr.clientKeeper.UpdateClient(ctx, msg.GetClientID(), msg.GetHeader())
case *channel.MsgPacket:
case *channeltypes.MsgPacket:
err = pvr.channelKeeper.RecvPacket(ctx, msg.Packet, msg.Proof, msg.ProofHeight)
case *channel.MsgAcknowledgement:
case *channeltypes.MsgAcknowledgement:
err = pvr.channelKeeper.AcknowledgePacket(ctx, msg.Packet, msg.Acknowledgement, msg.Proof, msg.ProofHeight)
case *channel.MsgTimeout:
case *channeltypes.MsgTimeout:
err = pvr.channelKeeper.TimeoutPacket(ctx, msg.Packet, msg.Proof, msg.ProofHeight, msg.NextSequenceRecv)
default:
// don't emit sender event for other msg types

View File

@ -15,7 +15,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
@ -89,13 +88,13 @@ func (suite *HandlerTestSuite) TestHandleMsgPacketOrdered() {
suite.chainA.App.IBCKeeper.ChannelKeeper,
))
packet := channel.NewPacket(newPacket(12345).GetData(), 1, portid, chanid, cpportid, cpchanid, 100, 0)
packet := channeltypes.NewPacket(newPacket(12345).GetData(), 1, portid, chanid, cpportid, cpchanid, 100, 0)
ctx := suite.chainA.GetContext()
cctx, _ := ctx.CacheContext()
// suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(ctx, packet.SourcePort, packet.SourceChannel, 1)
suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), packet.SourcePort, packet.SourceChannel, packet.Sequence, channeltypes.CommitPacket(packet))
msg := channel.NewMsgPacket(packet, []byte{}, 0, addr1)
msg := channeltypes.NewMsgPacket(packet, []byte{}, 0, addr1)
_, err := handler(cctx, suite.newTx(msg), false)
suite.Error(err, "%+v", err) // channel does not exist
@ -104,7 +103,7 @@ func (suite *HandlerTestSuite) TestHandleMsgPacketOrdered() {
ctx = suite.chainA.GetContext()
packetCommitmentPath := host.PacketCommitmentPath(packet.SourcePort, packet.SourceChannel, packet.Sequence)
proof, proofHeight := queryProof(suite.chainB, packetCommitmentPath)
msg = channel.NewMsgPacket(packet, proof, uint64(proofHeight), addr1)
msg = channeltypes.NewMsgPacket(packet, proof, uint64(proofHeight), addr1)
_, err = handler(cctx, suite.newTx(msg), false)
suite.Error(err, "%+v", err) // invalid proof
@ -115,7 +114,7 @@ func (suite *HandlerTestSuite) TestHandleMsgPacketOrdered() {
// ctx = suite.chainA.GetContext()
proof, proofHeight = queryProof(suite.chainB, packetCommitmentPath)
msg = channel.NewMsgPacket(packet, proof, uint64(proofHeight), addr1)
msg = channeltypes.NewMsgPacket(packet, proof, uint64(proofHeight), addr1)
for i := 0; i < 10; i++ {
cctx, write := suite.chainA.GetContext().CacheContext()
@ -148,7 +147,7 @@ func (suite *HandlerTestSuite) TestHandleMsgPacketUnordered() {
var packet channeltypes.Packet
for i := 0; i < 5; i++ {
packet = channel.NewPacket(newPacket(uint64(i)).GetData(), uint64(i), portid, chanid, cpportid, cpchanid, 100, 0)
packet = channeltypes.NewPacket(newPacket(uint64(i)).GetData(), uint64(i), portid, chanid, cpportid, cpchanid, 100, 0)
suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), packet.SourcePort, packet.SourceChannel, uint64(i), channeltypes.CommitPacket(packet))
}
@ -160,10 +159,10 @@ func (suite *HandlerTestSuite) TestHandleMsgPacketUnordered() {
for i := 10; i >= 0; i-- {
cctx, write := suite.chainA.GetContext().CacheContext()
packet = channel.NewPacket(newPacket(uint64(i)).GetData(), uint64(i), portid, chanid, cpportid, cpchanid, 100, 0)
packet = channeltypes.NewPacket(newPacket(uint64(i)).GetData(), uint64(i), portid, chanid, cpportid, cpchanid, 100, 0)
packetCommitmentPath := host.PacketCommitmentPath(packet.SourcePort, packet.SourceChannel, uint64(i))
proof, proofHeight := queryProof(suite.chainB, packetCommitmentPath)
msg := channel.NewMsgPacket(packet, proof, uint64(proofHeight), addr1)
msg := channeltypes.NewMsgPacket(packet, proof, uint64(proofHeight), addr1)
_, err := handler(cctx, suite.newTx(msg), false)
if i < 5 {
suite.NoError(err, "%d", i) // successfully executed

View File

@ -6,7 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
@ -53,29 +53,29 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
connectiontypes.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}),
},
),
ChannelGenesis: channel.NewGenesisState(
[]channel.IdentifiedChannel{
channel.NewIdentifiedChannel(
port1, channel1, channel.NewChannel(
channel.INIT, channelOrder,
channel.NewCounterparty(port2, channel2), []string{connectionID}, channelVersion,
ChannelGenesis: channeltypes.NewGenesisState(
[]channeltypes.IdentifiedChannel{
channeltypes.NewIdentifiedChannel(
port1, channel1, channeltypes.NewChannel(
channeltypes.INIT, channelOrder,
channeltypes.NewCounterparty(port2, channel2), []string{connectionID}, channelVersion,
),
),
},
[]channel.PacketAckCommitment{
channel.NewPacketAckCommitment(port2, channel2, 1, []byte("ack")),
[]channeltypes.PacketAckCommitment{
channeltypes.NewPacketAckCommitment(port2, channel2, 1, []byte("ack")),
},
[]channel.PacketAckCommitment{
channel.NewPacketAckCommitment(port1, channel1, 1, []byte("commit_hash")),
[]channeltypes.PacketAckCommitment{
channeltypes.NewPacketAckCommitment(port1, channel1, 1, []byte("commit_hash")),
},
[]channel.PacketSequence{
channel.NewPacketSequence(port1, channel1, 1),
[]channeltypes.PacketSequence{
channeltypes.NewPacketSequence(port1, channel1, 1),
},
[]channel.PacketSequence{
channel.NewPacketSequence(port2, channel2, 1),
[]channeltypes.PacketSequence{
channeltypes.NewPacketSequence(port2, channel2, 1),
},
[]channel.PacketSequence{
channel.NewPacketSequence(port2, channel2, 1),
[]channeltypes.PacketSequence{
channeltypes.NewPacketSequence(port2, channel2, 1),
},
),
},
@ -116,9 +116,9 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
genState: types.GenesisState{
ClientGenesis: clienttypes.DefaultGenesisState(),
ConnectionGenesis: connectiontypes.DefaultGenesisState(),
ChannelGenesis: channel.GenesisState{
Acknowledgements: []channel.PacketAckCommitment{
channel.NewPacketAckCommitment("(portID)", channel1, 1, []byte("ack")),
ChannelGenesis: channeltypes.GenesisState{
Acknowledgements: []channeltypes.PacketAckCommitment{
channeltypes.NewPacketAckCommitment("(portID)", channel1, 1, []byte("ack")),
},
},
},

View File

@ -8,6 +8,7 @@ import (
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
"github.com/cosmos/cosmos-sdk/x/ibc/keeper"
)
@ -39,7 +40,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return connection.HandleMsgConnectionOpenConfirm(ctx, k.ConnectionKeeper, msg)
// IBC channel msgs
case *channel.MsgChannelOpenInit:
case *channeltypes.MsgChannelOpenInit:
// Lookup module by port capability
module, portCap, err := k.PortKeeper.LookupModuleByPort(ctx, msg.PortID)
if err != nil {
@ -62,7 +63,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return res, nil
case *channel.MsgChannelOpenTry:
case *channeltypes.MsgChannelOpenTry:
// Lookup module by port capability
module, portCap, err := k.PortKeeper.LookupModuleByPort(ctx, msg.PortID)
if err != nil {
@ -84,7 +85,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return res, nil
case *channel.MsgChannelOpenAck:
case *channeltypes.MsgChannelOpenAck:
// Lookup module by channel capability
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
if err != nil {
@ -102,7 +103,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
}
return channel.HandleMsgChannelOpenAck(ctx, k.ChannelKeeper, cap, msg)
case *channel.MsgChannelOpenConfirm:
case *channeltypes.MsgChannelOpenConfirm:
// Lookup module by channel capability
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
if err != nil {
@ -120,7 +121,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
}
return channel.HandleMsgChannelOpenConfirm(ctx, k.ChannelKeeper, cap, msg)
case *channel.MsgChannelCloseInit:
case *channeltypes.MsgChannelCloseInit:
// Lookup module by channel capability
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
if err != nil {
@ -138,7 +139,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
}
return channel.HandleMsgChannelCloseInit(ctx, k.ChannelKeeper, cap, msg)
case *channel.MsgChannelCloseConfirm:
case *channeltypes.MsgChannelCloseConfirm:
// Lookup module by channel capability
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
if err != nil {
@ -157,7 +158,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return channel.HandleMsgChannelCloseConfirm(ctx, k.ChannelKeeper, cap, msg)
// IBC packet msgs get routed to the appropriate module callback
case *channel.MsgPacket:
case *channeltypes.MsgPacket:
// Lookup module by channel capability
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.DestinationPort, msg.Packet.DestinationChannel)
if err != nil {
@ -183,7 +184,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return res, nil
case *channel.MsgAcknowledgement:
case *channeltypes.MsgAcknowledgement:
// Lookup module by channel capability
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
if err != nil {
@ -209,7 +210,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return res, nil
case *channel.MsgTimeout:
case *channeltypes.MsgTimeout:
// Lookup module by channel capability
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
if err != nil {

View File

@ -7,7 +7,7 @@ import (
clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectionkeeper "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
)
@ -18,7 +18,7 @@ type Keeper struct {
ClientKeeper clientkeeper.Keeper
ConnectionKeeper connectionkeeper.Keeper
ChannelKeeper channel.Keeper
ChannelKeeper channelkeeper.Keeper
PortKeeper port.Keeper
Router *port.Router
}
@ -30,7 +30,7 @@ func NewKeeper(
clientKeeper := clientkeeper.NewKeeper(aminoCdc, key, stakingKeeper)
connectionKeeper := connectionkeeper.NewKeeper(aminoCdc, cdc, key, clientKeeper)
portKeeper := port.NewKeeper(scopedKeeper)
channelKeeper := channel.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper)
channelKeeper := channelkeeper.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper)
return &Keeper{
aminoCdc: aminoCdc,

View File

@ -5,7 +5,7 @@ import (
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
@ -16,7 +16,7 @@ import (
func RegisterCodec(cdc *codec.Codec) {
clienttypes.RegisterCodec(cdc)
connectiontypes.RegisterCodec(cdc)
channel.RegisterCodec(cdc)
channeltypes.RegisterCodec(cdc)
ibctmtypes.RegisterCodec(cdc)
localhosttypes.RegisterCodec(cdc)
commitmenttypes.RegisterCodec(cdc)
@ -25,5 +25,5 @@ func RegisterCodec(cdc *codec.Codec) {
// RegisterInterfaces registers x/ibc interfaces into protobuf Any.
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
connectiontypes.RegisterInterfaces(registry)
channel.RegisterInterfaces(registry)
channeltypes.RegisterInterfaces(registry)
}

View File

@ -3,14 +3,14 @@ package types
import (
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
)
// GenesisState defines the ibc module's genesis state.
type GenesisState struct {
ClientGenesis clienttypes.GenesisState `json:"client_genesis" yaml:"client_genesis"`
ConnectionGenesis connectiontypes.GenesisState `json:"connection_genesis" yaml:"connection_genesis"`
ChannelGenesis channel.GenesisState `json:"channel_genesis" yaml:"channel_genesis"`
ChannelGenesis channeltypes.GenesisState `json:"channel_genesis" yaml:"channel_genesis"`
}
// DefaultGenesisState returns the ibc module's default genesis state.
@ -18,7 +18,7 @@ func DefaultGenesisState() GenesisState {
return GenesisState{
ClientGenesis: clienttypes.DefaultGenesisState(),
ConnectionGenesis: connectiontypes.DefaultGenesisState(),
ChannelGenesis: channel.DefaultGenesisState(),
ChannelGenesis: channeltypes.DefaultGenesisState(),
}
}