x/ibc: remove alias.go from 03-connection (#6543)

This commit is contained in:
colin axner 2020-06-30 15:10:53 +02:00 committed by GitHub
parent 43b4f2f120
commit e8fb76ae44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 120 additions and 197 deletions

View File

@ -6,7 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types" "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
) )
@ -26,7 +26,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
func() { func() {
suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, testCoins) suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, testCoins)
suite.chainA.CreateClient(suite.chainB) suite.chainA.CreateClient(suite.chainB)
suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connection.OPEN) suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectiontypes.OPEN)
suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection) suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection)
suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
}, true, true}, }, true, true},
@ -36,7 +36,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
_, err := suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, prefixCoins) _, err := suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, prefixCoins)
suite.Require().NoError(err) suite.Require().NoError(err)
suite.chainA.CreateClient(suite.chainB) suite.chainA.CreateClient(suite.chainB)
suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connection.OPEN) suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectiontypes.OPEN)
suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection) suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection)
suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
}, false, true}, }, false, true},
@ -45,7 +45,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
{"next seq send not found", testCoins, {"next seq send not found", testCoins,
func() { func() {
suite.chainA.CreateClient(suite.chainB) suite.chainA.CreateClient(suite.chainB)
suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connection.OPEN) suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectiontypes.OPEN)
suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection) suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection)
}, true, false}, }, true, false},
// createOutgoingPacket tests // createOutgoingPacket tests
@ -53,7 +53,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
{"send coins failed", testCoins, {"send coins failed", testCoins,
func() { func() {
suite.chainA.CreateClient(suite.chainB) suite.chainA.CreateClient(suite.chainB)
suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connection.OPEN) suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectiontypes.OPEN)
suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection) suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection)
suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
}, true, false}, }, true, false},
@ -61,7 +61,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
{"send from module account failed", testCoins, {"send from module account failed", testCoins,
func() { func() {
suite.chainA.CreateClient(suite.chainB) suite.chainA.CreateClient(suite.chainB)
suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connection.OPEN) suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectiontypes.OPEN)
suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection) suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection)
suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
}, false, false}, }, false, false},
@ -69,7 +69,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
func() { func() {
suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, testCoins) suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, testCoins)
suite.chainA.CreateClient(suite.chainB) suite.chainA.CreateClient(suite.chainB)
suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connection.OPEN) suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectiontypes.OPEN)
suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection) suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channeltypes.OPEN, channeltypes.ORDERED, testConnection)
suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
// Release channel capability // Release channel capability

View File

@ -5,7 +5,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
) )
@ -41,7 +41,7 @@ type ClientKeeper interface {
// ConnectionKeeper defines the expected IBC connection keeper // ConnectionKeeper defines the expected IBC connection keeper
type ConnectionKeeper interface { type ConnectionKeeper interface {
GetConnection(ctx sdk.Context, connectionID string) (connection connection.End, found bool) GetConnection(ctx sdk.Context, connectionID string) (connection connectiontypes.ConnectionEnd, found bool)
} }
// PortKeeper defines the expected IBC port keeper // PortKeeper defines the expected IBC port keeper

View File

@ -1,83 +0,0 @@
package connection
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types
import (
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
)
const (
AttributeKeyConnectionID = types.AttributeKeyConnectionID
AttributeKeyCounterpartyClientID = types.AttributeKeyCounterpartyClientID
SubModuleName = types.SubModuleName
StoreKey = types.StoreKey
RouterKey = types.RouterKey
QuerierRoute = types.QuerierRoute
QueryAllConnections = types.QueryAllConnections
QueryAllClientConnections = types.QueryAllClientConnections
QueryClientConnections = types.QueryClientConnections
UNINITIALIZED = types.UNINITIALIZED
INIT = types.INIT
TRYOPEN = types.TRYOPEN
OPEN = types.OPEN
)
var (
// functions aliases
NewKeeper = keeper.NewKeeper
QuerierConnections = keeper.QuerierConnections
QuerierClientConnections = keeper.QuerierClientConnections
QuerierAllClientConnections = keeper.QuerierAllClientConnections
RegisterCodec = types.RegisterCodec
RegisterInterfaces = types.RegisterInterfaces
NewConnectionEnd = types.NewConnectionEnd
NewCounterparty = types.NewCounterparty
ErrConnectionExists = types.ErrConnectionExists
ErrConnectionNotFound = types.ErrConnectionNotFound
ErrClientConnectionPathsNotFound = types.ErrClientConnectionPathsNotFound
ErrConnectionPath = types.ErrConnectionPath
ErrInvalidConnectionState = types.ErrInvalidConnectionState
ErrInvalidCounterparty = types.ErrInvalidCounterparty
NewMsgConnectionOpenInit = types.NewMsgConnectionOpenInit
NewMsgConnectionOpenTry = types.NewMsgConnectionOpenTry
NewMsgConnectionOpenAck = types.NewMsgConnectionOpenAck
NewMsgConnectionOpenConfirm = types.NewMsgConnectionOpenConfirm
NewConnectionResponse = types.NewConnectionResponse
NewClientConnectionsResponse = types.NewClientConnectionsResponse
NewQueryClientConnectionsParams = types.NewQueryClientConnectionsParams
GetCompatibleVersions = types.GetCompatibleVersions
LatestVersion = types.LatestVersion
PickVersion = types.PickVersion
NewConnectionPaths = types.NewConnectionPaths
DefaultGenesisState = types.DefaultGenesisState
NewGenesisState = types.NewGenesisState
// variable aliases
SubModuleCdc = types.SubModuleCdc
EventTypeConnectionOpenInit = types.EventTypeConnectionOpenInit
EventTypeConnectionOpenTry = types.EventTypeConnectionOpenTry
EventTypeConnectionOpenAck = types.EventTypeConnectionOpenAck
EventTypeConnectionOpenConfirm = types.EventTypeConnectionOpenConfirm
AttributeValueCategory = types.AttributeValueCategory
)
type (
Keeper = keeper.Keeper
End = types.ConnectionEnd
State = types.State
Counterparty = types.Counterparty
ClientKeeper = types.ClientKeeper
MsgConnectionOpenInit = types.MsgConnectionOpenInit
MsgConnectionOpenTry = types.MsgConnectionOpenTry
MsgConnectionOpenAck = types.MsgConnectionOpenAck
MsgConnectionOpenConfirm = types.MsgConnectionOpenConfirm
Response = types.ConnectionResponse
ClientConnectionsResponse = types.ClientConnectionsResponse
QueryClientConnectionsParams = types.QueryClientConnectionsParams
GenesisState = types.GenesisState
Paths = types.ConnectionPaths
)

View File

@ -2,11 +2,13 @@ package connection
import ( import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
) )
// InitGenesis initializes the ibc connection submodule's state from a provided genesis // InitGenesis initializes the ibc connection submodule's state from a provided genesis
// state. // state.
func InitGenesis(ctx sdk.Context, k Keeper, gs GenesisState) { func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
for _, connection := range gs.Connections { for _, connection := range gs.Connections {
k.SetConnection(ctx, connection.ID, connection) k.SetConnection(ctx, connection.ID, connection)
} }
@ -16,8 +18,8 @@ func InitGenesis(ctx sdk.Context, k Keeper, gs GenesisState) {
} }
// ExportGenesis returns the ibc connection submodule's exported genesis. // ExportGenesis returns the ibc connection submodule's exported genesis.
func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState { func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
return GenesisState{ return types.GenesisState{
Connections: k.GetAllConnections(ctx), Connections: k.GetAllConnections(ctx),
ClientConnectionPaths: k.GetAllClientConnectionPaths(ctx), ClientConnectionPaths: k.GetAllClientConnectionPaths(ctx),
} }

View File

@ -2,11 +2,12 @@ package connection
import ( import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
) )
// HandleMsgConnectionOpenInit defines the sdk.Handler for MsgConnectionOpenInit // HandleMsgConnectionOpenInit defines the sdk.Handler for MsgConnectionOpenInit
func HandleMsgConnectionOpenInit(ctx sdk.Context, k Keeper, msg *MsgConnectionOpenInit) (*sdk.Result, error) { func HandleMsgConnectionOpenInit(ctx sdk.Context, k keeper.Keeper, msg *types.MsgConnectionOpenInit) (*sdk.Result, error) {
if err := k.ConnOpenInit( if err := k.ConnOpenInit(
ctx, msg.ConnectionID, msg.ClientID, msg.Counterparty, ctx, msg.ConnectionID, msg.ClientID, msg.Counterparty,
); err != nil { ); err != nil {
@ -22,7 +23,7 @@ func HandleMsgConnectionOpenInit(ctx sdk.Context, k Keeper, msg *MsgConnectionOp
), ),
sdk.NewEvent( sdk.NewEvent(
sdk.EventTypeMessage, sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory), sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
), ),
}) })
@ -32,7 +33,7 @@ func HandleMsgConnectionOpenInit(ctx sdk.Context, k Keeper, msg *MsgConnectionOp
} }
// HandleMsgConnectionOpenTry defines the sdk.Handler for MsgConnectionOpenTry // HandleMsgConnectionOpenTry defines the sdk.Handler for MsgConnectionOpenTry
func HandleMsgConnectionOpenTry(ctx sdk.Context, k Keeper, msg *MsgConnectionOpenTry) (*sdk.Result, error) { func HandleMsgConnectionOpenTry(ctx sdk.Context, k keeper.Keeper, msg *types.MsgConnectionOpenTry) (*sdk.Result, error) {
if err := k.ConnOpenTry( if err := k.ConnOpenTry(
ctx, msg.ConnectionID, msg.Counterparty, msg.ClientID, ctx, msg.ConnectionID, msg.Counterparty, msg.ClientID,
msg.CounterpartyVersions, msg.ProofInit, msg.ProofConsensus, msg.CounterpartyVersions, msg.ProofInit, msg.ProofConsensus,
@ -50,7 +51,7 @@ func HandleMsgConnectionOpenTry(ctx sdk.Context, k Keeper, msg *MsgConnectionOpe
), ),
sdk.NewEvent( sdk.NewEvent(
sdk.EventTypeMessage, sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory), sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
), ),
}) })
@ -60,7 +61,7 @@ func HandleMsgConnectionOpenTry(ctx sdk.Context, k Keeper, msg *MsgConnectionOpe
} }
// HandleMsgConnectionOpenAck defines the sdk.Handler for MsgConnectionOpenAck // HandleMsgConnectionOpenAck defines the sdk.Handler for MsgConnectionOpenAck
func HandleMsgConnectionOpenAck(ctx sdk.Context, k Keeper, msg *MsgConnectionOpenAck) (*sdk.Result, error) { func HandleMsgConnectionOpenAck(ctx sdk.Context, k keeper.Keeper, msg *types.MsgConnectionOpenAck) (*sdk.Result, error) {
if err := k.ConnOpenAck( if err := k.ConnOpenAck(
ctx, msg.ConnectionID, msg.Version, msg.ProofTry, msg.ProofConsensus, ctx, msg.ConnectionID, msg.Version, msg.ProofTry, msg.ProofConsensus,
msg.ProofHeight, msg.ConsensusHeight, msg.ProofHeight, msg.ConsensusHeight,
@ -70,12 +71,12 @@ func HandleMsgConnectionOpenAck(ctx sdk.Context, k Keeper, msg *MsgConnectionOpe
ctx.EventManager().EmitEvents(sdk.Events{ ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent( sdk.NewEvent(
EventTypeConnectionOpenAck, types.EventTypeConnectionOpenAck,
sdk.NewAttribute(AttributeKeyConnectionID, msg.ConnectionID), sdk.NewAttribute(types.AttributeKeyConnectionID, msg.ConnectionID),
), ),
sdk.NewEvent( sdk.NewEvent(
sdk.EventTypeMessage, sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory), sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
), ),
}) })
@ -85,7 +86,7 @@ func HandleMsgConnectionOpenAck(ctx sdk.Context, k Keeper, msg *MsgConnectionOpe
} }
// HandleMsgConnectionOpenConfirm defines the sdk.Handler for MsgConnectionOpenConfirm // HandleMsgConnectionOpenConfirm defines the sdk.Handler for MsgConnectionOpenConfirm
func HandleMsgConnectionOpenConfirm(ctx sdk.Context, k Keeper, msg *MsgConnectionOpenConfirm) (*sdk.Result, error) { func HandleMsgConnectionOpenConfirm(ctx sdk.Context, k keeper.Keeper, msg *types.MsgConnectionOpenConfirm) (*sdk.Result, error) {
if err := k.ConnOpenConfirm( if err := k.ConnOpenConfirm(
ctx, msg.ConnectionID, msg.ProofAck, msg.ProofHeight, ctx, msg.ConnectionID, msg.ProofAck, msg.ProofHeight,
); err != nil { ); err != nil {
@ -94,12 +95,12 @@ func HandleMsgConnectionOpenConfirm(ctx sdk.Context, k Keeper, msg *MsgConnectio
ctx.EventManager().EmitEvents(sdk.Events{ ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent( sdk.NewEvent(
EventTypeConnectionOpenConfirm, types.EventTypeConnectionOpenConfirm,
sdk.NewAttribute(AttributeKeyConnectionID, msg.ConnectionID), sdk.NewAttribute(types.AttributeKeyConnectionID, msg.ConnectionID),
), ),
sdk.NewEvent( sdk.NewEvent(
sdk.EventTypeMessage, sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory), sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
), ),
}) })

View File

@ -3,8 +3,8 @@ package keeper_test
import ( import (
"fmt" "fmt"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
) )
@ -26,7 +26,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
{"couldn't add connection to client", func() {}, false}, {"couldn't add connection to client", func() {}, false},
} }
counterparty := connection.NewCounterparty(testClientIDB, testConnectionIDB, commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) counterparty := connectiontypes.NewCounterparty(testClientIDB, testConnectionIDB, commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes()))
for i, tc := range testCases { for i, tc := range testCases {
tc := tc tc := tc
@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
// connection on Chain A (ID #1) is INIT // connection on Chain A (ID #1) is INIT
func (suite *KeeperTestSuite) TestConnOpenTry() { func (suite *KeeperTestSuite) TestConnOpenTry() {
// counterparty for A on B // counterparty for A on B
counterparty := connection.NewCounterparty( counterparty := connectiontypes.NewCounterparty(
testClientIDB, testConnectionIDA, commitmenttypes.NewMerklePrefix(suite.chainB.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes()), testClientIDB, testConnectionIDA, commitmenttypes.NewMerklePrefix(suite.chainB.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes()),
) )
@ -124,7 +124,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
err := suite.chainB.App.IBCKeeper.ConnectionKeeper.ConnOpenTry( err := suite.chainB.App.IBCKeeper.ConnectionKeeper.ConnOpenTry(
suite.chainB.GetContext(), testConnectionIDB, counterparty, testClientIDA, suite.chainB.GetContext(), testConnectionIDB, counterparty, testClientIDA,
connection.GetCompatibleVersions(), proofInit, proofConsensus, connectiontypes.GetCompatibleVersions(), proofInit, proofConsensus,
proofHeight+1, consensusHeight, proofHeight+1, consensusHeight,
) )
@ -140,7 +140,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
// TestConnOpenAck - Chain A (ID #1) calls TestConnOpenAck to acknowledge (ACK state) // TestConnOpenAck - Chain A (ID #1) calls TestConnOpenAck to acknowledge (ACK state)
// the initialization (TRYINIT) of the connection on Chain B (ID #2). // the initialization (TRYINIT) of the connection on Chain B (ID #2).
func (suite *KeeperTestSuite) TestConnOpenAck() { func (suite *KeeperTestSuite) TestConnOpenAck() {
version := connection.GetCompatibleVersions()[0] version := connectiontypes.GetCompatibleVersions()[0]
testCases := []struct { testCases := []struct {
msg string msg string

View File

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

View File

@ -6,7 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
@ -49,12 +49,12 @@ func (k Keeper) ChanOpenInit(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, connectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, connectionHops[0])
if !found { if !found {
return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, connectionHops[0]) return nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0])
} }
if connectionEnd.GetState() == int32(connection.UNINITIALIZED) { if connectionEnd.GetState() == int32(connectiontypes.UNINITIALIZED) {
return nil, sdkerrors.Wrap( return nil, sdkerrors.Wrap(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection state cannot be UNINITIALIZED", "connection state cannot be UNINITIALIZED",
) )
} }
@ -111,13 +111,13 @@ func (k Keeper) ChanOpenTry(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, connectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, connectionHops[0])
if !found { if !found {
return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, connectionHops[0]) return nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0])
} }
if connectionEnd.GetState() != int32(connection.OPEN) { if connectionEnd.GetState() != int32(connectiontypes.OPEN) {
return nil, sdkerrors.Wrapf( return nil, sdkerrors.Wrapf(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection state is not OPEN (got %s)", connection.State(connectionEnd.GetState()).String(), "connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(),
) )
} }
@ -190,13 +190,13 @@ func (k Keeper) ChanOpenAck(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) return sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
} }
if connectionEnd.GetState() != int32(connection.OPEN) { if connectionEnd.GetState() != int32(connectiontypes.OPEN) {
return sdkerrors.Wrapf( return sdkerrors.Wrapf(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection state is not OPEN (got %s)", connection.State(connectionEnd.GetState()).String(), "connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(),
) )
} }
@ -257,13 +257,13 @@ func (k Keeper) ChanOpenConfirm(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) return sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
} }
if connectionEnd.GetState() != int32(connection.OPEN) { if connectionEnd.GetState() != int32(connectiontypes.OPEN) {
return sdkerrors.Wrapf( return sdkerrors.Wrapf(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection state is not OPEN (got %s)", connection.State(connectionEnd.GetState()).String(), "connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(),
) )
} }
@ -322,13 +322,13 @@ func (k Keeper) ChanCloseInit(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) return sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
} }
if connectionEnd.GetState() != int32(connection.OPEN) { if connectionEnd.GetState() != int32(connectiontypes.OPEN) {
return sdkerrors.Wrapf( return sdkerrors.Wrapf(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection state is not OPEN (got %s)", connection.State(connectionEnd.GetState()).String(), "connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(),
) )
} }
@ -365,13 +365,13 @@ func (k Keeper) ChanCloseConfirm(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) return sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
} }
if connectionEnd.GetState() != int32(connection.OPEN) { if connectionEnd.GetState() != int32(connectiontypes.OPEN) {
return sdkerrors.Wrapf( return sdkerrors.Wrapf(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection state is not OPEN (got %s)", connection.State(connectionEnd.GetState()).String(), "connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(),
) )
} }

View File

@ -9,7 +9,7 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
@ -59,13 +59,13 @@ func (k Keeper) SendPacket(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) return sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
} }
// NOTE: assume UNINITIALIZED is a closed connection // NOTE: assume UNINITIALIZED is a closed connection
if connectionEnd.GetState() == int32(connection.UNINITIALIZED) { if connectionEnd.GetState() == int32(connectiontypes.UNINITIALIZED) {
return sdkerrors.Wrap( return sdkerrors.Wrap(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection is UNINITIALIZED", "connection is UNINITIALIZED",
) )
} }
@ -175,13 +175,13 @@ func (k Keeper) RecvPacket(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) return nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
} }
if connectionEnd.GetState() != int32(connection.OPEN) { if connectionEnd.GetState() != int32(connectiontypes.OPEN) {
return nil, sdkerrors.Wrapf( return nil, sdkerrors.Wrapf(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection state is not OPEN (got %s)", connection.State(connectionEnd.GetState()).String(), "connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(),
) )
} }
@ -356,13 +356,13 @@ func (k Keeper) AcknowledgePacket(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) return nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
} }
if connectionEnd.GetState() != int32(connection.OPEN) { if connectionEnd.GetState() != int32(connectiontypes.OPEN) {
return nil, sdkerrors.Wrapf( return nil, sdkerrors.Wrapf(
connection.ErrInvalidConnectionState, connectiontypes.ErrInvalidConnectionState,
"connection state is not OPEN (got %s)", connection.State(connectionEnd.GetState()).String(), "connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(),
) )
} }

View File

@ -7,7 +7,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
@ -61,7 +61,7 @@ func (k Keeper) TimeoutPacket(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return nil, sdkerrors.Wrap( return nil, sdkerrors.Wrap(
connection.ErrConnectionNotFound, connectiontypes.ErrConnectionNotFound,
channel.ConnectionHops[0], channel.ConnectionHops[0],
) )
} }
@ -202,7 +202,7 @@ func (k Keeper) TimeoutOnClose(
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found { if !found {
return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) return nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
} }
commitment := k.GetPacketCommitment(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) commitment := k.GetPacketCommitment(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence())

View File

@ -5,7 +5,7 @@ import (
tmmath "github.com/tendermint/tendermint/libs/math" tmmath "github.com/tendermint/tendermint/libs/math"
lite "github.com/tendermint/tendermint/lite2" lite "github.com/tendermint/tendermint/lite2"
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" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
@ -163,13 +163,13 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() {
} }
func (suite *TendermintTestSuite) TestVerifyConnectionState() { func (suite *TendermintTestSuite) TestVerifyConnectionState() {
counterparty := connection.NewCounterparty("clientB", testConnectionID, commitmenttypes.NewMerklePrefix([]byte("ibc"))) counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, commitmenttypes.NewMerklePrefix([]byte("ibc")))
conn := connection.NewConnectionEnd(connection.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"}) conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"})
testCases := []struct { testCases := []struct {
name string name string
clientState ibctmtypes.ClientState clientState ibctmtypes.ClientState
connection connection.End connection connectiontypes.ConnectionEnd
consensusState ibctmtypes.ConsensusState consensusState ibctmtypes.ConsensusState
prefix commitmenttypes.MerklePrefix prefix commitmenttypes.MerklePrefix
proof []byte proof []byte

View File

@ -1,7 +1,7 @@
package types_test package types_test
import ( 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" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
"github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types" "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
@ -86,13 +86,13 @@ func (suite *LocalhostTestSuite) TestVerifyClientConsensusState() {
} }
func (suite *LocalhostTestSuite) TestVerifyConnectionState() { func (suite *LocalhostTestSuite) TestVerifyConnectionState() {
counterparty := connection.NewCounterparty("clientB", testConnectionID, commitmenttypes.NewMerklePrefix([]byte("ibc"))) counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, commitmenttypes.NewMerklePrefix([]byte("ibc")))
conn := connection.NewConnectionEnd(connection.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"}) conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"})
testCases := []struct { testCases := []struct {
name string name string
clientState types.ClientState clientState types.ClientState
connection connection.End connection connectiontypes.ConnectionEnd
prefix commitmenttypes.MerklePrefix prefix commitmenttypes.MerklePrefix
proof []byte proof []byte
expPass bool expPass bool

View File

@ -5,7 +5,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
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" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types" localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
@ -45,12 +45,12 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
}, },
true, true,
), ),
ConnectionGenesis: connection.NewGenesisState( ConnectionGenesis: connectiontypes.NewGenesisState(
[]connection.End{ []connectiontypes.ConnectionEnd{
connection.NewConnectionEnd(connection.INIT, connectionID, clientID, connection.NewCounterparty(clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}), connectiontypes.NewConnectionEnd(connectiontypes.INIT, connectionID, clientID, connectiontypes.NewCounterparty(clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}),
}, },
[]connection.Paths{ []connectiontypes.ConnectionPaths{
connection.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}), connectiontypes.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}),
}, },
), ),
ChannelGenesis: channel.NewGenesisState( ChannelGenesis: channel.NewGenesisState(
@ -92,7 +92,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
nil, nil,
false, false,
), ),
ConnectionGenesis: connection.DefaultGenesisState(), ConnectionGenesis: connectiontypes.DefaultGenesisState(),
}, },
expPass: false, expPass: false,
}, },
@ -100,12 +100,12 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
name: "invalid connection genesis", name: "invalid connection genesis",
genState: types.GenesisState{ genState: types.GenesisState{
ClientGenesis: clienttypes.DefaultGenesisState(), ClientGenesis: clienttypes.DefaultGenesisState(),
ConnectionGenesis: connection.NewGenesisState( ConnectionGenesis: connectiontypes.NewGenesisState(
[]connection.End{ []connectiontypes.ConnectionEnd{
connection.NewConnectionEnd(connection.INIT, connectionID, "(CLIENTIDONE)", connection.NewCounterparty(clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}), connectiontypes.NewConnectionEnd(connectiontypes.INIT, connectionID, "(CLIENTIDONE)", connectiontypes.NewCounterparty(clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}),
}, },
[]connection.Paths{ []connectiontypes.ConnectionPaths{
connection.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}), connectiontypes.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}),
}, },
), ),
}, },
@ -115,7 +115,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
name: "invalid channel genesis", name: "invalid channel genesis",
genState: types.GenesisState{ genState: types.GenesisState{
ClientGenesis: clienttypes.DefaultGenesisState(), ClientGenesis: clienttypes.DefaultGenesisState(),
ConnectionGenesis: connection.DefaultGenesisState(), ConnectionGenesis: connectiontypes.DefaultGenesisState(),
ChannelGenesis: channel.GenesisState{ ChannelGenesis: channel.GenesisState{
Acknowledgements: []channel.PacketAckCommitment{ Acknowledgements: []channel.PacketAckCommitment{
channel.NewPacketAckCommitment("(portID)", channel1, 1, []byte("ack")), channel.NewPacketAckCommitment("(portID)", channel1, 1, []byte("ack")),

View File

@ -6,6 +6,7 @@ import (
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client" client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" 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" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port" port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
"github.com/cosmos/cosmos-sdk/x/ibc/keeper" "github.com/cosmos/cosmos-sdk/x/ibc/keeper"
@ -25,16 +26,16 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return &sdk.Result{}, nil return &sdk.Result{}, nil
// IBC connection msgs // IBC connection msgs
case *connection.MsgConnectionOpenInit: case *connectiontypes.MsgConnectionOpenInit:
return connection.HandleMsgConnectionOpenInit(ctx, k.ConnectionKeeper, msg) return connection.HandleMsgConnectionOpenInit(ctx, k.ConnectionKeeper, msg)
case *connection.MsgConnectionOpenTry: case *connectiontypes.MsgConnectionOpenTry:
return connection.HandleMsgConnectionOpenTry(ctx, k.ConnectionKeeper, msg) return connection.HandleMsgConnectionOpenTry(ctx, k.ConnectionKeeper, msg)
case *connection.MsgConnectionOpenAck: case *connectiontypes.MsgConnectionOpenAck:
return connection.HandleMsgConnectionOpenAck(ctx, k.ConnectionKeeper, msg) return connection.HandleMsgConnectionOpenAck(ctx, k.ConnectionKeeper, msg)
case *connection.MsgConnectionOpenConfirm: case *connectiontypes.MsgConnectionOpenConfirm:
return connection.HandleMsgConnectionOpenConfirm(ctx, k.ConnectionKeeper, msg) return connection.HandleMsgConnectionOpenConfirm(ctx, k.ConnectionKeeper, msg)
// IBC channel msgs // IBC channel msgs

View File

@ -6,7 +6,7 @@ import (
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper" clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" connectionkeeper "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port" port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
) )
@ -17,7 +17,7 @@ type Keeper struct {
cdc codec.Marshaler cdc codec.Marshaler
ClientKeeper clientkeeper.Keeper ClientKeeper clientkeeper.Keeper
ConnectionKeeper connection.Keeper ConnectionKeeper connectionkeeper.Keeper
ChannelKeeper channel.Keeper ChannelKeeper channel.Keeper
PortKeeper port.Keeper PortKeeper port.Keeper
Router *port.Router Router *port.Router
@ -28,7 +28,7 @@ func NewKeeper(
aminoCdc *codec.Codec, cdc codec.Marshaler, key sdk.StoreKey, stakingKeeper clienttypes.StakingKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, aminoCdc *codec.Codec, cdc codec.Marshaler, key sdk.StoreKey, stakingKeeper clienttypes.StakingKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
) *Keeper { ) *Keeper {
clientKeeper := clientkeeper.NewKeeper(aminoCdc, key, stakingKeeper) clientKeeper := clientkeeper.NewKeeper(aminoCdc, key, stakingKeeper)
connectionKeeper := connection.NewKeeper(aminoCdc, cdc, key, clientKeeper) connectionKeeper := connectionkeeper.NewKeeper(aminoCdc, cdc, key, clientKeeper)
portKeeper := port.NewKeeper(scopedKeeper) portKeeper := port.NewKeeper(scopedKeeper)
channelKeeper := channel.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper) channelKeeper := channel.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper)

View File

@ -7,7 +7,8 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper" clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" connectionkeeper "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper" channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
) )
@ -28,16 +29,16 @@ func NewQuerier(k Keeper) sdk.Querier {
default: default:
err = sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown IBC %s query endpoint", clienttypes.SubModuleName) err = sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown IBC %s query endpoint", clienttypes.SubModuleName)
} }
case connection.SubModuleName: case connectiontypes.SubModuleName:
switch path[1] { switch path[1] {
case connection.QueryAllConnections: case connectiontypes.QueryAllConnections:
res, err = connection.QuerierConnections(ctx, req, k.ConnectionKeeper) res, err = connectionkeeper.QuerierConnections(ctx, req, k.ConnectionKeeper)
case connection.QueryAllClientConnections: case connectiontypes.QueryAllClientConnections:
res, err = connection.QuerierAllClientConnections(ctx, req, k.ConnectionKeeper) res, err = connectionkeeper.QuerierAllClientConnections(ctx, req, k.ConnectionKeeper)
case connection.QueryClientConnections: case connectiontypes.QueryClientConnections:
res, err = connection.QuerierClientConnections(ctx, req, k.ConnectionKeeper) res, err = connectionkeeper.QuerierClientConnections(ctx, req, k.ConnectionKeeper)
default: default:
err = sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown IBC %s query endpoint", connection.SubModuleName) err = sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown IBC %s query endpoint", connectiontypes.SubModuleName)
} }
case channeltypes.SubModuleName: case channeltypes.SubModuleName:
switch path[1] { switch path[1] {

View File

@ -4,7 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types" cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
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" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types" localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
@ -15,7 +15,7 @@ import (
// on the provided Amino codec. These types are used for Amino JSON serialization. // on the provided Amino codec. These types are used for Amino JSON serialization.
func RegisterCodec(cdc *codec.Codec) { func RegisterCodec(cdc *codec.Codec) {
clienttypes.RegisterCodec(cdc) clienttypes.RegisterCodec(cdc)
connection.RegisterCodec(cdc) connectiontypes.RegisterCodec(cdc)
channel.RegisterCodec(cdc) channel.RegisterCodec(cdc)
ibctmtypes.RegisterCodec(cdc) ibctmtypes.RegisterCodec(cdc)
localhosttypes.RegisterCodec(cdc) localhosttypes.RegisterCodec(cdc)
@ -24,6 +24,6 @@ func RegisterCodec(cdc *codec.Codec) {
// RegisterInterfaces registers x/ibc interfaces into protobuf Any. // RegisterInterfaces registers x/ibc interfaces into protobuf Any.
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
connection.RegisterInterfaces(registry) connectiontypes.RegisterInterfaces(registry)
channel.RegisterInterfaces(registry) channel.RegisterInterfaces(registry)
} }

View File

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