move IBC exported files to one location to avoid circular deps (#7224)

* move exported files to one location to avoid circular deps

* gofmt

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
colin axnér 2020-09-02 18:38:50 +02:00 committed by GitHub
parent 4b2024cf30
commit 979e8144fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 440 additions and 472 deletions

View File

@ -7,8 +7,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
exported "github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -31,7 +31,7 @@ func (suite *HandlerTestSuite) SetupTest() {
// constructs a send from chainA to chainB on the established channel/connection
// and sends the same coin back from chainB to chainA.
func (suite *HandlerTestSuite) TestHandleMsgTransfer() {
clientA, clientB, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB := suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
originalBalance := suite.chainA.App.BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom)

View File

@ -14,9 +14,9 @@ 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"
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"
ibcexported "github.com/cosmos/cosmos-sdk/x/ibc/exported"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)
@ -75,7 +75,7 @@ func (k Keeper) GetTransferAccount(ctx sdk.Context) authtypes.ModuleAccountI {
// ReceiveExecuted defines a wrapper function for the channel Keeper's function
// in order to expose it to the ICS20 transfer handler.
// Keeper retrieves channel capability and passes it into channel keeper for authentication
func (k Keeper) ReceiveExecuted(ctx sdk.Context, packet channelexported.PacketI, acknowledgement []byte) error {
func (k Keeper) ReceiveExecuted(ctx sdk.Context, packet ibcexported.PacketI, acknowledgement []byte) error {
chanCap, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(packet.GetDestPort(), packet.GetDestChannel()))
if !ok {
return sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "channel capability could not be retrieved for packet")

View File

@ -4,10 +4,9 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"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"
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"
ibcexported "github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// AccountKeeper defines the contract required for account APIs.
@ -29,14 +28,14 @@ type BankKeeper interface {
type ChannelKeeper interface {
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet channelexported.PacketI) error
ReceiveExecuted(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet channelexported.PacketI, acknowledgement []byte) error
SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error
ReceiveExecuted(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, acknowledgement []byte) error
ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
}
// ClientKeeper defines the expected IBC client keeper
type ClientKeeper interface {
GetClientConsensusState(ctx sdk.Context, clientID string) (connection clientexported.ConsensusState, found bool)
GetClientConsensusState(ctx sdk.Context, clientID string) (connection ibcexported.ConsensusState, found bool)
}
// ConnectionKeeper defines the expected IBC connection keeper

View File

@ -2,8 +2,8 @@ package client
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// BeginBlocker updates an existing localhost client with the latest block height.

View File

@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/suite"
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)

View File

@ -2,10 +2,10 @@ package client
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// InitGenesis initializes the ibc client submodule's state from a provided genesis

View File

@ -5,8 +5,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// CreateClient creates a new client state and populates it with a given consensus

View File

@ -6,11 +6,11 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/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"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
const (

View File

@ -1,8 +1,8 @@
package keeper
import (
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// UnmarshalClientState attempts to decode and return an ClientState object from

View File

@ -12,9 +12,9 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ types.QueryServer = Keeper{}

View File

@ -8,10 +8,10 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
func (suite *KeeperTestSuite) TestQueryClientState() {

View File

@ -13,11 +13,11 @@ import (
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// Keeper represents a type that grants read and write permissions to any client

View File

@ -14,13 +14,12 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/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"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)
@ -142,7 +141,7 @@ func (suite *KeeperTestSuite) TestSetClientConsensusState() {
func (suite *KeeperTestSuite) TestValidateSelfClient() {
testCases := []struct {
name string
clientState clientexported.ClientState
clientState exported.ClientState
expPass bool
}{
{

View File

@ -5,9 +5,9 @@ import (
"fmt"
"github.com/cosmos/cosmos-sdk/types/kv"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ ClientUnmarshaler = (*keeper.Keeper)(nil)

View File

@ -9,11 +9,11 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/types/kv"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/simulation"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
func TestDecodeStore(t *testing.T) {

View File

@ -6,7 +6,7 @@ import (
proto "github.com/gogo/protobuf/proto"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ codectypes.UnpackInterfacesMessage = IdentifiedClientState{}

View File

@ -7,7 +7,7 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// RegisterInterfaces registers the client interfaces to protobuf Any.

View File

@ -3,15 +3,15 @@ package types_test
import (
"testing"
"github.com/stretchr/testify/require"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/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"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
"github.com/stretchr/testify/require"
)
type caseAny struct {

View File

@ -4,7 +4,7 @@ import (
"fmt"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// MustUnmarshalClientState attempts to decode and return an ClientState object from

View File

@ -5,8 +5,8 @@ import (
"sort"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var (

View File

@ -7,11 +7,11 @@ import (
"github.com/stretchr/testify/require"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/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"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)

View File

@ -3,7 +3,7 @@ package types
import (
"fmt"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ exported.Height = (*Height)(nil)

View File

@ -4,8 +4,8 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// message types for the IBC client

View File

@ -7,11 +7,11 @@ import (
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/suite"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/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"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
solomachinetypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)

View File

@ -12,11 +12,11 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
clientutils "github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/utils"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"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"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// QueryConnection returns a connection end.
@ -181,8 +181,8 @@ func QueryConnectionConsensusState(
// ParseClientState unmarshals a cmd input argument from a JSON string to a client state
// If the input is not a JSON, it looks for a path to the JSON file
func ParseClientState(cdc *codec.LegacyAmino, arg string) (clientexported.ClientState, error) {
var clientState clientexported.ClientState
func ParseClientState(cdc *codec.LegacyAmino, arg string) (exported.ClientState, error) {
var clientState exported.ClientState
if err := cdc.UnmarshalJSON([]byte(arg), &clientState); err != nil {
// check for file path if JSON input is not provided
contents, err := ioutil.ReadFile(arg)

View File

@ -5,10 +5,10 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -47,7 +47,7 @@ func (suite *KeeperTestSuite) TestQueryConnection() {
{
"success",
func() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
connB := suite.chainB.GetFirstTestConnection(clientB, clientA)
@ -111,11 +111,11 @@ func (suite *KeeperTestSuite) TestQueryConnections() {
{
"success",
func() {
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
connA1, connB1, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
clientA1, clientB1, connA2, connB2 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA1, clientB1, connA2, connB2 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
counterparty1 := types.NewCounterparty(clientB, connB0.ID, suite.chainB.GetPrefix())
counterparty2 := types.NewCounterparty(clientB, connB1.ID, suite.chainB.GetPrefix())
@ -197,7 +197,7 @@ func (suite *KeeperTestSuite) TestQueryClientConnections() {
{
"success",
func() {
clientA, clientB, connA0, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB, connA0, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
connA1, _ := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA, clientB)
expPaths = []string{connA0.ID, connA1.ID}
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetClientConnectionPaths(suite.chainA.GetContext(), clientA, expPaths)
@ -282,7 +282,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionClientState() {
{
"success",
func() {
clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
expClientState := suite.chainA.GetClientState(clientA)
expIdentifiedClientState = clienttypes.NewIdentifiedClientState(clientA, expClientState)
@ -318,7 +318,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionClientState() {
func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
var (
req *types.QueryConnectionConsensusStateRequest
expConsensusState clientexported.ConsensusState
expConsensusState exported.ConsensusState
expClientID string
)
@ -368,7 +368,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
{
"success",
func() {
clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
clientState := suite.chainA.GetClientState(clientA)
expConsensusState, _ = suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())

View File

@ -6,10 +6,10 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// ConnOpenInit initialises a connection attempt on chain A.
@ -49,7 +49,7 @@ func (k Keeper) ConnOpenTry(
connectionID string, // desiredIdentifier
counterparty types.Counterparty, // counterpartyConnectionIdentifier, counterpartyPrefix and counterpartyClientIdentifier
clientID string, // clientID of chainA
clientState clientexported.ClientState, // clientState that chainA has for chainB
clientState exported.ClientState, // clientState that chainA has for chainB
counterpartyVersions []string, // supported versions of chain A
proofInit []byte, // proof that chainA stored connectionEnd in state (on ConnOpenInit)
proofClient []byte, // proof that chainA stored a light client of chainB
@ -141,7 +141,7 @@ func (k Keeper) ConnOpenTry(
func (k Keeper) ConnOpenAck(
ctx sdk.Context,
connectionID string,
clientState clientexported.ClientState, // client state for chainA on chainB
clientState exported.ClientState, // client state for chainA on chainB
encodedVersion string, // version that ChainB chose in ConnOpenTry
proofTry []byte, // proof that connectionEnd was added to ChainB state in ConnOpenTry
proofClient []byte, // proof of client state on chainB for chainA

View File

@ -3,10 +3,10 @@ package keeper_test
import (
"time"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// TestConnOpenInit - chainA initializes (INIT state) a connection with
@ -23,14 +23,14 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
expPass bool
}{
{"success", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
}, true},
{"connection already exists", func() {
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
}, false},
{"couldn't add connection to client", func() {
// swap client identifiers to result in client that does not exist
clientB, clientA = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientB, clientA = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
}, false},
}
@ -64,7 +64,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
clientB string
versions []string
consensusHeight uint64
counterpartyClient clientexported.ClientState
counterpartyClient exported.ClientState
)
testCases := []struct {
@ -73,7 +73,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
expPass bool
}{
{"success", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -81,7 +81,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
counterpartyClient = suite.chainA.GetClientState(clientA)
}, true},
{"invalid counterparty client", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -96,7 +96,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), clientA, tmClient)
}, false},
{"consensus height >= latest height", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -106,7 +106,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
consensusHeight = uint64(suite.chainB.GetContext().BlockHeight())
}, false},
{"self consensus state not found", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -116,7 +116,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
consensusHeight = 1
}, false},
{"counterparty versions is empty", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -126,7 +126,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
versions = nil
}, false},
{"counterparty versions don't have a match", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -138,14 +138,14 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
versions = []string{version}
}, false},
{"connection state verification failed", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
// chainA connection not created
// retrieve client state of chainA to pass as counterpartyClient
counterpartyClient = suite.chainA.GetClientState(clientA)
}, false},
{"client state verification failed", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -158,7 +158,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
tmClient.LatestHeight = tmClient.LatestHeight.Increment()
}, false},
{"consensus state verification failed", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
// retrieve client state of chainA to pass as counterpartyClient
counterpartyClient = suite.chainA.GetClientState(clientA)
@ -177,7 +177,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
suite.Require().NoError(err)
}, false},
{"invalid previous connection is in TRYOPEN", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
// retrieve client state of chainA to pass as counterpartyClient
counterpartyClient = suite.chainA.GetClientState(clientA)
@ -246,7 +246,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
clientB string
consensusHeight uint64
version string
counterpartyClient clientexported.ClientState
counterpartyClient exported.ClientState
)
testCases := []struct {
@ -255,7 +255,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
expPass bool
}{
{"success", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -267,7 +267,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
}, true},
{"success from tryopen", func() {
// chainA is in TRYOPEN, chainB is in TRYOPEN
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
suite.Require().NoError(err)
@ -279,15 +279,15 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
connection.State = types.TRYOPEN
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
// update clientB so state change is committed
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
// retrieve client state of chainB to pass as counterpartyClient
counterpartyClient = suite.chainB.GetClientState(clientB)
}, true},
{"invalid counterparty client", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -305,7 +305,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
suite.Require().NoError(err)
}, false},
{"consensus height >= latest height", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -319,14 +319,14 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
}, false},
{"connection not found", func() {
// connections are never created
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
// retrieve client state of chainB to pass as counterpartyClient
counterpartyClient = suite.chainB.GetClientState(clientB)
}, false},
{"connection state is not INIT", func() {
// connection state is already OPEN on chainA
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -340,7 +340,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
suite.Require().NoError(err)
}, false},
{"incompatible IBC versions", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -354,7 +354,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
version = "(2.0,[])"
}, false},
{"empty version", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -367,7 +367,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
version = ""
}, false},
{"feature set verification failed - unsupported feature", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -381,7 +381,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
suite.Require().NoError(err)
}, false},
{"self consensus state not found", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -395,7 +395,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
}, false},
{"connection state verification failed", func() {
// chainB connection is not in INIT
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -403,7 +403,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
counterpartyClient = suite.chainB.GetClientState(clientB)
}, false},
{"client state verification failed", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -419,7 +419,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
suite.Require().NoError(err)
}, false},
{"consensus state verification failed", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -497,7 +497,7 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() {
expPass bool
}{
{"success", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -509,15 +509,15 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() {
}, true},
{"connection not found", func() {
// connections are never created
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
}, false},
{"chain B's connection state is not TRYOPEN", func() {
// connections are OPEN
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
}, false},
{"connection state verification failed", func() {
// chainA is in INIT
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)

View File

@ -8,12 +8,11 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// Keeper defines the IBC connection keeper
@ -42,7 +41,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
// GetCommitmentPrefix returns the IBC connection store prefix as a commitment
// Prefix
func (k Keeper) GetCommitmentPrefix() commitmentexported.Prefix {
func (k Keeper) GetCommitmentPrefix() exported.Prefix {
return commitmenttypes.NewMerklePrefix([]byte(k.storeKey.Name()))
}
@ -111,7 +110,7 @@ func (k Keeper) SetClientConnectionPaths(ctx sdk.Context, clientID string, paths
// no paths are stored.
func (k Keeper) GetAllClientConnectionPaths(ctx sdk.Context) []types.ConnectionPaths {
var allConnectionPaths []types.ConnectionPaths
k.clientKeeper.IterateClients(ctx, func(clientID string, cs clientexported.ClientState) bool {
k.clientKeeper.IterateClients(ctx, func(clientID string, cs exported.ClientState) bool {
paths, found := k.GetClientConnectionPaths(ctx, clientID)
if !found {
// continue when connection handshake is not initialized

View File

@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/suite"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -32,7 +32,7 @@ func TestKeeperTestSuite(t *testing.T) {
}
func (suite *KeeperTestSuite) TestSetAndGetConnection() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
_, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), connA.ID)
suite.Require().False(existed)
@ -43,7 +43,7 @@ func (suite *KeeperTestSuite) TestSetAndGetConnection() {
}
func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() {
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
_, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetClientConnectionPaths(suite.chainA.GetContext(), clientA)
suite.False(existed)
@ -55,7 +55,7 @@ func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() {
// create 2 connections: A0 - B0, A1 - B1
func (suite KeeperTestSuite) TestGetAllConnections() {
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
connA1, connB1 := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA, clientB)
counterpartyB0 := types.NewCounterparty(clientB, connB0.ID, suite.chainB.GetPrefix()) // connection B0
@ -77,8 +77,8 @@ func (suite KeeperTestSuite) TestGetAllConnections() {
// the test creates 2 clients clientA0 and clientA1. clientA0 has a single
// connection and clientA1 has 2 connections.
func (suite KeeperTestSuite) TestGetAllClientConnectionPaths() {
clientA0, _, connA0, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA1, clientB1, connA1, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA0, _, connA0, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
clientA1, clientB1, connA1, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
connA2, _ := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA1, clientB1)
expPaths := []types.ConnectionPaths{
@ -102,7 +102,7 @@ func (suite *KeeperTestSuite) TestGetTimestampAtHeight() {
expPass bool
}{
{"verification success", func() {
_, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
connection = suite.chainA.GetConnection(connA)
}, true},
{"consensus state not found", func() {

View File

@ -3,10 +3,8 @@ package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// VerifyClientState verifies a proof of a client state of the running machine
@ -16,7 +14,7 @@ func (k Keeper) VerifyClientState(
connection exported.ConnectionI,
height uint64,
proof []byte,
clientState clientexported.ClientState,
clientState exported.ClientState,
) error {
clientID := connection.GetClientID()
targetClient, found := k.clientKeeper.GetClientState(ctx, clientID)
@ -46,7 +44,7 @@ func (k Keeper) VerifyClientConsensusState(
height uint64,
consensusHeight uint64,
proof []byte,
consensusState clientexported.ConsensusState,
consensusState exported.ConsensusState,
) error {
clientID := connection.GetClientID()
clientState, found := k.clientKeeper.GetClientState(ctx, clientID)
@ -103,7 +101,7 @@ func (k Keeper) VerifyChannelState(
proof []byte,
portID,
channelID string,
channel channelexported.ChannelI,
channel exported.ChannelI,
) error {
clientState, found := k.clientKeeper.GetClientState(ctx, connection.GetClientID())
if !found {

View File

@ -4,11 +4,11 @@ import (
"fmt"
"time"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
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"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -34,7 +34,7 @@ func (suite *KeeperTestSuite) TestVerifyClientState() {
suite.Run(tc.msg, func() {
suite.SetupTest() // reset
_, clientB, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, clientB, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
counterpartyClient, clientProof := suite.chainB.QueryClientStateProof(clientB)
proofHeight := uint64(suite.chainB.GetContext().BlockHeight() - 1)
@ -79,20 +79,20 @@ func (suite *KeeperTestSuite) TestVerifyClientConsensusState() {
expPass bool
}{
{"verification success", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
}, true},
{"client state not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
changeClientID = true
}, false},
{"consensus state not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
heightDiff = 5
}, false},
{"verification failed", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
clientB := connB.ClientID
// give chainB wrong consensus state for chainA
@ -165,7 +165,7 @@ func (suite *KeeperTestSuite) TestVerifyConnectionState() {
suite.Run(tc.msg, func() {
suite.SetupTest() // reset
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
connection := suite.chainA.GetConnection(connA)
if tc.changeClientID {
@ -397,7 +397,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgementAbsence() {
} else {
// need to update height to prove absence
suite.coordinator.CommitBlock(suite.chainA, suite.chainB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}
packetAckKey := host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())

View File

@ -4,7 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// RegisterInterfaces register the ibc interfaces submodule implementations to protobuf
@ -15,15 +15,15 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
(*exported.ConnectionI)(nil),
)
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.connection.CounterpartyI",
(*exported.CounterpartyI)(nil),
"cosmos_sdk.ibc.v1.connection.CounterpartyConnectionI",
(*exported.CounterpartyConnectionI)(nil),
)
registry.RegisterImplementations(
(*exported.ConnectionI)(nil),
&ConnectionEnd{},
)
registry.RegisterImplementations(
(*exported.CounterpartyI)(nil),
(*exported.CounterpartyConnectionI)(nil),
&Counterparty{},
)
registry.RegisterImplementations(

View File

@ -2,10 +2,9 @@ package types
import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ exported.ConnectionI = (*ConnectionEnd)(nil)
@ -31,7 +30,7 @@ func (c ConnectionEnd) GetClientID() string {
}
// GetCounterparty implements the Connection interface
func (c ConnectionEnd) GetCounterparty() exported.CounterpartyI {
func (c ConnectionEnd) GetCounterparty() exported.CounterpartyConnectionI {
return c.Counterparty
}
@ -58,7 +57,7 @@ func (c ConnectionEnd) ValidateBasic() error {
return c.Counterparty.ValidateBasic()
}
var _ exported.CounterpartyI = (*Counterparty)(nil)
var _ exported.CounterpartyConnectionI = (*Counterparty)(nil)
// NewCounterparty creates a new Counterparty instance.
func NewCounterparty(clientID, connectionID string, prefix commitmenttypes.MerklePrefix) Counterparty {
@ -69,18 +68,18 @@ func NewCounterparty(clientID, connectionID string, prefix commitmenttypes.Merkl
}
}
// GetClientID implements the CounterpartyI interface
// GetClientID implements the CounterpartyConnectionI interface
func (c Counterparty) GetClientID() string {
return c.ClientId
}
// GetConnectionID implements the CounterpartyI interface
// GetConnectionID implements the CounterpartyConnectionI interface
func (c Counterparty) GetConnectionID() string {
return c.ConnectionId
}
// GetPrefix implements the CounterpartyI interface
func (c Counterparty) GetPrefix() commitmentexported.Prefix {
// GetPrefix implements the CounterpartyConnectionI interface
func (c Counterparty) GetPrefix() exported.Prefix {
return &c.Prefix
}

View File

@ -2,15 +2,15 @@ package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// ClientKeeper expected account IBC client keeper
type ClientKeeper interface {
GetClientState(ctx sdk.Context, clientID string) (clientexported.ClientState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (clientexported.ConsensusState, bool)
GetSelfConsensusState(ctx sdk.Context, height uint64) (clientexported.ConsensusState, bool)
ValidateSelfClient(ctx sdk.Context, clientState clientexported.ClientState) error
IterateClients(ctx sdk.Context, cb func(string, clientexported.ClientState) bool)
GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (exported.ConsensusState, bool)
GetSelfConsensusState(ctx sdk.Context, height uint64) (exported.ConsensusState, bool)
ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error
IterateClients(ctx sdk.Context, cb func(string, exported.ClientState) bool)
ClientStore(ctx sdk.Context, clientID string) sdk.KVStore
}

View File

@ -3,10 +3,10 @@ package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ sdk.Msg = &MsgConnectionOpenInit{}
@ -65,7 +65,7 @@ var _ sdk.Msg = &MsgConnectionOpenTry{}
// NewMsgConnectionOpenTry creates a new MsgConnectionOpenTry instance
func NewMsgConnectionOpenTry(
connectionID, clientID, counterpartyConnectionID,
counterpartyClientID string, counterpartyClient clientexported.ClientState,
counterpartyClientID string, counterpartyClient exported.ClientState,
counterpartyPrefix commitmenttypes.MerklePrefix, counterpartyVersions []string,
proofInit, proofClient, proofConsensus []byte,
proofHeight, consensusHeight uint64, signer sdk.AccAddress,
@ -158,7 +158,7 @@ var _ sdk.Msg = &MsgConnectionOpenAck{}
// NewMsgConnectionOpenAck creates a new MsgConnectionOpenAck instance
func NewMsgConnectionOpenAck(
connectionID string, counterpartyClient clientexported.ClientState,
connectionID string, counterpartyClient exported.ClientState,
proofTry, proofClient, proofConsensus []byte,
proofHeight, consensusHeight uint64, version string,
signer sdk.AccAddress,

View File

@ -9,10 +9,10 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
clientutils "github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/utils"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// QueryPacketCommitment returns a packet commitment.
@ -183,7 +183,7 @@ func QueryChannelConsensusState(
// counterparty ConsensusState given the source port ID and source channel ID.
func QueryCounterpartyConsensusState(
clientCtx client.Context, portID, channelID string, height uint64,
) (clientexported.ConsensusState, uint64, error) {
) (exported.ConsensusState, uint64, error) {
channelRes, err := QueryChannel(clientCtx, portID, channelID, false)
if err != nil {
return nil, 0, err

View File

@ -5,10 +5,10 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
clientexported "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"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) TestQueryChannel() {
{
"success",
func() {
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
// init channel
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -377,7 +377,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() {
{
"success",
func() {
clientA, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
// init channel
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -417,7 +417,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() {
func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
var (
req *types.QueryChannelConsensusStateRequest
expConsensusState clientexported.ConsensusState
expConsensusState exported.ConsensusState
expClientID string
)
@ -500,7 +500,7 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
{
"success",
func() {
clientA, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
// init channel
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)

View File

@ -4,10 +4,10 @@ import (
"fmt"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -31,7 +31,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
testCases := []testCase{
{"success", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"}
suite.chainA.CreatePortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
@ -57,12 +57,12 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
portCap = nil
}, false},
{"capability is incorrect", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"}
portCap = capabilitytypes.NewCapability(3)
}, false},
{"connection version not negotiated", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
// modify connA versions
conn := suite.chainA.GetConnection(connA)
@ -80,7 +80,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
}, false},
{"connection does not support ORDERED channels", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
// modify connA versions to only support UNORDERED channels
conn := suite.chainA.GetConnection(connA)
@ -158,14 +158,14 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
testCases := []testCase{
{"success", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
}, true},
{"previous channel with invalid state", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
// make previous channel have wrong ordering
suite.coordinator.ChanOpenInit(suite.chainB, suite.chainA, connB, connA, ibctesting.TransferPort, ibctesting.TransferPort, types.UNORDERED)
@ -180,7 +180,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
portCap = suite.chainB.GetPortCapability(connB.FirstOrNextTestChannel(ibctesting.TransferPort).PortID)
}, false},
{"connection is not OPEN", func() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
// pass capability check
suite.chainB.CreatePortCapability(connB.FirstOrNextTestChannel(ibctesting.TransferPort).PortID)
portCap = suite.chainB.GetPortCapability(connB.FirstOrNextTestChannel(ibctesting.TransferPort).PortID)
@ -190,7 +190,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
suite.Require().NoError(err)
}, false},
{"consensus state not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
@ -200,17 +200,17 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
}, false},
{"channel verification failed", func() {
// not creating a channel on chainA will result in an invalid proof of existence
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
}, false},
{"port capability not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
portCap = capabilitytypes.NewCapability(3)
}, false},
{"connection version not negotiated", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
// modify connB versions
@ -228,7 +228,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
}, false},
{"connection does not support ORDERED channels", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
// modify connA versions to only support UNORDERED channels
@ -296,7 +296,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
testCases := []testCase{
{"success", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -313,7 +313,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
{"connection not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -328,7 +328,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
}, false},
{"connection is not OPEN", func() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
var err error
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
@ -342,7 +342,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
{"consensus state not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -355,7 +355,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
}, false},
{"channel verification failed", func() {
// chainB is INIT, chainA in TRYOPEN
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelB, channelA, err := suite.coordinator.ChanOpenInit(suite.chainB, suite.chainA, connB, connA, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -365,7 +365,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
{"channel capability not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -415,7 +415,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
)
testCases := []testCase{
{"success", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -435,7 +435,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
}, false},
{"connection not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -453,7 +453,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainB.GetContext(), channelB.PortID, channelB.ID, channel)
}, false},
{"connection is not OPEN", func() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
var err error
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
@ -463,7 +463,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
}, false},
{"consensus state not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -479,7 +479,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
}, false},
{"channel verification failed", func() {
// chainA is INIT, chainB in TRYOPEN
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -489,7 +489,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
}, false},
{"channel capability not found", func() {
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
suite.Require().NoError(err)
@ -576,7 +576,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() {
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
}, false},
{"connection is not OPEN", func() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
var err error
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
@ -665,7 +665,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() {
suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainB.GetContext(), channelB.PortID, channelB.ID, channel)
}, false},
{"connection is not OPEN", func() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
var err error
connB, connA, err = suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)

View File

@ -5,8 +5,8 @@ import (
"github.com/stretchr/testify/suite"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) SetupTest() {
// and existence of a channel in INIT on chainA.
func (suite *KeeperTestSuite) TestSetChannel() {
// create client and connections on both chains
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
// check for channel to be created on chainB
channelA := connA.NextTestChannel(ibctesting.TransferPort)

View File

@ -10,9 +10,9 @@ import (
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
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/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// SendPacket is called by a module in order to send an IBC packet on a channel

View File

@ -4,11 +4,10 @@ import (
"fmt"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
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/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -148,7 +147,7 @@ func (suite *KeeperTestSuite) TestSendPacket() {
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
{"next sequence send not found", func() {
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA := connA.NextTestChannel(ibctesting.TransferPort)
channelB := connB.NextTestChannel(ibctesting.TransferPort)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
@ -276,7 +275,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
}, false},
{"connection not OPEN", func() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
// connection on chainB is in INIT
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
suite.Require().NoError(err)
@ -309,7 +308,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
suite.coordinator.ReceiveExecuted(suite.chainB, suite.chainA, packet, clientA)
}, false},
{"next receive sequence is not found", func() {
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA := connA.NextTestChannel(ibctesting.TransferPort)
channelB := connB.NextTestChannel(ibctesting.TransferPort)
@ -390,7 +389,7 @@ func (suite *KeeperTestSuite) TestReceiveExecuted() {
suite.Require().NoError(err)
}, false},
{"next sequence receive not found", func() {
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA := connA.NextTestChannel(ibctesting.TransferPort)
channelB := connB.NextTestChannel(ibctesting.TransferPort)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
@ -508,7 +507,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() {
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
}, false},
{"connection not OPEN", func() {
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
// connection on chainA is in INIT
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
suite.Require().NoError(err)
@ -537,7 +536,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() {
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
}, false},
{"next ack sequence not found", func() {
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint)
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA := connA.NextTestChannel(ibctesting.TransferPort)
channelB := connB.NextTestChannel(ibctesting.TransferPort)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)

View File

@ -8,9 +8,9 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
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/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// TimeoutPacket is called by a module which originally attempted to send a

View File

@ -4,9 +4,9 @@ import (
"fmt"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -28,7 +28,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, true},
{"success: UNORDERED", func() {
ordered = false
@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, true},
{"channel not found", func() {
// use wrong channel naming
@ -76,7 +76,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, false},
{"packet already received ", func() {
ordered = true
@ -85,12 +85,12 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, false},
{"packet hasn't been sent", func() {
clientA, _, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, false},
{"next seq receive verification failed", func() {
// set ordered to false resulting in wrong proof provided
@ -99,7 +99,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, false},
{"packet ack verification failed", func() {
// set ordered to true resulting in wrong proof provided
@ -108,7 +108,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.UNORDERED)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, false},
}
@ -212,7 +212,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, true},
@ -223,7 +223,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, true},
@ -272,7 +272,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
@ -290,7 +290,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
{"packet ack verification failed", func() {
@ -300,7 +300,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
{"channel capability not found", func() {
@ -310,7 +310,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
chanCap = capabilitytypes.NewCapability(100)
}, false},

View File

@ -2,13 +2,13 @@ package types
import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var (
_ exported.ChannelI = (*Channel)(nil)
_ exported.CounterpartyI = (*Counterparty)(nil)
_ exported.ChannelI = (*Channel)(nil)
_ exported.CounterpartyChannelI = (*Counterparty)(nil)
)
// NewChannel creates a new Channel instance
@ -36,7 +36,7 @@ func (ch Channel) GetOrdering() int32 {
}
// GetCounterparty implements Channel interface.
func (ch Channel) GetCounterparty() exported.CounterpartyI {
func (ch Channel) GetCounterparty() exported.CounterpartyChannelI {
return ch.Counterparty
}
@ -78,12 +78,12 @@ func NewCounterparty(portID, channelID string) Counterparty {
}
}
// GetPortID implements CounterpartyI interface
// GetPortID implements CounterpartyChannelI interface
func (c Counterparty) GetPortID() string {
return c.PortId
}
// GetChannelID implements CounterpartyI interface
// GetChannelID implements CounterpartyChannelI interface
func (c Counterparty) GetChannelID() string {
return c.ChannelId
}

View File

@ -4,7 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// RegisterInterfaces register the ibc channel submodule interfaces to protobuf
@ -15,8 +15,8 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
(*exported.ChannelI)(nil),
)
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.channel.CounterpartyI",
(*exported.CounterpartyI)(nil),
"cosmos_sdk.ibc.v1.channel.CounterpartyChannelI",
(*exported.CounterpartyChannelI)(nil),
)
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.channel.PacketI",
@ -27,7 +27,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
&Channel{},
)
registry.RegisterImplementations(
(*exported.CounterpartyI)(nil),
(*exported.CounterpartyChannelI)(nil),
&Counterparty{},
)
registry.RegisterImplementations(

View File

@ -3,16 +3,14 @@ package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// ClientKeeper expected account IBC client keeper
type ClientKeeper interface {
GetClientState(ctx sdk.Context, clientID string) (clientexported.ClientState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (clientexported.ConsensusState, bool)
GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (exported.ConsensusState, bool)
}
// ConnectionKeeper expected account IBC connection keeper
@ -25,7 +23,7 @@ type ConnectionKeeper interface {
) (uint64, error)
VerifyChannelState(
ctx sdk.Context,
connection connectionexported.ConnectionI,
connection exported.ConnectionI,
height uint64,
proof []byte,
portID,
@ -34,7 +32,7 @@ type ConnectionKeeper interface {
) error
VerifyPacketCommitment(
ctx sdk.Context,
connection connectionexported.ConnectionI,
connection exported.ConnectionI,
height uint64,
proof []byte,
portID,
@ -44,7 +42,7 @@ type ConnectionKeeper interface {
) error
VerifyPacketAcknowledgement(
ctx sdk.Context,
connection connectionexported.ConnectionI,
connection exported.ConnectionI,
height uint64,
proof []byte,
portID,
@ -54,7 +52,7 @@ type ConnectionKeeper interface {
) error
VerifyPacketAcknowledgementAbsence(
ctx sdk.Context,
connection connectionexported.ConnectionI,
connection exported.ConnectionI,
height uint64,
proof []byte,
portID,
@ -63,7 +61,7 @@ type ConnectionKeeper interface {
) error
VerifyNextSequenceRecv(
ctx sdk.Context,
connection connectionexported.ConnectionI,
connection exported.ConnectionI,
height uint64,
proof []byte,
portID,

View File

@ -15,8 +15,8 @@ import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// define constants used for testing
@ -46,7 +46,7 @@ var (
invalidPacket = types.NewPacket(unknownPacketData, 0, portid, chanid, cpportid, cpchanid, timeoutHeight, timeoutTimestamp)
emptyProof = []byte{}
invalidProofs1 = commitmentexported.Proof(nil)
invalidProofs1 = exported.Proof(nil)
invalidProofs2 = emptyProof
addr1 = sdk.AccAddress("testaddr1")

View File

@ -5,8 +5,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// CommitPacket returns a packet commitment bytes. The commitment consists of:

View File

@ -10,18 +10,15 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
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"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ clientexported.ClientState = (*ClientState)(nil)
var _ exported.ClientState = (*ClientState)(nil)
// NewClientState creates a new ClientState instance
func NewClientState(
@ -47,8 +44,8 @@ func (cs ClientState) GetChainID() string {
}
// ClientType is tendermint.
func (cs ClientState) ClientType() clientexported.ClientType {
return clientexported.Tendermint
func (cs ClientState) ClientType() exported.ClientType {
return exported.Tendermint
}
// GetLatestHeight returns latest block height.
@ -119,12 +116,12 @@ func (cs ClientState) GetProofSpecs() []*ics23.ProofSpec {
func (cs ClientState) VerifyClientState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
provingRoot commitmentexported.Root,
provingRoot exported.Root,
height uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
counterpartyClientIdentifier string,
proof []byte,
clientState clientexported.ClientState,
clientState exported.ClientState,
) error {
merkleProof, _, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
if err != nil {
@ -159,13 +156,13 @@ func (cs ClientState) VerifyClientState(
func (cs ClientState) VerifyClientConsensusState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
provingRoot commitmentexported.Root,
provingRoot exported.Root,
height uint64,
counterpartyClientIdentifier string,
consensusHeight uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
consensusState clientexported.ConsensusState,
consensusState exported.ConsensusState,
) error {
merkleProof, _, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
if err != nil {
@ -205,10 +202,10 @@ func (cs ClientState) VerifyConnectionState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
connectionID string,
connectionEnd connectionexported.ConnectionI,
connectionEnd exported.ConnectionI,
) error {
merkleProof, consensusState, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
if err != nil {
@ -243,11 +240,11 @@ func (cs ClientState) VerifyChannelState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
channel channelexported.ChannelI,
channel exported.ChannelI,
) error {
merkleProof, consensusState, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
if err != nil {
@ -282,7 +279,7 @@ func (cs ClientState) VerifyPacketCommitment(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
@ -312,7 +309,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
@ -343,7 +340,7 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
@ -372,7 +369,7 @@ func (cs ClientState) VerifyNextSequenceRecv(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
@ -405,7 +402,7 @@ func produceVerificationArgs(
cdc codec.BinaryMarshaler,
cs ClientState,
height uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
) (merkleProof commitmenttypes.MerkleProof, consensusState *ConsensusState, err error) {
if cs.GetLatestHeight() < height {

View File

@ -3,12 +3,12 @@ package types_test
import (
ics23 "github.com/confio/ics23/go"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -548,7 +548,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() {
suite.Require().NoError(err)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
var ok bool
clientStateI := suite.chainA.GetClientState(clientA)
@ -639,7 +639,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() {
suite.Require().NoError(err)
// need to update chainA's client representing chainB
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
var ok bool
clientStateI := suite.chainA.GetClientState(clientA)

View File

@ -3,30 +3,30 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// RegisterInterfaces registers the tendermint concrete evidence and client-related
// implementations and interfaces.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations(
(*clientexported.ClientState)(nil),
(*exported.ClientState)(nil),
&ClientState{},
)
registry.RegisterImplementations(
(*clientexported.ConsensusState)(nil),
(*exported.ConsensusState)(nil),
&ConsensusState{},
)
registry.RegisterImplementations(
(*clientexported.Header)(nil),
(*exported.Header)(nil),
&Header{},
)
registry.RegisterImplementations(
(*clientexported.Misbehaviour)(nil),
(*exported.Misbehaviour)(nil),
&Misbehaviour{},
)
registry.RegisterImplementations(
(*clientexported.Header)(nil),
(*exported.Header)(nil),
&Header{},
)
}

View File

@ -7,10 +7,9 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// NewConsensusState creates a new ConsensusState instance.
@ -27,12 +26,12 @@ func NewConsensusState(
}
// ClientType returns Tendermint
func (ConsensusState) ClientType() clientexported.ClientType {
return clientexported.Tendermint
func (ConsensusState) ClientType() exported.ClientType {
return exported.Tendermint
}
// GetRoot returns the commitment Root for the specific
func (cs ConsensusState) GetRoot() commitmentexported.Root {
func (cs ConsensusState) GetRoot() exported.Root {
return cs.Root
}

View File

@ -3,10 +3,10 @@ package types_test
import (
"time"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
@ -69,7 +69,7 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
for i, tc := range testCases {
tc := tc
suite.Require().Equal(tc.consensusState.ClientType(), clientexported.Tendermint)
suite.Require().Equal(tc.consensusState.ClientType(), exported.Tendermint)
suite.Require().Equal(tc.consensusState.GetRoot(), tc.consensusState.Root)
if tc.expectPass {

View File

@ -7,16 +7,16 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ clientexported.Header = Header{}
var _ exported.Header = Header{}
// ClientType defines that the Header is a Tendermint consensus algorithm
func (h Header) ClientType() clientexported.ClientType {
return clientexported.Tendermint
func (h Header) ClientType() exported.ClientType {
return exported.Tendermint
}
// ConsensusState returns the updated consensus state associated with the header

View File

@ -5,9 +5,9 @@ import (
tmprotocrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
func (suite *TendermintTestSuite) TestGetHeight() {
@ -64,7 +64,7 @@ func (suite *TendermintTestSuite) TestHeaderValidateBasic() {
}, false},
}
suite.Require().Equal(clientexported.Tendermint, suite.header.ClientType())
suite.Require().Equal(exported.Tendermint, suite.header.ClientType())
for _, tc := range testCases {
tc := tc

View File

@ -10,13 +10,13 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var (
_ clientexported.Misbehaviour = Misbehaviour{}
_ exported.Misbehaviour = Misbehaviour{}
)
// NewMisbehaviour creates a new Misbehaviour instance.
@ -31,8 +31,8 @@ func NewMisbehaviour(clientID, chainID string, header1, header2 *Header) *Misbeh
}
// ClientType is Tendermint light client
func (misbehaviour Misbehaviour) ClientType() clientexported.ClientType {
return clientexported.Tendermint
func (misbehaviour Misbehaviour) ClientType() exported.ClientType {
return exported.Tendermint
}
// GetClientID returns the ID of the client that committed a misbehaviour.

View File

@ -8,8 +8,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// CheckMisbehaviourAndUpdateState determines whether or not two conflicting
@ -23,8 +23,8 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
ctx sdk.Context,
cdc codec.BinaryMarshaler,
clientStore sdk.KVStore,
misbehaviour clientexported.Misbehaviour,
) (clientexported.ClientState, error) {
misbehaviour exported.Misbehaviour,
) (exported.ClientState, error) {
tmMisbehaviour, ok := misbehaviour.(*Misbehaviour)
if !ok {
return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "expected type %T, got %T", misbehaviour, &Misbehaviour{})

View File

@ -8,10 +8,10 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/simapp"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
@ -40,10 +40,10 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
testCases := []struct {
name string
clientState clientexported.ClientState
consensusState1 clientexported.ConsensusState
consensusState2 clientexported.ConsensusState
misbehaviour clientexported.Misbehaviour
clientState exported.ClientState
consensusState1 exported.ConsensusState
consensusState2 exported.ConsensusState
misbehaviour exported.Misbehaviour
timestamp time.Time
expPass bool
}{

View File

@ -7,8 +7,8 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
func (suite *TendermintTestSuite) TestMisbehaviour() {
@ -22,7 +22,7 @@ func (suite *TendermintTestSuite) TestMisbehaviour() {
ClientId: clientID,
}
suite.Require().Equal(clientexported.Tendermint, misbehaviour.ClientType())
suite.Require().Equal(exported.Tendermint, misbehaviour.ClientType())
suite.Require().Equal(clientID, misbehaviour.GetClientID())
suite.Require().Equal(height.EpochHeight, misbehaviour.GetHeight())
}

View File

@ -4,9 +4,9 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// GetConsensusState retrieves the consensus state from the client prefixed
@ -20,7 +20,7 @@ func GetConsensusState(store sdk.KVStore, cdc codec.BinaryMarshaler, height uint
)
}
var consensusStateI clientexported.ConsensusState
var consensusStateI exported.ConsensusState
if err := codec.UnmarshalAny(cdc, &consensusStateI, bz); err != nil {
return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidConsensus, "unmarshal error: %v", err)
}

View File

@ -10,9 +10,9 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// CheckHeaderAndUpdateState checks if the provided header is valid, and if valid it will:
@ -36,8 +36,8 @@ import (
// in the [Tendermint spec](https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md).
func (cs ClientState) CheckHeaderAndUpdateState(
ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore,
header clientexported.Header,
) (clientexported.ClientState, clientexported.ConsensusState, error) {
header exported.Header,
) (exported.ClientState, exported.ConsensusState, error) {
tmHeader, ok := header.(*Header)
if !ok {
return nil, nil, sdkerrors.Wrapf(

View File

@ -11,17 +11,14 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
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"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ clientexported.ClientState = (*ClientState)(nil)
var _ exported.ClientState = (*ClientState)(nil)
// NewClientState creates a new ClientState instance
func NewClientState(chainID string, height clienttypes.Height) *ClientState {
@ -37,8 +34,8 @@ func (cs ClientState) GetChainID() string {
}
// ClientType is localhost.
func (cs ClientState) ClientType() clientexported.ClientType {
return clientexported.Localhost
func (cs ClientState) ClientType() exported.ClientType {
return exported.Localhost
}
// GetLatestHeight returns the latest height stored.
@ -74,8 +71,8 @@ func (cs ClientState) GetProofSpecs() []*ics23.ProofSpec {
// CheckHeaderAndUpdateState updates the localhost client. It only needs access to the context
func (cs *ClientState) CheckHeaderAndUpdateState(
ctx sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ clientexported.Header,
) (clientexported.ClientState, clientexported.ConsensusState, error) {
ctx sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ exported.Header,
) (exported.ClientState, exported.ConsensusState, error) {
// use the chain ID from context since the localhost client is from the running chain (i.e self).
cs.ChainId = ctx.ChainID()
// Hardcode 0 for epoch number for now
@ -88,15 +85,15 @@ func (cs *ClientState) CheckHeaderAndUpdateState(
// Since localhost is the client of the running chain, misbehaviour cannot be submitted to it
// Thus, CheckMisbehaviourAndUpdateState returns an error for localhost
func (cs ClientState) CheckMisbehaviourAndUpdateState(
_ sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ clientexported.Misbehaviour,
) (clientexported.ClientState, error) {
_ sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ exported.Misbehaviour,
) (exported.ClientState, error) {
return nil, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "cannot submit misbehaviour to localhost client")
}
// VerifyClientState verifies that the localhost client state is stored locally
func (cs ClientState) VerifyClientState(
store sdk.KVStore, cdc codec.BinaryMarshaler, _ commitmentexported.Root,
_ uint64, _ commitmentexported.Prefix, _ string, _ []byte, clientState clientexported.ClientState,
store sdk.KVStore, cdc codec.BinaryMarshaler, _ exported.Root,
_ uint64, _ exported.Prefix, _ string, _ []byte, clientState exported.ClientState,
) error {
path := host.KeyClientState()
bz := store.Get(path)
@ -119,8 +116,8 @@ func (cs ClientState) VerifyClientState(
// VerifyClientConsensusState returns nil since a local host client does not store consensus
// states.
func (cs ClientState) VerifyClientConsensusState(
sdk.KVStore, codec.BinaryMarshaler, commitmentexported.Root,
uint64, string, uint64, commitmentexported.Prefix, []byte, clientexported.ConsensusState,
sdk.KVStore, codec.BinaryMarshaler, exported.Root,
uint64, string, uint64, exported.Prefix, []byte, exported.ConsensusState,
) error {
return nil
}
@ -131,10 +128,10 @@ func (cs ClientState) VerifyConnectionState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
_ uint64,
_ commitmentexported.Prefix,
_ exported.Prefix,
_ []byte,
connectionID string,
connectionEnd connectionexported.ConnectionI,
connectionEnd exported.ConnectionI,
) error {
path := host.KeyConnection(connectionID)
bz := store.Get(path)
@ -164,11 +161,11 @@ func (cs ClientState) VerifyChannelState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
_ uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
_ []byte,
portID,
channelID string,
channel channelexported.ChannelI,
channel exported.ChannelI,
) error {
path := host.KeyChannel(portID, channelID)
bz := store.Get(path)
@ -198,7 +195,7 @@ func (cs ClientState) VerifyPacketCommitment(
store sdk.KVStore,
_ codec.BinaryMarshaler,
_ uint64,
_ commitmentexported.Prefix,
_ exported.Prefix,
_ []byte,
portID,
channelID string,
@ -228,7 +225,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
store sdk.KVStore,
_ codec.BinaryMarshaler,
_ uint64,
_ commitmentexported.Prefix,
_ exported.Prefix,
_ []byte,
portID,
channelID string,
@ -259,7 +256,7 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
store sdk.KVStore,
_ codec.BinaryMarshaler,
_ uint64,
_ commitmentexported.Prefix,
_ exported.Prefix,
_ []byte,
portID,
channelID string,
@ -281,7 +278,7 @@ func (cs ClientState) VerifyNextSequenceRecv(
store sdk.KVStore,
_ codec.BinaryMarshaler,
_ uint64,
_ commitmentexported.Prefix,
_ exported.Prefix,
_ []byte,
portID,
channelID string,

View File

@ -3,14 +3,14 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// RegisterInterfaces register the ibc interfaces submodule implementations to protobuf
// Any.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations(
(*clientexported.ClientState)(nil),
(*exported.ClientState)(nil),
&ClientState{},
)
}

View File

@ -9,8 +9,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
const (
@ -35,7 +35,7 @@ func (suite *LocalhostTestSuite) SetupTest() {
suite.cdc = app.AppCodec()
suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{Height: 1, ChainID: "ibc-chain"})
suite.store = app.IBCKeeper.ClientKeeper.ClientStore(suite.ctx, clientexported.ClientTypeLocalHost)
suite.store = app.IBCKeeper.ClientKeeper.ClientStore(suite.ctx, exported.ClientTypeLocalHost)
}
func TestLocalhostTestSuite(t *testing.T) {

View File

@ -3,7 +3,7 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// RegisterInterfaces registers the commitment interfaces to protobuf Any.

View File

@ -9,8 +9,8 @@ import (
tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// var representing the proofspecs for a SDK chain

View File

@ -4,15 +4,15 @@ package exported
type ChannelI interface {
GetState() int32
GetOrdering() int32
GetCounterparty() CounterpartyI
GetCounterparty() CounterpartyChannelI
GetConnectionHops() []string
GetVersion() string
ValidateBasic() error
}
// CounterpartyI defines the standard interface for a channel end's
// CounterpartyChannelI defines the standard interface for a channel end's
// counterparty.
type CounterpartyI interface {
type CounterpartyChannelI interface {
GetPortID() string
GetChannelID() string
ValidateBasic() error

View File

@ -9,9 +9,6 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/codec"
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
)
// ClientState defines the required common functions for light clients.
@ -33,9 +30,9 @@ type ClientState interface {
VerifyClientState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
root commitmentexported.Root,
root Root,
height uint64,
prefix commitmentexported.Prefix,
prefix Prefix,
counterpartyClientIdentifier string,
proof []byte,
clientState ClientState,
@ -43,11 +40,11 @@ type ClientState interface {
VerifyClientConsensusState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
root commitmentexported.Root,
root Root,
height uint64,
counterpartyClientIdentifier string,
consensusHeight uint64,
prefix commitmentexported.Prefix,
prefix Prefix,
proof []byte,
consensusState ConsensusState,
) error
@ -55,26 +52,26 @@ type ClientState interface {
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix Prefix,
proof []byte,
connectionID string,
connectionEnd connectionexported.ConnectionI,
connectionEnd ConnectionI,
) error
VerifyChannelState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix Prefix,
proof []byte,
portID,
channelID string,
channel channelexported.ChannelI,
channel ChannelI,
) error
VerifyPacketCommitment(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix Prefix,
proof []byte,
portID,
channelID string,
@ -85,7 +82,7 @@ type ClientState interface {
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix Prefix,
proof []byte,
portID,
channelID string,
@ -96,7 +93,7 @@ type ClientState interface {
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix Prefix,
proof []byte,
portID,
channelID string,
@ -106,7 +103,7 @@ type ClientState interface {
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
prefix commitmentexported.Prefix,
prefix Prefix,
proof []byte,
portID,
channelID string,
@ -123,7 +120,7 @@ type ConsensusState interface {
// GetRoot returns the commitment root of the consensus state,
// which is used for key-value pair verification.
GetRoot() commitmentexported.Root
GetRoot() Root
// GetTimestamp returns the timestamp (in nanoseconds) of the consensus state
GetTimestamp() uint64

View File

@ -1,22 +1,18 @@
package exported
import (
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
)
// ConnectionI describes the required methods for a connection.
type ConnectionI interface {
GetClientID() string
GetState() int32
GetCounterparty() CounterpartyI
GetCounterparty() CounterpartyConnectionI
GetVersions() []string
ValidateBasic() error
}
// CounterpartyI describes the required methods for a counterparty connection.
type CounterpartyI interface {
// CounterpartyConnectionI describes the required methods for a counterparty connection.
type CounterpartyConnectionI interface {
GetClientID() string
GetConnectionID() string
GetPrefix() commitmentexported.Prefix
GetPrefix() Prefix
ValidateBasic() error
}

View File

@ -8,7 +8,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/ibc"
clientexported "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"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
@ -16,6 +15,7 @@ import (
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
"github.com/cosmos/cosmos-sdk/x/ibc/types"
)
@ -40,13 +40,13 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs()),
),
clienttypes.NewIdentifiedClientState(
clientexported.ClientTypeLocalHost, localhosttypes.NewClientState("chaindID", clientHeight),
exported.ClientTypeLocalHost, localhosttypes.NewClientState("chaindID", clientHeight),
),
},
[]clienttypes.ClientConsensusStates{
clienttypes.NewClientConsensusStates(
clientID,
[]clientexported.ConsensusState{
[]exported.ConsensusState{
ibctmtypes.NewConsensusState(
suite.header.GetTime(), commitmenttypes.NewMerkleRoot(suite.header.Header.AppHash), clienttypes.NewHeight(0, suite.header.GetHeight()), suite.header.Header.NextValidatorsHash,
),
@ -100,7 +100,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs()),
),
clienttypes.NewIdentifiedClientState(
clientexported.ClientTypeLocalHost, localhosttypes.NewClientState("(chaindID)", clienttypes.Height{}),
exported.ClientTypeLocalHost, localhosttypes.NewClientState("(chaindID)", clienttypes.Height{}),
),
},
nil,
@ -169,13 +169,13 @@ func (suite *IBCTestSuite) TestInitGenesis() {
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs()),
),
clienttypes.NewIdentifiedClientState(
clientexported.ClientTypeLocalHost, localhosttypes.NewClientState("chaindID", clientHeight),
exported.ClientTypeLocalHost, localhosttypes.NewClientState("chaindID", clientHeight),
),
},
[]clienttypes.ClientConsensusStates{
clienttypes.NewClientConsensusStates(
clientID,
[]clientexported.ConsensusState{
[]exported.ConsensusState{
ibctmtypes.NewConsensusState(
suite.header.GetTime(), commitmenttypes.NewMerkleRoot(suite.header.Header.AppHash), clienttypes.NewHeight(0, suite.header.GetHeight()), suite.header.Header.NextValidatorsHash,
),
@ -242,8 +242,8 @@ func (suite *HandlerTestSuite) TestExportGenesis() {
// creates clients
suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
// create extra clients
suite.coordinator.CreateClient(suite.chainA, suite.chainB, clientexported.Tendermint)
suite.coordinator.CreateClient(suite.chainA, suite.chainB, clientexported.Tendermint)
suite.coordinator.CreateClient(suite.chainA, suite.chainB, exported.Tendermint)
suite.coordinator.CreateClient(suite.chainA, suite.chainB, exported.Tendermint)
},
},
}

View File

@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/suite"
"github.com/cosmos/cosmos-sdk/x/ibc"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -323,7 +323,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
suite.Require().NoError(err)
// need to update chainA client to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
}, true},
@ -336,7 +336,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
suite.Require().NoError(err)
// need to update chainA client to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
}, true},
@ -354,7 +354,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
suite.Require().NoError(err)
}
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
}, true},
@ -371,7 +371,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
suite.Require().NoError(err)
}
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
}, true},
@ -453,7 +453,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
suite.Require().NoError(err)
// need to update chainA client to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
@ -475,7 +475,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
suite.Require().NoError(err)
// need to update chainA client to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
@ -503,7 +503,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
}
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
// close counterparty channel
@ -528,7 +528,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
suite.Require().NoError(err)
}
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
// close counterparty channel
@ -569,7 +569,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
suite.Require().NoError(err)
// need to update chainA client to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, clientexported.Tendermint)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())

View File

@ -6,16 +6,13 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ clientexported.ClientState = (*ClientState)(nil)
var _ exported.ClientState = (*ClientState)(nil)
// NewClientState creates a new ClientState instance.
func NewClientState(consensusState *ConsensusState) *ClientState {
@ -26,8 +23,8 @@ func NewClientState(consensusState *ConsensusState) *ClientState {
}
// ClientType is Solo Machine.
func (cs ClientState) ClientType() clientexported.ClientType {
return clientexported.SoloMachine
func (cs ClientState) ClientType() exported.ClientType {
return exported.SoloMachine
}
// GetLatestHeight returns the latest sequence number.
@ -63,12 +60,12 @@ func (cs ClientState) Validate() error {
func (cs ClientState) VerifyClientState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
_ commitmentexported.Root,
_ exported.Root,
sequence uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
counterpartyClientIdentifier string,
proof []byte,
clientState clientexported.ClientState,
clientState exported.ClientState,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
if err != nil {
@ -101,13 +98,13 @@ func (cs ClientState) VerifyClientState(
func (cs ClientState) VerifyClientConsensusState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
_ commitmentexported.Root,
_ exported.Root,
sequence uint64,
counterpartyClientIdentifier string,
consensusHeight uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
consensusState clientexported.ConsensusState,
consensusState exported.ConsensusState,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
if err != nil {
@ -141,10 +138,10 @@ func (cs ClientState) VerifyConnectionState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
connectionID string,
connectionEnd connectionexported.ConnectionI,
connectionEnd exported.ConnectionI,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
if err != nil {
@ -177,11 +174,11 @@ func (cs ClientState) VerifyChannelState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
channel channelexported.ChannelI,
channel exported.ChannelI,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
if err != nil {
@ -214,7 +211,7 @@ func (cs ClientState) VerifyPacketCommitment(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
@ -249,7 +246,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
@ -285,7 +282,7 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
@ -319,7 +316,7 @@ func (cs ClientState) VerifyNextSequenceRecv(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
@ -354,7 +351,7 @@ func produceVerificationArgs(
cdc codec.BinaryMarshaler,
cs ClientState,
sequence uint64,
prefix commitmentexported.Prefix,
prefix exported.Prefix,
proof []byte,
) (signature TimestampedSignature, err error) {
if cs.IsFrozen() {
@ -397,7 +394,7 @@ func produceVerificationArgs(
}
// sets the client state to the store
func setClientState(store sdk.KVStore, cdc codec.BinaryMarshaler, clientState clientexported.ClientState) {
func setClientState(store sdk.KVStore, cdc codec.BinaryMarshaler, clientState exported.ClientState) {
bz := clienttypes.MustMarshalClientState(cdc, clientState)
store.Set(host.KeyClientState(), bz)
}

View File

@ -1,12 +1,11 @@
package types_test
import (
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
)
@ -73,7 +72,7 @@ func (suite *SoloMachineTestSuite) TestClientStateValidateBasic() {
func (suite *SoloMachineTestSuite) TestVerifyClientState() {
// create client for tendermint so we can use client state for verification
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
clientState := suite.chainA.GetClientState(clientA)
clientPrefixedPath := "clients/" + counterpartyClientIdentifier + "/" + host.ClientStatePath()
@ -97,7 +96,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientState() {
testCases := []struct {
name string
clientState *types.ClientState
prefix commitmentexported.Prefix
prefix exported.Prefix
proof []byte
expPass bool
}{
@ -196,7 +195,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientState() {
func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
// create client for tendermint so we can use consensus state for verification
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, clientexported.Tendermint)
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
clientState := suite.chainA.GetClientState(clientA)
consensusState, found := suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
suite.Require().True(found)
@ -222,7 +221,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
testCases := []struct {
name string
clientState *types.ClientState
prefix commitmentexported.Prefix
prefix exported.Prefix
proof []byte
expPass bool
}{
@ -343,7 +342,7 @@ func (suite *SoloMachineTestSuite) TestVerifyConnectionState() {
testCases := []struct {
name string
clientState *types.ClientState
prefix commitmentexported.Prefix
prefix exported.Prefix
proof []byte
expPass bool
}{
@ -426,7 +425,7 @@ func (suite *SoloMachineTestSuite) TestVerifyChannelState() {
testCases := []struct {
name string
clientState *types.ClientState
prefix commitmentexported.Prefix
prefix exported.Prefix
proof []byte
expPass bool
}{
@ -506,7 +505,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketCommitment() {
testCases := []struct {
name string
clientState *types.ClientState
prefix commitmentexported.Prefix
prefix exported.Prefix
proof []byte
expPass bool
}{
@ -586,7 +585,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketAcknowledgement() {
testCases := []struct {
name string
clientState *types.ClientState
prefix commitmentexported.Prefix
prefix exported.Prefix
proof []byte
expPass bool
}{
@ -665,7 +664,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketAcknowledgementAbsence() {
testCases := []struct {
name string
clientState *types.ClientState
prefix commitmentexported.Prefix
prefix exported.Prefix
proof []byte
expPass bool
}{
@ -745,7 +744,7 @@ func (suite *SoloMachineTestSuite) TestVerifyNextSeqRecv() {
testCases := []struct {
name string
clientState *types.ClientState
prefix commitmentexported.Prefix
prefix exported.Prefix
proof []byte
expPass bool
}{

View File

@ -3,26 +3,26 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// RegisterInterfaces register the ibc channel submodule interfaces to protobuf
// Any.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations(
(*clientexported.ClientState)(nil),
(*exported.ClientState)(nil),
&ClientState{},
)
registry.RegisterImplementations(
(*clientexported.ConsensusState)(nil),
(*exported.ConsensusState)(nil),
&ConsensusState{},
)
registry.RegisterImplementations(
(*clientexported.Header)(nil),
(*exported.Header)(nil),
&Header{},
)
registry.RegisterImplementations(
(*clientexported.Misbehaviour)(nil),
(*exported.Misbehaviour)(nil),
&Misbehaviour{},
)
}

View File

@ -5,16 +5,15 @@ import (
"github.com/cosmos/cosmos-sdk/std"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ clientexported.ConsensusState = ConsensusState{}
var _ exported.ConsensusState = ConsensusState{}
// ClientType returns Solo Machine type.
func (ConsensusState) ClientType() clientexported.ClientType {
return clientexported.SoloMachine
func (ConsensusState) ClientType() exported.ClientType {
return exported.SoloMachine
}
// GetHeight returns the sequence number.
@ -28,7 +27,7 @@ func (cs ConsensusState) GetTimestamp() uint64 {
}
// GetRoot returns nil since solo machines do not have roots.
func (cs ConsensusState) GetRoot() commitmentexported.Root {
func (cs ConsensusState) GetRoot() exported.Root {
return nil
}

View File

@ -1,14 +1,14 @@
package types_test
import (
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
)
func (suite *SoloMachineTestSuite) TestConsensusState() {
consensusState := suite.solomachine.ConsensusState()
suite.Require().Equal(clientexported.SoloMachine, consensusState.ClientType())
suite.Require().Equal(exported.SoloMachine, consensusState.ClientType())
suite.Require().Equal(suite.solomachine.Sequence, consensusState.GetHeight())
suite.Require().Equal(suite.solomachine.Time, consensusState.GetTimestamp())
suite.Require().Nil(consensusState.GetRoot())

View File

@ -5,15 +5,15 @@ import (
"github.com/cosmos/cosmos-sdk/std"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var _ clientexported.Header = Header{}
var _ exported.Header = Header{}
// ClientType defines that the Header is a Solo Machine.
func (Header) ClientType() clientexported.ClientType {
return clientexported.SoloMachine
func (Header) ClientType() exported.ClientType {
return exported.SoloMachine
}
// GetHeight returns the current sequence number as the height.

View File

@ -1,7 +1,7 @@
package types_test
import (
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
)
@ -47,7 +47,7 @@ func (suite *SoloMachineTestSuite) TestHeaderValidateBasic() {
},
}
suite.Require().Equal(clientexported.SoloMachine, header.ClientType())
suite.Require().Equal(exported.SoloMachine, header.ClientType())
for _, tc := range cases {
tc := tc

View File

@ -6,18 +6,18 @@ import (
yaml "gopkg.in/yaml.v2"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var (
_ clientexported.Misbehaviour = (*Misbehaviour)(nil)
_ exported.Misbehaviour = (*Misbehaviour)(nil)
)
// ClientType is a Solo Machine light client.
func (misbehaviour Misbehaviour) ClientType() clientexported.ClientType {
return clientexported.SoloMachine
func (misbehaviour Misbehaviour) ClientType() exported.ClientType {
return exported.SoloMachine
}
// GetClientID returns the ID of the client that committed a misbehaviour.
@ -27,7 +27,7 @@ func (misbehaviour Misbehaviour) GetClientID() string {
// Type implements Evidence interface.
func (misbehaviour Misbehaviour) Type() string {
return clientexported.TypeClientMisbehaviour
return exported.TypeClientMisbehaviour
}
// String implements Evidence interface.

View File

@ -4,8 +4,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// CheckMisbehaviourAndUpdateState determines whether or not the currently registered
@ -15,8 +15,8 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
ctx sdk.Context,
cdc codec.BinaryMarshaler,
clientStore sdk.KVStore,
misbehaviour clientexported.Misbehaviour,
) (clientexported.ClientState, error) {
misbehaviour exported.Misbehaviour,
) (exported.ClientState, error) {
soloMisbehaviour, ok := misbehaviour.(*Misbehaviour)
if !ok {

View File

@ -2,14 +2,14 @@ package types_test
import (
sdk "github.com/cosmos/cosmos-sdk/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
var (
clientState clientexported.ClientState
misbehaviour clientexported.Misbehaviour
clientState exported.ClientState
misbehaviour exported.Misbehaviour
)
testCases := []struct {

View File

@ -1,14 +1,14 @@
package types_test
import (
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
)
func (suite *SoloMachineTestSuite) TestMisbehaviour() {
misbehaviour := suite.solomachine.CreateMisbehaviour()
suite.Require().Equal(clientexported.SoloMachine, misbehaviour.ClientType())
suite.Require().Equal(exported.SoloMachine, misbehaviour.ClientType())
suite.Require().Equal(suite.solomachine.ClientID, misbehaviour.GetClientID())
suite.Require().Equal(suite.solomachine.Sequence, misbehaviour.GetHeight())
}

View File

@ -6,13 +6,11 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
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"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// VerifySignature verifies if the the provided public key generated the signature
@ -53,7 +51,7 @@ func ClientStateSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
path commitmenttypes.MerklePath,
clientState clientexported.ClientState,
clientState exported.ClientState,
) ([]byte, error) {
bz, err := codec.MarshalAny(cdc, clientState)
if err != nil {
@ -75,7 +73,7 @@ func ConsensusStateSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
path commitmenttypes.MerklePath,
consensusState clientexported.ConsensusState,
consensusState exported.ConsensusState,
) ([]byte, error) {
bz, err := codec.MarshalAny(cdc, consensusState)
if err != nil {
@ -97,7 +95,7 @@ func ConnectionStateSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
path commitmenttypes.MerklePath,
connectionEnd connectionexported.ConnectionI,
connectionEnd exported.ConnectionI,
) ([]byte, error) {
connection, ok := connectionEnd.(connectiontypes.ConnectionEnd)
if !ok {
@ -124,7 +122,7 @@ func ChannelStateSignBytes(
cdc codec.BinaryMarshaler,
sequence, timestamp uint64,
path commitmenttypes.MerklePath,
channelEnd channelexported.ChannelI,
channelEnd exported.ChannelI,
) ([]byte, error) {
channel, ok := channelEnd.(channeltypes.Channel)
if !ok {

View File

@ -7,8 +7,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -32,7 +32,7 @@ func (suite *SoloMachineTestSuite) SetupTest() {
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
suite.store = suite.chainA.App.IBCKeeper.ClientKeeper.ClientStore(suite.chainA.GetContext(), clientexported.ClientTypeSoloMachine)
suite.store = suite.chainA.App.IBCKeeper.ClientKeeper.ClientStore(suite.chainA.GetContext(), exported.ClientTypeSoloMachine)
bz, err := codec.MarshalAny(suite.chainA.Codec, suite.solomachine.ClientState())
suite.Require().NoError(err)
@ -47,7 +47,7 @@ func (suite *SoloMachineTestSuite) GetSequenceFromStore() uint64 {
bz := suite.store.Get(host.KeyClientState())
suite.Require().NotNil(bz)
var clientState clientexported.ClientState
var clientState exported.ClientState
err := codec.UnmarshalAny(suite.chainA.Codec, &clientState, bz)
suite.Require().NoError(err)
return clientState.GetLatestHeight()

View File

@ -4,8 +4,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// CheckHeaderAndUpdateState checks if the provided header is valid and updates
@ -14,8 +14,8 @@ import (
// - the currently registered public key did not provide the update signature
func (cs ClientState) CheckHeaderAndUpdateState(
ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore,
header clientexported.Header,
) (clientexported.ClientState, clientexported.ConsensusState, error) {
header exported.Header,
) (exported.ClientState, exported.ConsensusState, error) {
smHeader, ok := header.(*Header)
if !ok {
return nil, nil, sdkerrors.Wrapf(

View File

@ -2,15 +2,15 @@ package types_test
import (
sdk "github.com/cosmos/cosmos-sdk/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
)
func (suite *SoloMachineTestSuite) TestCheckHeaderAndUpdateState() {
var (
clientState clientexported.ClientState
header clientexported.Header
clientState exported.ClientState
header exported.Header
)
testCases := []struct {

View File

@ -24,14 +24,13 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
clientexported "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"
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/testing/mock"
"github.com/cosmos/cosmos-sdk/x/ibc/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
@ -186,7 +185,7 @@ func (chain *TestChain) QueryProof(key []byte) ([]byte, uint64) {
// QueryClientStateProof performs and abci query for a client state
// stored with a given clientID and returns the ClientState along with the proof
func (chain *TestChain) QueryClientStateProof(clientID string) (clientexported.ClientState, []byte) {
func (chain *TestChain) QueryClientStateProof(clientID string) (exported.ClientState, []byte) {
// retrieve client state to provide proof for
clientState, found := chain.App.IBCKeeper.ClientKeeper.GetClientState(chain.GetContext(), clientID)
require.True(chain.t, found)
@ -271,7 +270,7 @@ func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) {
// GetClientState retrieves the client state for the provided clientID. The client is
// expected to exist otherwise testing will fail.
func (chain *TestChain) GetClientState(clientID string) clientexported.ClientState {
func (chain *TestChain) GetClientState(clientID string) exported.ClientState {
clientState, found := chain.App.IBCKeeper.ClientKeeper.GetClientState(chain.GetContext(), clientID)
require.True(chain.t, found)
@ -280,7 +279,7 @@ func (chain *TestChain) GetClientState(clientID string) clientexported.ClientSta
// GetConsensusState retrieves the consensus state for the provided clientID and height.
// It will return a success boolean depending on if consensus state exists or not.
func (chain *TestChain) GetConsensusState(clientID string, height uint64) (clientexported.ConsensusState, bool) {
func (chain *TestChain) GetConsensusState(clientID string, height uint64) (exported.ConsensusState, bool) {
return chain.App.IBCKeeper.ClientKeeper.GetClientConsensusState(chain.GetContext(), clientID, height)
}
@ -316,7 +315,7 @@ func (chain *TestChain) GetChannel(testChannel TestChannel) channeltypes.Channel
// GetAcknowledgement retrieves an acknowledgement for the provided packet. If the
// acknowledgement does not exist then testing will fail.
func (chain *TestChain) GetAcknowledgement(packet channelexported.PacketI) []byte {
func (chain *TestChain) GetAcknowledgement(packet exported.PacketI) []byte {
ack, found := chain.App.IBCKeeper.ChannelKeeper.GetPacketAcknowledgement(chain.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
require.True(chain.t, found)
@ -371,18 +370,18 @@ func (chain *TestChain) GetFirstTestConnection(clientID, counterpartyClientID st
// ConstructMsgCreateClient constructs a message to create a new client state (tendermint or solomachine).
func (chain *TestChain) ConstructMsgCreateClient(counterparty *TestChain, clientID string, clientType string) *clienttypes.MsgCreateClient {
var (
clientState clientexported.ClientState
consensusState clientexported.ConsensusState
clientState exported.ClientState
consensusState exported.ConsensusState
)
switch clientType {
case clientexported.ClientTypeTendermint:
case exported.ClientTypeTendermint:
clientState = ibctmtypes.NewClientState(
counterparty.ChainID, DefaultTrustLevel, TrustingPeriod, UnbondingPeriod, MaxClockDrift,
clienttypes.NewHeight(0, counterparty.LastHeader.GetHeight()), commitmenttypes.GetSDKSpecs(),
)
consensusState = counterparty.LastHeader.ConsensusState()
case clientexported.ClientTypeSoloMachine:
case exported.ClientTypeSoloMachine:
solo := NewSolomachine(chain.t, clientID)
clientState = solo.ClientState()
consensusState = solo.ConsensusState()
@ -401,7 +400,7 @@ func (chain *TestChain) ConstructMsgCreateClient(counterparty *TestChain, client
// client will be created on the (target) chain.
func (chain *TestChain) CreateTMClient(counterparty *TestChain, clientID string) error {
// construct MsgCreateClient using counterparty
msg := chain.ConstructMsgCreateClient(counterparty, clientID, clientexported.ClientTypeTendermint)
msg := chain.ConstructMsgCreateClient(counterparty, clientID, exported.ClientTypeTendermint)
return chain.sendMsgs(msg)
}
@ -746,7 +745,7 @@ func (chain *TestChain) GetPacketData(counterparty *TestChain) []byte {
// SendPacket simulates sending a packet through the channel keeper. No message needs to be
// passed since this call is made from a module.
func (chain *TestChain) SendPacket(
packet channelexported.PacketI,
packet exported.PacketI,
) error {
channelCap := chain.GetChannelCapability(packet.GetSourcePort(), packet.GetSourceChannel())
@ -765,7 +764,7 @@ func (chain *TestChain) SendPacket(
// ReceiveExecuted simulates receiving and writing an acknowledgement to the chain.
func (chain *TestChain) ReceiveExecuted(
packet channelexported.PacketI,
packet exported.PacketI,
) error {
channelCap := chain.GetChannelCapability(packet.GetDestPort(), packet.GetDestChannel())
@ -785,7 +784,7 @@ func (chain *TestChain) ReceiveExecuted(
// AcknowledgementExecuted simulates deleting a packet commitment with the
// given packet sequence.
func (chain *TestChain) AcknowledgementExecuted(
packet channelexported.PacketI,
packet exported.PacketI,
) error {
channelCap := chain.GetChannelCapability(packet.GetSourcePort(), packet.GetSourceChannel())

View File

@ -10,10 +10,9 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
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"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
var (
@ -50,7 +49,7 @@ func NewCoordinator(t *testing.T, n int) *Coordinator {
func (coord *Coordinator) Setup(
chainA, chainB *TestChain, order channeltypes.Order,
) (string, string, *TestConnection, *TestConnection, TestChannel, TestChannel) {
clientA, clientB, connA, connB := coord.SetupClientConnections(chainA, chainB, clientexported.Tendermint)
clientA, clientB, connA, connB := coord.SetupClientConnections(chainA, chainB, exported.Tendermint)
// channels can also be referenced through the returned connections
channelA, channelB := coord.CreateMockChannels(chainA, chainB, connA, connB, order)
@ -62,7 +61,7 @@ func (coord *Coordinator) Setup(
// caller does not anticipate any errors.
func (coord *Coordinator) SetupClients(
chainA, chainB *TestChain,
clientType clientexported.ClientType,
clientType exported.ClientType,
) (string, string) {
clientA, err := coord.CreateClient(chainA, chainB, clientType)
@ -79,7 +78,7 @@ func (coord *Coordinator) SetupClients(
// anticipate any errors.
func (coord *Coordinator) SetupClientConnections(
chainA, chainB *TestChain,
clientType clientexported.ClientType,
clientType exported.ClientType,
) (string, string, *TestConnection, *TestConnection) {
clientA, clientB := coord.SetupClients(chainA, chainB, clientType)
@ -92,14 +91,14 @@ func (coord *Coordinator) SetupClientConnections(
// CreateClient creates a counterparty client on the source chain and returns the clientID.
func (coord *Coordinator) CreateClient(
source, counterparty *TestChain,
clientType clientexported.ClientType,
clientType exported.ClientType,
) (clientID string, err error) {
coord.CommitBlock(source, counterparty)
clientID = source.NewClientID(counterparty.ChainID)
switch clientType {
case clientexported.Tendermint:
case exported.Tendermint:
err = source.CreateTMClient(counterparty, clientID)
default:
@ -119,12 +118,12 @@ func (coord *Coordinator) CreateClient(
func (coord *Coordinator) UpdateClient(
source, counterparty *TestChain,
clientID string,
clientType clientexported.ClientType,
clientType exported.ClientType,
) (err error) {
coord.CommitBlock(source, counterparty)
switch clientType {
case clientexported.Tendermint:
case exported.Tendermint:
err = source.UpdateTMClient(counterparty, clientID)
default:
@ -216,7 +215,7 @@ func (coord *Coordinator) CreateChannel(
// counterparty client for the source chain.
func (coord *Coordinator) SendPacket(
source, counterparty *TestChain,
packet channelexported.PacketI,
packet exported.PacketI,
counterpartyClientID string,
) error {
if err := source.SendPacket(packet); err != nil {
@ -227,7 +226,7 @@ func (coord *Coordinator) SendPacket(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
counterpartyClientID, clientexported.Tendermint,
counterpartyClientID, exported.Tendermint,
)
}
@ -252,7 +251,7 @@ func (coord *Coordinator) RecvPacket(
// counterparty client for the source chain.
func (coord *Coordinator) ReceiveExecuted(
source, counterparty *TestChain,
packet channelexported.PacketI,
packet exported.PacketI,
counterpartyClientID string,
) error {
if err := source.ReceiveExecuted(packet); err != nil {
@ -263,7 +262,7 @@ func (coord *Coordinator) ReceiveExecuted(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
counterpartyClientID, clientexported.Tendermint,
counterpartyClientID, exported.Tendermint,
)
}
@ -289,7 +288,7 @@ func (coord *Coordinator) AcknowledgePacket(
// packet sequence since the acknowledgement has been verified.
func (coord *Coordinator) AcknowledgementExecuted(
source, counterparty *TestChain,
packet channelexported.PacketI,
packet exported.PacketI,
counterpartyClientID string,
) error {
if err := source.AcknowledgementExecuted(packet); err != nil {
@ -300,7 +299,7 @@ func (coord *Coordinator) AcknowledgementExecuted(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
counterpartyClientID, clientexported.Tendermint,
counterpartyClientID, exported.Tendermint,
)
}
@ -347,7 +346,7 @@ func (coord *Coordinator) SendMsgs(source, counterparty *TestChain, counterparty
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
counterpartyClientID, clientexported.Tendermint,
counterpartyClientID, exported.Tendermint,
)
}
@ -406,7 +405,7 @@ func (coord *Coordinator) ConnOpenInit(
// update source client on counterparty connection
if err := coord.UpdateClient(
counterparty, source,
counterpartyClientID, clientexported.Tendermint,
counterpartyClientID, exported.Tendermint,
); err != nil {
return sourceConnection, counterpartyConnection, err
}
@ -429,7 +428,7 @@ func (coord *Coordinator) ConnOpenTry(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
counterpartyConnection.ClientID, clientexported.Tendermint,
counterpartyConnection.ClientID, exported.Tendermint,
)
}
@ -448,7 +447,7 @@ func (coord *Coordinator) ConnOpenAck(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
counterpartyConnection.ClientID, clientexported.Tendermint,
counterpartyConnection.ClientID, exported.Tendermint,
)
}
@ -466,7 +465,7 @@ func (coord *Coordinator) ConnOpenConfirm(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
counterpartyConnection.ClientID, clientexported.Tendermint,
counterpartyConnection.ClientID, exported.Tendermint,
)
}
@ -498,7 +497,7 @@ func (coord *Coordinator) ChanOpenInit(
// update source client on counterparty connection
if err := coord.UpdateClient(
counterparty, source,
counterpartyConnection.ClientID, clientexported.Tendermint,
counterpartyConnection.ClientID, exported.Tendermint,
); err != nil {
return sourceChannel, counterpartyChannel, err
}
@ -524,7 +523,7 @@ func (coord *Coordinator) ChanOpenTry(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
connection.CounterpartyClientID, clientexported.Tendermint,
connection.CounterpartyClientID, exported.Tendermint,
)
}
@ -543,7 +542,7 @@ func (coord *Coordinator) ChanOpenAck(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
sourceChannel.CounterpartyClientID, clientexported.Tendermint,
sourceChannel.CounterpartyClientID, exported.Tendermint,
)
}
@ -562,7 +561,7 @@ func (coord *Coordinator) ChanOpenConfirm(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
sourceChannel.CounterpartyClientID, clientexported.Tendermint,
sourceChannel.CounterpartyClientID, exported.Tendermint,
)
}
@ -583,7 +582,7 @@ func (coord *Coordinator) ChanCloseInit(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
channel.CounterpartyClientID, clientexported.Tendermint,
channel.CounterpartyClientID, exported.Tendermint,
)
}
@ -602,6 +601,6 @@ func (coord *Coordinator) SetChannelClosed(
// update source client on counterparty connection
return coord.UpdateClient(
counterparty, source,
testChannel.CounterpartyClientID, clientexported.Tendermint,
testChannel.CounterpartyClientID, exported.Tendermint,
)
}