Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove alias.go from 03-connection #6543

Merged
merged 1 commit into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions x/ibc-transfer/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/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"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)
Expand All @@ -26,7 +26,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
func() {
suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, testCoins)
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.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
}, true, true},
Expand All @@ -36,7 +36,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
_, err := suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, prefixCoins)
suite.Require().NoError(err)
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.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
}, false, true},
Expand All @@ -45,31 +45,31 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
{"next seq send not found", testCoins,
func() {
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)
}, true, false},
// createOutgoingPacket tests
// - source chain
{"send coins failed", testCoins,
func() {
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.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
}, true, false},
// - receiving chain
{"send from module account failed", testCoins,
func() {
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.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
}, false, false},
{"channel capability not found", testCoins,
func() {
suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, testCoins)
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.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1)
// Release channel capability
Expand Down
4 changes: 2 additions & 2 deletions x/ibc-transfer/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/types"
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"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
)
Expand Down Expand Up @@ -41,7 +41,7 @@ type ClientKeeper interface {

// ConnectionKeeper defines the expected IBC connection keeper
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
Expand Down
83 changes: 0 additions & 83 deletions x/ibc/03-connection/alias.go

This file was deleted.

8 changes: 5 additions & 3 deletions x/ibc/03-connection/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package connection

import (
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
// 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 {
k.SetConnection(ctx, connection.ID, connection)
}
Expand All @@ -16,8 +18,8 @@ func InitGenesis(ctx sdk.Context, k Keeper, gs GenesisState) {
}

// ExportGenesis returns the ibc connection 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{
Connections: k.GetAllConnections(ctx),
ClientConnectionPaths: k.GetAllClientConnectionPaths(ctx),
}
Expand Down
25 changes: 13 additions & 12 deletions x/ibc/03-connection/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package connection

import (
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"
)

// 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(
ctx, msg.ConnectionID, msg.ClientID, msg.Counterparty,
); err != nil {
Expand All @@ -22,7 +23,7 @@ func HandleMsgConnectionOpenInit(ctx sdk.Context, k Keeper, msg *MsgConnectionOp
),
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
),
})

Expand All @@ -32,7 +33,7 @@ func HandleMsgConnectionOpenInit(ctx sdk.Context, k Keeper, msg *MsgConnectionOp
}

// 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(
ctx, msg.ConnectionID, msg.Counterparty, msg.ClientID,
msg.CounterpartyVersions, msg.ProofInit, msg.ProofConsensus,
Expand All @@ -50,7 +51,7 @@ func HandleMsgConnectionOpenTry(ctx sdk.Context, k Keeper, msg *MsgConnectionOpe
),
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
),
})

Expand All @@ -60,7 +61,7 @@ func HandleMsgConnectionOpenTry(ctx sdk.Context, k Keeper, msg *MsgConnectionOpe
}

// 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(
ctx, msg.ConnectionID, msg.Version, msg.ProofTry, msg.ProofConsensus,
msg.ProofHeight, msg.ConsensusHeight,
Expand All @@ -70,12 +71,12 @@ func HandleMsgConnectionOpenAck(ctx sdk.Context, k Keeper, msg *MsgConnectionOpe

ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
EventTypeConnectionOpenAck,
sdk.NewAttribute(AttributeKeyConnectionID, msg.ConnectionID),
types.EventTypeConnectionOpenAck,
sdk.NewAttribute(types.AttributeKeyConnectionID, msg.ConnectionID),
),
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
),
})

Expand All @@ -85,7 +86,7 @@ func HandleMsgConnectionOpenAck(ctx sdk.Context, k Keeper, msg *MsgConnectionOpe
}

// 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(
ctx, msg.ConnectionID, msg.ProofAck, msg.ProofHeight,
); err != nil {
Expand All @@ -94,12 +95,12 @@ func HandleMsgConnectionOpenConfirm(ctx sdk.Context, k Keeper, msg *MsgConnectio

ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
EventTypeConnectionOpenConfirm,
sdk.NewAttribute(AttributeKeyConnectionID, msg.ConnectionID),
types.EventTypeConnectionOpenConfirm,
sdk.NewAttribute(types.AttributeKeyConnectionID, msg.ConnectionID),
),
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
),
})

Expand Down
10 changes: 5 additions & 5 deletions x/ibc/03-connection/keeper/handshake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package keeper_test
import (
"fmt"

connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
"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"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)
Expand All @@ -26,7 +26,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
{"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 {
tc := tc
Expand All @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
// connection on Chain A (ID #1) is INIT
func (suite *KeeperTestSuite) TestConnOpenTry() {
// counterparty for A on B
counterparty := connection.NewCounterparty(
counterparty := connectiontypes.NewCounterparty(
testClientIDB, testConnectionIDA, commitmenttypes.NewMerklePrefix(suite.chainB.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes()),
)

Expand Down Expand Up @@ -124,7 +124,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {

err := suite.chainB.App.IBCKeeper.ConnectionKeeper.ConnOpenTry(
suite.chainB.GetContext(), testConnectionIDB, counterparty, testClientIDA,
connection.GetCompatibleVersions(), proofInit, proofConsensus,
connectiontypes.GetCompatibleVersions(), proofInit, proofConsensus,
proofHeight+1, consensusHeight,
)

Expand All @@ -140,7 +140,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
// TestConnOpenAck - Chain A (ID #1) calls TestConnOpenAck to acknowledge (ACK state)
// the initialization (TRYINIT) of the connection on Chain B (ID #2).
func (suite *KeeperTestSuite) TestConnOpenAck() {
version := connection.GetCompatibleVersions()[0]
version := connectiontypes.GetCompatibleVersions()[0]

testCases := []struct {
msg string
Expand Down
3 changes: 2 additions & 1 deletion x/ibc/03-connection/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"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/rest"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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.
Expand Down
Loading