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:
parent
4b2024cf30
commit
979e8144fb
|
@ -7,8 +7,8 @@ import (
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/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"
|
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"
|
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
|
// constructs a send from chainA to chainB on the established channel/connection
|
||||||
// and sends the same coin back from chainB to chainA.
|
// and sends the same coin back from chainB to chainA.
|
||||||
func (suite *HandlerTestSuite) TestHandleMsgTransfer() {
|
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)
|
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)
|
originalBalance := suite.chainA.App.BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom)
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ import (
|
||||||
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/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"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
ibcexported "github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
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
|
// ReceiveExecuted defines a wrapper function for the channel Keeper's function
|
||||||
// in order to expose it to the ICS20 transfer handler.
|
// in order to expose it to the ICS20 transfer handler.
|
||||||
// Keeper retrieves channel capability and passes it into channel keeper for authentication
|
// 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()))
|
chanCap, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(packet.GetDestPort(), packet.GetDestChannel()))
|
||||||
if !ok {
|
if !ok {
|
||||||
return sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "channel capability could not be retrieved for packet")
|
return sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "channel capability could not be retrieved for packet")
|
||||||
|
|
|
@ -4,10 +4,9 @@ import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
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.
|
// AccountKeeper defines the contract required for account APIs.
|
||||||
|
@ -29,14 +28,14 @@ type BankKeeper interface {
|
||||||
type ChannelKeeper interface {
|
type ChannelKeeper interface {
|
||||||
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
|
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
|
||||||
GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
|
GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
|
||||||
SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet channelexported.PacketI) error
|
SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error
|
||||||
ReceiveExecuted(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet channelexported.PacketI, acknowledgement []byte) 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
|
ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientKeeper defines the expected IBC client keeper
|
// ClientKeeper defines the expected IBC client keeper
|
||||||
type ClientKeeper interface {
|
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
|
// ConnectionKeeper defines the expected IBC connection keeper
|
||||||
|
|
|
@ -2,8 +2,8 @@ package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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/keeper"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BeginBlocker updates an existing localhost client with the latest block height.
|
// BeginBlocker updates an existing localhost client with the latest block height.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
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"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/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
|
// InitGenesis initializes the ibc client submodule's state from a provided genesis
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
"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/02-client/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateClient creates a new client state and populates it with a given consensus
|
// CreateClient creates a new client state and populates it with a given consensus
|
||||||
|
|
|
@ -6,11 +6,11 @@ import (
|
||||||
|
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package keeper
|
package keeper
|
||||||
|
|
||||||
import (
|
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/02-client/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnmarshalClientState attempts to decode and return an ClientState object from
|
// UnmarshalClientState attempts to decode and return an ClientState object from
|
||||||
|
|
|
@ -12,9 +12,9 @@ import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
"github.com/cosmos/cosmos-sdk/types/query"
|
"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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ types.QueryServer = Keeper{}
|
var _ types.QueryServer = Keeper{}
|
||||||
|
|
|
@ -8,10 +8,10 @@ import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/types/query"
|
"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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) TestQueryClientState() {
|
func (suite *KeeperTestSuite) TestQueryClientState() {
|
||||||
|
|
|
@ -13,11 +13,11 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
"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/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Keeper represents a type that grants read and write permissions to any client
|
// Keeper represents a type that grants read and write permissions to any client
|
||||||
|
|
|
@ -14,13 +14,12 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
"github.com/cosmos/cosmos-sdk/simapp"
|
"github.com/cosmos/cosmos-sdk/simapp"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/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"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||||
)
|
)
|
||||||
|
@ -142,7 +141,7 @@ func (suite *KeeperTestSuite) TestSetClientConsensusState() {
|
||||||
func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState clientexported.ClientState
|
clientState exported.ClientState
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/types/kv"
|
"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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ ClientUnmarshaler = (*keeper.Keeper)(nil)
|
var _ ClientUnmarshaler = (*keeper.Keeper)(nil)
|
||||||
|
|
|
@ -9,11 +9,11 @@ import (
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/simapp"
|
"github.com/cosmos/cosmos-sdk/simapp"
|
||||||
"github.com/cosmos/cosmos-sdk/types/kv"
|
"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/simulation"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDecodeStore(t *testing.T) {
|
func TestDecodeStore(t *testing.T) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
proto "github.com/gogo/protobuf/proto"
|
proto "github.com/gogo/protobuf/proto"
|
||||||
|
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
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{}
|
var _ codectypes.UnpackInterfacesMessage = IdentifiedClientState{}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
"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.
|
// RegisterInterfaces registers the client interfaces to protobuf Any.
|
||||||
|
|
|
@ -3,15 +3,15 @@ package types_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/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"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type caseAny struct {
|
type caseAny struct {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"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
|
// MustUnmarshalClientState attempts to decode and return an ClientState object from
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
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"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -7,11 +7,11 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/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"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package types
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ exported.Height = (*Height)(nil)
|
var _ exported.Height = (*Height)(nil)
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// message types for the IBC client
|
// message types for the IBC client
|
||||||
|
|
|
@ -7,11 +7,11 @@ import (
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/stretchr/testify/suite"
|
"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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/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"
|
solomachinetypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,11 +12,11 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
clientutils "github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/utils"
|
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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QueryConnection returns a connection end.
|
// 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
|
// 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
|
// 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) {
|
func ParseClientState(cdc *codec.LegacyAmino, arg string) (exported.ClientState, error) {
|
||||||
var clientState clientexported.ClientState
|
var clientState exported.ClientState
|
||||||
if err := cdc.UnmarshalJSON([]byte(arg), &clientState); err != nil {
|
if err := cdc.UnmarshalJSON([]byte(arg), &clientState); err != nil {
|
||||||
// check for file path if JSON input is not provided
|
// check for file path if JSON input is not provided
|
||||||
contents, err := ioutil.ReadFile(arg)
|
contents, err := ioutil.ReadFile(arg)
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/types/query"
|
"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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func (suite *KeeperTestSuite) TestQueryConnection() {
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
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)
|
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
|
||||||
connB := suite.chainB.GetFirstTestConnection(clientB, clientA)
|
connB := suite.chainB.GetFirstTestConnection(clientB, clientA)
|
||||||
|
|
||||||
|
@ -111,11 +111,11 @@ func (suite *KeeperTestSuite) TestQueryConnections() {
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
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)
|
connA1, connB1, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
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())
|
counterparty1 := types.NewCounterparty(clientB, connB0.ID, suite.chainB.GetPrefix())
|
||||||
counterparty2 := types.NewCounterparty(clientB, connB1.ID, suite.chainB.GetPrefix())
|
counterparty2 := types.NewCounterparty(clientB, connB1.ID, suite.chainB.GetPrefix())
|
||||||
|
@ -197,7 +197,7 @@ func (suite *KeeperTestSuite) TestQueryClientConnections() {
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
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)
|
connA1, _ := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
expPaths = []string{connA0.ID, connA1.ID}
|
expPaths = []string{connA0.ID, connA1.ID}
|
||||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetClientConnectionPaths(suite.chainA.GetContext(), clientA, expPaths)
|
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetClientConnectionPaths(suite.chainA.GetContext(), clientA, expPaths)
|
||||||
|
@ -282,7 +282,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionClientState() {
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
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)
|
expClientState := suite.chainA.GetClientState(clientA)
|
||||||
expIdentifiedClientState = clienttypes.NewIdentifiedClientState(clientA, expClientState)
|
expIdentifiedClientState = clienttypes.NewIdentifiedClientState(clientA, expClientState)
|
||||||
|
@ -318,7 +318,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionClientState() {
|
||||||
func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
||||||
var (
|
var (
|
||||||
req *types.QueryConnectionConsensusStateRequest
|
req *types.QueryConnectionConsensusStateRequest
|
||||||
expConsensusState clientexported.ConsensusState
|
expConsensusState exported.ConsensusState
|
||||||
expClientID string
|
expClientID string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
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)
|
clientState := suite.chainA.GetClientState(clientA)
|
||||||
expConsensusState, _ = suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
|
expConsensusState, _ = suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConnOpenInit initialises a connection attempt on chain A.
|
// ConnOpenInit initialises a connection attempt on chain A.
|
||||||
|
@ -49,7 +49,7 @@ func (k Keeper) ConnOpenTry(
|
||||||
connectionID string, // desiredIdentifier
|
connectionID string, // desiredIdentifier
|
||||||
counterparty types.Counterparty, // counterpartyConnectionIdentifier, counterpartyPrefix and counterpartyClientIdentifier
|
counterparty types.Counterparty, // counterpartyConnectionIdentifier, counterpartyPrefix and counterpartyClientIdentifier
|
||||||
clientID string, // clientID of chainA
|
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
|
counterpartyVersions []string, // supported versions of chain A
|
||||||
proofInit []byte, // proof that chainA stored connectionEnd in state (on ConnOpenInit)
|
proofInit []byte, // proof that chainA stored connectionEnd in state (on ConnOpenInit)
|
||||||
proofClient []byte, // proof that chainA stored a light client of chainB
|
proofClient []byte, // proof that chainA stored a light client of chainB
|
||||||
|
@ -141,7 +141,7 @@ func (k Keeper) ConnOpenTry(
|
||||||
func (k Keeper) ConnOpenAck(
|
func (k Keeper) ConnOpenAck(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
connectionID string,
|
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
|
encodedVersion string, // version that ChainB chose in ConnOpenTry
|
||||||
proofTry []byte, // proof that connectionEnd was added to ChainB state in ConnOpenTry
|
proofTry []byte, // proof that connectionEnd was added to ChainB state in ConnOpenTry
|
||||||
proofClient []byte, // proof of client state on chainB for chainA
|
proofClient []byte, // proof of client state on chainB for chainA
|
||||||
|
|
|
@ -3,10 +3,10 @@ package keeper_test
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
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/03-connection/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
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
|
// TestConnOpenInit - chainA initializes (INIT state) a connection with
|
||||||
|
@ -23,14 +23,14 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
{"success", func() {
|
{"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},
|
}, true},
|
||||||
{"connection already exists", func() {
|
{"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},
|
}, false},
|
||||||
{"couldn't add connection to client", func() {
|
{"couldn't add connection to client", func() {
|
||||||
// swap client identifiers to result in client that does not exist
|
// 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},
|
}, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
clientB string
|
clientB string
|
||||||
versions []string
|
versions []string
|
||||||
consensusHeight uint64
|
consensusHeight uint64
|
||||||
counterpartyClient clientexported.ClientState
|
counterpartyClient exported.ClientState
|
||||||
)
|
)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
|
@ -73,7 +73,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
{"success", func() {
|
{"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)
|
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||||
}, true},
|
}, true},
|
||||||
{"invalid counterparty client", func() {
|
{"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)
|
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), clientA, tmClient)
|
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), clientA, tmClient)
|
||||||
}, false},
|
}, false},
|
||||||
{"consensus height >= latest height", func() {
|
{"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)
|
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
consensusHeight = uint64(suite.chainB.GetContext().BlockHeight())
|
consensusHeight = uint64(suite.chainB.GetContext().BlockHeight())
|
||||||
}, false},
|
}, false},
|
||||||
{"self consensus state not found", func() {
|
{"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)
|
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
consensusHeight = 1
|
consensusHeight = 1
|
||||||
}, false},
|
}, false},
|
||||||
{"counterparty versions is empty", func() {
|
{"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)
|
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
versions = nil
|
versions = nil
|
||||||
}, false},
|
}, false},
|
||||||
{"counterparty versions don't have a match", func() {
|
{"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)
|
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -138,14 +138,14 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
versions = []string{version}
|
versions = []string{version}
|
||||||
}, false},
|
}, false},
|
||||||
{"connection state verification failed", func() {
|
{"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
|
// chainA connection not created
|
||||||
|
|
||||||
// retrieve client state of chainA to pass as counterpartyClient
|
// retrieve client state of chainA to pass as counterpartyClient
|
||||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||||
}, false},
|
}, false},
|
||||||
{"client state verification failed", func() {
|
{"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)
|
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
tmClient.LatestHeight = tmClient.LatestHeight.Increment()
|
tmClient.LatestHeight = tmClient.LatestHeight.Increment()
|
||||||
}, false},
|
}, false},
|
||||||
{"consensus state verification failed", func() {
|
{"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
|
// retrieve client state of chainA to pass as counterpartyClient
|
||||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||||
|
@ -177,7 +177,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
}, false},
|
}, false},
|
||||||
{"invalid previous connection is in TRYOPEN", func() {
|
{"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
|
// retrieve client state of chainA to pass as counterpartyClient
|
||||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||||
|
@ -246,7 +246,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
clientB string
|
clientB string
|
||||||
consensusHeight uint64
|
consensusHeight uint64
|
||||||
version string
|
version string
|
||||||
counterpartyClient clientexported.ClientState
|
counterpartyClient exported.ClientState
|
||||||
)
|
)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
|
@ -255,7 +255,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
{"success", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
}, true},
|
}, true},
|
||||||
{"success from tryopen", func() {
|
{"success from tryopen", func() {
|
||||||
// chainA is in TRYOPEN, chainB is in TRYOPEN
|
// 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)
|
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -279,15 +279,15 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
connection.State = types.TRYOPEN
|
connection.State = types.TRYOPEN
|
||||||
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
|
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
|
||||||
// update clientB so state change is committed
|
// 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
|
// retrieve client state of chainB to pass as counterpartyClient
|
||||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||||
}, true},
|
}, true},
|
||||||
{"invalid counterparty client", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
}, false},
|
}, false},
|
||||||
{"consensus height >= latest height", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -319,14 +319,14 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
}, false},
|
}, false},
|
||||||
{"connection not found", func() {
|
{"connection not found", func() {
|
||||||
// connections are never created
|
// 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
|
// retrieve client state of chainB to pass as counterpartyClient
|
||||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection state is not INIT", func() {
|
{"connection state is not INIT", func() {
|
||||||
// connection state is already OPEN on chainA
|
// 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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
}, false},
|
}, false},
|
||||||
{"incompatible IBC versions", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
version = "(2.0,[])"
|
version = "(2.0,[])"
|
||||||
}, false},
|
}, false},
|
||||||
{"empty version", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
version = ""
|
version = ""
|
||||||
}, false},
|
}, false},
|
||||||
{"feature set verification failed - unsupported feature", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
}, false},
|
}, false},
|
||||||
{"self consensus state not found", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
}, false},
|
}, false},
|
||||||
{"connection state verification failed", func() {
|
{"connection state verification failed", func() {
|
||||||
// chainB connection is not in INIT
|
// 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)
|
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||||
}, false},
|
}, false},
|
||||||
{"client state verification failed", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
}, false},
|
}, false},
|
||||||
{"consensus state verification failed", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() {
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
{"success", func() {
|
{"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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -509,15 +509,15 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() {
|
||||||
}, true},
|
}, true},
|
||||||
{"connection not found", func() {
|
{"connection not found", func() {
|
||||||
// connections are never created
|
// 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},
|
}, false},
|
||||||
{"chain B's connection state is not TRYOPEN", func() {
|
{"chain B's connection state is not TRYOPEN", func() {
|
||||||
// connections are OPEN
|
// 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},
|
}, false},
|
||||||
{"connection state verification failed", func() {
|
{"connection state verification failed", func() {
|
||||||
// chainA is in INIT
|
// 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)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,11 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Keeper defines the IBC connection keeper
|
// 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
|
// GetCommitmentPrefix returns the IBC connection store prefix as a commitment
|
||||||
// Prefix
|
// Prefix
|
||||||
func (k Keeper) GetCommitmentPrefix() commitmentexported.Prefix {
|
func (k Keeper) GetCommitmentPrefix() exported.Prefix {
|
||||||
return commitmenttypes.NewMerklePrefix([]byte(k.storeKey.Name()))
|
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.
|
// no paths are stored.
|
||||||
func (k Keeper) GetAllClientConnectionPaths(ctx sdk.Context) []types.ConnectionPaths {
|
func (k Keeper) GetAllClientConnectionPaths(ctx sdk.Context) []types.ConnectionPaths {
|
||||||
var allConnectionPaths []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)
|
paths, found := k.GetClientConnectionPaths(ctx, clientID)
|
||||||
if !found {
|
if !found {
|
||||||
// continue when connection handshake is not initialized
|
// continue when connection handshake is not initialized
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"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/03-connection/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ func TestKeeperTestSuite(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) TestSetAndGetConnection() {
|
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)
|
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
|
||||||
_, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), connA.ID)
|
_, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), connA.ID)
|
||||||
suite.Require().False(existed)
|
suite.Require().False(existed)
|
||||||
|
@ -43,7 +43,7 @@ func (suite *KeeperTestSuite) TestSetAndGetConnection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() {
|
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)
|
_, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetClientConnectionPaths(suite.chainA.GetContext(), clientA)
|
||||||
suite.False(existed)
|
suite.False(existed)
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() {
|
||||||
|
|
||||||
// create 2 connections: A0 - B0, A1 - B1
|
// create 2 connections: A0 - B0, A1 - B1
|
||||||
func (suite KeeperTestSuite) TestGetAllConnections() {
|
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)
|
connA1, connB1 := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
|
|
||||||
counterpartyB0 := types.NewCounterparty(clientB, connB0.ID, suite.chainB.GetPrefix()) // connection B0
|
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
|
// the test creates 2 clients clientA0 and clientA1. clientA0 has a single
|
||||||
// connection and clientA1 has 2 connections.
|
// connection and clientA1 has 2 connections.
|
||||||
func (suite KeeperTestSuite) TestGetAllClientConnectionPaths() {
|
func (suite KeeperTestSuite) TestGetAllClientConnectionPaths() {
|
||||||
clientA0, _, connA0, _ := 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, clientexported.Tendermint)
|
clientA1, clientB1, connA1, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||||
connA2, _ := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA1, clientB1)
|
connA2, _ := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA1, clientB1)
|
||||||
|
|
||||||
expPaths := []types.ConnectionPaths{
|
expPaths := []types.ConnectionPaths{
|
||||||
|
@ -102,7 +102,7 @@ func (suite *KeeperTestSuite) TestGetTimestampAtHeight() {
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
{"verification success", func() {
|
{"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)
|
connection = suite.chainA.GetConnection(connA)
|
||||||
}, true},
|
}, true},
|
||||||
{"consensus state not found", func() {
|
{"consensus state not found", func() {
|
||||||
|
|
|
@ -3,10 +3,8 @@ package keeper
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// VerifyClientState verifies a proof of a client state of the running machine
|
// VerifyClientState verifies a proof of a client state of the running machine
|
||||||
|
@ -16,7 +14,7 @@ func (k Keeper) VerifyClientState(
|
||||||
connection exported.ConnectionI,
|
connection exported.ConnectionI,
|
||||||
height uint64,
|
height uint64,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
clientState clientexported.ClientState,
|
clientState exported.ClientState,
|
||||||
) error {
|
) error {
|
||||||
clientID := connection.GetClientID()
|
clientID := connection.GetClientID()
|
||||||
targetClient, found := k.clientKeeper.GetClientState(ctx, clientID)
|
targetClient, found := k.clientKeeper.GetClientState(ctx, clientID)
|
||||||
|
@ -46,7 +44,7 @@ func (k Keeper) VerifyClientConsensusState(
|
||||||
height uint64,
|
height uint64,
|
||||||
consensusHeight uint64,
|
consensusHeight uint64,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
consensusState clientexported.ConsensusState,
|
consensusState exported.ConsensusState,
|
||||||
) error {
|
) error {
|
||||||
clientID := connection.GetClientID()
|
clientID := connection.GetClientID()
|
||||||
clientState, found := k.clientKeeper.GetClientState(ctx, clientID)
|
clientState, found := k.clientKeeper.GetClientState(ctx, clientID)
|
||||||
|
@ -103,7 +101,7 @@ func (k Keeper) VerifyChannelState(
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
channel channelexported.ChannelI,
|
channel exported.ChannelI,
|
||||||
) error {
|
) error {
|
||||||
clientState, found := k.clientKeeper.GetClientState(ctx, connection.GetClientID())
|
clientState, found := k.clientKeeper.GetClientState(ctx, connection.GetClientID())
|
||||||
if !found {
|
if !found {
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
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/03-connection/types"
|
||||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
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"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func (suite *KeeperTestSuite) TestVerifyClientState() {
|
||||||
suite.Run(tc.msg, func() {
|
suite.Run(tc.msg, func() {
|
||||||
suite.SetupTest() // reset
|
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)
|
counterpartyClient, clientProof := suite.chainB.QueryClientStateProof(clientB)
|
||||||
proofHeight := uint64(suite.chainB.GetContext().BlockHeight() - 1)
|
proofHeight := uint64(suite.chainB.GetContext().BlockHeight() - 1)
|
||||||
|
@ -79,20 +79,20 @@ func (suite *KeeperTestSuite) TestVerifyClientConsensusState() {
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
{"verification success", func() {
|
{"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},
|
}, true},
|
||||||
{"client state not found", func() {
|
{"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
|
changeClientID = true
|
||||||
}, false},
|
}, false},
|
||||||
{"consensus state not found", func() {
|
{"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
|
heightDiff = 5
|
||||||
}, false},
|
}, false},
|
||||||
{"verification failed", func() {
|
{"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
|
clientB := connB.ClientID
|
||||||
|
|
||||||
// give chainB wrong consensus state for chainA
|
// give chainB wrong consensus state for chainA
|
||||||
|
@ -165,7 +165,7 @@ func (suite *KeeperTestSuite) TestVerifyConnectionState() {
|
||||||
suite.Run(tc.msg, func() {
|
suite.Run(tc.msg, func() {
|
||||||
suite.SetupTest() // reset
|
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)
|
connection := suite.chainA.GetConnection(connA)
|
||||||
if tc.changeClientID {
|
if tc.changeClientID {
|
||||||
|
@ -397,7 +397,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgementAbsence() {
|
||||||
} else {
|
} else {
|
||||||
// need to update height to prove absence
|
// need to update height to prove absence
|
||||||
suite.coordinator.CommitBlock(suite.chainA, suite.chainB)
|
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())
|
packetAckKey := host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/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
|
// RegisterInterfaces register the ibc interfaces submodule implementations to protobuf
|
||||||
|
@ -15,15 +15,15 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||||
(*exported.ConnectionI)(nil),
|
(*exported.ConnectionI)(nil),
|
||||||
)
|
)
|
||||||
registry.RegisterInterface(
|
registry.RegisterInterface(
|
||||||
"cosmos_sdk.ibc.v1.connection.CounterpartyI",
|
"cosmos_sdk.ibc.v1.connection.CounterpartyConnectionI",
|
||||||
(*exported.CounterpartyI)(nil),
|
(*exported.CounterpartyConnectionI)(nil),
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*exported.ConnectionI)(nil),
|
(*exported.ConnectionI)(nil),
|
||||||
&ConnectionEnd{},
|
&ConnectionEnd{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*exported.CounterpartyI)(nil),
|
(*exported.CounterpartyConnectionI)(nil),
|
||||||
&Counterparty{},
|
&Counterparty{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
|
|
|
@ -2,10 +2,9 @@ package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ exported.ConnectionI = (*ConnectionEnd)(nil)
|
var _ exported.ConnectionI = (*ConnectionEnd)(nil)
|
||||||
|
@ -31,7 +30,7 @@ func (c ConnectionEnd) GetClientID() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCounterparty implements the Connection interface
|
// GetCounterparty implements the Connection interface
|
||||||
func (c ConnectionEnd) GetCounterparty() exported.CounterpartyI {
|
func (c ConnectionEnd) GetCounterparty() exported.CounterpartyConnectionI {
|
||||||
return c.Counterparty
|
return c.Counterparty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +57,7 @@ func (c ConnectionEnd) ValidateBasic() error {
|
||||||
return c.Counterparty.ValidateBasic()
|
return c.Counterparty.ValidateBasic()
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ exported.CounterpartyI = (*Counterparty)(nil)
|
var _ exported.CounterpartyConnectionI = (*Counterparty)(nil)
|
||||||
|
|
||||||
// NewCounterparty creates a new Counterparty instance.
|
// NewCounterparty creates a new Counterparty instance.
|
||||||
func NewCounterparty(clientID, connectionID string, prefix commitmenttypes.MerklePrefix) Counterparty {
|
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 {
|
func (c Counterparty) GetClientID() string {
|
||||||
return c.ClientId
|
return c.ClientId
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetConnectionID implements the CounterpartyI interface
|
// GetConnectionID implements the CounterpartyConnectionI interface
|
||||||
func (c Counterparty) GetConnectionID() string {
|
func (c Counterparty) GetConnectionID() string {
|
||||||
return c.ConnectionId
|
return c.ConnectionId
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPrefix implements the CounterpartyI interface
|
// GetPrefix implements the CounterpartyConnectionI interface
|
||||||
func (c Counterparty) GetPrefix() commitmentexported.Prefix {
|
func (c Counterparty) GetPrefix() exported.Prefix {
|
||||||
return &c.Prefix
|
return &c.Prefix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,15 @@ package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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
|
// ClientKeeper expected account IBC client keeper
|
||||||
type ClientKeeper interface {
|
type ClientKeeper interface {
|
||||||
GetClientState(ctx sdk.Context, clientID string) (clientexported.ClientState, bool)
|
GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)
|
||||||
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (clientexported.ConsensusState, bool)
|
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (exported.ConsensusState, bool)
|
||||||
GetSelfConsensusState(ctx sdk.Context, height uint64) (clientexported.ConsensusState, bool)
|
GetSelfConsensusState(ctx sdk.Context, height uint64) (exported.ConsensusState, bool)
|
||||||
ValidateSelfClient(ctx sdk.Context, clientState clientexported.ClientState) error
|
ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error
|
||||||
IterateClients(ctx sdk.Context, cb func(string, clientexported.ClientState) bool)
|
IterateClients(ctx sdk.Context, cb func(string, exported.ClientState) bool)
|
||||||
ClientStore(ctx sdk.Context, clientID string) sdk.KVStore
|
ClientStore(ctx sdk.Context, clientID string) sdk.KVStore
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,10 @@ package types
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ sdk.Msg = &MsgConnectionOpenInit{}
|
var _ sdk.Msg = &MsgConnectionOpenInit{}
|
||||||
|
@ -65,7 +65,7 @@ var _ sdk.Msg = &MsgConnectionOpenTry{}
|
||||||
// NewMsgConnectionOpenTry creates a new MsgConnectionOpenTry instance
|
// NewMsgConnectionOpenTry creates a new MsgConnectionOpenTry instance
|
||||||
func NewMsgConnectionOpenTry(
|
func NewMsgConnectionOpenTry(
|
||||||
connectionID, clientID, counterpartyConnectionID,
|
connectionID, clientID, counterpartyConnectionID,
|
||||||
counterpartyClientID string, counterpartyClient clientexported.ClientState,
|
counterpartyClientID string, counterpartyClient exported.ClientState,
|
||||||
counterpartyPrefix commitmenttypes.MerklePrefix, counterpartyVersions []string,
|
counterpartyPrefix commitmenttypes.MerklePrefix, counterpartyVersions []string,
|
||||||
proofInit, proofClient, proofConsensus []byte,
|
proofInit, proofClient, proofConsensus []byte,
|
||||||
proofHeight, consensusHeight uint64, signer sdk.AccAddress,
|
proofHeight, consensusHeight uint64, signer sdk.AccAddress,
|
||||||
|
@ -158,7 +158,7 @@ var _ sdk.Msg = &MsgConnectionOpenAck{}
|
||||||
|
|
||||||
// NewMsgConnectionOpenAck creates a new MsgConnectionOpenAck instance
|
// NewMsgConnectionOpenAck creates a new MsgConnectionOpenAck instance
|
||||||
func NewMsgConnectionOpenAck(
|
func NewMsgConnectionOpenAck(
|
||||||
connectionID string, counterpartyClient clientexported.ClientState,
|
connectionID string, counterpartyClient exported.ClientState,
|
||||||
proofTry, proofClient, proofConsensus []byte,
|
proofTry, proofClient, proofConsensus []byte,
|
||||||
proofHeight, consensusHeight uint64, version string,
|
proofHeight, consensusHeight uint64, version string,
|
||||||
signer sdk.AccAddress,
|
signer sdk.AccAddress,
|
||||||
|
|
|
@ -9,10 +9,10 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
clientutils "github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/utils"
|
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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QueryPacketCommitment returns a packet commitment.
|
// QueryPacketCommitment returns a packet commitment.
|
||||||
|
@ -183,7 +183,7 @@ func QueryChannelConsensusState(
|
||||||
// counterparty ConsensusState given the source port ID and source channel ID.
|
// counterparty ConsensusState given the source port ID and source channel ID.
|
||||||
func QueryCounterpartyConsensusState(
|
func QueryCounterpartyConsensusState(
|
||||||
clientCtx client.Context, portID, channelID string, height uint64,
|
clientCtx client.Context, portID, channelID string, height uint64,
|
||||||
) (clientexported.ConsensusState, uint64, error) {
|
) (exported.ConsensusState, uint64, error) {
|
||||||
channelRes, err := QueryChannel(clientCtx, portID, channelID, false)
|
channelRes, err := QueryChannel(clientCtx, portID, channelID, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/types/query"
|
"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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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/04-channel/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) TestQueryChannel() {
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
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
|
// init channel
|
||||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
@ -377,7 +377,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() {
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
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
|
// init channel
|
||||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
@ -417,7 +417,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() {
|
||||||
func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||||
var (
|
var (
|
||||||
req *types.QueryChannelConsensusStateRequest
|
req *types.QueryChannelConsensusStateRequest
|
||||||
expConsensusState clientexported.ConsensusState
|
expConsensusState exported.ConsensusState
|
||||||
expClientID string
|
expClientID string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
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
|
// init channel
|
||||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
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"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||||
|
|
||||||
testCases := []testCase{
|
testCases := []testCase{
|
||||||
{"success", func() {
|
{"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"}
|
features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"}
|
||||||
suite.chainA.CreatePortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
|
suite.chainA.CreatePortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
|
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
|
@ -57,12 +57,12 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||||
portCap = nil
|
portCap = nil
|
||||||
}, false},
|
}, false},
|
||||||
{"capability is incorrect", func() {
|
{"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"}
|
features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"}
|
||||||
portCap = capabilitytypes.NewCapability(3)
|
portCap = capabilitytypes.NewCapability(3)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection version not negotiated", func() {
|
{"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
|
// modify connA versions
|
||||||
conn := suite.chainA.GetConnection(connA)
|
conn := suite.chainA.GetConnection(connA)
|
||||||
|
@ -80,7 +80,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||||
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
|
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection does not support ORDERED channels", func() {
|
{"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
|
// modify connA versions to only support UNORDERED channels
|
||||||
conn := suite.chainA.GetConnection(connA)
|
conn := suite.chainA.GetConnection(connA)
|
||||||
|
@ -158,14 +158,14 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||||
|
|
||||||
testCases := []testCase{
|
testCases := []testCase{
|
||||||
{"success", func() {
|
{"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.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
|
|
||||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
}, true},
|
}, true},
|
||||||
{"previous channel with invalid state", func() {
|
{"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
|
// make previous channel have wrong ordering
|
||||||
suite.coordinator.ChanOpenInit(suite.chainB, suite.chainA, connB, connA, ibctesting.TransferPort, ibctesting.TransferPort, types.UNORDERED)
|
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)
|
portCap = suite.chainB.GetPortCapability(connB.FirstOrNextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection is not OPEN", func() {
|
{"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
|
// pass capability check
|
||||||
suite.chainB.CreatePortCapability(connB.FirstOrNextTestChannel(ibctesting.TransferPort).PortID)
|
suite.chainB.CreatePortCapability(connB.FirstOrNextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
portCap = suite.chainB.GetPortCapability(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)
|
suite.Require().NoError(err)
|
||||||
}, false},
|
}, false},
|
||||||
{"consensus state not found", func() {
|
{"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.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
|
|
||||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
|
@ -200,17 +200,17 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||||
}, false},
|
}, false},
|
||||||
{"channel verification failed", func() {
|
{"channel verification failed", func() {
|
||||||
// not creating a channel on chainA will result in an invalid proof of existence
|
// 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)
|
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
}, false},
|
}, false},
|
||||||
{"port capability not found", func() {
|
{"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)
|
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
|
|
||||||
portCap = capabilitytypes.NewCapability(3)
|
portCap = capabilitytypes.NewCapability(3)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection version not negotiated", func() {
|
{"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)
|
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
|
|
||||||
// modify connB versions
|
// modify connB versions
|
||||||
|
@ -228,7 +228,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.TransferPort).PortID)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection does not support ORDERED channels", func() {
|
{"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)
|
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
|
|
||||||
// modify connA versions to only support UNORDERED channels
|
// modify connA versions to only support UNORDERED channels
|
||||||
|
@ -296,7 +296,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||||
|
|
||||||
testCases := []testCase{
|
testCases := []testCase{
|
||||||
{"success", func() {
|
{"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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection not found", func() {
|
{"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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
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)
|
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection is not OPEN", func() {
|
{"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
|
var err error
|
||||||
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
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)
|
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"consensus state not found", func() {
|
{"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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||||
}, false},
|
}, false},
|
||||||
{"channel verification failed", func() {
|
{"channel verification failed", func() {
|
||||||
// chainB is INIT, chainA in TRYOPEN
|
// 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)
|
channelB, channelA, err := suite.coordinator.ChanOpenInit(suite.chainB, suite.chainA, connB, connA, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"channel capability not found", func() {
|
{"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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||||
)
|
)
|
||||||
testCases := []testCase{
|
testCases := []testCase{
|
||||||
{"success", func() {
|
{"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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||||
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection not found", func() {
|
{"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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
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)
|
suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainB.GetContext(), channelB.PortID, channelB.ID, channel)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection is not OPEN", func() {
|
{"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
|
var err error
|
||||||
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
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)
|
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"consensus state not found", func() {
|
{"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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -479,7 +479,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||||
}, false},
|
}, false},
|
||||||
{"channel verification failed", func() {
|
{"channel verification failed", func() {
|
||||||
// chainA is INIT, chainB in TRYOPEN
|
// 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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||||
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"channel capability not found", func() {
|
{"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)
|
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.TransferPort, ibctesting.TransferPort, types.ORDERED)
|
||||||
suite.Require().NoError(err)
|
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)
|
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection is not OPEN", func() {
|
{"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
|
var err error
|
||||||
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
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)
|
suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainB.GetContext(), channelB.PortID, channelB.ID, channel)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection is not OPEN", func() {
|
{"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
|
var err error
|
||||||
connB, connA, err = suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
connB, connA, err = suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"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/04-channel/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
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.
|
// and existence of a channel in INIT on chainA.
|
||||||
func (suite *KeeperTestSuite) TestSetChannel() {
|
func (suite *KeeperTestSuite) TestSetChannel() {
|
||||||
// create client and connections on both chains
|
// 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
|
// check for channel to be created on chainB
|
||||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SendPacket is called by a module in order to send an IBC packet on a channel
|
// SendPacket is called by a module in order to send an IBC packet on a channel
|
||||||
|
|
|
@ -4,11 +4,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
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)
|
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"next sequence send not found", func() {
|
{"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)
|
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
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)
|
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection not OPEN", func() {
|
{"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
|
// connection on chainB is in INIT
|
||||||
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
@ -309,7 +308,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
|
||||||
suite.coordinator.ReceiveExecuted(suite.chainB, suite.chainA, packet, clientA)
|
suite.coordinator.ReceiveExecuted(suite.chainB, suite.chainA, packet, clientA)
|
||||||
}, false},
|
}, false},
|
||||||
{"next receive sequence is not found", func() {
|
{"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)
|
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||||
|
|
||||||
|
@ -390,7 +389,7 @@ func (suite *KeeperTestSuite) TestReceiveExecuted() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
}, false},
|
}, false},
|
||||||
{"next sequence receive not found", func() {
|
{"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)
|
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
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)
|
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
||||||
}, false},
|
}, false},
|
||||||
{"connection not OPEN", func() {
|
{"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
|
// connection on chainA is in INIT
|
||||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
@ -537,7 +536,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() {
|
||||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
}, false},
|
}, false},
|
||||||
{"next ack sequence not found", func() {
|
{"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)
|
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TimeoutPacket is called by a module which originally attempted to send a
|
// TimeoutPacket is called by a module which originally attempted to send a
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
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()))
|
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.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
// need to update chainA's client representing chainB to prove missing ack
|
// 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},
|
}, true},
|
||||||
{"success: UNORDERED", func() {
|
{"success: UNORDERED", func() {
|
||||||
ordered = false
|
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)
|
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.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
// need to update chainA's client representing chainB to prove missing ack
|
// 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},
|
}, true},
|
||||||
{"channel not found", func() {
|
{"channel not found", func() {
|
||||||
// use wrong channel naming
|
// 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)
|
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)
|
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.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},
|
}, false},
|
||||||
{"packet already received ", func() {
|
{"packet already received ", func() {
|
||||||
ordered = true
|
ordered = true
|
||||||
|
@ -85,12 +85,12 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
|
||||||
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
|
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()))
|
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.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},
|
}, false},
|
||||||
{"packet hasn't been sent", func() {
|
{"packet hasn't been sent", func() {
|
||||||
clientA, _, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
|
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()))
|
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},
|
}, false},
|
||||||
{"next seq receive verification failed", func() {
|
{"next seq receive verification failed", func() {
|
||||||
// set ordered to false resulting in wrong proof provided
|
// 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)
|
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)
|
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.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},
|
}, false},
|
||||||
{"packet ack verification failed", func() {
|
{"packet ack verification failed", func() {
|
||||||
// set ordered to true resulting in wrong proof provided
|
// 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)
|
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)
|
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.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},
|
}, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||||
// need to update chainA's client representing chainB to prove missing ack
|
// 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)
|
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, true},
|
}, true},
|
||||||
|
@ -223,7 +223,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||||
// need to update chainA's client representing chainB to prove missing ack
|
// 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)
|
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, true},
|
}, true},
|
||||||
|
@ -272,7 +272,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||||
// need to update chainA's client representing chainB to prove missing ack
|
// 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)
|
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, false},
|
}, 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()))
|
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.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
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)
|
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"packet ack verification failed", func() {
|
{"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)
|
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.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
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)
|
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||||
}, false},
|
}, false},
|
||||||
{"channel capability not found", func() {
|
{"channel capability not found", func() {
|
||||||
|
@ -310,7 +310,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||||
// need to update chainA's client representing chainB to prove missing ack
|
// 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)
|
chanCap = capabilitytypes.NewCapability(100)
|
||||||
}, false},
|
}, false},
|
||||||
|
|
|
@ -2,13 +2,13 @@ package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ exported.ChannelI = (*Channel)(nil)
|
_ exported.ChannelI = (*Channel)(nil)
|
||||||
_ exported.CounterpartyI = (*Counterparty)(nil)
|
_ exported.CounterpartyChannelI = (*Counterparty)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewChannel creates a new Channel instance
|
// NewChannel creates a new Channel instance
|
||||||
|
@ -36,7 +36,7 @@ func (ch Channel) GetOrdering() int32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCounterparty implements Channel interface.
|
// GetCounterparty implements Channel interface.
|
||||||
func (ch Channel) GetCounterparty() exported.CounterpartyI {
|
func (ch Channel) GetCounterparty() exported.CounterpartyChannelI {
|
||||||
return ch.Counterparty
|
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 {
|
func (c Counterparty) GetPortID() string {
|
||||||
return c.PortId
|
return c.PortId
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetChannelID implements CounterpartyI interface
|
// GetChannelID implements CounterpartyChannelI interface
|
||||||
func (c Counterparty) GetChannelID() string {
|
func (c Counterparty) GetChannelID() string {
|
||||||
return c.ChannelId
|
return c.ChannelId
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/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
|
// RegisterInterfaces register the ibc channel submodule interfaces to protobuf
|
||||||
|
@ -15,8 +15,8 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||||
(*exported.ChannelI)(nil),
|
(*exported.ChannelI)(nil),
|
||||||
)
|
)
|
||||||
registry.RegisterInterface(
|
registry.RegisterInterface(
|
||||||
"cosmos_sdk.ibc.v1.channel.CounterpartyI",
|
"cosmos_sdk.ibc.v1.channel.CounterpartyChannelI",
|
||||||
(*exported.CounterpartyI)(nil),
|
(*exported.CounterpartyChannelI)(nil),
|
||||||
)
|
)
|
||||||
registry.RegisterInterface(
|
registry.RegisterInterface(
|
||||||
"cosmos_sdk.ibc.v1.channel.PacketI",
|
"cosmos_sdk.ibc.v1.channel.PacketI",
|
||||||
|
@ -27,7 +27,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||||
&Channel{},
|
&Channel{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*exported.CounterpartyI)(nil),
|
(*exported.CounterpartyChannelI)(nil),
|
||||||
&Counterparty{},
|
&Counterparty{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
|
|
|
@ -3,16 +3,14 @@ package types
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
|
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClientKeeper expected account IBC client keeper
|
// ClientKeeper expected account IBC client keeper
|
||||||
type ClientKeeper interface {
|
type ClientKeeper interface {
|
||||||
GetClientState(ctx sdk.Context, clientID string) (clientexported.ClientState, bool)
|
GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)
|
||||||
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (clientexported.ConsensusState, bool)
|
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (exported.ConsensusState, bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConnectionKeeper expected account IBC connection keeper
|
// ConnectionKeeper expected account IBC connection keeper
|
||||||
|
@ -25,7 +23,7 @@ type ConnectionKeeper interface {
|
||||||
) (uint64, error)
|
) (uint64, error)
|
||||||
VerifyChannelState(
|
VerifyChannelState(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
connection connectionexported.ConnectionI,
|
connection exported.ConnectionI,
|
||||||
height uint64,
|
height uint64,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
|
@ -34,7 +32,7 @@ type ConnectionKeeper interface {
|
||||||
) error
|
) error
|
||||||
VerifyPacketCommitment(
|
VerifyPacketCommitment(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
connection connectionexported.ConnectionI,
|
connection exported.ConnectionI,
|
||||||
height uint64,
|
height uint64,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
|
@ -44,7 +42,7 @@ type ConnectionKeeper interface {
|
||||||
) error
|
) error
|
||||||
VerifyPacketAcknowledgement(
|
VerifyPacketAcknowledgement(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
connection connectionexported.ConnectionI,
|
connection exported.ConnectionI,
|
||||||
height uint64,
|
height uint64,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
|
@ -54,7 +52,7 @@ type ConnectionKeeper interface {
|
||||||
) error
|
) error
|
||||||
VerifyPacketAcknowledgementAbsence(
|
VerifyPacketAcknowledgementAbsence(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
connection connectionexported.ConnectionI,
|
connection exported.ConnectionI,
|
||||||
height uint64,
|
height uint64,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
|
@ -63,7 +61,7 @@ type ConnectionKeeper interface {
|
||||||
) error
|
) error
|
||||||
VerifyNextSequenceRecv(
|
VerifyNextSequenceRecv(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
connection connectionexported.ConnectionI,
|
connection exported.ConnectionI,
|
||||||
height uint64,
|
height uint64,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
|
|
|
@ -15,8 +15,8 @@ import (
|
||||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/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"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// define constants used for testing
|
// define constants used for testing
|
||||||
|
@ -46,7 +46,7 @@ var (
|
||||||
invalidPacket = types.NewPacket(unknownPacketData, 0, portid, chanid, cpportid, cpchanid, timeoutHeight, timeoutTimestamp)
|
invalidPacket = types.NewPacket(unknownPacketData, 0, portid, chanid, cpportid, cpchanid, timeoutHeight, timeoutTimestamp)
|
||||||
|
|
||||||
emptyProof = []byte{}
|
emptyProof = []byte{}
|
||||||
invalidProofs1 = commitmentexported.Proof(nil)
|
invalidProofs1 = exported.Proof(nil)
|
||||||
invalidProofs2 = emptyProof
|
invalidProofs2 = emptyProof
|
||||||
|
|
||||||
addr1 = sdk.AccAddress("testaddr1")
|
addr1 = sdk.AccAddress("testaddr1")
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
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:
|
// CommitPacket returns a packet commitment bytes. The commitment consists of:
|
||||||
|
|
|
@ -10,18 +10,15 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
|
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
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"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ clientexported.ClientState = (*ClientState)(nil)
|
var _ exported.ClientState = (*ClientState)(nil)
|
||||||
|
|
||||||
// NewClientState creates a new ClientState instance
|
// NewClientState creates a new ClientState instance
|
||||||
func NewClientState(
|
func NewClientState(
|
||||||
|
@ -47,8 +44,8 @@ func (cs ClientState) GetChainID() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientType is tendermint.
|
// ClientType is tendermint.
|
||||||
func (cs ClientState) ClientType() clientexported.ClientType {
|
func (cs ClientState) ClientType() exported.ClientType {
|
||||||
return clientexported.Tendermint
|
return exported.Tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLatestHeight returns latest block height.
|
// GetLatestHeight returns latest block height.
|
||||||
|
@ -119,12 +116,12 @@ func (cs ClientState) GetProofSpecs() []*ics23.ProofSpec {
|
||||||
func (cs ClientState) VerifyClientState(
|
func (cs ClientState) VerifyClientState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
provingRoot commitmentexported.Root,
|
provingRoot exported.Root,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
counterpartyClientIdentifier string,
|
counterpartyClientIdentifier string,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
clientState clientexported.ClientState,
|
clientState exported.ClientState,
|
||||||
) error {
|
) error {
|
||||||
merkleProof, _, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
|
merkleProof, _, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -159,13 +156,13 @@ func (cs ClientState) VerifyClientState(
|
||||||
func (cs ClientState) VerifyClientConsensusState(
|
func (cs ClientState) VerifyClientConsensusState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
provingRoot commitmentexported.Root,
|
provingRoot exported.Root,
|
||||||
height uint64,
|
height uint64,
|
||||||
counterpartyClientIdentifier string,
|
counterpartyClientIdentifier string,
|
||||||
consensusHeight uint64,
|
consensusHeight uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
consensusState clientexported.ConsensusState,
|
consensusState exported.ConsensusState,
|
||||||
) error {
|
) error {
|
||||||
merkleProof, _, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
|
merkleProof, _, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -205,10 +202,10 @@ func (cs ClientState) VerifyConnectionState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
connectionID string,
|
connectionID string,
|
||||||
connectionEnd connectionexported.ConnectionI,
|
connectionEnd exported.ConnectionI,
|
||||||
) error {
|
) error {
|
||||||
merkleProof, consensusState, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
|
merkleProof, consensusState, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -243,11 +240,11 @@ func (cs ClientState) VerifyChannelState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
channel channelexported.ChannelI,
|
channel exported.ChannelI,
|
||||||
) error {
|
) error {
|
||||||
merkleProof, consensusState, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
|
merkleProof, consensusState, err := produceVerificationArgs(store, cdc, cs, height, prefix, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -282,7 +279,7 @@ func (cs ClientState) VerifyPacketCommitment(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -312,7 +309,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -343,7 +340,7 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -372,7 +369,7 @@ func (cs ClientState) VerifyNextSequenceRecv(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -405,7 +402,7 @@ func produceVerificationArgs(
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
cs ClientState,
|
cs ClientState,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
) (merkleProof commitmenttypes.MerkleProof, consensusState *ConsensusState, err error) {
|
) (merkleProof commitmenttypes.MerkleProof, consensusState *ConsensusState, err error) {
|
||||||
if cs.GetLatestHeight() < height {
|
if cs.GetLatestHeight() < height {
|
||||||
|
|
|
@ -3,12 +3,12 @@ package types_test
|
||||||
import (
|
import (
|
||||||
ics23 "github.com/confio/ics23/go"
|
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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
// need to update chainA's client representing chainB to prove missing ack
|
// 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
|
var ok bool
|
||||||
clientStateI := suite.chainA.GetClientState(clientA)
|
clientStateI := suite.chainA.GetClientState(clientA)
|
||||||
|
@ -639,7 +639,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
// need to update chainA's client representing chainB
|
// 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
|
var ok bool
|
||||||
clientStateI := suite.chainA.GetClientState(clientA)
|
clientStateI := suite.chainA.GetClientState(clientA)
|
||||||
|
|
|
@ -3,30 +3,30 @@ package types
|
||||||
import (
|
import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
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
|
// RegisterInterfaces registers the tendermint concrete evidence and client-related
|
||||||
// implementations and interfaces.
|
// implementations and interfaces.
|
||||||
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.ClientState)(nil),
|
(*exported.ClientState)(nil),
|
||||||
&ClientState{},
|
&ClientState{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.ConsensusState)(nil),
|
(*exported.ConsensusState)(nil),
|
||||||
&ConsensusState{},
|
&ConsensusState{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.Header)(nil),
|
(*exported.Header)(nil),
|
||||||
&Header{},
|
&Header{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.Misbehaviour)(nil),
|
(*exported.Misbehaviour)(nil),
|
||||||
&Misbehaviour{},
|
&Misbehaviour{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.Header)(nil),
|
(*exported.Header)(nil),
|
||||||
&Header{},
|
&Header{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,9 @@ import (
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
|
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
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"
|
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.
|
// NewConsensusState creates a new ConsensusState instance.
|
||||||
|
@ -27,12 +26,12 @@ func NewConsensusState(
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientType returns Tendermint
|
// ClientType returns Tendermint
|
||||||
func (ConsensusState) ClientType() clientexported.ClientType {
|
func (ConsensusState) ClientType() exported.ClientType {
|
||||||
return clientexported.Tendermint
|
return exported.Tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRoot returns the commitment Root for the specific
|
// GetRoot returns the commitment Root for the specific
|
||||||
func (cs ConsensusState) GetRoot() commitmentexported.Root {
|
func (cs ConsensusState) GetRoot() exported.Root {
|
||||||
return cs.Root
|
return cs.Root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ package types_test
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
|
func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
|
||||||
|
@ -69,7 +69,7 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
|
||||||
for i, tc := range testCases {
|
for i, tc := range testCases {
|
||||||
tc := tc
|
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)
|
suite.Require().Equal(tc.consensusState.GetRoot(), tc.consensusState.Root)
|
||||||
|
|
||||||
if tc.expectPass {
|
if tc.expectPass {
|
||||||
|
|
|
@ -7,16 +7,16 @@ import (
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
|
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/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
|
// ClientType defines that the Header is a Tendermint consensus algorithm
|
||||||
func (h Header) ClientType() clientexported.ClientType {
|
func (h Header) ClientType() exported.ClientType {
|
||||||
return clientexported.Tendermint
|
return exported.Tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsensusState returns the updated consensus state associated with the header
|
// ConsensusState returns the updated consensus state associated with the header
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
|
|
||||||
tmprotocrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
|
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"
|
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/07-tendermint/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *TendermintTestSuite) TestGetHeight() {
|
func (suite *TendermintTestSuite) TestGetHeight() {
|
||||||
|
@ -64,7 +64,7 @@ func (suite *TendermintTestSuite) TestHeaderValidateBasic() {
|
||||||
}, false},
|
}, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
suite.Require().Equal(clientexported.Tendermint, suite.header.ClientType())
|
suite.Require().Equal(exported.Tendermint, suite.header.ClientType())
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
tc := tc
|
tc := tc
|
||||||
|
|
|
@ -10,13 +10,13 @@ import (
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
|
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ clientexported.Misbehaviour = Misbehaviour{}
|
_ exported.Misbehaviour = Misbehaviour{}
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewMisbehaviour creates a new Misbehaviour instance.
|
// NewMisbehaviour creates a new Misbehaviour instance.
|
||||||
|
@ -31,8 +31,8 @@ func NewMisbehaviour(clientID, chainID string, header1, header2 *Header) *Misbeh
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientType is Tendermint light client
|
// ClientType is Tendermint light client
|
||||||
func (misbehaviour Misbehaviour) ClientType() clientexported.ClientType {
|
func (misbehaviour Misbehaviour) ClientType() exported.ClientType {
|
||||||
return clientexported.Tendermint
|
return exported.Tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetClientID returns the ID of the client that committed a misbehaviour.
|
// GetClientID returns the ID of the client that committed a misbehaviour.
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckMisbehaviourAndUpdateState determines whether or not two conflicting
|
// CheckMisbehaviourAndUpdateState determines whether or not two conflicting
|
||||||
|
@ -23,8 +23,8 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
clientStore sdk.KVStore,
|
clientStore sdk.KVStore,
|
||||||
misbehaviour clientexported.Misbehaviour,
|
misbehaviour exported.Misbehaviour,
|
||||||
) (clientexported.ClientState, error) {
|
) (exported.ClientState, error) {
|
||||||
tmMisbehaviour, ok := misbehaviour.(*Misbehaviour)
|
tmMisbehaviour, ok := misbehaviour.(*Misbehaviour)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "expected type %T, got %T", misbehaviour, &Misbehaviour{})
|
return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "expected type %T, got %T", misbehaviour, &Misbehaviour{})
|
||||||
|
|
|
@ -8,10 +8,10 @@ import (
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/simapp"
|
"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"
|
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/07-tendermint/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||||
|
@ -40,10 +40,10 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState clientexported.ClientState
|
clientState exported.ClientState
|
||||||
consensusState1 clientexported.ConsensusState
|
consensusState1 exported.ConsensusState
|
||||||
consensusState2 clientexported.ConsensusState
|
consensusState2 exported.ConsensusState
|
||||||
misbehaviour clientexported.Misbehaviour
|
misbehaviour exported.Misbehaviour
|
||||||
timestamp time.Time
|
timestamp time.Time
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||||
tmtypes "github.com/tendermint/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/07-tendermint/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *TendermintTestSuite) TestMisbehaviour() {
|
func (suite *TendermintTestSuite) TestMisbehaviour() {
|
||||||
|
@ -22,7 +22,7 @@ func (suite *TendermintTestSuite) TestMisbehaviour() {
|
||||||
ClientId: clientID,
|
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(clientID, misbehaviour.GetClientID())
|
||||||
suite.Require().Equal(height.EpochHeight, misbehaviour.GetHeight())
|
suite.Require().Equal(height.EpochHeight, misbehaviour.GetHeight())
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
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
|
// 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 {
|
if err := codec.UnmarshalAny(cdc, &consensusStateI, bz); err != nil {
|
||||||
return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidConsensus, "unmarshal error: %v", err)
|
return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidConsensus, "unmarshal error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/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:
|
// 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).
|
// in the [Tendermint spec](https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md).
|
||||||
func (cs ClientState) CheckHeaderAndUpdateState(
|
func (cs ClientState) CheckHeaderAndUpdateState(
|
||||||
ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore,
|
ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore,
|
||||||
header clientexported.Header,
|
header exported.Header,
|
||||||
) (clientexported.ClientState, clientexported.ConsensusState, error) {
|
) (exported.ClientState, exported.ConsensusState, error) {
|
||||||
tmHeader, ok := header.(*Header)
|
tmHeader, ok := header.(*Header)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, sdkerrors.Wrapf(
|
return nil, nil, sdkerrors.Wrapf(
|
||||||
|
|
|
@ -11,17 +11,14 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
|
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
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"
|
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
|
// NewClientState creates a new ClientState instance
|
||||||
func NewClientState(chainID string, height clienttypes.Height) *ClientState {
|
func NewClientState(chainID string, height clienttypes.Height) *ClientState {
|
||||||
|
@ -37,8 +34,8 @@ func (cs ClientState) GetChainID() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientType is localhost.
|
// ClientType is localhost.
|
||||||
func (cs ClientState) ClientType() clientexported.ClientType {
|
func (cs ClientState) ClientType() exported.ClientType {
|
||||||
return clientexported.Localhost
|
return exported.Localhost
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLatestHeight returns the latest height stored.
|
// 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
|
// CheckHeaderAndUpdateState updates the localhost client. It only needs access to the context
|
||||||
func (cs *ClientState) CheckHeaderAndUpdateState(
|
func (cs *ClientState) CheckHeaderAndUpdateState(
|
||||||
ctx sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ clientexported.Header,
|
ctx sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ exported.Header,
|
||||||
) (clientexported.ClientState, clientexported.ConsensusState, error) {
|
) (exported.ClientState, exported.ConsensusState, error) {
|
||||||
// use the chain ID from context since the localhost client is from the running chain (i.e self).
|
// use the chain ID from context since the localhost client is from the running chain (i.e self).
|
||||||
cs.ChainId = ctx.ChainID()
|
cs.ChainId = ctx.ChainID()
|
||||||
// Hardcode 0 for epoch number for now
|
// 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
|
// Since localhost is the client of the running chain, misbehaviour cannot be submitted to it
|
||||||
// Thus, CheckMisbehaviourAndUpdateState returns an error for localhost
|
// Thus, CheckMisbehaviourAndUpdateState returns an error for localhost
|
||||||
func (cs ClientState) CheckMisbehaviourAndUpdateState(
|
func (cs ClientState) CheckMisbehaviourAndUpdateState(
|
||||||
_ sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ clientexported.Misbehaviour,
|
_ sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ exported.Misbehaviour,
|
||||||
) (clientexported.ClientState, error) {
|
) (exported.ClientState, error) {
|
||||||
return nil, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "cannot submit misbehaviour to localhost client")
|
return nil, sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "cannot submit misbehaviour to localhost client")
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyClientState verifies that the localhost client state is stored locally
|
// VerifyClientState verifies that the localhost client state is stored locally
|
||||||
func (cs ClientState) VerifyClientState(
|
func (cs ClientState) VerifyClientState(
|
||||||
store sdk.KVStore, cdc codec.BinaryMarshaler, _ commitmentexported.Root,
|
store sdk.KVStore, cdc codec.BinaryMarshaler, _ exported.Root,
|
||||||
_ uint64, _ commitmentexported.Prefix, _ string, _ []byte, clientState clientexported.ClientState,
|
_ uint64, _ exported.Prefix, _ string, _ []byte, clientState exported.ClientState,
|
||||||
) error {
|
) error {
|
||||||
path := host.KeyClientState()
|
path := host.KeyClientState()
|
||||||
bz := store.Get(path)
|
bz := store.Get(path)
|
||||||
|
@ -119,8 +116,8 @@ func (cs ClientState) VerifyClientState(
|
||||||
// VerifyClientConsensusState returns nil since a local host client does not store consensus
|
// VerifyClientConsensusState returns nil since a local host client does not store consensus
|
||||||
// states.
|
// states.
|
||||||
func (cs ClientState) VerifyClientConsensusState(
|
func (cs ClientState) VerifyClientConsensusState(
|
||||||
sdk.KVStore, codec.BinaryMarshaler, commitmentexported.Root,
|
sdk.KVStore, codec.BinaryMarshaler, exported.Root,
|
||||||
uint64, string, uint64, commitmentexported.Prefix, []byte, clientexported.ConsensusState,
|
uint64, string, uint64, exported.Prefix, []byte, exported.ConsensusState,
|
||||||
) error {
|
) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -131,10 +128,10 @@ func (cs ClientState) VerifyConnectionState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
_ uint64,
|
_ uint64,
|
||||||
_ commitmentexported.Prefix,
|
_ exported.Prefix,
|
||||||
_ []byte,
|
_ []byte,
|
||||||
connectionID string,
|
connectionID string,
|
||||||
connectionEnd connectionexported.ConnectionI,
|
connectionEnd exported.ConnectionI,
|
||||||
) error {
|
) error {
|
||||||
path := host.KeyConnection(connectionID)
|
path := host.KeyConnection(connectionID)
|
||||||
bz := store.Get(path)
|
bz := store.Get(path)
|
||||||
|
@ -164,11 +161,11 @@ func (cs ClientState) VerifyChannelState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
_ uint64,
|
_ uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
_ []byte,
|
_ []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
channel channelexported.ChannelI,
|
channel exported.ChannelI,
|
||||||
) error {
|
) error {
|
||||||
path := host.KeyChannel(portID, channelID)
|
path := host.KeyChannel(portID, channelID)
|
||||||
bz := store.Get(path)
|
bz := store.Get(path)
|
||||||
|
@ -198,7 +195,7 @@ func (cs ClientState) VerifyPacketCommitment(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
_ codec.BinaryMarshaler,
|
_ codec.BinaryMarshaler,
|
||||||
_ uint64,
|
_ uint64,
|
||||||
_ commitmentexported.Prefix,
|
_ exported.Prefix,
|
||||||
_ []byte,
|
_ []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -228,7 +225,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
_ codec.BinaryMarshaler,
|
_ codec.BinaryMarshaler,
|
||||||
_ uint64,
|
_ uint64,
|
||||||
_ commitmentexported.Prefix,
|
_ exported.Prefix,
|
||||||
_ []byte,
|
_ []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -259,7 +256,7 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
_ codec.BinaryMarshaler,
|
_ codec.BinaryMarshaler,
|
||||||
_ uint64,
|
_ uint64,
|
||||||
_ commitmentexported.Prefix,
|
_ exported.Prefix,
|
||||||
_ []byte,
|
_ []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -281,7 +278,7 @@ func (cs ClientState) VerifyNextSequenceRecv(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
_ codec.BinaryMarshaler,
|
_ codec.BinaryMarshaler,
|
||||||
_ uint64,
|
_ uint64,
|
||||||
_ commitmentexported.Prefix,
|
_ exported.Prefix,
|
||||||
_ []byte,
|
_ []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
|
|
@ -3,14 +3,14 @@ package types
|
||||||
import (
|
import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
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
|
// RegisterInterfaces register the ibc interfaces submodule implementations to protobuf
|
||||||
// Any.
|
// Any.
|
||||||
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.ClientState)(nil),
|
(*exported.ClientState)(nil),
|
||||||
&ClientState{},
|
&ClientState{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
"github.com/cosmos/cosmos-sdk/simapp"
|
"github.com/cosmos/cosmos-sdk/simapp"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -35,7 +35,7 @@ func (suite *LocalhostTestSuite) SetupTest() {
|
||||||
|
|
||||||
suite.cdc = app.AppCodec()
|
suite.cdc = app.AppCodec()
|
||||||
suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{Height: 1, ChainID: "ibc-chain"})
|
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) {
|
func TestLocalhostTestSuite(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package types
|
||||||
import (
|
import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
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.
|
// RegisterInterfaces registers the commitment interfaces to protobuf Any.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
|
tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
|
||||||
|
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
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
|
// var representing the proofspecs for a SDK chain
|
||||||
|
|
|
@ -4,15 +4,15 @@ package exported
|
||||||
type ChannelI interface {
|
type ChannelI interface {
|
||||||
GetState() int32
|
GetState() int32
|
||||||
GetOrdering() int32
|
GetOrdering() int32
|
||||||
GetCounterparty() CounterpartyI
|
GetCounterparty() CounterpartyChannelI
|
||||||
GetConnectionHops() []string
|
GetConnectionHops() []string
|
||||||
GetVersion() string
|
GetVersion() string
|
||||||
ValidateBasic() error
|
ValidateBasic() error
|
||||||
}
|
}
|
||||||
|
|
||||||
// CounterpartyI defines the standard interface for a channel end's
|
// CounterpartyChannelI defines the standard interface for a channel end's
|
||||||
// counterparty.
|
// counterparty.
|
||||||
type CounterpartyI interface {
|
type CounterpartyChannelI interface {
|
||||||
GetPortID() string
|
GetPortID() string
|
||||||
GetChannelID() string
|
GetChannelID() string
|
||||||
ValidateBasic() error
|
ValidateBasic() error
|
|
@ -9,9 +9,6 @@ import (
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"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.
|
// ClientState defines the required common functions for light clients.
|
||||||
|
@ -33,9 +30,9 @@ type ClientState interface {
|
||||||
VerifyClientState(
|
VerifyClientState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
root commitmentexported.Root,
|
root Root,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix Prefix,
|
||||||
counterpartyClientIdentifier string,
|
counterpartyClientIdentifier string,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
clientState ClientState,
|
clientState ClientState,
|
||||||
|
@ -43,11 +40,11 @@ type ClientState interface {
|
||||||
VerifyClientConsensusState(
|
VerifyClientConsensusState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
root commitmentexported.Root,
|
root Root,
|
||||||
height uint64,
|
height uint64,
|
||||||
counterpartyClientIdentifier string,
|
counterpartyClientIdentifier string,
|
||||||
consensusHeight uint64,
|
consensusHeight uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
consensusState ConsensusState,
|
consensusState ConsensusState,
|
||||||
) error
|
) error
|
||||||
|
@ -55,26 +52,26 @@ type ClientState interface {
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
connectionID string,
|
connectionID string,
|
||||||
connectionEnd connectionexported.ConnectionI,
|
connectionEnd ConnectionI,
|
||||||
) error
|
) error
|
||||||
VerifyChannelState(
|
VerifyChannelState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
channel channelexported.ChannelI,
|
channel ChannelI,
|
||||||
) error
|
) error
|
||||||
VerifyPacketCommitment(
|
VerifyPacketCommitment(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -85,7 +82,7 @@ type ClientState interface {
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -96,7 +93,7 @@ type ClientState interface {
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -106,7 +103,7 @@ type ClientState interface {
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
height uint64,
|
height uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -123,7 +120,7 @@ type ConsensusState interface {
|
||||||
|
|
||||||
// GetRoot returns the commitment root of the consensus state,
|
// GetRoot returns the commitment root of the consensus state,
|
||||||
// which is used for key-value pair verification.
|
// which is used for key-value pair verification.
|
||||||
GetRoot() commitmentexported.Root
|
GetRoot() Root
|
||||||
|
|
||||||
// GetTimestamp returns the timestamp (in nanoseconds) of the consensus state
|
// GetTimestamp returns the timestamp (in nanoseconds) of the consensus state
|
||||||
GetTimestamp() uint64
|
GetTimestamp() uint64
|
|
@ -1,22 +1,18 @@
|
||||||
package exported
|
package exported
|
||||||
|
|
||||||
import (
|
|
||||||
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ConnectionI describes the required methods for a connection.
|
// ConnectionI describes the required methods for a connection.
|
||||||
type ConnectionI interface {
|
type ConnectionI interface {
|
||||||
GetClientID() string
|
GetClientID() string
|
||||||
GetState() int32
|
GetState() int32
|
||||||
GetCounterparty() CounterpartyI
|
GetCounterparty() CounterpartyConnectionI
|
||||||
GetVersions() []string
|
GetVersions() []string
|
||||||
ValidateBasic() error
|
ValidateBasic() error
|
||||||
}
|
}
|
||||||
|
|
||||||
// CounterpartyI describes the required methods for a counterparty connection.
|
// CounterpartyConnectionI describes the required methods for a counterparty connection.
|
||||||
type CounterpartyI interface {
|
type CounterpartyConnectionI interface {
|
||||||
GetClientID() string
|
GetClientID() string
|
||||||
GetConnectionID() string
|
GetConnectionID() string
|
||||||
GetPrefix() commitmentexported.Prefix
|
GetPrefix() Prefix
|
||||||
ValidateBasic() error
|
ValidateBasic() error
|
||||||
}
|
}
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
"github.com/cosmos/cosmos-sdk/simapp"
|
"github.com/cosmos/cosmos-sdk/simapp"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc"
|
"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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
|
@ -16,6 +15,7 @@ import (
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
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"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/types"
|
"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()),
|
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs()),
|
||||||
),
|
),
|
||||||
clienttypes.NewIdentifiedClientState(
|
clienttypes.NewIdentifiedClientState(
|
||||||
clientexported.ClientTypeLocalHost, localhosttypes.NewClientState("chaindID", clientHeight),
|
exported.ClientTypeLocalHost, localhosttypes.NewClientState("chaindID", clientHeight),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
[]clienttypes.ClientConsensusStates{
|
[]clienttypes.ClientConsensusStates{
|
||||||
clienttypes.NewClientConsensusStates(
|
clienttypes.NewClientConsensusStates(
|
||||||
clientID,
|
clientID,
|
||||||
[]clientexported.ConsensusState{
|
[]exported.ConsensusState{
|
||||||
ibctmtypes.NewConsensusState(
|
ibctmtypes.NewConsensusState(
|
||||||
suite.header.GetTime(), commitmenttypes.NewMerkleRoot(suite.header.Header.AppHash), clienttypes.NewHeight(0, suite.header.GetHeight()), suite.header.Header.NextValidatorsHash,
|
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()),
|
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs()),
|
||||||
),
|
),
|
||||||
clienttypes.NewIdentifiedClientState(
|
clienttypes.NewIdentifiedClientState(
|
||||||
clientexported.ClientTypeLocalHost, localhosttypes.NewClientState("(chaindID)", clienttypes.Height{}),
|
exported.ClientTypeLocalHost, localhosttypes.NewClientState("(chaindID)", clienttypes.Height{}),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
|
@ -169,13 +169,13 @@ func (suite *IBCTestSuite) TestInitGenesis() {
|
||||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs()),
|
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs()),
|
||||||
),
|
),
|
||||||
clienttypes.NewIdentifiedClientState(
|
clienttypes.NewIdentifiedClientState(
|
||||||
clientexported.ClientTypeLocalHost, localhosttypes.NewClientState("chaindID", clientHeight),
|
exported.ClientTypeLocalHost, localhosttypes.NewClientState("chaindID", clientHeight),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
[]clienttypes.ClientConsensusStates{
|
[]clienttypes.ClientConsensusStates{
|
||||||
clienttypes.NewClientConsensusStates(
|
clienttypes.NewClientConsensusStates(
|
||||||
clientID,
|
clientID,
|
||||||
[]clientexported.ConsensusState{
|
[]exported.ConsensusState{
|
||||||
ibctmtypes.NewConsensusState(
|
ibctmtypes.NewConsensusState(
|
||||||
suite.header.GetTime(), commitmenttypes.NewMerkleRoot(suite.header.Header.AppHash), clienttypes.NewHeight(0, suite.header.GetHeight()), suite.header.Header.NextValidatorsHash,
|
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
|
// creates clients
|
||||||
suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
|
suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
|
||||||
// create extra clients
|
// create extra clients
|
||||||
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, clientexported.Tendermint)
|
suite.coordinator.CreateClient(suite.chainA, suite.chainB, exported.Tendermint)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc"
|
"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"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
// need to update chainA client to prove missing ack
|
// 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())
|
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
|
||||||
}, true},
|
}, true},
|
||||||
|
@ -336,7 +336,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
// need to update chainA client to prove missing ack
|
// 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())
|
packetKey = host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||||
}, true},
|
}, true},
|
||||||
|
@ -354,7 +354,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
|
||||||
suite.Require().NoError(err)
|
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())
|
packetKey = host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||||
|
|
||||||
}, true},
|
}, true},
|
||||||
|
@ -371,7 +371,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
|
||||||
suite.Require().NoError(err)
|
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())
|
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
|
||||||
|
|
||||||
}, true},
|
}, true},
|
||||||
|
@ -453,7 +453,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
// need to update chainA client to prove missing ack
|
// 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())
|
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
// need to update chainA client to prove missing ack
|
// 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())
|
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())
|
packetKey = host.KeyPacketAcknowledgement(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||||
|
|
||||||
// close counterparty channel
|
// close counterparty channel
|
||||||
|
@ -528,7 +528,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||||
suite.Require().NoError(err)
|
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())
|
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
|
||||||
|
|
||||||
// close counterparty channel
|
// close counterparty channel
|
||||||
|
@ -569,7 +569,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
// need to update chainA client to prove missing ack
|
// 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())
|
packetKey = host.KeyNextSequenceRecv(packet.GetDestPort(), packet.GetDestChannel())
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,13 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
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"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ clientexported.ClientState = (*ClientState)(nil)
|
var _ exported.ClientState = (*ClientState)(nil)
|
||||||
|
|
||||||
// NewClientState creates a new ClientState instance.
|
// NewClientState creates a new ClientState instance.
|
||||||
func NewClientState(consensusState *ConsensusState) *ClientState {
|
func NewClientState(consensusState *ConsensusState) *ClientState {
|
||||||
|
@ -26,8 +23,8 @@ func NewClientState(consensusState *ConsensusState) *ClientState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientType is Solo Machine.
|
// ClientType is Solo Machine.
|
||||||
func (cs ClientState) ClientType() clientexported.ClientType {
|
func (cs ClientState) ClientType() exported.ClientType {
|
||||||
return clientexported.SoloMachine
|
return exported.SoloMachine
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLatestHeight returns the latest sequence number.
|
// GetLatestHeight returns the latest sequence number.
|
||||||
|
@ -63,12 +60,12 @@ func (cs ClientState) Validate() error {
|
||||||
func (cs ClientState) VerifyClientState(
|
func (cs ClientState) VerifyClientState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
_ commitmentexported.Root,
|
_ exported.Root,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
counterpartyClientIdentifier string,
|
counterpartyClientIdentifier string,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
clientState clientexported.ClientState,
|
clientState exported.ClientState,
|
||||||
) error {
|
) error {
|
||||||
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
|
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -101,13 +98,13 @@ func (cs ClientState) VerifyClientState(
|
||||||
func (cs ClientState) VerifyClientConsensusState(
|
func (cs ClientState) VerifyClientConsensusState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
_ commitmentexported.Root,
|
_ exported.Root,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
counterpartyClientIdentifier string,
|
counterpartyClientIdentifier string,
|
||||||
consensusHeight uint64,
|
consensusHeight uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
consensusState clientexported.ConsensusState,
|
consensusState exported.ConsensusState,
|
||||||
) error {
|
) error {
|
||||||
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
|
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -141,10 +138,10 @@ func (cs ClientState) VerifyConnectionState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
connectionID string,
|
connectionID string,
|
||||||
connectionEnd connectionexported.ConnectionI,
|
connectionEnd exported.ConnectionI,
|
||||||
) error {
|
) error {
|
||||||
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
|
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -177,11 +174,11 @@ func (cs ClientState) VerifyChannelState(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
channel channelexported.ChannelI,
|
channel exported.ChannelI,
|
||||||
) error {
|
) error {
|
||||||
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
|
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -214,7 +211,7 @@ func (cs ClientState) VerifyPacketCommitment(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -249,7 +246,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -285,7 +282,7 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -319,7 +316,7 @@ func (cs ClientState) VerifyNextSequenceRecv(
|
||||||
store sdk.KVStore,
|
store sdk.KVStore,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
portID,
|
portID,
|
||||||
channelID string,
|
channelID string,
|
||||||
|
@ -354,7 +351,7 @@ func produceVerificationArgs(
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
cs ClientState,
|
cs ClientState,
|
||||||
sequence uint64,
|
sequence uint64,
|
||||||
prefix commitmentexported.Prefix,
|
prefix exported.Prefix,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
) (signature TimestampedSignature, err error) {
|
) (signature TimestampedSignature, err error) {
|
||||||
if cs.IsFrozen() {
|
if cs.IsFrozen() {
|
||||||
|
@ -397,7 +394,7 @@ func produceVerificationArgs(
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets the client state to the store
|
// 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)
|
bz := clienttypes.MustMarshalClientState(cdc, clientState)
|
||||||
store.Set(host.KeyClientState(), bz)
|
store.Set(host.KeyClientState(), bz)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package types_test
|
package types_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
|
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ func (suite *SoloMachineTestSuite) TestClientStateValidateBasic() {
|
||||||
|
|
||||||
func (suite *SoloMachineTestSuite) TestVerifyClientState() {
|
func (suite *SoloMachineTestSuite) TestVerifyClientState() {
|
||||||
// create client for tendermint so we can use client state for verification
|
// 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)
|
clientState := suite.chainA.GetClientState(clientA)
|
||||||
|
|
||||||
clientPrefixedPath := "clients/" + counterpartyClientIdentifier + "/" + host.ClientStatePath()
|
clientPrefixedPath := "clients/" + counterpartyClientIdentifier + "/" + host.ClientStatePath()
|
||||||
|
@ -97,7 +96,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientState() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState *types.ClientState
|
clientState *types.ClientState
|
||||||
prefix commitmentexported.Prefix
|
prefix exported.Prefix
|
||||||
proof []byte
|
proof []byte
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
@ -196,7 +195,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientState() {
|
||||||
|
|
||||||
func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
|
func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
|
||||||
// create client for tendermint so we can use consensus state for verification
|
// 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)
|
clientState := suite.chainA.GetClientState(clientA)
|
||||||
consensusState, found := suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
|
consensusState, found := suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
|
||||||
suite.Require().True(found)
|
suite.Require().True(found)
|
||||||
|
@ -222,7 +221,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState *types.ClientState
|
clientState *types.ClientState
|
||||||
prefix commitmentexported.Prefix
|
prefix exported.Prefix
|
||||||
proof []byte
|
proof []byte
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
@ -343,7 +342,7 @@ func (suite *SoloMachineTestSuite) TestVerifyConnectionState() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState *types.ClientState
|
clientState *types.ClientState
|
||||||
prefix commitmentexported.Prefix
|
prefix exported.Prefix
|
||||||
proof []byte
|
proof []byte
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
@ -426,7 +425,7 @@ func (suite *SoloMachineTestSuite) TestVerifyChannelState() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState *types.ClientState
|
clientState *types.ClientState
|
||||||
prefix commitmentexported.Prefix
|
prefix exported.Prefix
|
||||||
proof []byte
|
proof []byte
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
@ -506,7 +505,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketCommitment() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState *types.ClientState
|
clientState *types.ClientState
|
||||||
prefix commitmentexported.Prefix
|
prefix exported.Prefix
|
||||||
proof []byte
|
proof []byte
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
@ -586,7 +585,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketAcknowledgement() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState *types.ClientState
|
clientState *types.ClientState
|
||||||
prefix commitmentexported.Prefix
|
prefix exported.Prefix
|
||||||
proof []byte
|
proof []byte
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
@ -665,7 +664,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketAcknowledgementAbsence() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState *types.ClientState
|
clientState *types.ClientState
|
||||||
prefix commitmentexported.Prefix
|
prefix exported.Prefix
|
||||||
proof []byte
|
proof []byte
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
@ -745,7 +744,7 @@ func (suite *SoloMachineTestSuite) TestVerifyNextSeqRecv() {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
clientState *types.ClientState
|
clientState *types.ClientState
|
||||||
prefix commitmentexported.Prefix
|
prefix exported.Prefix
|
||||||
proof []byte
|
proof []byte
|
||||||
expPass bool
|
expPass bool
|
||||||
}{
|
}{
|
||||||
|
|
|
@ -3,26 +3,26 @@ package types
|
||||||
import (
|
import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
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
|
// RegisterInterfaces register the ibc channel submodule interfaces to protobuf
|
||||||
// Any.
|
// Any.
|
||||||
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.ClientState)(nil),
|
(*exported.ClientState)(nil),
|
||||||
&ClientState{},
|
&ClientState{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.ConsensusState)(nil),
|
(*exported.ConsensusState)(nil),
|
||||||
&ConsensusState{},
|
&ConsensusState{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.Header)(nil),
|
(*exported.Header)(nil),
|
||||||
&Header{},
|
&Header{},
|
||||||
)
|
)
|
||||||
registry.RegisterImplementations(
|
registry.RegisterImplementations(
|
||||||
(*clientexported.Misbehaviour)(nil),
|
(*exported.Misbehaviour)(nil),
|
||||||
&Misbehaviour{},
|
&Misbehaviour{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,15 @@ import (
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/std"
|
"github.com/cosmos/cosmos-sdk/std"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
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.
|
// ClientType returns Solo Machine type.
|
||||||
func (ConsensusState) ClientType() clientexported.ClientType {
|
func (ConsensusState) ClientType() exported.ClientType {
|
||||||
return clientexported.SoloMachine
|
return exported.SoloMachine
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHeight returns the sequence number.
|
// GetHeight returns the sequence number.
|
||||||
|
@ -28,7 +27,7 @@ func (cs ConsensusState) GetTimestamp() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRoot returns nil since solo machines do not have roots.
|
// GetRoot returns nil since solo machines do not have roots.
|
||||||
func (cs ConsensusState) GetRoot() commitmentexported.Root {
|
func (cs ConsensusState) GetRoot() exported.Root {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package types_test
|
package types_test
|
||||||
|
|
||||||
import (
|
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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *SoloMachineTestSuite) TestConsensusState() {
|
func (suite *SoloMachineTestSuite) TestConsensusState() {
|
||||||
consensusState := suite.solomachine.ConsensusState()
|
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.Sequence, consensusState.GetHeight())
|
||||||
suite.Require().Equal(suite.solomachine.Time, consensusState.GetTimestamp())
|
suite.Require().Equal(suite.solomachine.Time, consensusState.GetTimestamp())
|
||||||
suite.Require().Nil(consensusState.GetRoot())
|
suite.Require().Nil(consensusState.GetRoot())
|
||||||
|
|
|
@ -5,15 +5,15 @@ import (
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/std"
|
"github.com/cosmos/cosmos-sdk/std"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
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.
|
// ClientType defines that the Header is a Solo Machine.
|
||||||
func (Header) ClientType() clientexported.ClientType {
|
func (Header) ClientType() exported.ClientType {
|
||||||
return clientexported.SoloMachine
|
return exported.SoloMachine
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHeight returns the current sequence number as the height.
|
// GetHeight returns the current sequence number as the height.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package types_test
|
package types_test
|
||||||
|
|
||||||
import (
|
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"
|
"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 {
|
for _, tc := range cases {
|
||||||
tc := tc
|
tc := tc
|
||||||
|
|
|
@ -6,18 +6,18 @@ import (
|
||||||
yaml "gopkg.in/yaml.v2"
|
yaml "gopkg.in/yaml.v2"
|
||||||
|
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ clientexported.Misbehaviour = (*Misbehaviour)(nil)
|
_ exported.Misbehaviour = (*Misbehaviour)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClientType is a Solo Machine light client.
|
// ClientType is a Solo Machine light client.
|
||||||
func (misbehaviour Misbehaviour) ClientType() clientexported.ClientType {
|
func (misbehaviour Misbehaviour) ClientType() exported.ClientType {
|
||||||
return clientexported.SoloMachine
|
return exported.SoloMachine
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetClientID returns the ID of the client that committed a misbehaviour.
|
// GetClientID returns the ID of the client that committed a misbehaviour.
|
||||||
|
@ -27,7 +27,7 @@ func (misbehaviour Misbehaviour) GetClientID() string {
|
||||||
|
|
||||||
// Type implements Evidence interface.
|
// Type implements Evidence interface.
|
||||||
func (misbehaviour Misbehaviour) Type() string {
|
func (misbehaviour Misbehaviour) Type() string {
|
||||||
return clientexported.TypeClientMisbehaviour
|
return exported.TypeClientMisbehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
// String implements Evidence interface.
|
// String implements Evidence interface.
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckMisbehaviourAndUpdateState determines whether or not the currently registered
|
// CheckMisbehaviourAndUpdateState determines whether or not the currently registered
|
||||||
|
@ -15,8 +15,8 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
clientStore sdk.KVStore,
|
clientStore sdk.KVStore,
|
||||||
misbehaviour clientexported.Misbehaviour,
|
misbehaviour exported.Misbehaviour,
|
||||||
) (clientexported.ClientState, error) {
|
) (exported.ClientState, error) {
|
||||||
|
|
||||||
soloMisbehaviour, ok := misbehaviour.(*Misbehaviour)
|
soloMisbehaviour, ok := misbehaviour.(*Misbehaviour)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -2,14 +2,14 @@ package types_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||||
var (
|
var (
|
||||||
clientState clientexported.ClientState
|
clientState exported.ClientState
|
||||||
misbehaviour clientexported.Misbehaviour
|
misbehaviour exported.Misbehaviour
|
||||||
)
|
)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package types_test
|
package types_test
|
||||||
|
|
||||||
import (
|
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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *SoloMachineTestSuite) TestMisbehaviour() {
|
func (suite *SoloMachineTestSuite) TestMisbehaviour() {
|
||||||
misbehaviour := suite.solomachine.CreateMisbehaviour()
|
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.ClientID, misbehaviour.GetClientID())
|
||||||
suite.Require().Equal(suite.solomachine.Sequence, misbehaviour.GetHeight())
|
suite.Require().Equal(suite.solomachine.Sequence, misbehaviour.GetHeight())
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,11 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
|
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/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
|
// VerifySignature verifies if the the provided public key generated the signature
|
||||||
|
@ -53,7 +51,7 @@ func ClientStateSignBytes(
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence, timestamp uint64,
|
sequence, timestamp uint64,
|
||||||
path commitmenttypes.MerklePath,
|
path commitmenttypes.MerklePath,
|
||||||
clientState clientexported.ClientState,
|
clientState exported.ClientState,
|
||||||
) ([]byte, error) {
|
) ([]byte, error) {
|
||||||
bz, err := codec.MarshalAny(cdc, clientState)
|
bz, err := codec.MarshalAny(cdc, clientState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -75,7 +73,7 @@ func ConsensusStateSignBytes(
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence, timestamp uint64,
|
sequence, timestamp uint64,
|
||||||
path commitmenttypes.MerklePath,
|
path commitmenttypes.MerklePath,
|
||||||
consensusState clientexported.ConsensusState,
|
consensusState exported.ConsensusState,
|
||||||
) ([]byte, error) {
|
) ([]byte, error) {
|
||||||
bz, err := codec.MarshalAny(cdc, consensusState)
|
bz, err := codec.MarshalAny(cdc, consensusState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -97,7 +95,7 @@ func ConnectionStateSignBytes(
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence, timestamp uint64,
|
sequence, timestamp uint64,
|
||||||
path commitmenttypes.MerklePath,
|
path commitmenttypes.MerklePath,
|
||||||
connectionEnd connectionexported.ConnectionI,
|
connectionEnd exported.ConnectionI,
|
||||||
) ([]byte, error) {
|
) ([]byte, error) {
|
||||||
connection, ok := connectionEnd.(connectiontypes.ConnectionEnd)
|
connection, ok := connectionEnd.(connectiontypes.ConnectionEnd)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -124,7 +122,7 @@ func ChannelStateSignBytes(
|
||||||
cdc codec.BinaryMarshaler,
|
cdc codec.BinaryMarshaler,
|
||||||
sequence, timestamp uint64,
|
sequence, timestamp uint64,
|
||||||
path commitmenttypes.MerklePath,
|
path commitmenttypes.MerklePath,
|
||||||
channelEnd channelexported.ChannelI,
|
channelEnd exported.ChannelI,
|
||||||
) ([]byte, error) {
|
) ([]byte, error) {
|
||||||
channel, ok := channelEnd.(channeltypes.Channel)
|
channel, ok := channelEnd.(channeltypes.Channel)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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"
|
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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
||||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
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.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
|
||||||
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
|
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())
|
bz, err := codec.MarshalAny(suite.chainA.Codec, suite.solomachine.ClientState())
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
@ -47,7 +47,7 @@ func (suite *SoloMachineTestSuite) GetSequenceFromStore() uint64 {
|
||||||
bz := suite.store.Get(host.KeyClientState())
|
bz := suite.store.Get(host.KeyClientState())
|
||||||
suite.Require().NotNil(bz)
|
suite.Require().NotNil(bz)
|
||||||
|
|
||||||
var clientState clientexported.ClientState
|
var clientState exported.ClientState
|
||||||
err := codec.UnmarshalAny(suite.chainA.Codec, &clientState, bz)
|
err := codec.UnmarshalAny(suite.chainA.Codec, &clientState, bz)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
return clientState.GetLatestHeight()
|
return clientState.GetLatestHeight()
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
|
||||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckHeaderAndUpdateState checks if the provided header is valid and updates
|
// 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
|
// - the currently registered public key did not provide the update signature
|
||||||
func (cs ClientState) CheckHeaderAndUpdateState(
|
func (cs ClientState) CheckHeaderAndUpdateState(
|
||||||
ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore,
|
ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore,
|
||||||
header clientexported.Header,
|
header exported.Header,
|
||||||
) (clientexported.ClientState, clientexported.ConsensusState, error) {
|
) (exported.ClientState, exported.ConsensusState, error) {
|
||||||
smHeader, ok := header.(*Header)
|
smHeader, ok := header.(*Header)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, sdkerrors.Wrapf(
|
return nil, nil, sdkerrors.Wrapf(
|
||||||
|
|
|
@ -2,15 +2,15 @@ package types_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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"
|
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"
|
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (suite *SoloMachineTestSuite) TestCheckHeaderAndUpdateState() {
|
func (suite *SoloMachineTestSuite) TestCheckHeaderAndUpdateState() {
|
||||||
var (
|
var (
|
||||||
clientState clientexported.ClientState
|
clientState exported.ClientState
|
||||||
header clientexported.Header
|
header exported.Header
|
||||||
)
|
)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
|
|
|
@ -24,14 +24,13 @@ import (
|
||||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc-transfer/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"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/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"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/testing/mock"
|
"github.com/cosmos/cosmos-sdk/x/ibc/testing/mock"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/types"
|
||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/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
|
// QueryClientStateProof performs and abci query for a client state
|
||||||
// stored with a given clientID and returns the ClientState along with the proof
|
// 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
|
// retrieve client state to provide proof for
|
||||||
clientState, found := chain.App.IBCKeeper.ClientKeeper.GetClientState(chain.GetContext(), clientID)
|
clientState, found := chain.App.IBCKeeper.ClientKeeper.GetClientState(chain.GetContext(), clientID)
|
||||||
require.True(chain.t, found)
|
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
|
// GetClientState retrieves the client state for the provided clientID. The client is
|
||||||
// expected to exist otherwise testing will fail.
|
// 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)
|
clientState, found := chain.App.IBCKeeper.ClientKeeper.GetClientState(chain.GetContext(), clientID)
|
||||||
require.True(chain.t, found)
|
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.
|
// 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.
|
// 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)
|
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
|
// GetAcknowledgement retrieves an acknowledgement for the provided packet. If the
|
||||||
// acknowledgement does not exist then testing will fail.
|
// 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())
|
ack, found := chain.App.IBCKeeper.ChannelKeeper.GetPacketAcknowledgement(chain.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||||
require.True(chain.t, found)
|
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).
|
// 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 {
|
func (chain *TestChain) ConstructMsgCreateClient(counterparty *TestChain, clientID string, clientType string) *clienttypes.MsgCreateClient {
|
||||||
var (
|
var (
|
||||||
clientState clientexported.ClientState
|
clientState exported.ClientState
|
||||||
consensusState clientexported.ConsensusState
|
consensusState exported.ConsensusState
|
||||||
)
|
)
|
||||||
|
|
||||||
switch clientType {
|
switch clientType {
|
||||||
case clientexported.ClientTypeTendermint:
|
case exported.ClientTypeTendermint:
|
||||||
clientState = ibctmtypes.NewClientState(
|
clientState = ibctmtypes.NewClientState(
|
||||||
counterparty.ChainID, DefaultTrustLevel, TrustingPeriod, UnbondingPeriod, MaxClockDrift,
|
counterparty.ChainID, DefaultTrustLevel, TrustingPeriod, UnbondingPeriod, MaxClockDrift,
|
||||||
clienttypes.NewHeight(0, counterparty.LastHeader.GetHeight()), commitmenttypes.GetSDKSpecs(),
|
clienttypes.NewHeight(0, counterparty.LastHeader.GetHeight()), commitmenttypes.GetSDKSpecs(),
|
||||||
)
|
)
|
||||||
consensusState = counterparty.LastHeader.ConsensusState()
|
consensusState = counterparty.LastHeader.ConsensusState()
|
||||||
case clientexported.ClientTypeSoloMachine:
|
case exported.ClientTypeSoloMachine:
|
||||||
solo := NewSolomachine(chain.t, clientID)
|
solo := NewSolomachine(chain.t, clientID)
|
||||||
clientState = solo.ClientState()
|
clientState = solo.ClientState()
|
||||||
consensusState = solo.ConsensusState()
|
consensusState = solo.ConsensusState()
|
||||||
|
@ -401,7 +400,7 @@ func (chain *TestChain) ConstructMsgCreateClient(counterparty *TestChain, client
|
||||||
// client will be created on the (target) chain.
|
// client will be created on the (target) chain.
|
||||||
func (chain *TestChain) CreateTMClient(counterparty *TestChain, clientID string) error {
|
func (chain *TestChain) CreateTMClient(counterparty *TestChain, clientID string) error {
|
||||||
// construct MsgCreateClient using counterparty
|
// construct MsgCreateClient using counterparty
|
||||||
msg := chain.ConstructMsgCreateClient(counterparty, clientID, clientexported.ClientTypeTendermint)
|
msg := chain.ConstructMsgCreateClient(counterparty, clientID, exported.ClientTypeTendermint)
|
||||||
return chain.sendMsgs(msg)
|
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
|
// SendPacket simulates sending a packet through the channel keeper. No message needs to be
|
||||||
// passed since this call is made from a module.
|
// passed since this call is made from a module.
|
||||||
func (chain *TestChain) SendPacket(
|
func (chain *TestChain) SendPacket(
|
||||||
packet channelexported.PacketI,
|
packet exported.PacketI,
|
||||||
) error {
|
) error {
|
||||||
channelCap := chain.GetChannelCapability(packet.GetSourcePort(), packet.GetSourceChannel())
|
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.
|
// ReceiveExecuted simulates receiving and writing an acknowledgement to the chain.
|
||||||
func (chain *TestChain) ReceiveExecuted(
|
func (chain *TestChain) ReceiveExecuted(
|
||||||
packet channelexported.PacketI,
|
packet exported.PacketI,
|
||||||
) error {
|
) error {
|
||||||
channelCap := chain.GetChannelCapability(packet.GetDestPort(), packet.GetDestChannel())
|
channelCap := chain.GetChannelCapability(packet.GetDestPort(), packet.GetDestChannel())
|
||||||
|
|
||||||
|
@ -785,7 +784,7 @@ func (chain *TestChain) ReceiveExecuted(
|
||||||
// AcknowledgementExecuted simulates deleting a packet commitment with the
|
// AcknowledgementExecuted simulates deleting a packet commitment with the
|
||||||
// given packet sequence.
|
// given packet sequence.
|
||||||
func (chain *TestChain) AcknowledgementExecuted(
|
func (chain *TestChain) AcknowledgementExecuted(
|
||||||
packet channelexported.PacketI,
|
packet exported.PacketI,
|
||||||
) error {
|
) error {
|
||||||
channelCap := chain.GetChannelCapability(packet.GetSourcePort(), packet.GetSourceChannel())
|
channelCap := chain.GetChannelCapability(packet.GetSourcePort(), packet.GetSourceChannel())
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,9 @@ import (
|
||||||
abci "github.com/tendermint/tendermint/abci/types"
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/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"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -50,7 +49,7 @@ func NewCoordinator(t *testing.T, n int) *Coordinator {
|
||||||
func (coord *Coordinator) Setup(
|
func (coord *Coordinator) Setup(
|
||||||
chainA, chainB *TestChain, order channeltypes.Order,
|
chainA, chainB *TestChain, order channeltypes.Order,
|
||||||
) (string, string, *TestConnection, *TestConnection, TestChannel, TestChannel) {
|
) (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
|
// channels can also be referenced through the returned connections
|
||||||
channelA, channelB := coord.CreateMockChannels(chainA, chainB, connA, connB, order)
|
channelA, channelB := coord.CreateMockChannels(chainA, chainB, connA, connB, order)
|
||||||
|
@ -62,7 +61,7 @@ func (coord *Coordinator) Setup(
|
||||||
// caller does not anticipate any errors.
|
// caller does not anticipate any errors.
|
||||||
func (coord *Coordinator) SetupClients(
|
func (coord *Coordinator) SetupClients(
|
||||||
chainA, chainB *TestChain,
|
chainA, chainB *TestChain,
|
||||||
clientType clientexported.ClientType,
|
clientType exported.ClientType,
|
||||||
) (string, string) {
|
) (string, string) {
|
||||||
|
|
||||||
clientA, err := coord.CreateClient(chainA, chainB, clientType)
|
clientA, err := coord.CreateClient(chainA, chainB, clientType)
|
||||||
|
@ -79,7 +78,7 @@ func (coord *Coordinator) SetupClients(
|
||||||
// anticipate any errors.
|
// anticipate any errors.
|
||||||
func (coord *Coordinator) SetupClientConnections(
|
func (coord *Coordinator) SetupClientConnections(
|
||||||
chainA, chainB *TestChain,
|
chainA, chainB *TestChain,
|
||||||
clientType clientexported.ClientType,
|
clientType exported.ClientType,
|
||||||
) (string, string, *TestConnection, *TestConnection) {
|
) (string, string, *TestConnection, *TestConnection) {
|
||||||
|
|
||||||
clientA, clientB := coord.SetupClients(chainA, chainB, clientType)
|
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.
|
// CreateClient creates a counterparty client on the source chain and returns the clientID.
|
||||||
func (coord *Coordinator) CreateClient(
|
func (coord *Coordinator) CreateClient(
|
||||||
source, counterparty *TestChain,
|
source, counterparty *TestChain,
|
||||||
clientType clientexported.ClientType,
|
clientType exported.ClientType,
|
||||||
) (clientID string, err error) {
|
) (clientID string, err error) {
|
||||||
coord.CommitBlock(source, counterparty)
|
coord.CommitBlock(source, counterparty)
|
||||||
|
|
||||||
clientID = source.NewClientID(counterparty.ChainID)
|
clientID = source.NewClientID(counterparty.ChainID)
|
||||||
|
|
||||||
switch clientType {
|
switch clientType {
|
||||||
case clientexported.Tendermint:
|
case exported.Tendermint:
|
||||||
err = source.CreateTMClient(counterparty, clientID)
|
err = source.CreateTMClient(counterparty, clientID)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -119,12 +118,12 @@ func (coord *Coordinator) CreateClient(
|
||||||
func (coord *Coordinator) UpdateClient(
|
func (coord *Coordinator) UpdateClient(
|
||||||
source, counterparty *TestChain,
|
source, counterparty *TestChain,
|
||||||
clientID string,
|
clientID string,
|
||||||
clientType clientexported.ClientType,
|
clientType exported.ClientType,
|
||||||
) (err error) {
|
) (err error) {
|
||||||
coord.CommitBlock(source, counterparty)
|
coord.CommitBlock(source, counterparty)
|
||||||
|
|
||||||
switch clientType {
|
switch clientType {
|
||||||
case clientexported.Tendermint:
|
case exported.Tendermint:
|
||||||
err = source.UpdateTMClient(counterparty, clientID)
|
err = source.UpdateTMClient(counterparty, clientID)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -216,7 +215,7 @@ func (coord *Coordinator) CreateChannel(
|
||||||
// counterparty client for the source chain.
|
// counterparty client for the source chain.
|
||||||
func (coord *Coordinator) SendPacket(
|
func (coord *Coordinator) SendPacket(
|
||||||
source, counterparty *TestChain,
|
source, counterparty *TestChain,
|
||||||
packet channelexported.PacketI,
|
packet exported.PacketI,
|
||||||
counterpartyClientID string,
|
counterpartyClientID string,
|
||||||
) error {
|
) error {
|
||||||
if err := source.SendPacket(packet); err != nil {
|
if err := source.SendPacket(packet); err != nil {
|
||||||
|
@ -227,7 +226,7 @@ func (coord *Coordinator) SendPacket(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
counterpartyClientID, clientexported.Tendermint,
|
counterpartyClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +251,7 @@ func (coord *Coordinator) RecvPacket(
|
||||||
// counterparty client for the source chain.
|
// counterparty client for the source chain.
|
||||||
func (coord *Coordinator) ReceiveExecuted(
|
func (coord *Coordinator) ReceiveExecuted(
|
||||||
source, counterparty *TestChain,
|
source, counterparty *TestChain,
|
||||||
packet channelexported.PacketI,
|
packet exported.PacketI,
|
||||||
counterpartyClientID string,
|
counterpartyClientID string,
|
||||||
) error {
|
) error {
|
||||||
if err := source.ReceiveExecuted(packet); err != nil {
|
if err := source.ReceiveExecuted(packet); err != nil {
|
||||||
|
@ -263,7 +262,7 @@ func (coord *Coordinator) ReceiveExecuted(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
counterpartyClientID, clientexported.Tendermint,
|
counterpartyClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +288,7 @@ func (coord *Coordinator) AcknowledgePacket(
|
||||||
// packet sequence since the acknowledgement has been verified.
|
// packet sequence since the acknowledgement has been verified.
|
||||||
func (coord *Coordinator) AcknowledgementExecuted(
|
func (coord *Coordinator) AcknowledgementExecuted(
|
||||||
source, counterparty *TestChain,
|
source, counterparty *TestChain,
|
||||||
packet channelexported.PacketI,
|
packet exported.PacketI,
|
||||||
counterpartyClientID string,
|
counterpartyClientID string,
|
||||||
) error {
|
) error {
|
||||||
if err := source.AcknowledgementExecuted(packet); err != nil {
|
if err := source.AcknowledgementExecuted(packet); err != nil {
|
||||||
|
@ -300,7 +299,7 @@ func (coord *Coordinator) AcknowledgementExecuted(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
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
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
counterpartyClientID, clientexported.Tendermint,
|
counterpartyClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +405,7 @@ func (coord *Coordinator) ConnOpenInit(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
if err := coord.UpdateClient(
|
if err := coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
counterpartyClientID, clientexported.Tendermint,
|
counterpartyClientID, exported.Tendermint,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return sourceConnection, counterpartyConnection, err
|
return sourceConnection, counterpartyConnection, err
|
||||||
}
|
}
|
||||||
|
@ -429,7 +428,7 @@ func (coord *Coordinator) ConnOpenTry(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
counterpartyConnection.ClientID, clientexported.Tendermint,
|
counterpartyConnection.ClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +447,7 @@ func (coord *Coordinator) ConnOpenAck(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
counterpartyConnection.ClientID, clientexported.Tendermint,
|
counterpartyConnection.ClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +465,7 @@ func (coord *Coordinator) ConnOpenConfirm(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
counterpartyConnection.ClientID, clientexported.Tendermint,
|
counterpartyConnection.ClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +497,7 @@ func (coord *Coordinator) ChanOpenInit(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
if err := coord.UpdateClient(
|
if err := coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
counterpartyConnection.ClientID, clientexported.Tendermint,
|
counterpartyConnection.ClientID, exported.Tendermint,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return sourceChannel, counterpartyChannel, err
|
return sourceChannel, counterpartyChannel, err
|
||||||
}
|
}
|
||||||
|
@ -524,7 +523,7 @@ func (coord *Coordinator) ChanOpenTry(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
connection.CounterpartyClientID, clientexported.Tendermint,
|
connection.CounterpartyClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,7 +542,7 @@ func (coord *Coordinator) ChanOpenAck(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
sourceChannel.CounterpartyClientID, clientexported.Tendermint,
|
sourceChannel.CounterpartyClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +561,7 @@ func (coord *Coordinator) ChanOpenConfirm(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
sourceChannel.CounterpartyClientID, clientexported.Tendermint,
|
sourceChannel.CounterpartyClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +582,7 @@ func (coord *Coordinator) ChanCloseInit(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
channel.CounterpartyClientID, clientexported.Tendermint,
|
channel.CounterpartyClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,6 +601,6 @@ func (coord *Coordinator) SetChannelClosed(
|
||||||
// update source client on counterparty connection
|
// update source client on counterparty connection
|
||||||
return coord.UpdateClient(
|
return coord.UpdateClient(
|
||||||
counterparty, source,
|
counterparty, source,
|
||||||
testChannel.CounterpartyClientID, clientexported.Tendermint,
|
testChannel.CounterpartyClientID, exported.Tendermint,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue