x/ibc: implement Height interface (#7211)

* change interfaces

* fix tendermint client interfaces

* fix other clients interfaces

* fix queries

* fix tendermint build

* fix builds of clients

* fix 02-build

* start fixing connection and make queries non-nullable

* fix connection keepers and queries

* fix connection build

* fix channel build

* fix all non-test files

* fix testing build

* cleanup

* lint

* fix timeout height interface

* fix tendermint tests

* fix rest of clients

* fix connection tests

* fix client tests

* fix channel tests

* fix all ibc tests

* fix transfer tests:

* docs

* fix connection query

* Apply suggestions from code review

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* wrap-up review

Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Aditya 2020-09-03 16:23:20 -04:00 committed by GitHub
parent d76f5cee70
commit 4f9e31ea21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
106 changed files with 2786 additions and 1676 deletions

View File

@ -4,6 +4,7 @@ package ibc.channel;
option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types";
import "gogoproto/gogo.proto";
import "ibc/client/client.proto";
// MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It
// is called by a relayer on Chain A.
@ -24,7 +25,10 @@ message MsgChannelOpenTry {
string counterparty_version = 4
[(gogoproto.moretags) = "yaml:\"counterparty_version\""];
bytes proof_init = 5 [(gogoproto.moretags) = "yaml:\"proof_init\""];
uint64 proof_height = 6 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 6 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
bytes signer = 7
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}
@ -37,7 +41,10 @@ message MsgChannelOpenAck {
string counterparty_version = 3
[(gogoproto.moretags) = "yaml:\"counterparty_version\""];
bytes proof_try = 4 [(gogoproto.moretags) = "yaml:\"proof_try\""];
uint64 proof_height = 5 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 5 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
bytes signer = 6
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}
@ -48,7 +55,10 @@ message MsgChannelOpenConfirm {
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
bytes proof_ack = 3 [(gogoproto.moretags) = "yaml:\"proof_ack\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 4 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
bytes signer = 5
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}
@ -68,7 +78,10 @@ message MsgChannelCloseConfirm {
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
bytes proof_init = 3 [(gogoproto.moretags) = "yaml:\"proof_init\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 4 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
bytes signer = 5
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}
@ -77,7 +90,10 @@ message MsgChannelCloseConfirm {
message MsgRecvPacket {
Packet packet = 1 [(gogoproto.nullable) = false];
bytes proof = 2;
uint64 proof_height = 3 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 3 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
bytes signer = 4
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}
@ -86,7 +102,10 @@ message MsgRecvPacket {
message MsgTimeout {
Packet packet = 1 [(gogoproto.nullable) = false];
bytes proof = 2;
uint64 proof_height = 3 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 3 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
uint64 next_sequence_recv = 4
[(gogoproto.moretags) = "yaml:\"next_sequence_recv\""];
bytes signer = 5
@ -98,7 +117,10 @@ message MsgTimeoutOnClose {
Packet packet = 1 [(gogoproto.nullable) = false];
bytes proof = 2;
bytes proof_close = 3 [(gogoproto.moretags) = "yaml:\"proof_close\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 4 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
uint64 next_sequence_recv = 5
[(gogoproto.moretags) = "yaml:\"next_sequence_recv\""];
bytes signer = 6
@ -110,7 +132,10 @@ message MsgAcknowledgement {
Packet packet = 1 [(gogoproto.nullable) = false];
bytes acknowledgement = 2;
bytes proof = 3;
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 4 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
bytes signer = 5
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}
@ -222,7 +247,10 @@ message Packet {
// actual opaque bytes transferred directly to the application module
bytes data = 6;
// block height after which the packet times out
uint64 timeout_height = 7 [(gogoproto.moretags) = "yaml:\"timeout_height\""];
ibc.client.Height timeout_height = 7 [
(gogoproto.moretags) = "yaml:\"timeout_height\"",
(gogoproto.nullable) = false
];
// block timestamp (in nanoseconds) after which the packet times out
uint64 timeout_timestamp = 8
[(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];

View File

@ -6,6 +6,7 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "ibc/channel/channel.proto";
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types";
@ -39,7 +40,7 @@ service Query {
// associated with the provided channel identifiers.
rpc ChannelConsensusState(QueryChannelConsensusStateRequest)
returns (QueryChannelConsensusStateResponse) {
option (google.api.http).get = "/ibc/channel/v1beta1/channels/{channel_id}/ports/{port_id}/consensus_state/{height}";
option (google.api.http).get = "/ibc/channel/v1beta1/channels/{channel_id}/ports/{port_id}/consensus_state/epoch/{epoch_number}/height/{epoch_height}";
}
// PacketCommitment queries a stored packet commitment hash.
@ -94,7 +95,9 @@ message QueryChannelResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}
// QueryChannelsRequest is the request type for the Query/Channels RPC method
@ -110,7 +113,9 @@ message QueryChannelsResponse {
// pagination response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
// query block height
int64 height = 3;
ibc.client.Height height = 3 [
(gogoproto.nullable) = false
];
}
// QueryConnectionChannelsRequest is the request type for the
@ -130,7 +135,9 @@ message QueryConnectionChannelsResponse {
// pagination response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
// query block height
int64 height = 3;
ibc.client.Height height = 3 [
(gogoproto.nullable) = false
];
}
// QueryChannelClientStateRequest is the request type for the Query/ClientState
@ -152,7 +159,9 @@ message QueryChannelClientStateResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}
// QueryChannelConsensusStateRequest is the request type for the
@ -162,8 +171,10 @@ message QueryChannelConsensusStateRequest {
string port_id = 1;
// channel unique identifier
string channel_id = 2;
// height of the consensus state
uint64 height = 3;
// epoch number of the consensus state
uint64 epoch_number = 3;
// epoch height of the consensus state
uint64 epoch_height = 4;
}
// QueryChannelClientStateResponse is the Response type for the
@ -178,7 +189,9 @@ message QueryChannelConsensusStateResponse {
// merkle proof path
string proof_path = 4;
// height at which the proof was retrieved
uint64 proof_height = 5;
ibc.client.Height proof_height = 5 [
(gogoproto.nullable) = false
];
}
// QueryPacketCommitmentRequest is the request type for the
@ -203,7 +216,9 @@ message QueryPacketCommitmentResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}
// QueryPacketCommitmentsRequest is the request type for the
@ -224,7 +239,9 @@ message QueryPacketCommitmentsResponse {
// pagination response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
// query block height
int64 height = 3;
ibc.client.Height height = 3 [
(gogoproto.nullable) = false
];
}
// QueryPacketAcknowledgementRequest is the request type for the
@ -249,7 +266,9 @@ message QueryPacketAcknowledgementResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}
// QueryUnrelayedPacketsRequest is the request type for the
@ -272,7 +291,9 @@ message QueryUnrelayedPacketsResponse {
// list of unrelayed packet sequences
repeated uint64 sequences = 1;
// query block height
int64 height = 2;
ibc.client.Height height = 2 [
(gogoproto.nullable) = false
];
}
// QueryNextSequenceReceiveRequest is the request type for the
@ -294,6 +315,8 @@ message QueryNextSequenceReceiveResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}

View File

@ -76,6 +76,7 @@ message MsgSubmitMisbehaviour {
// In these cases, the epoch number is incremented so that height continues to
// be monitonically increasing even as the EpochHeight gets reset
message Height {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
// the epoch that the client is currently on

View File

@ -5,6 +5,7 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "ibc/client/client.proto";
import "google/protobuf/any.proto";
import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types";
@ -22,7 +23,7 @@ service Query {
// ConsensusState queries a consensus state associated with a client state at a given height.
rpc ConsensusState(QueryConsensusStateRequest) returns (QueryConsensusStateResponse) {
option (google.api.http).get = "/ibc/client/v1beta1/consensus_states/{client_id}/{height}";
option (google.api.http).get = "/ibc/client/v1beta1/consensus_states/{client_id}/epoch/{epoch_number}/height/{epoch_height}";
}
// ConsensusStates queries all the consensus state associated with a given client.
@ -49,7 +50,9 @@ message QueryClientStateResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}
// QueryClientStatesRequest is the request type for the Query/ClientStates RPC
@ -73,10 +76,12 @@ message QueryClientStatesResponse {
message QueryConsensusStateRequest {
// client identifier
string client_id = 1;
// consensus state height
uint64 height = 2;
// consensus state epoch number
uint64 epoch_number = 2;
// consensus state epoch height
uint64 epoch_height = 3;
// latest_height overrrides the height field and queries the latest stored ConsensusState
bool latest_height = 3;
bool latest_height = 4;
}
// QueryConsensusStateResponse is the response type for the Query/ConsensusState RPC method
@ -88,7 +93,10 @@ message QueryConsensusStateResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
;
}
// QueryConsensusStatesRequest is the request type for the Query/ConsensusStates RPC method.

View File

@ -6,6 +6,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "ibc/commitment/commitment.proto";
import "ibc/client/client.proto";
// MsgConnectionOpenInit defines the msg sent by an account on Chain A to
// initialize a connection with Chain B.
@ -36,7 +37,10 @@ message MsgConnectionOpenTry {
Counterparty counterparty = 4 [(gogoproto.nullable) = false];
repeated string counterparty_versions = 5
[(gogoproto.moretags) = "yaml:\"counterparty_versions\""];
uint64 proof_height = 6 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 6 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
// proof of the initialization the connection on Chain A: `UNITIALIZED ->
// INIT`
bytes proof_init = 7 [(gogoproto.moretags) = "yaml:\"proof_init\""];
@ -44,8 +48,10 @@ message MsgConnectionOpenTry {
bytes proof_client = 8 [(gogoproto.moretags) = "yaml:\"proof_client\""];
// proof of client consensus state
bytes proof_consensus = 9 [(gogoproto.moretags) = "yaml:\"proof_consensus\""];
uint64 consensus_height = 10
[(gogoproto.moretags) = "yaml:\"consensus_height\""];
ibc.client.Height consensus_height = 10 [
(gogoproto.moretags) = "yaml:\"consensus_height\"",
(gogoproto.nullable) = false
];
bytes signer = 11
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}
@ -60,7 +66,10 @@ message MsgConnectionOpenAck {
google.protobuf.Any client_state = 3 [
(gogoproto.moretags) = "yaml:\"client_state\""
];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 4 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
// proof of the initialization the connection on Chain B: `UNITIALIZED ->
// TRYOPEN`
bytes proof_try = 5 [(gogoproto.moretags) = "yaml:\"proof_try\""];
@ -68,8 +77,10 @@ message MsgConnectionOpenAck {
bytes proof_client = 6 [(gogoproto.moretags) = "yaml:\"proof_client\""];
// proof of client consensus state
bytes proof_consensus = 7 [(gogoproto.moretags) = "yaml:\"proof_consensus\""];
uint64 consensus_height = 8
[(gogoproto.moretags) = "yaml:\"consensus_height\""];
ibc.client.Height consensus_height = 8 [
(gogoproto.moretags) = "yaml:\"consensus_height\"",
(gogoproto.nullable) = false
];
bytes signer = 9
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}
@ -82,7 +93,10 @@ message MsgConnectionOpenConfirm {
];
// proof for the change of the connection state on Chain A: `INIT -> OPEN`
bytes proof_ack = 2 [(gogoproto.moretags) = "yaml:\"proof_ack\""];
uint64 proof_height = 3 [(gogoproto.moretags) = "yaml:\"proof_height\""];
ibc.client.Height proof_height = 3 [
(gogoproto.moretags) = "yaml:\"proof_height\"",
(gogoproto.nullable) = false
];
bytes signer = 4
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

View File

@ -40,7 +40,7 @@ service Query {
// connection.
rpc ConnectionConsensusState(QueryConnectionConsensusStateRequest)
returns (QueryConnectionConsensusStateResponse) {
option (google.api.http).get = "/ibc/connection/v1beta1/connections/{connection_id}/consensus_state";
option (google.api.http).get = "/ibc/connection/v1beta1/connections/{connection_id}/consensus_state/epoch/{epoch_number}/height/{epoch_height}";
}
}
@ -62,7 +62,9 @@ message QueryConnectionResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}
// QueryConnectionsRequest is the request type for the Query/Connections RPC
@ -79,7 +81,9 @@ message QueryConnectionsResponse {
// pagination response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
// query block height
int64 height = 3;
ibc.client.Height height = 3 [
(gogoproto.nullable) = false
];
}
// QueryClientConnectionsRequest is the request type for the
@ -99,7 +103,9 @@ message QueryClientConnectionsResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was generated
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}
// QueryConnectionClientStateRequest is the request type for the
@ -121,7 +127,9 @@ message QueryConnectionClientStateResponse {
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
uint64 proof_height = 4;
ibc.client.Height proof_height = 4 [
(gogoproto.nullable) = false
];
}
// QueryConnectionConsensusStateRequest is the request type for the
@ -131,7 +139,8 @@ message QueryConnectionConsensusStateRequest {
string connection_id = 1 [
(gogoproto.moretags) = "yaml:\"connection_id\""
];
uint64 height = 2;
uint64 epoch_number = 2;
uint64 epoch_height = 3;
}
// QueryConnectionConsensusStateResponse is the response type for the
@ -146,5 +155,7 @@ message QueryConnectionConsensusStateResponse {
// merkle proof path
string proof_path = 4;
// height at which the proof was retrieved
uint64 proof_height = 5;
ibc.client.Height proof_height = 5 [
(gogoproto.nullable) = false
];
}

View File

@ -5,6 +5,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types";
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "ibc/client/client.proto";
// MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between
// ICS20 enabled chains. See ICS Spec here:
@ -22,7 +23,10 @@ message MsgTransfer {
string receiver = 5;
// Timeout height relative to the current block height.
// The timeout is disabled when set to 0.
uint64 timeout_height = 6 [(gogoproto.moretags) = "yaml:\"timeout_height\""];
ibc.client.Height timeout_height = 6 [
(gogoproto.moretags) = "yaml:\"timeout_height\"",
(gogoproto.nullable) = false
];
// Timeout timestamp (in nanoseconds) relative to the current block timestamp.
// The timeout is disabled when set to 0.
uint64 timeout_timestamp = 7 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];

View File

@ -12,6 +12,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
channelutils "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/client/utils"
)
@ -27,7 +28,8 @@ func NewTransferTxCmd() *cobra.Command {
Use: "transfer [src-port] [src-channel] [receiver] [amount]",
Short: "Transfer a fungible token through IBC",
Long: strings.TrimSpace(`Transfer a fungible token through IBC. Timeouts can be specified
as absolute or relative using the "absolute-timeouts" flag. Relative timeouts are added to
as absolute or relative using the "absolute-timeouts" flag. Timeout height can be set by passing in the height string
in the form {epoch}-{height} using the "packet-timeout-height" flag. Relative timeouts are added to
the block height and block timestamp queried from the latest consensus state corresponding
to the counterparty channel. Any timeout set to 0 is disabled.`),
Example: fmt.Sprintf("%s tx ibc-transfer transfer [src-port] [src-channel] [receiver] [amount]", version.AppName),
@ -54,7 +56,11 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
coin.Denom = denomTrace.IBCDenom()
}
timeoutHeight, err := cmd.Flags().GetUint64(flagPacketTimeoutHeight)
timeoutHeightStr, err := cmd.Flags().GetString(flagPacketTimeoutHeight)
if err != nil {
return err
}
timeoutHeight, err := clienttypes.ParseHeight(timeoutHeightStr)
if err != nil {
return err
}
@ -72,13 +78,16 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
// if the timeouts are not absolute, retrieve latest block height and block timestamp
// for the consensus state connected to the destination port/channel
if !absoluteTimeouts {
consensusState, _, err := channelutils.QueryCounterpartyConsensusState(clientCtx, srcPort, srcChannel, uint64(clientCtx.Height))
consensusState, _, err := channelutils.QueryLatestConsensusState(clientCtx, srcPort, srcChannel)
if err != nil {
return err
}
if timeoutHeight != 0 {
timeoutHeight = consensusState.GetHeight() + timeoutHeight
if !timeoutHeight.IsZero() {
absoluteHeight := consensusState.GetHeight().(clienttypes.Height)
absoluteHeight.EpochNumber += timeoutHeight.EpochNumber
absoluteHeight.EpochHeight += timeoutHeight.EpochHeight
timeoutHeight = absoluteHeight
}
if timeoutTimestamp != 0 {
@ -97,7 +106,7 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
},
}
cmd.Flags().Uint64(flagPacketTimeoutHeight, types.DefaultRelativePacketTimeoutHeight, "Packet timeout block height. The timeout is disabled when set to 0.")
cmd.Flags().String(flagPacketTimeoutHeight, types.DefaultRelativePacketTimeoutHeight, "Packet timeout block height. The timeout is disabled when set to 0-0.")
cmd.Flags().Uint64(flagPacketTimeoutTimestamp, types.DefaultRelativePacketTimeoutTimestamp, "Packet timeout timestamp in nanoseconds. Default is 10 minutes. The timeout is disabled when set to 0.")
cmd.Flags().Bool(flagAbsoluteTimeouts, false, "Timeout flags are used as absolute timeouts.")
flags.AddTxFlagsToCmd(cmd)

View File

@ -7,6 +7,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/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"
@ -34,18 +35,19 @@ func (suite *HandlerTestSuite) TestHandleMsgTransfer() {
clientA, clientB, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
channelA, channelB := suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
originalBalance := suite.chainA.App.BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom)
timeoutHeight := clienttypes.NewHeight(0, 110)
coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))
// send from chainA to chainB
msg := types.NewMsgTransfer(channelA.PortID, channelA.ID, coinToSendToB, suite.chainA.SenderAccount.GetAddress(), suite.chainB.SenderAccount.GetAddress().String(), 110, 0)
msg := types.NewMsgTransfer(channelA.PortID, channelA.ID, coinToSendToB, suite.chainA.SenderAccount.GetAddress(), suite.chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0)
err := suite.coordinator.SendMsg(suite.chainA, suite.chainB, clientB, msg)
suite.Require().NoError(err) // message committed
// relay send
fungibleTokenPacket := types.NewFungibleTokenPacketData(coinToSendToB.Denom, coinToSendToB.Amount.Uint64(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String())
packet := channeltypes.NewPacket(fungibleTokenPacket.GetBytes(), 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, 110, 0)
packet := channeltypes.NewPacket(fungibleTokenPacket.GetBytes(), 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, 0)
ack := types.FungibleTokenPacketAcknowledgement{Success: true}
err = suite.coordinator.RelayPacket(suite.chainA, suite.chainB, clientA, clientB, packet, ack.GetBytes())
suite.Require().NoError(err) // relay committed
@ -58,7 +60,7 @@ func (suite *HandlerTestSuite) TestHandleMsgTransfer() {
suite.Require().Equal(coinToSendBackToA, balance)
// send from chainB back to chainA
msg = types.NewMsgTransfer(channelB.PortID, channelB.ID, coinToSendBackToA, suite.chainB.SenderAccount.GetAddress(), suite.chainA.SenderAccount.GetAddress().String(), 110, 0)
msg = types.NewMsgTransfer(channelB.PortID, channelB.ID, coinToSendBackToA, suite.chainB.SenderAccount.GetAddress(), suite.chainA.SenderAccount.GetAddress().String(), timeoutHeight, 0)
err = suite.coordinator.SendMsg(suite.chainB, suite.chainA, clientA, msg)
suite.Require().NoError(err) // message committed
@ -67,7 +69,7 @@ func (suite *HandlerTestSuite) TestHandleMsgTransfer() {
// NOTE: fungible token is prefixed with the full trace in order to verify the packet commitment
voucherDenom := voucherDenomTrace.GetPrefix() + voucherDenomTrace.BaseDenom
fungibleTokenPacket = types.NewFungibleTokenPacketData(voucherDenom, coinToSendBackToA.Amount.Uint64(), suite.chainB.SenderAccount.GetAddress().String(), suite.chainA.SenderAccount.GetAddress().String())
packet = channeltypes.NewPacket(fungibleTokenPacket.GetBytes(), 1, channelB.PortID, channelB.ID, channelA.PortID, channelA.ID, 110, 0)
packet = channeltypes.NewPacket(fungibleTokenPacket.GetBytes(), 1, channelB.PortID, channelB.ID, channelA.PortID, channelA.ID, timeoutHeight, 0)
err = suite.coordinator.RelayPacket(suite.chainB, suite.chainA, clientB, clientA, packet, ack.GetBytes())
suite.Require().NoError(err) // relay committed

View File

@ -6,6 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)
@ -49,7 +50,7 @@ func (k Keeper) SendTransfer(
token sdk.Coin,
sender sdk.AccAddress,
receiver string,
timeoutHeight,
timeoutHeight clienttypes.Height,
timeoutTimestamp uint64,
) error {

View File

@ -15,7 +15,7 @@ type MsgTransfer struct {
Token sdk.Coin
Sender sdk.AccAddress
Receiver string
TimeoutHeight uint64
TimeoutHeight ibcexported.Height
TimeoutTimestamp uint64
}
```

View File

@ -3,6 +3,7 @@ package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)
@ -15,7 +16,7 @@ const (
func NewMsgTransfer(
sourcePort, sourceChannel string,
token sdk.Coin, sender sdk.AccAddress, receiver string,
timeoutHeight, timeoutTimestamp uint64,
timeoutHeight clienttypes.Height, timeoutTimestamp uint64,
) *MsgTransfer {
return &MsgTransfer{
SourcePort: sourcePort,

View File

@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"
sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
)
// define constants used for testing
@ -32,18 +33,20 @@ var (
invalidIBCCoin = sdk.NewCoin("notibc/7F1D3FCF4AE79E1554D670D1AD949A9BA4E4A3C76C63093E17E446A46061A7A2", sdk.NewInt(100))
invalidDenomCoin = sdk.Coin{Denom: "0atom", Amount: sdk.NewInt(100)}
zeroCoin = sdk.Coin{Denom: "atoms", Amount: sdk.NewInt(0)}
timeoutHeight = clienttypes.NewHeight(0, 10)
)
// TestMsgTransferRoute tests Route for MsgTransfer
func TestMsgTransferRoute(t *testing.T) {
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, 10, 0)
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, timeoutHeight, 0)
require.Equal(t, RouterKey, msg.Route())
}
// TestMsgTransferType tests Type for MsgTransfer
func TestMsgTransferType(t *testing.T) {
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, 10, 0)
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, timeoutHeight, 0)
require.Equal(t, "transfer", msg.Type())
}
@ -55,20 +58,20 @@ func TestMsgTransferValidation(t *testing.T) {
msg *MsgTransfer
expPass bool
}{
{"valid msg with base denom", NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, 10, 0), true},
{"valid msg with trace hash", NewMsgTransfer(validPort, validChannel, ibcCoin, addr1, addr2, 10, 0), true},
{"invalid ibc denom", NewMsgTransfer(validPort, validChannel, invalidIBCCoin, addr1, addr2, 10, 0), false},
{"too short port id", NewMsgTransfer(invalidShortPort, validChannel, coin, addr1, addr2, 10, 0), false},
{"too long port id", NewMsgTransfer(invalidLongPort, validChannel, coin, addr1, addr2, 10, 0), false},
{"port id contains non-alpha", NewMsgTransfer(invalidPort, validChannel, coin, addr1, addr2, 10, 0), false},
{"too short channel id", NewMsgTransfer(validPort, invalidShortChannel, coin, addr1, addr2, 10, 0), false},
{"too long channel id", NewMsgTransfer(validPort, invalidLongChannel, coin, addr1, addr2, 10, 0), false},
{"channel id contains non-alpha", NewMsgTransfer(validPort, invalidChannel, coin, addr1, addr2, 10, 0), false},
{"invalid denom", NewMsgTransfer(validPort, validChannel, invalidDenomCoin, addr1, addr2, 10, 0), false},
{"zero coin", NewMsgTransfer(validPort, validChannel, zeroCoin, addr1, addr2, 10, 0), false},
{"missing sender address", NewMsgTransfer(validPort, validChannel, coin, emptyAddr, addr2, 10, 0), false},
{"missing recipient address", NewMsgTransfer(validPort, validChannel, coin, addr1, "", 10, 0), false},
{"empty coin", NewMsgTransfer(validPort, validChannel, sdk.Coin{}, addr1, addr2, 10, 0), false},
{"valid msg with base denom", NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, timeoutHeight, 0), true},
{"valid msg with trace hash", NewMsgTransfer(validPort, validChannel, ibcCoin, addr1, addr2, timeoutHeight, 0), true},
{"invalid ibc denom", NewMsgTransfer(validPort, validChannel, invalidIBCCoin, addr1, addr2, timeoutHeight, 0), false},
{"too short port id", NewMsgTransfer(invalidShortPort, validChannel, coin, addr1, addr2, timeoutHeight, 0), false},
{"too long port id", NewMsgTransfer(invalidLongPort, validChannel, coin, addr1, addr2, timeoutHeight, 0), false},
{"port id contains non-alpha", NewMsgTransfer(invalidPort, validChannel, coin, addr1, addr2, timeoutHeight, 0), false},
{"too short channel id", NewMsgTransfer(validPort, invalidShortChannel, coin, addr1, addr2, timeoutHeight, 0), false},
{"too long channel id", NewMsgTransfer(validPort, invalidLongChannel, coin, addr1, addr2, timeoutHeight, 0), false},
{"channel id contains non-alpha", NewMsgTransfer(validPort, invalidChannel, coin, addr1, addr2, timeoutHeight, 0), false},
{"invalid denom", NewMsgTransfer(validPort, validChannel, invalidDenomCoin, addr1, addr2, timeoutHeight, 0), false},
{"zero coin", NewMsgTransfer(validPort, validChannel, zeroCoin, addr1, addr2, timeoutHeight, 0), false},
{"missing sender address", NewMsgTransfer(validPort, validChannel, coin, emptyAddr, addr2, timeoutHeight, 0), false},
{"missing recipient address", NewMsgTransfer(validPort, validChannel, coin, addr1, "", timeoutHeight, 0), false},
{"empty coin", NewMsgTransfer(validPort, validChannel, sdk.Coin{}, addr1, addr2, timeoutHeight, 0), false},
}
for i, tc := range testCases {
@ -83,16 +86,16 @@ func TestMsgTransferValidation(t *testing.T) {
// TestMsgTransferGetSignBytes tests GetSignBytes for MsgTransfer
func TestMsgTransferGetSignBytes(t *testing.T) {
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, 110, 10)
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, clienttypes.NewHeight(0, 110), 10)
res := msg.GetSignBytes()
expected := `{"receiver":"cosmos1w3jhxarpv3j8yvs7f9y7g","sender":"cosmos1w3jhxarpv3j8yvg4ufs4x","source_channel":"testchannel","source_port":"testportid","timeout_height":"110","timeout_timestamp":"10","token":{"amount":"100","denom":"atom"}}`
expected := `{"receiver":"cosmos1w3jhxarpv3j8yvs7f9y7g","sender":"cosmos1w3jhxarpv3j8yvg4ufs4x","source_channel":"testchannel","source_port":"testportid","timeout_height":{"epoch_height":"110","epoch_number":"0"},"timeout_timestamp":"10","token":{"amount":"100","denom":"atom"}}`
require.Equal(t, expected, string(res))
}
// TestMsgTransferGetSigners tests GetSigners for MsgTransfer
func TestMsgTransferGetSigners(t *testing.T) {
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, 10, 0)
msg := NewMsgTransfer(validPort, validChannel, coin, addr1, addr2, timeoutHeight, 0)
res := msg.GetSigners()
expected := "[746573746164647231]"

View File

@ -12,7 +12,7 @@ var (
// DefaultRelativePacketTimeoutHeight is the default packet timeout height (in blocks) relative
// to the current block height of the counterparty chain provided by the client state. The
// timeout is disabled when set to 0.
DefaultRelativePacketTimeoutHeight = uint64(1000)
DefaultRelativePacketTimeoutHeight = "0-1000"
// DefaultRelativePacketTimeoutTimestamp is the default packet timeout timestamp (in nanoseconds)
// relative to the current block timestamp of the counterparty chain provided by the client

View File

@ -7,6 +7,7 @@ import (
fmt "fmt"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
types1 "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
@ -41,7 +42,7 @@ type MsgTransfer struct {
Receiver string `protobuf:"bytes,5,opt,name=receiver,proto3" json:"receiver,omitempty"`
// Timeout height relative to the current block height.
// The timeout is disabled when set to 0.
TimeoutHeight uint64 `protobuf:"varint,6,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty" yaml:"timeout_height"`
TimeoutHeight types1.Height `protobuf:"bytes,6,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height" yaml:"timeout_height"`
// Timeout timestamp (in nanoseconds) relative to the current block timestamp.
// The timeout is disabled when set to 0.
TimeoutTimestamp uint64 `protobuf:"varint,7,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty" yaml:"timeout_timestamp"`
@ -115,11 +116,11 @@ func (m *MsgTransfer) GetReceiver() string {
return ""
}
func (m *MsgTransfer) GetTimeoutHeight() uint64 {
func (m *MsgTransfer) GetTimeoutHeight() types1.Height {
if m != nil {
return m.TimeoutHeight
}
return 0
return types1.Height{}
}
func (m *MsgTransfer) GetTimeoutTimestamp() uint64 {
@ -385,45 +386,47 @@ func init() {
func init() { proto.RegisterFile("ibc/transfer/transfer.proto", fileDescriptor_08134a70fd29e656) }
var fileDescriptor_08134a70fd29e656 = []byte{
// 601 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x41, 0x6f, 0xd3, 0x30,
0x14, 0x6e, 0xb6, 0xae, 0xdb, 0xdc, 0x6d, 0x80, 0x19, 0x5b, 0x56, 0x20, 0xa9, 0x72, 0xea, 0x65,
0x89, 0x0a, 0x42, 0x48, 0xbb, 0xc0, 0xba, 0x81, 0x98, 0x10, 0xd2, 0x14, 0xf5, 0xc4, 0xa5, 0x72,
0x9c, 0x47, 0x1a, 0xb5, 0xb1, 0x2b, 0xdb, 0x1d, 0x4c, 0xfc, 0x02, 0x6e, 0xfc, 0x17, 0xfe, 0xc4,
0x8e, 0x3b, 0x72, 0x8a, 0xd0, 0xf6, 0x0f, 0x7a, 0xe4, 0x84, 0x1c, 0x7b, 0x65, 0x45, 0x13, 0xa7,
0xf8, 0xfb, 0xde, 0xfb, 0x5e, 0xbe, 0xf7, 0xfc, 0x8c, 0x1e, 0xe7, 0x09, 0x8d, 0x94, 0x20, 0x4c,
0x7e, 0x02, 0x31, 0x3f, 0x84, 0x13, 0xc1, 0x15, 0xc7, 0x1b, 0x79, 0x42, 0xc3, 0x1b,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41, 0xe8,
0x05, 0x4e, 0x1a, 0xd5, 0x2f, 0xf8, 0xc9, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x4b, 0xfa,
0xcf, 0x3d, 0x04, 0x00, 0x00,
}
func (m *MsgTransfer) Marshal() (dAtA []byte, err error) {
@ -451,11 +454,16 @@ func (m *MsgTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x38
}
if m.TimeoutHeight != 0 {
i = encodeVarintTransfer(dAtA, i, uint64(m.TimeoutHeight))
i--
dAtA[i] = 0x30
{
size, err := m.TimeoutHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTransfer(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
if len(m.Receiver) > 0 {
i -= len(m.Receiver)
copy(dAtA[i:], m.Receiver)
@ -701,9 +709,8 @@ func (m *MsgTransfer) Size() (n int) {
if l > 0 {
n += 1 + l + sovTransfer(uint64(l))
}
if m.TimeoutHeight != 0 {
n += 1 + sovTransfer(uint64(m.TimeoutHeight))
}
l = m.TimeoutHeight.Size()
n += 1 + l + sovTransfer(uint64(l))
if m.TimeoutTimestamp != 0 {
n += 1 + sovTransfer(uint64(m.TimeoutTimestamp))
}
@ -981,10 +988,10 @@ func (m *MsgTransfer) Unmarshal(dAtA []byte) error {
m.Receiver = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType)
}
m.TimeoutHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTransfer
@ -994,11 +1001,25 @@ func (m *MsgTransfer) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.TimeoutHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTransfer
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTransfer
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.TimeoutHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType)

View File

@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/suite"
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
@ -31,10 +32,10 @@ func TestClientTestSuite(t *testing.T) {
}
func (suite *ClientTestSuite) TestBeginBlocker() {
prevHeight := suite.chainA.GetContext().BlockHeight()
prevHeight := types.GetSelfHeight(suite.chainA.GetContext())
localHostClient := suite.chainA.GetClientState(exported.ClientTypeLocalHost)
suite.Require().Equal(prevHeight, int64(localHostClient.GetLatestHeight()))
suite.Require().Equal(prevHeight, localHostClient.GetLatestHeight())
for i := 0; i < 10; i++ {
// increment height
@ -45,7 +46,7 @@ func (suite *ClientTestSuite) TestBeginBlocker() {
}, "BeginBlocker shouldn't panic")
localHostClient = suite.chainA.GetClientState(exported.ClientTypeLocalHost)
suite.Require().Equal(prevHeight+1, int64(localHostClient.GetLatestHeight()))
prevHeight = int64(localHostClient.GetLatestHeight())
suite.Require().Equal(prevHeight.Increment(), localHostClient.GetLatestHeight())
prevHeight = localHostClient.GetLatestHeight().(types.Height)
}
}

View File

@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"strconv"
"github.com/spf13/cobra"
@ -16,7 +15,9 @@ import (
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)
const flagLatestHeight = "latest-height"
const (
flagLatestHeight = "latest-height"
)
// GetCmdQueryClientStates defines the command to query all the light clients
// that this chain mantains.
@ -158,16 +159,16 @@ If the '--latest' flag is included, the query returns the latest consensus state
queryLatestHeight, _ := cmd.Flags().GetBool(flagLatestHeight)
var height uint64
var height types.Height
if !queryLatestHeight {
if len(args) != 2 {
return errors.New("must include a second 'height' argument when '--latest-height' flag is not provided")
}
height, err = strconv.ParseUint(args[1], 10, 64)
height, err = types.ParseHeight(args[1])
if err != nil {
return fmt.Errorf("expected integer height, got: %s", args[1])
return err
}
}

View File

@ -9,10 +9,12 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// QueryClientState returns a client state.
@ -65,7 +67,9 @@ func QueryClientStateABCI(
return nil, err
}
clientStateRes := types.NewQueryClientStateResponse(clientID, anyClientState, proofBz, res.Height)
// TODO: retrieve epoch-number from chain-id
height := types.NewHeight(0, uint64(res.Height))
clientStateRes := types.NewQueryClientStateResponse(clientID, anyClientState, proofBz, height)
return clientStateRes, nil
}
@ -73,16 +77,24 @@ func QueryClientStateABCI(
// If prove is true, it performs an ABCI store query in order to retrieve the merkle proof. Otherwise,
// it uses the gRPC query client.
func QueryConsensusState(
clientCtx client.Context, clientID string, height uint64, prove, latestHeight bool,
clientCtx client.Context, clientID string, heightI exported.Height, prove, latestHeight bool,
) (*types.QueryConsensusStateResponse, error) {
if prove {
return QueryConsensusStateABCI(clientCtx, clientID, height)
return QueryConsensusStateABCI(clientCtx, clientID, heightI)
}
height, ok := heightI.(types.Height)
if !ok {
return nil, sdkerrors.Wrapf(
sdkerrors.ErrInvalidHeight, "invalid height type: %T, expected: %T",
heightI, types.Height{},
)
}
queryClient := types.NewQueryClient(clientCtx)
req := &types.QueryConsensusStateRequest{
ClientId: clientID,
Height: height,
EpochNumber: height.EpochNumber,
EpochHeight: height.EpochHeight,
LatestHeight: latestHeight,
}
@ -92,7 +104,7 @@ func QueryConsensusState(
// QueryConsensusStateABCI queries the store to get the consensus state of a light client and a
// merkle proof of its existence or non-existence.
func QueryConsensusStateABCI(
clientCtx client.Context, clientID string, height uint64,
clientCtx client.Context, clientID string, height exported.Height,
) (*types.QueryConsensusStateResponse, error) {
req := abci.RequestQuery{
Path: "store/ibc/key",
@ -122,7 +134,9 @@ func QueryConsensusStateABCI(
return nil, err
}
return types.NewQueryConsensusStateResponse(clientID, anyConsensusState, proofBz, res.Height), nil
// TODO: retrieve epoch-number from chain-id
proofHeight := types.NewHeight(0, uint64(res.Height))
return types.NewQueryConsensusStateResponse(clientID, anyConsensusState, proofBz, proofHeight), nil
}
// QueryTendermintHeader takes a client context and returns the appropriate

View File

@ -31,7 +31,7 @@ func HandleMsgCreateClient(ctx sdk.Context, k keeper.Keeper, msg *types.MsgCreat
types.EventTypeCreateClient,
sdk.NewAttribute(types.AttributeKeyClientID, msg.ClientId),
sdk.NewAttribute(types.AttributeKeyClientType, clientState.ClientType().String()),
sdk.NewAttribute(types.AttributeKeyConsensusHeight, fmt.Sprintf("%d", consensusState.GetHeight())),
sdk.NewAttribute(types.AttributeKeyConsensusHeight, consensusState.GetHeight().String()),
),
sdk.NewEvent(
sdk.EventTypeMessage,

View File

@ -56,13 +56,13 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, header exported.H
}
// prevent update if the client is frozen before or at header height
if clientState.IsFrozen() && clientState.GetFrozenHeight() <= header.GetHeight() {
if clientState.IsFrozen() && clientState.GetFrozenHeight().LTE(header.GetHeight()) {
return nil, sdkerrors.Wrapf(types.ErrClientFrozen, "cannot update client with ID %s", clientID)
}
var (
consensusState exported.ConsensusState
consensusHeight uint64
consensusHeight exported.Height
err error
)
@ -78,6 +78,8 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, header exported.H
if header != nil && clientType != exported.Localhost {
k.SetClientConsensusState(ctx, clientID, header.GetHeight(), consensusState)
consensusHeight = consensusState.GetHeight()
} else {
consensusHeight = types.GetSelfHeight(ctx)
}
k.Logger(ctx).Info(fmt.Sprintf("client %s updated to height %d", clientID, clientState.GetLatestHeight()))
@ -88,7 +90,7 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, header exported.H
types.EventTypeUpdateClient,
sdk.NewAttribute(types.AttributeKeyClientID, clientID),
sdk.NewAttribute(types.AttributeKeyClientType, clientType.String()),
sdk.NewAttribute(types.AttributeKeyConsensusHeight, fmt.Sprintf("%d", consensusHeight)),
sdk.NewAttribute(types.AttributeKeyConsensusHeight, consensusHeight.String()),
),
)

View File

@ -59,11 +59,11 @@ func (suite *KeeperTestSuite) TestCreateClient() {
func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
// Must create header creation functions since suite.header gets recreated on each test case
createFutureUpdateFn := func(s *KeeperTestSuite) *ibctmtypes.Header {
return ibctmtypes.CreateTestHeader(testChainID, int64(suite.header.GetHeight()+3), int64(suite.header.GetHeight()), suite.header.Header.Time.Add(time.Hour),
return ibctmtypes.CreateTestHeader(testChainID, int64(suite.header.GetHeight().GetEpochHeight()+3), int64(suite.header.GetHeight().GetEpochHeight()), suite.header.Header.Time.Add(time.Hour),
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
}
createPastUpdateFn := func(s *KeeperTestSuite) *ibctmtypes.Header {
return ibctmtypes.CreateTestHeader(testChainID, int64(suite.header.GetHeight()-2), int64(suite.header.GetHeight())-4, suite.header.Header.Time,
return ibctmtypes.CreateTestHeader(testChainID, int64(suite.header.GetHeight().GetEpochHeight()-2), int64(suite.header.GetHeight().GetEpochHeight())-4, suite.header.Header.Time,
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
}
var (
@ -87,7 +87,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
Timestamp: suite.now.Add(time.Minute),
NextValidatorsHash: suite.valSetHash,
}
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, incrementedClientHeight.EpochHeight, intermediateConsState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, incrementedClientHeight, intermediateConsState)
clientState.LatestHeight = incrementedClientHeight
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
@ -100,21 +100,25 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
_, err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
suite.Require().NoError(err)
height1 := types.NewHeight(0, 1)
// store previous consensus state
prevConsState := &ibctmtypes.ConsensusState{
Height: types.NewHeight(0, 1),
Height: height1,
Timestamp: suite.past,
NextValidatorsHash: suite.valSetHash,
}
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, 1, prevConsState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height1, prevConsState)
height2 := types.NewHeight(0, 2)
// store intermediate consensus state to check that trustedHeight does not need to be hightest consensus state before header height
intermediateConsState := &ibctmtypes.ConsensusState{
Height: types.NewHeight(0, 2),
Height: height2,
Timestamp: suite.past.Add(time.Minute),
NextValidatorsHash: suite.valSetHash,
}
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, 2, intermediateConsState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height2, intermediateConsState)
// updateHeader will fill in consensus state between prevConsState and suite.consState
// clientState should not be updated
@ -160,13 +164,15 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
_, err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
suite.Require().NoError(err)
height1 := types.NewHeight(0, 1)
// store previous consensus state
prevConsState := &ibctmtypes.ConsensusState{
Height: types.NewHeight(0, 1),
Height: height1,
Timestamp: suite.past,
NextValidatorsHash: suite.valSetHash,
}
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, 1, prevConsState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height1, prevConsState)
// updateHeader will fill in consensus state between prevConsState and suite.consState
// clientState should not be updated
@ -200,7 +206,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
suite.Require().NoError(err, err)
expConsensusState := &ibctmtypes.ConsensusState{
Height: types.NewHeight(0, updateHeader.GetHeight()),
Height: updateHeader.GetHeight().(types.Height),
Timestamp: updateHeader.GetTime(),
Root: commitmenttypes.NewMerkleRoot(updateHeader.Header.GetAppHash()),
NextValidatorsHash: updateHeader.Header.NextValidatorsHash,
@ -215,9 +221,9 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
suite.Require().Equal(updatedClientState, newClientState, "updatedClient state not persisted correctly")
// Determine if clientState should be updated or not
if uint64(updateHeader.GetHeight()) > clientState.GetLatestHeight() {
if updateHeader.GetHeight().GT(clientState.GetLatestHeight()) {
// Header Height is greater than clientState latest Height, clientState should be updated with header.GetHeight()
suite.Require().Equal(uint64(updateHeader.GetHeight()), updatedClientState.GetLatestHeight(), "clientstate height did not update")
suite.Require().Equal(updateHeader.GetHeight(), updatedClientState.GetLatestHeight(), "clientstate height did not update")
} else {
// Update will add past consensus state, clientState should not be updated at all
suite.Require().Equal(clientState.GetLatestHeight(), updatedClientState.GetLatestHeight(), "client state height updated for past header")
@ -239,7 +245,7 @@ func (suite *KeeperTestSuite) TestUpdateClientLocalhost() {
updatedClientState, err := suite.keeper.UpdateClient(suite.ctx, exported.ClientTypeLocalHost, nil)
suite.Require().NoError(err, err)
suite.Require().Equal(localhostClient.GetLatestHeight()+1, updatedClientState.GetLatestHeight())
suite.Require().Equal(localhostClient.GetLatestHeight().(types.Height).Increment(), updatedClientState.GetLatestHeight())
}
func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
@ -267,6 +273,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
// Create valid Misbehaviour by making a duplicate header that signs over different block time
altTime := suite.ctx.BlockTime().Add(time.Minute)
heightPlus3 := types.NewHeight(0, height+3)
testCases := []struct {
name string
misbehaviour *ibctmtypes.Misbehaviour
@ -305,13 +313,13 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
// store intermediate consensus state to check that trustedHeight does not need to be highest consensus state before header height
intermediateConsState := &ibctmtypes.ConsensusState{
Height: types.NewHeight(0, height+3),
Height: heightPlus3,
Timestamp: suite.now.Add(time.Minute),
NextValidatorsHash: suite.valSetHash,
}
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height+3, intermediateConsState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, heightPlus3, intermediateConsState)
clientState.LatestHeight = types.NewHeight(0, height+3)
clientState.LatestHeight = heightPlus3
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
return err
@ -333,13 +341,13 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
// store trusted consensus state for Header2
intermediateConsState := &ibctmtypes.ConsensusState{
Height: types.NewHeight(0, height+3),
Height: heightPlus3,
Timestamp: suite.now.Add(time.Minute),
NextValidatorsHash: bothValsHash,
}
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height+3, intermediateConsState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, heightPlus3, intermediateConsState)
clientState.LatestHeight = types.NewHeight(0, height+3)
clientState.LatestHeight = heightPlus3
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
return err
@ -380,7 +388,6 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
},
false,
},
{
"client state not found",
&ibctmtypes.Misbehaviour{},
@ -407,7 +414,6 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
},
false,
},
{
"misbehaviour check failed",
&ibctmtypes.Misbehaviour{
@ -446,8 +452,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
clientState, found := suite.keeper.GetClientState(suite.ctx, testClientID)
suite.Require().True(found, "valid test case %d failed: %s", i, tc.name)
suite.Require().True(clientState.IsFrozen(), "valid test case %d failed: %s", i, tc.name)
suite.Require().Equal(uint64(tc.misbehaviour.GetHeight()), clientState.GetFrozenHeight(),
"valid test case %d failed: %s. Expected FrozenHeight %d got %d", tc.misbehaviour.GetHeight(), clientState.GetFrozenHeight())
suite.Require().Equal(tc.misbehaviour.GetHeight(), clientState.GetFrozenHeight(),
"valid test case %d failed: %s. Expected FrozenHeight %s got %s", tc.misbehaviour.GetHeight(), clientState.GetFrozenHeight())
} else {
suite.Require().Error(err, "invalid test case %d passed: %s", i, tc.name)
}

View File

@ -43,9 +43,10 @@ func (q Keeper) ClientState(c context.Context, req *types.QueryClientStateReques
return nil, status.Error(codes.Internal, err.Error())
}
proofHeight := types.GetSelfHeight(ctx)
return &types.QueryClientStateResponse{
ClientState: any,
ProofHeight: uint64(ctx.BlockHeight()),
ProofHeight: proofHeight,
}, nil
}
@ -108,20 +109,21 @@ func (q Keeper) ConsensusState(c context.Context, req *types.QueryConsensusState
found bool
)
height := types.NewHeight(req.EpochNumber, req.EpochHeight)
if req.LatestHeight {
consensusState, found = q.GetLatestClientConsensusState(ctx, req.ClientId)
} else {
if req.Height == 0 {
if req.EpochHeight == 0 {
return nil, status.Error(codes.InvalidArgument, "consensus state height cannot be 0")
}
consensusState, found = q.GetClientConsensusState(ctx, req.ClientId, req.Height)
consensusState, found = q.GetClientConsensusState(ctx, req.ClientId, height)
}
if !found {
return nil, status.Error(
codes.NotFound,
sdkerrors.Wrapf(types.ErrConsensusStateNotFound, "client-id: %s, height: %d", req.ClientId, req.Height).Error(),
sdkerrors.Wrapf(types.ErrConsensusStateNotFound, "client-id: %s, height: %s", req.ClientId, height).Error(),
)
}
@ -130,9 +132,10 @@ func (q Keeper) ConsensusState(c context.Context, req *types.QueryConsensusState
return nil, status.Error(codes.Internal, err.Error())
}
proofHeight := types.GetSelfHeight(ctx)
return &types.QueryConsensusStateResponse{
ConsensusState: any,
ProofHeight: uint64(ctx.BlockHeight()),
ProofHeight: proofHeight,
}, nil
}

View File

@ -188,7 +188,8 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() {
func() {
req = &types.QueryConsensusStateRequest{
ClientId: testClientID,
Height: 0,
EpochNumber: 0,
EpochHeight: 0,
LatestHeight: false,
}
},
@ -231,15 +232,16 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() {
cs := ibctmtypes.NewConsensusState(
suite.consensusState.Timestamp, commitmenttypes.NewMerkleRoot([]byte("hash1")), suite.consensusState.Height, nil,
)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height, cs)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, testClientHeight, cs)
var err error
expConsensusState, err = types.PackConsensusState(cs)
suite.Require().NoError(err)
req = &types.QueryConsensusStateRequest{
ClientId: testClientID,
Height: height,
ClientId: testClientID,
EpochNumber: 0,
EpochHeight: height,
}
},
true,
@ -317,8 +319,8 @@ func (suite *KeeperTestSuite) TestQueryConsensusStates() {
suite.consensusState.Timestamp.Add(time.Second), commitmenttypes.NewMerkleRoot([]byte("hash2")), suite.consensusState.Height, nil,
)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height, cs)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height+1, cs2)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, testClientHeight, cs)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, testClientHeight.Increment(), cs2)
any, err := types.PackConsensusState(cs)
suite.Require().NoError(err)

View File

@ -78,7 +78,7 @@ func (k Keeper) SetClientType(ctx sdk.Context, clientID string, clientType expor
}
// GetClientConsensusState gets the stored consensus state from a client at a given height.
func (k Keeper) GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (exported.ConsensusState, bool) {
func (k Keeper) GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) {
store := k.ClientStore(ctx, clientID)
bz := store.Get(host.KeyConsensusState(height))
if bz == nil {
@ -91,7 +91,7 @@ func (k Keeper) GetClientConsensusState(ctx sdk.Context, clientID string, height
// SetClientConsensusState sets a ConsensusState to a particular client at the given
// height
func (k Keeper) SetClientConsensusState(ctx sdk.Context, clientID string, height uint64, consensusState exported.ConsensusState) {
func (k Keeper) SetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height, consensusState exported.ConsensusState) {
store := k.ClientStore(ctx, clientID)
store.Set(host.KeyConsensusState(height), k.MustMarshalConsensusState(consensusState))
}
@ -157,7 +157,7 @@ func (k Keeper) GetAllConsensusStates(ctx sdk.Context) types.ClientsConsensusSta
// HasClientConsensusState returns if keeper has a ConsensusState for a particular
// client at the given height
func (k Keeper) HasClientConsensusState(ctx sdk.Context, clientID string, height uint64) bool {
func (k Keeper) HasClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) bool {
store := k.ClientStore(ctx, clientID)
return store.Has(host.KeyConsensusState(height))
}
@ -173,12 +173,16 @@ func (k Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string)
// GetClientConsensusStateLTE will get the latest ConsensusState of a particular client at the latest height
// less than or equal to the given height
func (k Keeper) GetClientConsensusStateLTE(ctx sdk.Context, clientID string, maxHeight uint64) (exported.ConsensusState, bool) {
for i := maxHeight; i > 0; i-- {
found := k.HasClientConsensusState(ctx, clientID, i)
// It will only search for heights within the same epoch
func (k Keeper) GetClientConsensusStateLTE(ctx sdk.Context, clientID string, maxHeight exported.Height) (exported.ConsensusState, bool) {
h := maxHeight
ok := true
for ok {
found := k.HasClientConsensusState(ctx, clientID, h)
if found {
return k.GetClientConsensusState(ctx, clientID, i)
return k.GetClientConsensusState(ctx, clientID, h)
}
h, ok = h.Decrement()
}
return nil, false
}
@ -186,14 +190,22 @@ func (k Keeper) GetClientConsensusStateLTE(ctx sdk.Context, clientID string, max
// GetSelfConsensusState introspects the (self) past historical info at a given height
// and returns the expected consensus state at that height.
// TODO: Replace height with *clienttypes.Height once interfaces change
func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height uint64) (exported.ConsensusState, bool) {
histInfo, found := k.stakingKeeper.GetHistoricalInfo(ctx, int64(height))
func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height exported.Height) (exported.ConsensusState, bool) {
// TODO: check self chain-id against epoch number
selfHeight, ok := height.(types.Height)
if !ok {
return nil, false
}
if selfHeight.EpochNumber != 0 {
return nil, false
}
histInfo, found := k.stakingKeeper.GetHistoricalInfo(ctx, int64(selfHeight.EpochHeight))
if !found {
return nil, false
}
consensusState := &ibctmtypes.ConsensusState{
Height: types.NewHeight(0, height),
Height: selfHeight,
Timestamp: histInfo.Header.Time,
Root: commitmenttypes.NewMerkleRoot(histInfo.Header.GetAppHash()),
NextValidatorsHash: histInfo.Header.NextValidatorsHash,

View File

@ -128,9 +128,9 @@ func (suite *KeeperTestSuite) TestSetClientType() {
}
func (suite *KeeperTestSuite) TestSetClientConsensusState() {
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height, suite.consensusState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, testClientHeight, suite.consensusState)
retrievedConsState, found := suite.keeper.GetClientConsensusState(suite.ctx, testClientID, height)
retrievedConsState, found := suite.keeper.GetClientConsensusState(suite.ctx, testClientID, testClientHeight)
suite.Require().True(found, "GetConsensusState failed")
tmConsState, ok := retrievedConsState.(*ibctmtypes.ConsensusState)
@ -259,13 +259,13 @@ func (suite KeeperTestSuite) TestGetConsensusState() {
suite.ctx = suite.ctx.WithBlockHeight(10)
cases := []struct {
name string
height uint64
height types.Height
expPass bool
}{
{"zero height", 0, false},
{"height > latest height", uint64(suite.ctx.BlockHeight()) + 1, false},
{"latest height - 1", uint64(suite.ctx.BlockHeight()) - 1, true},
{"latest height", uint64(suite.ctx.BlockHeight()), true},
{"zero height", types.Height{}, false},
{"height > latest height", types.NewHeight(0, uint64(suite.ctx.BlockHeight())+1), false},
{"latest height - 1", types.NewHeight(0, uint64(suite.ctx.BlockHeight())-1), true},
{"latest height", types.GetSelfHeight(suite.ctx), true},
}
for i, tc := range cases {
@ -286,7 +286,7 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() {
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs())
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height, suite.consensusState)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, testClientHeight, suite.consensusState)
nextState := ibctmtypes.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot([]byte("next")), types.NewHeight(0, height+5), suite.valSetHash)
@ -294,8 +294,8 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() {
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
// mock update functionality
clientState.LatestHeight = types.NewHeight(0, header.GetHeight())
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, height+5, nextState)
clientState.LatestHeight = header.GetHeight().(types.Height)
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, header.GetHeight(), nextState)
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
latest, ok := suite.keeper.GetLatestClientConsensusState(suite.ctx, testClientID)
@ -303,7 +303,7 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() {
suite.Require().Equal(nextState, latest, "Latest client not returned correctly")
// Should return existing consensusState at latestClientHeight
lte, ok := suite.keeper.GetClientConsensusStateLTE(suite.ctx, testClientID, height+3)
lte, ok := suite.keeper.GetClientConsensusStateLTE(suite.ctx, testClientID, types.NewHeight(0, height+3))
suite.Require().True(ok)
suite.Require().Equal(suite.consensusState, lte, "LTE helper function did not return latest client state below height: %d", height+3)
}
@ -320,7 +320,7 @@ func (suite KeeperTestSuite) TestGetAllConsensusStates() {
expConsensus2 := []exported.ConsensusState{
ibctmtypes.NewConsensusState(
suite.consensusState.Timestamp.Add(2*time.Minute), commitmenttypes.NewMerkleRoot([]byte("app_hash_2")), types.NewHeight(0, suite.consensusState.GetHeight()+2), nil,
suite.consensusState.Timestamp.Add(2*time.Minute), commitmenttypes.NewMerkleRoot([]byte("app_hash_2")), types.NewHeight(0, suite.consensusState.GetHeight().GetEpochHeight()+2), nil,
),
}

View File

@ -20,12 +20,14 @@ func TestDecodeStore(t *testing.T) {
app := simapp.Setup(false)
clientID := "clientidone"
height := types.NewHeight(0, 10)
clientState := &ibctmtypes.ClientState{
FrozenHeight: types.NewHeight(0, 10),
FrozenHeight: height,
}
consState := &ibctmtypes.ConsensusState{
Height: types.NewHeight(0, 10),
Height: height,
Timestamp: time.Now().UTC(),
}
@ -40,7 +42,7 @@ func TestDecodeStore(t *testing.T) {
Value: []byte(exported.Tendermint.String()),
},
{
Key: host.FullKeyClientPath(clientID, host.KeyConsensusState(10)),
Key: host.FullKeyClientPath(clientID, host.KeyConsensusState(height)),
Value: app.IBCKeeper.ClientKeeper.MustMarshalConsensusState(consState),
},
{

View File

@ -389,20 +389,6 @@ func (m *Height) XXX_DiscardUnknown() {
var xxx_messageInfo_Height proto.InternalMessageInfo
func (m *Height) GetEpochNumber() uint64 {
if m != nil {
return m.EpochNumber
}
return 0
}
func (m *Height) GetEpochHeight() uint64 {
if m != nil {
return m.EpochHeight
}
return 0
}
func init() {
proto.RegisterType((*IdentifiedClientState)(nil), "ibc.client.IdentifiedClientState")
proto.RegisterType((*ClientConsensusStates)(nil), "ibc.client.ClientConsensusStates")
@ -415,40 +401,40 @@ func init() {
func init() { proto.RegisterFile("ibc/client/client.proto", fileDescriptor_226f80e576f20abd) }
var fileDescriptor_226f80e576f20abd = []byte{
// 520 bytes of a gzipped FileDescriptorProto
// 525 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0x3f, 0x8f, 0x12, 0x41,
0x1c, 0x65, 0x80, 0x10, 0x6f, 0x20, 0x72, 0x59, 0x41, 0x10, 0x93, 0x5d, 0x32, 0x15, 0x85, 0xec,
0x7a, 0xd8, 0x18, 0x3a, 0xa0, 0x91, 0x44, 0x8c, 0xd9, 0x8b, 0x85, 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x99, 0x91,
0xfb, 0x78, 0x66, 0xe4, 0x06, 0x4f, 0xbe, 0xcd, 0x75, 0x70, 0x3e, 0xd7, 0xc1, 0xcf, 0xb9, 0x0e,
0x3e, 0x2c, 0xf4, 0xdc, 0xf9, 0x42, 0xcf, 0xfd, 0x58, 0xe8, 0xb9, 0x97, 0xdd, 0x9d, 0xea, 0xde,
0x5a, 0xab, 0x6f, 0xf3, 0x41, 0xb7, 0x93, 0xfd, 0x9c, 0x52, 0xad, 0x5b, 0x94, 0x0e, 0x3e, 0xfc,
0x1d, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x85, 0x19, 0xfc, 0x54, 0x05, 0x00, 0x00,
}
func (m *IdentifiedClientState) Marshal() (dAtA []byte, err error) {

View File

@ -62,7 +62,7 @@ func TestValidateGenesis(t *testing.T) {
clientID,
[]exported.ConsensusState{
ibctmtypes.NewConsensusState(
header.GetTime(), commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), types.NewHeight(0, header.GetHeight()), header.Header.NextValidatorsHash,
header.GetTime(), commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), header.GetHeight().(types.Height), header.Header.NextValidatorsHash,
),
},
),
@ -87,7 +87,7 @@ func TestValidateGenesis(t *testing.T) {
clientID,
[]exported.ConsensusState{
ibctmtypes.NewConsensusState(
header.GetTime(), commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), types.NewHeight(0, header.GetHeight()), header.Header.NextValidatorsHash,
header.GetTime(), commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), header.GetHeight().(types.Height), header.Header.NextValidatorsHash,
),
},
),

View File

@ -2,7 +2,11 @@ package types
import (
"fmt"
"strconv"
"strings"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
@ -16,6 +20,16 @@ func NewHeight(epochNumber, epochHeight uint64) Height {
}
}
// GetEpochNumber returns the epoch-number of the height
func (h Height) GetEpochNumber() uint64 {
return h.EpochNumber
}
// GetEpochHeight returns the epoch-height of the height
func (h Height) GetEpochHeight() uint64 {
return h.EpochHeight
}
/// Compare implements a method to compare two heights. When comparing two heights a, b
// we can call a.Compare(b) which will return
// -1 if a < b
@ -72,21 +86,18 @@ func (h Height) EQ(other exported.Height) bool {
// String returns a string representation of Height
func (h Height) String() string {
return fmt.Sprintf("epoch-%d-height-%d", h.EpochNumber, h.EpochHeight)
return fmt.Sprintf("%d-%d", h.EpochNumber, h.EpochHeight)
}
// Decrement will return a decremented height from the given height. If this is not possible,
// an error is returned
// Decrement will return a new height with the EpochHeight decremented
// If the EpochHeight is already at lowest value (1), then false success flag is returend
func (h Height) Decrement() (decremented Height, success bool) {
func (h Height) Decrement() (decremented exported.Height, success bool) {
if h.EpochHeight == 0 {
return Height{}, false
}
return NewHeight(h.EpochNumber, h.EpochHeight-1), true
}
// Increment will return an incremented height from the given height.
// Increment will return a height with the same epoch number but an
// incremented epoch height
func (h Height) Increment() Height {
@ -97,3 +108,27 @@ func (h Height) Increment() Height {
func (h Height) IsZero() bool {
return h.EpochNumber == 0 && h.EpochHeight == 0
}
// ParseHeight is a utility function that takes a string representation of the height
// and returns a Height struct
func ParseHeight(heightStr string) (Height, error) {
splitStr := strings.Split(heightStr, "-")
if len(splitStr) != 2 {
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "expected height string format: {epoch}-{height}. Got: %s", heightStr)
}
epochNumber, err := strconv.ParseUint(splitStr[0], 10, 64)
if err != nil {
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid epoch number. parse err: %s", err)
}
epochHeight, err := strconv.ParseUint(splitStr[1], 10, 64)
if err != nil {
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid epoch height. parse err: %s", err)
}
return NewHeight(epochNumber, epochHeight), nil
}
// GetSelfHeight is a utility function that returns self height given context
// TODO: Retrieve epoch-number from chain-id
func GetSelfHeight(ctx sdk.Context) Height {
return NewHeight(0, uint64(ctx.BlockHeight()))
}

View File

@ -53,3 +53,24 @@ func TestDecrement(t *testing.T) {
require.Equal(t, types.Height{}, actual, "invalid decrement returned non-zero height: %s", actual)
require.False(t, success, "invalid decrement passed")
}
func TestString(t *testing.T) {
_, err := types.ParseHeight("height")
require.Error(t, err, "invalid height string passed")
_, err = types.ParseHeight("epoch-10")
require.Error(t, err, "invalid epoch string passed")
_, err = types.ParseHeight("3-height")
require.Error(t, err, "invalid epoch-height string passed")
height := types.NewHeight(3, 4)
recovered, err := types.ParseHeight(height.String())
require.NoError(t, err, "valid height string could not be parsed")
require.Equal(t, height, recovered, "recovered height not equal to original height")
parse, err := types.ParseHeight("3-10")
require.NoError(t, err, "parse err")
require.Equal(t, types.NewHeight(3, 10), parse, "parse height returns wrong height")
}

View File

@ -10,26 +10,26 @@ import (
// NewQueryClientStateResponse creates a new QueryClientStateResponse instance.
func NewQueryClientStateResponse(
clientID string, clientStateAny *codectypes.Any, proof []byte, height int64,
clientID string, clientStateAny *codectypes.Any, proof []byte, height Height,
) *QueryClientStateResponse {
path := commitmenttypes.NewMerklePath(append([]string{clientID}, strings.Split(host.ClientStatePath(), "/")...))
return &QueryClientStateResponse{
ClientState: clientStateAny,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
// NewQueryConsensusStateResponse creates a new QueryConsensusStateResponse instance.
func NewQueryConsensusStateResponse(
clientID string, consensusStateAny *codectypes.Any, proof []byte, height int64,
clientID string, consensusStateAny *codectypes.Any, proof []byte, height Height,
) *QueryConsensusStateResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(clientID, host.ConsensusStatePath(uint64(height))), "/"))
path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(clientID, host.ConsensusStatePath(height)), "/"))
return &QueryConsensusStateResponse{
ConsensusState: consensusStateAny,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}

View File

@ -8,6 +8,7 @@ import (
fmt "fmt"
types "github.com/cosmos/cosmos-sdk/codec/types"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
@ -88,7 +89,7 @@ type QueryClientStateResponse struct {
// merkle proof path
ProofPath string `protobuf:"bytes,3,opt,name=proof_path,json=proofPath,proto3" json:"proof_path,omitempty"`
// height at which the proof was retrieved
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"`
ProofHeight Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"`
}
func (m *QueryClientStateResponse) Reset() { *m = QueryClientStateResponse{} }
@ -145,11 +146,11 @@ func (m *QueryClientStateResponse) GetProofPath() string {
return ""
}
func (m *QueryClientStateResponse) GetProofHeight() uint64 {
func (m *QueryClientStateResponse) GetProofHeight() Height {
if m != nil {
return m.ProofHeight
}
return 0
return Height{}
}
// QueryClientStatesRequest is the request type for the Query/ClientStates RPC
@ -260,10 +261,12 @@ func (m *QueryClientStatesResponse) GetPagination() *query.PageResponse {
type QueryConsensusStateRequest struct {
// client identifier
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
// consensus state height
Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
// consensus state epoch number
EpochNumber uint64 `protobuf:"varint,2,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"`
// consensus state epoch height
EpochHeight uint64 `protobuf:"varint,3,opt,name=epoch_height,json=epochHeight,proto3" json:"epoch_height,omitempty"`
// latest_height overrrides the height field and queries the latest stored ConsensusState
LatestHeight bool `protobuf:"varint,3,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height,omitempty"`
LatestHeight bool `protobuf:"varint,4,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height,omitempty"`
}
func (m *QueryConsensusStateRequest) Reset() { *m = QueryConsensusStateRequest{} }
@ -306,9 +309,16 @@ func (m *QueryConsensusStateRequest) GetClientId() string {
return ""
}
func (m *QueryConsensusStateRequest) GetHeight() uint64 {
func (m *QueryConsensusStateRequest) GetEpochNumber() uint64 {
if m != nil {
return m.Height
return m.EpochNumber
}
return 0
}
func (m *QueryConsensusStateRequest) GetEpochHeight() uint64 {
if m != nil {
return m.EpochHeight
}
return 0
}
@ -329,7 +339,7 @@ type QueryConsensusStateResponse struct {
// merkle proof path
ProofPath string `protobuf:"bytes,3,opt,name=proof_path,json=proofPath,proto3" json:"proof_path,omitempty"`
// height at which the proof was retrieved
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"`
ProofHeight Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"`
}
func (m *QueryConsensusStateResponse) Reset() { *m = QueryConsensusStateResponse{} }
@ -386,11 +396,11 @@ func (m *QueryConsensusStateResponse) GetProofPath() string {
return ""
}
func (m *QueryConsensusStateResponse) GetProofHeight() uint64 {
func (m *QueryConsensusStateResponse) GetProofHeight() Height {
if m != nil {
return m.ProofHeight
}
return 0
return Height{}
}
// QueryConsensusStatesRequest is the request type for the Query/ConsensusStates RPC method.
@ -517,50 +527,54 @@ func init() {
func init() { proto.RegisterFile("ibc/client/query.proto", fileDescriptor_320a7d3a97b17345) }
var fileDescriptor_320a7d3a97b17345 = []byte{
// 688 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0xcf, 0x4f, 0xd4, 0x4e,
0x18, 0xc6, 0x99, 0xe5, 0x47, 0xe0, 0xdd, 0x05, 0xbe, 0x99, 0x10, 0x58, 0x0a, 0xdf, 0xcd, 0xb2,
0x28, 0xac, 0x26, 0xcc, 0xc0, 0x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0x9d, 0xd4,
0xaa, 0x76, 0xdb, 0xf8, 0x0d, 0x82, 0xa1, 0x23, 0x3d, 0x89, 0x3b, 0x21, 0x3c, 0xe4, 0xb5, 0xdc,
0x39, 0x50, 0xd7, 0x72, 0x55, 0xd6, 0x52, 0xc1, 0x73, 0xbf, 0x5a, 0xcb, 0xc2, 0xdd, 0xdd, 0xfd,
0x22, 0xda, 0xdb, 0x2f, 0xa2, 0x6f, 0xfb, 0x45, 0xf4, 0xea, 0xa0, 0x98, 0xdb, 0x3b, 0x28, 0xe6,
0xbe, 0x1c, 0x14, 0x73, 0x0f, 0x2b, 0x61, 0x24, 0x6a, 0x0d, 0xdf, 0x09, 0xd8, 0x3a, 0xd1, 0xbf,
0x00, 0xea, 0x33, 0xcb, 0xab, 0x4f, 0xc8, 0x33, 0x99, 0x69, 0xae, 0x32, 0xab, 0x93, 0x89, 0xcd,
0x84, 0x72, 0xff, 0x1f, 0x39, 0x44, 0x17, 0x7f, 0x04, 0x00, 0x00, 0xff, 0xff, 0x35, 0x1e, 0xf8,
0x0d, 0x58, 0x08, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -809,11 +823,16 @@ func (m *QueryClientStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error
_ = i
var l int
_ = l
if m.ProofHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.ProofPath) > 0 {
i -= len(m.ProofPath)
copy(dAtA[i:], m.ProofPath)
@ -955,10 +974,15 @@ func (m *QueryConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, err
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
if m.EpochHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.EpochHeight))
i--
dAtA[i] = 0x18
}
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
if m.EpochNumber != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.EpochNumber))
i--
dAtA[i] = 0x10
}
@ -992,11 +1016,16 @@ func (m *QueryConsensusStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, er
_ = i
var l int
_ = l
if m.ProofHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.ProofPath) > 0 {
i -= len(m.ProofPath)
copy(dAtA[i:], m.ProofPath)
@ -1159,9 +1188,8 @@ func (m *QueryClientStateResponse) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovQuery(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
@ -1207,8 +1235,11 @@ func (m *QueryConsensusStateRequest) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
if m.EpochNumber != 0 {
n += 1 + sovQuery(uint64(m.EpochNumber))
}
if m.EpochHeight != 0 {
n += 1 + sovQuery(uint64(m.EpochHeight))
}
if m.LatestHeight {
n += 2
@ -1234,9 +1265,8 @@ func (m *QueryConsensusStateResponse) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovQuery(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
@ -1499,10 +1529,10 @@ func (m *QueryClientStateResponse) Unmarshal(dAtA []byte) error {
m.ProofPath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -1512,11 +1542,25 @@ func (m *QueryClientStateResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@ -1816,9 +1860,9 @@ func (m *QueryConsensusStateRequest) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType)
}
m.Height = 0
m.EpochNumber = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -1828,12 +1872,31 @@ func (m *QueryConsensusStateRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= uint64(b&0x7F) << shift
m.EpochNumber |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field EpochHeight", wireType)
}
m.EpochHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.EpochHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LatestHeight", wireType)
}
@ -2009,10 +2072,10 @@ func (m *QueryConsensusStateResponse) Unmarshal(dAtA []byte) error {
m.ProofPath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -2022,11 +2085,25 @@ func (m *QueryConsensusStateResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])

View File

@ -122,7 +122,7 @@ func local_request_Query_ClientStates_0(ctx context.Context, marshaler runtime.M
}
var (
filter_Query_ConsensusState_0 = &utilities.DoubleArray{Encoding: map[string]int{"client_id": 0, "height": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
filter_Query_ConsensusState_0 = &utilities.DoubleArray{Encoding: map[string]int{"client_id": 0, "epoch_number": 1, "epoch_height": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
)
func request_Query_ConsensusState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
@ -147,15 +147,26 @@ func request_Query_ConsensusState_0(ctx context.Context, marshaler runtime.Marsh
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err)
}
val, ok = pathParams["height"]
val, ok = pathParams["epoch_number"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_number")
}
protoReq.Height, err = runtime.Uint64(val)
protoReq.EpochNumber, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_number", err)
}
val, ok = pathParams["epoch_height"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_height")
}
protoReq.EpochHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_height", err)
}
if err := req.ParseForm(); err != nil {
@ -192,15 +203,26 @@ func local_request_Query_ConsensusState_0(ctx context.Context, marshaler runtime
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err)
}
val, ok = pathParams["height"]
val, ok = pathParams["epoch_number"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_number")
}
protoReq.Height, err = runtime.Uint64(val)
protoReq.EpochNumber, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_number", err)
}
val, ok = pathParams["epoch_height"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_height")
}
protoReq.EpochHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_height", err)
}
if err := req.ParseForm(); err != nil {
@ -501,7 +523,7 @@ var (
pattern_Query_ClientStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ibc", "client", "v1beta1", "client_states"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"ibc", "client", "v1beta1", "consensus_states", "client_id", "height"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8}, []string{"ibc", "client", "v1beta1", "consensus_states", "client_id", "epoch", "epoch_number", "height", "epoch_height"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ConsensusStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ibc", "client", "v1beta1", "consensus_states", "client_id"}, "", runtime.AssumeColonVerbOpt(true)))
)

View File

@ -79,7 +79,7 @@ func GetCmdQueryConnection() *cobra.Command {
return err
}
clientCtx = clientCtx.WithHeight(int64(connRes.ProofHeight))
clientCtx = clientCtx.WithHeight(int64(connRes.ProofHeight.EpochHeight))
return clientCtx.PrintOutput(connRes)
},
}
@ -113,7 +113,7 @@ func GetCmdQueryClientConnections() *cobra.Command {
return err
}
clientCtx = clientCtx.WithHeight(int64(connPathsRes.ProofHeight))
clientCtx = clientCtx.WithHeight(int64(connPathsRes.ProofHeight.EpochHeight))
return clientCtx.PrintOutput(connPathsRes)
},
}

View File

@ -10,6 +10,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/version"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/client/utils"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
@ -68,16 +69,16 @@ func NewConnectionOpenTryCmd() *cobra.Command {
cmd := &cobra.Command{
Use: strings.TrimSpace(`open-try [connection-id] [client-id]
[counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json] [path/to/client_state.json]
[counterparty-versions] [path/to/proof_init.json] [path/to/proof_client.json] [path/to/proof_consensus.json]`),
[counterparty-versions] [consensus-height] [proof-height] [path/to/proof_init.json] [path/to/proof_client.json] [path/to/proof_consensus.json]`),
Short: "initiate connection handshake between two chains",
Long: "Initialize a connection on chain A with a given counterparty chain B",
Example: fmt.Sprintf(
`%s tx %s %s open-try connection-id] [client-id] \
[counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json] [path/to/client_state.json]\
[counterparty-versions] [path/to/proof_init.json] [path/to/proof_client.json] [path/tp/proof_consensus.json]`,
[counterparty-versions] [consensus-height] [proof-height] [path/to/proof_init.json] [path/to/proof_client.json] [path/to/proof_consensus.json]`,
version.AppName, host.ModuleName, types.SubModuleName,
),
Args: cobra.ExactArgs(10),
Args: cobra.ExactArgs(12),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())
@ -103,23 +104,26 @@ func NewConnectionOpenTryCmd() *cobra.Command {
// TODO: parse strings?
counterpartyVersions := args[6]
proofInit, err := utils.ParseProof(clientCtx.LegacyAmino, args[7])
consensusHeight, err := clienttypes.ParseHeight(args[7])
if err != nil {
return err
}
proofHeight, err := clienttypes.ParseHeight(args[8])
if err != nil {
return err
}
proofClient, err := utils.ParseProof(clientCtx.LegacyAmino, args[8])
proofInit, err := utils.ParseProof(clientCtx.LegacyAmino, args[9])
if err != nil {
return err
}
proofConsensus, err := utils.ParseProof(clientCtx.LegacyAmino, args[9])
proofClient, err := utils.ParseProof(clientCtx.LegacyAmino, args[10])
if err != nil {
return err
}
proofHeight := uint64(clientCtx.Height)
consensusHeight, err := lastHeight(clientCtx)
proofConsensus, err := utils.ParseProof(clientCtx.LegacyAmino, args[11])
if err != nil {
return err
}
@ -148,14 +152,16 @@ func NewConnectionOpenTryCmd() *cobra.Command {
// connection open attempt from chain B to chain A
func NewConnectionOpenAckCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "open-ack [connection-id] [path/to/client_state.json] [path/to/proof_try.json] [path/to/proof_client.json] [path/to/proof_consensus.json] [version]",
Use: `open-ack [connection-id] [path/to/client_state.json] [consensus-height] [proof-height]
[path/to/proof_try.json] [path/to/proof_client.json] [path/to/proof_consensus.json] [version]`,
Short: "relay the acceptance of a connection open attempt",
Long: "Relay the acceptance of a connection open attempt from chain B to chain A",
Example: fmt.Sprintf(
"%s tx %s %s open-ack [connection-id] [path/to/client_state.json] [path/to/proof_try.json] [path/to/proof_client.json] [path/to/proof_consensus.json] [version]",
`%s tx %s %s open-ack [connection-id] [path/to/client_state.json] [consensus-height] [proof-height]
[path/to/proof_try.json] [path/to/proof_client.json] [path/to/proof_consensus.json] [version]`,
version.AppName, host.ModuleName, types.SubModuleName,
),
Args: cobra.ExactArgs(6),
Args: cobra.ExactArgs(8),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())
@ -170,28 +176,31 @@ func NewConnectionOpenAckCmd() *cobra.Command {
return err
}
proofTry, err := utils.ParseProof(clientCtx.LegacyAmino, args[2])
consensusHeight, err := clienttypes.ParseHeight(args[2])
if err != nil {
return err
}
proofHeight, err := clienttypes.ParseHeight(args[3])
if err != nil {
return err
}
proofClient, err := utils.ParseProof(clientCtx.LegacyAmino, args[3])
proofTry, err := utils.ParseProof(clientCtx.LegacyAmino, args[4])
if err != nil {
return err
}
proofConsensus, err := utils.ParseProof(clientCtx.LegacyAmino, args[4])
proofClient, err := utils.ParseProof(clientCtx.LegacyAmino, args[5])
if err != nil {
return err
}
proofHeight := uint64(clientCtx.Height)
consensusHeight, err := lastHeight(clientCtx)
proofConsensus, err := utils.ParseProof(clientCtx.LegacyAmino, args[6])
if err != nil {
return err
}
version := args[5]
version := args[7]
msg := types.NewMsgConnectionOpenAck(
connectionID, counterpartyClient, proofTry, proofClient, proofConsensus, proofHeight,
@ -215,14 +224,14 @@ func NewConnectionOpenAckCmd() *cobra.Command {
// chain A with a given counterparty chain B
func NewConnectionOpenConfirmCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "open-confirm [connection-id] [path/to/proof_ack.json]",
Use: "open-confirm [connection-id] [proof-height] [path/to/proof_ack.json]",
Short: "confirm to chain B that connection is open on chain A",
Long: "Confirm to chain B that connection is open on chain A",
Example: fmt.Sprintf(
"%s tx %s %s open-confirm [connection-id] [path/to/proof_ack.json]",
"%s tx %s %s open-confirm [connection-id] [proof-height] [path/to/proof_ack.json]",
version.AppName, host.ModuleName, types.SubModuleName,
),
Args: cobra.ExactArgs(2),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())
@ -232,12 +241,12 @@ func NewConnectionOpenConfirmCmd() *cobra.Command {
connectionID := args[0]
proofAck, err := utils.ParseProof(clientCtx.LegacyAmino, args[1])
proofHeight, err := clienttypes.ParseHeight(args[1])
if err != nil {
return err
}
proofHeight := uint64(clientCtx.Height)
proofAck, err := utils.ParseProof(clientCtx.LegacyAmino, args[2])
if err != nil {
return err
}
@ -258,18 +267,3 @@ func NewConnectionOpenConfirmCmd() *cobra.Command {
return cmd
}
// lastHeight util function to get the consensus height from the node
func lastHeight(clientCtx client.Context) (uint64, error) {
node, err := clientCtx.GetNode()
if err != nil {
return 0, err
}
info, err := node.ABCIInfo()
if err != nil {
return 0, err
}
return uint64(info.Response.LastBlockHeight), nil
}

View File

@ -61,7 +61,9 @@ func queryConnectionABCI(clientCtx client.Context, connectionID string) (*types.
return nil, err
}
return types.NewQueryConnectionResponse(connectionID, connection, proofBz, res.Height), nil
// TODO: Retrieve epoch number from chain-id
proofHeight := clienttypes.NewHeight(0, uint64(res.Height))
return types.NewQueryConnectionResponse(connectionID, connection, proofBz, proofHeight), nil
}
// QueryClientConnections queries the connection paths registered for a particular client.
@ -106,7 +108,9 @@ func queryClientConnectionsABCI(clientCtx client.Context, clientID string) (*typ
return nil, err
}
return types.NewQueryClientConnectionsResponse(clientID, paths, proofBz, res.Height), nil
// TODO: Retrieve epoch number from chain-id
proofHeight := clienttypes.NewHeight(0, uint64(res.Height))
return types.NewQueryClientConnectionsResponse(clientID, paths, proofBz, proofHeight), nil
}
// QueryConnectionClientState returns the ClientState of a connection end. If
@ -138,7 +142,7 @@ func QueryConnectionClientState(
ClientState: clientStateRes.ClientState,
}
res = types.NewQueryConnectionClientStateResponse(identifiedClientState, clientStateRes.Proof, int64(clientStateRes.ProofHeight))
res = types.NewQueryConnectionClientStateResponse(identifiedClientState, clientStateRes.Proof, clientStateRes.ProofHeight)
}
return res, nil
@ -148,13 +152,14 @@ func QueryConnectionClientState(
// prove is true, it performs an ABCI store query in order to retrieve the
// merkle proof. Otherwise, it uses the gRPC query client.
func QueryConnectionConsensusState(
clientCtx client.Context, connectionID string, height uint64, prove bool,
clientCtx client.Context, connectionID string, height clienttypes.Height, prove bool,
) (*types.QueryConnectionConsensusStateResponse, error) {
queryClient := types.NewQueryClient(clientCtx)
req := &types.QueryConnectionConsensusStateRequest{
ConnectionId: connectionID,
Height: height,
EpochNumber: height.EpochNumber,
EpochHeight: height.EpochHeight,
}
res, err := queryClient.ConnectionConsensusState(context.Background(), req)
@ -173,7 +178,8 @@ func QueryConnectionConsensusState(
return nil, err
}
res = types.NewQueryConnectionConsensusStateResponse(res.ClientId, consensusStateRes.ConsensusState, consensusState.GetHeight(), consensusStateRes.Proof, int64(consensusStateRes.ProofHeight))
consHeight := consensusState.GetHeight().(clienttypes.Height)
res = types.NewQueryConnectionConsensusStateResponse(res.ClientId, consensusStateRes.ConsensusState, consHeight, consensusStateRes.Proof, consensusStateRes.ProofHeight)
}
return res, nil

View File

@ -38,7 +38,7 @@ func (q Keeper) Connection(c context.Context, req *types.QueryConnectionRequest)
return &types.QueryConnectionResponse{
Connection: &connection,
ProofHeight: uint64(ctx.BlockHeight()),
ProofHeight: clienttypes.GetSelfHeight(ctx),
}, nil
}
@ -76,7 +76,7 @@ func (q Keeper) Connections(c context.Context, req *types.QueryConnectionsReques
return &types.QueryConnectionsResponse{
Connections: connections,
Pagination: pageRes,
Height: ctx.BlockHeight(),
Height: clienttypes.GetSelfHeight(ctx),
}, nil
}
@ -101,7 +101,7 @@ func (q Keeper) ClientConnections(c context.Context, req *types.QueryClientConne
return &types.QueryClientConnectionsResponse{
ConnectionPaths: clientConnectionPaths,
ProofHeight: uint64(ctx.BlockHeight()),
ProofHeight: clienttypes.GetSelfHeight(ctx),
}, nil
}
@ -135,7 +135,8 @@ func (q Keeper) ConnectionClientState(c context.Context, req *types.QueryConnect
identifiedClientState := clienttypes.NewIdentifiedClientState(connection.ClientId, clientState)
return types.NewQueryConnectionClientStateResponse(identifiedClientState, nil, ctx.BlockHeight()), nil
height := clienttypes.GetSelfHeight(ctx)
return types.NewQueryConnectionClientStateResponse(identifiedClientState, nil, height), nil
}
@ -159,7 +160,8 @@ func (q Keeper) ConnectionConsensusState(c context.Context, req *types.QueryConn
)
}
consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientId, req.Height)
height := clienttypes.NewHeight(req.EpochNumber, req.EpochHeight)
consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientId, height)
if !found {
return nil, status.Error(
codes.NotFound,
@ -172,5 +174,6 @@ func (q Keeper) ConnectionConsensusState(c context.Context, req *types.QueryConn
return nil, status.Error(codes.Internal, err.Error())
}
return types.NewQueryConnectionConsensusStateResponse(connection.ClientId, anyConsensusState, consensusState.GetHeight(), nil, ctx.BlockHeight()), nil
proofHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryConnectionConsensusStateResponse(connection.ClientId, anyConsensusState, consensusState.GetHeight().(clienttypes.Height), nil, proofHeight), nil
}

View File

@ -339,7 +339,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
func() {
req = &types.QueryConnectionConsensusStateRequest{
ConnectionId: "",
Height: 1,
EpochNumber: 0,
EpochHeight: 1,
}
},
false,
@ -349,7 +350,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
func() {
req = &types.QueryConnectionConsensusStateRequest{
ConnectionId: "test-connection-id",
Height: 1,
EpochNumber: 0,
EpochHeight: 1,
}
},
false,
@ -361,7 +363,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
req = &types.QueryConnectionConsensusStateRequest{
ConnectionId: connA.ID,
Height: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
EpochNumber: 0,
EpochHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
}
}, false,
},
@ -377,7 +380,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
req = &types.QueryConnectionConsensusStateRequest{
ConnectionId: connA.ID,
Height: expConsensusState.GetHeight(),
EpochNumber: expConsensusState.GetHeight().GetEpochNumber(),
EpochHeight: expConsensusState.GetHeight().GetEpochHeight(),
}
},
true,

View File

@ -54,13 +54,14 @@ func (k Keeper) ConnOpenTry(
proofInit []byte, // proof that chainA stored connectionEnd in state (on ConnOpenInit)
proofClient []byte, // proof that chainA stored a light client of chainB
proofConsensus []byte, // proof that chainA stored chainB's consensus state at consensus height
proofHeight uint64, // height at which relayer constructs proof of A storing connectionEnd in state
consensusHeight uint64, // latest height of chain B which chain A has stored in its chain B client
proofHeight exported.Height, // height at which relayer constructs proof of A storing connectionEnd in state
consensusHeight exported.Height, // latest height of chain B which chain A has stored in its chain B client
) error {
if consensusHeight >= uint64(ctx.BlockHeight()) {
selfHeight := clienttypes.GetSelfHeight(ctx)
if consensusHeight.GTE(selfHeight) {
return sdkerrors.Wrapf(
sdkerrors.ErrInvalidHeight,
"consensus height is greater than or equal to the current block height (%d >= %d)", consensusHeight, uint64(ctx.BlockHeight()),
"consensus height is greater than or equal to the current block height (%s >= %s)", consensusHeight, selfHeight,
)
}
@ -146,14 +147,15 @@ func (k Keeper) ConnOpenAck(
proofTry []byte, // proof that connectionEnd was added to ChainB state in ConnOpenTry
proofClient []byte, // proof of client state on chainB for chainA
proofConsensus []byte, // proof that chainB has stored ConsensusState of chainA on its client
proofHeight uint64, // height that relayer constructed proofTry
consensusHeight uint64, // latest height of chainA that chainB has stored on its chainA client
proofHeight exported.Height, // height that relayer constructed proofTry
consensusHeight exported.Height, // latest height of chainA that chainB has stored on its chainA client
) error {
// Check that chainB client hasn't stored invalid height
if consensusHeight >= uint64(ctx.BlockHeight()) {
selfHeight := clienttypes.GetSelfHeight(ctx)
if consensusHeight.GTE(selfHeight) {
return sdkerrors.Wrapf(
sdkerrors.ErrInvalidHeight,
"consensus height is greater than or equal to the current block height (%d >= %d)", consensusHeight, uint64(ctx.BlockHeight()),
"consensus height is greater than or equal to the current block height (%s >= %s)", consensusHeight, selfHeight,
)
}
@ -242,7 +244,7 @@ func (k Keeper) ConnOpenConfirm(
ctx sdk.Context,
connectionID string,
proofAck []byte, // proof that connection opened on ChainA during ConnOpenAck
proofHeight uint64, // height that relayer constructed proofAck
proofHeight exported.Height, // height that relayer constructed proofAck
) error {
// Retrieve connection
connection, found := k.GetConnection(ctx, connectionID)

View File

@ -3,6 +3,7 @@ package keeper_test
import (
"time"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
@ -63,7 +64,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
clientA string
clientB string
versions []string
consensusHeight uint64
consensusHeight exported.Height
counterpartyClient exported.ClientState
)
@ -103,7 +104,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
// retrieve client state of chainA to pass as counterpartyClient
counterpartyClient = suite.chainA.GetClientState(clientA)
consensusHeight = uint64(suite.chainB.GetContext().BlockHeight())
consensusHeight = clienttypes.GetSelfHeight(suite.chainB.GetContext())
}, false},
{"self consensus state not found", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
@ -113,7 +114,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
// retrieve client state of chainA to pass as counterpartyClient
counterpartyClient = suite.chainA.GetClientState(clientA)
consensusHeight = 1
consensusHeight = clienttypes.NewHeight(0, 1)
}, false},
{"counterparty versions is empty", func() {
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
@ -197,7 +198,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
suite.Run(tc.msg, func() {
suite.SetupTest() // reset
consensusHeight = 0 // must be explicitly changed in malleate
consensusHeight = clienttypes.Height{} // must be explicitly changed in malleate
versions = types.GetCompatibleEncodedVersions() // must be explicitly changed in malleate
tc.malleate()
@ -213,7 +214,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
consState, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetLatestClientConsensusState(suite.chainA.GetContext(), clientA)
suite.Require().True(found)
if consensusHeight == 0 {
if consensusHeight.IsZero() {
consensusHeight = consState.GetHeight()
}
consensusKey := host.FullKeyClientPath(clientA, host.KeyConsensusState(consensusHeight))
@ -244,7 +245,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
var (
clientA string
clientB string
consensusHeight uint64
consensusHeight exported.Height
version string
counterpartyClient exported.ClientState
)
@ -315,7 +316,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
err = suite.coordinator.ConnOpenTry(suite.chainB, suite.chainA, connB, connA)
suite.Require().NoError(err)
consensusHeight = uint64(suite.chainA.GetContext().BlockHeight())
consensusHeight = clienttypes.GetSelfHeight(suite.chainA.GetContext())
}, false},
{"connection not found", func() {
// connections are never created
@ -391,7 +392,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
err = suite.coordinator.ConnOpenTry(suite.chainB, suite.chainA, connB, connA)
suite.Require().NoError(err)
consensusHeight = 1
consensusHeight = clienttypes.NewHeight(0, 1)
}, false},
{"connection state verification failed", func() {
// chainB connection is not in INIT
@ -446,7 +447,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
suite.Run(tc.msg, func() {
suite.SetupTest() // reset
version = types.GetCompatibleEncodedVersions()[0] // must be explicitly changed in malleate
consensusHeight = 0 // must be explicitly changed in malleate
consensusHeight = clienttypes.Height{} // must be explicitly changed in malleate
tc.malleate()
@ -460,7 +461,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
consState, found := suite.chainB.App.IBCKeeper.ClientKeeper.GetLatestClientConsensusState(suite.chainB.GetContext(), clientB)
suite.Require().True(found)
if consensusHeight == 0 {
if consensusHeight.IsZero() {
consensusHeight = consState.GetHeight()
}
consensusKey := host.FullKeyClientPath(clientB, host.KeyConsensusState(consensusHeight))

View File

@ -68,7 +68,7 @@ func (k Keeper) SetConnection(ctx sdk.Context, connectionID string, connection t
// GetTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the
// given height.
func (k Keeper) GetTimestampAtHeight(ctx sdk.Context, connection types.ConnectionEnd, height uint64) (uint64, error) {
func (k Keeper) GetTimestampAtHeight(ctx sdk.Context, connection types.ConnectionEnd, height exported.Height) (uint64, error) {
consensusState, found := k.clientKeeper.GetClientConsensusState(
ctx, connection.GetClientID(), height,
)
@ -76,7 +76,7 @@ func (k Keeper) GetTimestampAtHeight(ctx sdk.Context, connection types.Connectio
if !found {
return 0, sdkerrors.Wrapf(
clienttypes.ErrConsensusStateNotFound,
"clientID (%s), height (%d)", connection.GetClientID(), height,
"clientID (%s), height (%s)", connection.GetClientID(), height,
)
}

View File

@ -118,7 +118,7 @@ func (suite *KeeperTestSuite) TestGetTimestampAtHeight() {
tc.malleate()
actualTimestamp, err := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetTimestampAtHeight(
suite.chainA.GetContext(), connection, uint64(suite.chainB.LastHeader.GetHeight()),
suite.chainA.GetContext(), connection, suite.chainB.LastHeader.GetHeight(),
)
if tc.expPass {

View File

@ -12,7 +12,7 @@ import (
func (k Keeper) VerifyClientState(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
clientState exported.ClientState,
) error {
@ -24,7 +24,7 @@ func (k Keeper) VerifyClientState(
targetConsState, found := k.clientKeeper.GetClientConsensusState(ctx, clientID, height)
if !found {
return sdkerrors.Wrapf(clienttypes.ErrConsensusStateNotFound, "clientID: %s with height: %d", clientID, height)
return sdkerrors.Wrapf(clienttypes.ErrConsensusStateNotFound, "clientID: %s with height: %s", clientID, height)
}
if err := targetClient.VerifyClientState(
@ -41,8 +41,8 @@ func (k Keeper) VerifyClientState(
func (k Keeper) VerifyClientConsensusState(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
consensusHeight uint64,
height exported.Height,
consensusHeight exported.Height,
proof []byte,
consensusState exported.ConsensusState,
) error {
@ -54,7 +54,7 @@ func (k Keeper) VerifyClientConsensusState(
targetConsState, found := k.clientKeeper.GetClientConsensusState(ctx, clientID, height)
if !found {
return sdkerrors.Wrapf(clienttypes.ErrConsensusStateNotFound, "clientID: %s with height: %d", clientID, height)
return sdkerrors.Wrapf(clienttypes.ErrConsensusStateNotFound, "clientID: %s with height: %s", clientID, height)
}
if err := clientState.VerifyClientConsensusState(
@ -72,7 +72,7 @@ func (k Keeper) VerifyClientConsensusState(
func (k Keeper) VerifyConnectionState(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
connectionID string,
connectionEnd exported.ConnectionI, // opposite connection
@ -97,7 +97,7 @@ func (k Keeper) VerifyConnectionState(
func (k Keeper) VerifyChannelState(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,
@ -124,7 +124,7 @@ func (k Keeper) VerifyChannelState(
func (k Keeper) VerifyPacketCommitment(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,
@ -152,7 +152,7 @@ func (k Keeper) VerifyPacketCommitment(
func (k Keeper) VerifyPacketAcknowledgement(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,
@ -181,7 +181,7 @@ func (k Keeper) VerifyPacketAcknowledgement(
func (k Keeper) VerifyPacketAcknowledgementAbsence(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,
@ -208,7 +208,7 @@ func (k Keeper) VerifyPacketAcknowledgementAbsence(
func (k Keeper) VerifyNextSequenceRecv(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,

View File

@ -4,6 +4,7 @@ import (
"fmt"
"time"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
@ -12,6 +13,8 @@ import (
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
var defaultTimeoutHeight = clienttypes.NewHeight(0, 100000)
// TestVerifyClientState verifies a client state of chainA
// stored on clientB (which is on chainB)
func (suite *KeeperTestSuite) TestVerifyClientState() {
@ -37,7 +40,7 @@ func (suite *KeeperTestSuite) TestVerifyClientState() {
_, clientB, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
counterpartyClient, clientProof := suite.chainB.QueryClientStateProof(clientB)
proofHeight := uint64(suite.chainB.GetContext().BlockHeight() - 1)
proofHeight := clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()-1))
if tc.malleateCounterparty {
tmClient, _ := counterpartyClient.(*ibctmtypes.ClientState)
@ -51,7 +54,7 @@ func (suite *KeeperTestSuite) TestVerifyClientState() {
err := suite.chainA.App.IBCKeeper.ConnectionKeeper.VerifyClientState(
suite.chainA.GetContext(), connection,
proofHeight+tc.heightDiff, clientProof, counterpartyClient,
malleateHeight(proofHeight, tc.heightDiff), clientProof, counterpartyClient,
)
if tc.expPass {
@ -125,13 +128,13 @@ func (suite *KeeperTestSuite) TestVerifyClientConsensusState() {
}
proof, consensusHeight := suite.chainB.QueryConsensusStateProof(connB.ClientID)
proofHeight := uint64(suite.chainB.GetContext().BlockHeight() - 1)
proofHeight := clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()-1))
consensusState, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetSelfConsensusState(suite.chainA.GetContext(), consensusHeight)
suite.Require().True(found)
err := suite.chainA.App.IBCKeeper.ConnectionKeeper.VerifyClientConsensusState(
suite.chainA.GetContext(), connection,
proofHeight+heightDiff, consensusHeight, proof, consensusState,
malleateHeight(proofHeight, heightDiff), consensusHeight, proof, consensusState,
)
if tc.expPass {
@ -182,7 +185,7 @@ func (suite *KeeperTestSuite) TestVerifyConnectionState() {
err := suite.chainA.App.IBCKeeper.ConnectionKeeper.VerifyConnectionState(
suite.chainA.GetContext(), connection,
proofHeight+tc.heightDiff, proof, connB.ID, expectedConnection,
malleateHeight(proofHeight, tc.heightDiff), proof, connB.ID, expectedConnection,
)
if tc.expPass {
@ -231,7 +234,7 @@ func (suite *KeeperTestSuite) TestVerifyChannelState() {
}
err := suite.chainA.App.IBCKeeper.ConnectionKeeper.VerifyChannelState(
suite.chainA.GetContext(), connection, proofHeight+tc.heightDiff, proof,
suite.chainA.GetContext(), connection, malleateHeight(proofHeight, tc.heightDiff), proof,
channelB.PortID, channelB.ID, channel,
)
@ -273,7 +276,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketCommitment() {
connection.ClientId = ibctesting.InvalidID
}
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, 100000, 0)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, defaultTimeoutHeight, 0)
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.Require().NoError(err)
@ -285,7 +288,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketCommitment() {
}
err = suite.chainB.App.IBCKeeper.ConnectionKeeper.VerifyPacketCommitment(
suite.chainB.GetContext(), connection, proofHeight+tc.heightDiff, proof,
suite.chainB.GetContext(), connection, malleateHeight(proofHeight, tc.heightDiff), proof,
packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence(), channeltypes.CommitPacket(packet),
)
@ -328,7 +331,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgement() {
}
// send and receive packet
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, 100000, 0)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, defaultTimeoutHeight, 0)
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.Require().NoError(err)
@ -344,7 +347,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgement() {
}
err = suite.chainA.App.IBCKeeper.ConnectionKeeper.VerifyPacketAcknowledgement(
suite.chainA.GetContext(), connection, proofHeight+tc.heightDiff, proof,
suite.chainA.GetContext(), connection, malleateHeight(proofHeight, tc.heightDiff), proof,
packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), ack,
)
@ -387,7 +390,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgementAbsence() {
}
// send, only receive if specified
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, 100000, 0)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, defaultTimeoutHeight, 0)
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.Require().NoError(err)
@ -404,7 +407,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgementAbsence() {
proof, proofHeight := suite.chainB.QueryProof(packetAckKey)
err = suite.chainA.App.IBCKeeper.ConnectionKeeper.VerifyPacketAcknowledgementAbsence(
suite.chainA.GetContext(), connection, proofHeight+tc.heightDiff, proof,
suite.chainA.GetContext(), connection, malleateHeight(proofHeight, tc.heightDiff), proof,
packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(),
)
@ -447,7 +450,7 @@ func (suite *KeeperTestSuite) TestVerifyNextSequenceRecv() {
}
// send and receive packet
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, 100000, 0)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, defaultTimeoutHeight, 0)
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.Require().NoError(err)
@ -458,7 +461,7 @@ func (suite *KeeperTestSuite) TestVerifyNextSequenceRecv() {
proof, proofHeight := suite.chainB.QueryProof(nextSeqRecvKey)
err = suite.chainA.App.IBCKeeper.ConnectionKeeper.VerifyNextSequenceRecv(
suite.chainA.GetContext(), connection, proofHeight+tc.heightDiff, proof,
suite.chainA.GetContext(), connection, malleateHeight(proofHeight, tc.heightDiff), proof,
packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()+tc.offsetSeq,
)
@ -470,3 +473,7 @@ func (suite *KeeperTestSuite) TestVerifyNextSequenceRecv() {
})
}
}
func malleateHeight(height exported.Height, diff uint64) exported.Height {
return clienttypes.NewHeight(height.GetEpochNumber(), height.GetEpochHeight()+diff)
}

View File

@ -7,7 +7,8 @@ import (
fmt "fmt"
types "github.com/cosmos/cosmos-sdk/codec/types"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types1 "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
types1 "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
types2 "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
@ -137,12 +138,12 @@ func (m *MsgConnectionOpenInit) GetSigner() github_com_cosmos_cosmos_sdk_types.A
// MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a
// connection on Chain B.
type MsgConnectionOpenTry struct {
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"`
ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
ClientState *types.Any `protobuf:"bytes,3,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
Counterparty Counterparty `protobuf:"bytes,4,opt,name=counterparty,proto3" json:"counterparty"`
CounterpartyVersions []string `protobuf:"bytes,5,rep,name=counterparty_versions,json=counterpartyVersions,proto3" json:"counterparty_versions,omitempty" yaml:"counterparty_versions"`
ProofHeight uint64 `protobuf:"varint,6,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"`
ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
ClientState *types.Any `protobuf:"bytes,3,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
Counterparty Counterparty `protobuf:"bytes,4,opt,name=counterparty,proto3" json:"counterparty"`
CounterpartyVersions []string `protobuf:"bytes,5,rep,name=counterparty_versions,json=counterpartyVersions,proto3" json:"counterparty_versions,omitempty" yaml:"counterparty_versions"`
ProofHeight types1.Height `protobuf:"bytes,6,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
// proof of the initialization the connection on Chain A: `UNITIALIZED ->
// INIT`
ProofInit []byte `protobuf:"bytes,7,opt,name=proof_init,json=proofInit,proto3" json:"proof_init,omitempty" yaml:"proof_init"`
@ -150,7 +151,7 @@ type MsgConnectionOpenTry struct {
ProofClient []byte `protobuf:"bytes,8,opt,name=proof_client,json=proofClient,proto3" json:"proof_client,omitempty" yaml:"proof_client"`
// proof of client consensus state
ProofConsensus []byte `protobuf:"bytes,9,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus,omitempty" yaml:"proof_consensus"`
ConsensusHeight uint64 `protobuf:"varint,10,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height,omitempty" yaml:"consensus_height"`
ConsensusHeight types1.Height `protobuf:"bytes,10,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height" yaml:"consensus_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,11,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -222,11 +223,11 @@ func (m *MsgConnectionOpenTry) GetCounterpartyVersions() []string {
return nil
}
func (m *MsgConnectionOpenTry) GetProofHeight() uint64 {
func (m *MsgConnectionOpenTry) GetProofHeight() types1.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types1.Height{}
}
func (m *MsgConnectionOpenTry) GetProofInit() []byte {
@ -250,11 +251,11 @@ func (m *MsgConnectionOpenTry) GetProofConsensus() []byte {
return nil
}
func (m *MsgConnectionOpenTry) GetConsensusHeight() uint64 {
func (m *MsgConnectionOpenTry) GetConsensusHeight() types1.Height {
if m != nil {
return m.ConsensusHeight
}
return 0
return types1.Height{}
}
func (m *MsgConnectionOpenTry) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -267,10 +268,10 @@ func (m *MsgConnectionOpenTry) GetSigner() github_com_cosmos_cosmos_sdk_types.Ac
// MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to
// acknowledge the change of connection state to TRYOPEN on Chain B.
type MsgConnectionOpenAck struct {
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
ClientState *types.Any `protobuf:"bytes,3,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
ClientState *types.Any `protobuf:"bytes,3,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
ProofHeight types1.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
// proof of the initialization the connection on Chain B: `UNITIALIZED ->
// TRYOPEN`
ProofTry []byte `protobuf:"bytes,5,opt,name=proof_try,json=proofTry,proto3" json:"proof_try,omitempty" yaml:"proof_try"`
@ -278,7 +279,7 @@ type MsgConnectionOpenAck struct {
ProofClient []byte `protobuf:"bytes,6,opt,name=proof_client,json=proofClient,proto3" json:"proof_client,omitempty" yaml:"proof_client"`
// proof of client consensus state
ProofConsensus []byte `protobuf:"bytes,7,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus,omitempty" yaml:"proof_consensus"`
ConsensusHeight uint64 `protobuf:"varint,8,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height,omitempty" yaml:"consensus_height"`
ConsensusHeight types1.Height `protobuf:"bytes,8,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height" yaml:"consensus_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,9,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -336,11 +337,11 @@ func (m *MsgConnectionOpenAck) GetClientState() *types.Any {
return nil
}
func (m *MsgConnectionOpenAck) GetProofHeight() uint64 {
func (m *MsgConnectionOpenAck) GetProofHeight() types1.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types1.Height{}
}
func (m *MsgConnectionOpenAck) GetProofTry() []byte {
@ -364,11 +365,11 @@ func (m *MsgConnectionOpenAck) GetProofConsensus() []byte {
return nil
}
func (m *MsgConnectionOpenAck) GetConsensusHeight() uint64 {
func (m *MsgConnectionOpenAck) GetConsensusHeight() types1.Height {
if m != nil {
return m.ConsensusHeight
}
return 0
return types1.Height{}
}
func (m *MsgConnectionOpenAck) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -384,7 +385,7 @@ type MsgConnectionOpenConfirm struct {
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
// proof for the change of the connection state on Chain A: `INIT -> OPEN`
ProofAck []byte `protobuf:"bytes,2,opt,name=proof_ack,json=proofAck,proto3" json:"proof_ack,omitempty" yaml:"proof_ack"`
ProofHeight uint64 `protobuf:"varint,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types1.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -435,11 +436,11 @@ func (m *MsgConnectionOpenConfirm) GetProofAck() []byte {
return nil
}
func (m *MsgConnectionOpenConfirm) GetProofHeight() uint64 {
func (m *MsgConnectionOpenConfirm) GetProofHeight() types1.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types1.Height{}
}
func (m *MsgConnectionOpenConfirm) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -555,7 +556,7 @@ type Counterparty struct {
// given connection.
ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
// commitment merkle prefix of the counterparty chain
Prefix types1.MerklePrefix `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix"`
Prefix types2.MerklePrefix `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix"`
}
func (m *Counterparty) Reset() { *m = Counterparty{} }
@ -751,69 +752,71 @@ func init() {
func init() { proto.RegisterFile("ibc/connection/connection.proto", fileDescriptor_3bf62bacf5a27ee9) }
var fileDescriptor_3bf62bacf5a27ee9 = []byte{
// 989 bytes of a gzipped FileDescriptorProto
// 1010 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4f, 0x6f, 0xe2, 0x46,
0x14, 0xc7, 0xc4, 0xfc, 0x7b, 0x40, 0xc2, 0xba, 0xa4, 0xeb, 0xd2, 0x2d, 0x46, 0xee, 0x05, 0xb5,
0x0a, 0x34, 0xbb, 0xd5, 0x1e, 0x22, 0xf5, 0x00, 0x2c, 0x51, 0xad, 0x76, 0xb3, 0xc8, 0x21, 0x95,
0x9a, 0x0b, 0x02, 0x33, 0x90, 0x11, 0x61, 0x8c, 0xec, 0xa1, 0x5a, 0xbe, 0xc1, 0x2a, 0xa7, 0x4a,
0x3d, 0x55, 0x6a, 0xa4, 0x4a, 0xfd, 0x26, 0x55, 0x0f, 0x7b, 0xd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x5e, 0x5e, 0x55, 0xb9, 0x57, 0x57, 0x55, 0xee, 0xaf, 0xab, 0x2a, 0xf7,
0xc3, 0x75, 0x35, 0xf6, 0xea, 0xba, 0x1a, 0xfb, 0xe3, 0xba, 0x1a, 0x3b, 0x7d, 0xf4, 0xbf, 0xa7,
0xcb, 0xf3, 0xba, 0xf7, 0xa7, 0xe2, 0xb3, 0x87, 0xfb, 0x91, 0xbf, 0x36, 0xe4, 0xc4, 0x19, 0xa4,
0xc9, 0x9d, 0xfb, 0xf0, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x5e, 0x84, 0x18, 0xf9, 0x0c,
0x00, 0x00,
}
func (m *MsgConnectionOpenInit) Marshal() (dAtA []byte, err error) {
@ -897,11 +900,16 @@ func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x5a
}
if m.ConsensusHeight != 0 {
i = encodeVarintConnection(dAtA, i, uint64(m.ConsensusHeight))
i--
dAtA[i] = 0x50
{
size, err := m.ConsensusHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnection(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x52
if len(m.ProofConsensus) > 0 {
i -= len(m.ProofConsensus)
copy(dAtA[i:], m.ProofConsensus)
@ -923,11 +931,16 @@ func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x3a
}
if m.ProofHeight != 0 {
i = encodeVarintConnection(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x30
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnection(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
if len(m.CounterpartyVersions) > 0 {
for iNdEx := len(m.CounterpartyVersions) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.CounterpartyVersions[iNdEx])
@ -1003,11 +1016,16 @@ func (m *MsgConnectionOpenAck) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x4a
}
if m.ConsensusHeight != 0 {
i = encodeVarintConnection(dAtA, i, uint64(m.ConsensusHeight))
i--
dAtA[i] = 0x40
{
size, err := m.ConsensusHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnection(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
if len(m.ProofConsensus) > 0 {
i -= len(m.ProofConsensus)
copy(dAtA[i:], m.ProofConsensus)
@ -1029,11 +1047,16 @@ func (m *MsgConnectionOpenAck) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x2a
}
if m.ProofHeight != 0 {
i = encodeVarintConnection(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnection(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if m.ClientState != nil {
{
size, err := m.ClientState.MarshalToSizedBuffer(dAtA[:i])
@ -1090,11 +1113,16 @@ func (m *MsgConnectionOpenConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error
i--
dAtA[i] = 0x22
}
if m.ProofHeight != 0 {
i = encodeVarintConnection(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x18
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintConnection(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if len(m.ProofAck) > 0 {
i -= len(m.ProofAck)
copy(dAtA[i:], m.ProofAck)
@ -1444,9 +1472,8 @@ func (m *MsgConnectionOpenTry) Size() (n int) {
n += 1 + l + sovConnection(uint64(l))
}
}
if m.ProofHeight != 0 {
n += 1 + sovConnection(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovConnection(uint64(l))
l = len(m.ProofInit)
if l > 0 {
n += 1 + l + sovConnection(uint64(l))
@ -1459,9 +1486,8 @@ func (m *MsgConnectionOpenTry) Size() (n int) {
if l > 0 {
n += 1 + l + sovConnection(uint64(l))
}
if m.ConsensusHeight != 0 {
n += 1 + sovConnection(uint64(m.ConsensusHeight))
}
l = m.ConsensusHeight.Size()
n += 1 + l + sovConnection(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovConnection(uint64(l))
@ -1487,9 +1513,8 @@ func (m *MsgConnectionOpenAck) Size() (n int) {
l = m.ClientState.Size()
n += 1 + l + sovConnection(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovConnection(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovConnection(uint64(l))
l = len(m.ProofTry)
if l > 0 {
n += 1 + l + sovConnection(uint64(l))
@ -1502,9 +1527,8 @@ func (m *MsgConnectionOpenAck) Size() (n int) {
if l > 0 {
n += 1 + l + sovConnection(uint64(l))
}
if m.ConsensusHeight != 0 {
n += 1 + sovConnection(uint64(m.ConsensusHeight))
}
l = m.ConsensusHeight.Size()
n += 1 + l + sovConnection(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovConnection(uint64(l))
@ -1526,9 +1550,8 @@ func (m *MsgConnectionOpenConfirm) Size() (n int) {
if l > 0 {
n += 1 + l + sovConnection(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovConnection(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovConnection(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovConnection(uint64(l))
@ -2045,10 +2068,10 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
m.CounterpartyVersions = append(m.CounterpartyVersions, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 6:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConnection
@ -2058,11 +2081,25 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthConnection
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthConnection
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofInit", wireType)
@ -2166,10 +2203,10 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 10:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHeight", wireType)
}
m.ConsensusHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConnection
@ -2179,11 +2216,25 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ConsensusHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthConnection
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthConnection
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ConsensusHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
@ -2372,10 +2423,10 @@ func (m *MsgConnectionOpenAck) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConnection
@ -2385,11 +2436,25 @@ func (m *MsgConnectionOpenAck) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthConnection
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthConnection
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofTry", wireType)
@ -2493,10 +2558,10 @@ func (m *MsgConnectionOpenAck) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 8:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHeight", wireType)
}
m.ConsensusHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConnection
@ -2506,11 +2571,25 @@ func (m *MsgConnectionOpenAck) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ConsensusHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthConnection
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthConnection
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ConsensusHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
@ -2665,10 +2744,10 @@ func (m *MsgConnectionOpenConfirm) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 3:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConnection
@ -2678,11 +2757,25 @@ func (m *MsgConnectionOpenConfirm) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthConnection
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthConnection
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)

View File

@ -8,8 +8,8 @@ import (
// ClientKeeper expected account IBC client keeper
type ClientKeeper interface {
GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (exported.ConsensusState, bool)
GetSelfConsensusState(ctx sdk.Context, height uint64) (exported.ConsensusState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool)
GetSelfConsensusState(ctx sdk.Context, height exported.Height) (exported.ConsensusState, bool)
ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error
IterateClients(ctx sdk.Context, cb func(string, exported.ClientState) bool)
ClientStore(ctx sdk.Context, clientID string) sdk.KVStore

View File

@ -68,7 +68,7 @@ func NewMsgConnectionOpenTry(
counterpartyClientID string, counterpartyClient exported.ClientState,
counterpartyPrefix commitmenttypes.MerklePrefix, counterpartyVersions []string,
proofInit, proofClient, proofConsensus []byte,
proofHeight, consensusHeight uint64, signer sdk.AccAddress,
proofHeight, consensusHeight clienttypes.Height, signer sdk.AccAddress,
) *MsgConnectionOpenTry {
counterparty := NewCounterparty(counterpartyClientID, counterpartyConnectionID, counterpartyPrefix)
csAny, _ := clienttypes.PackClientState(counterpartyClient)
@ -132,11 +132,11 @@ func (msg MsgConnectionOpenTry) ValidateBasic() error {
if len(msg.ProofConsensus) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof of consensus state")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
if msg.ConsensusHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "consensus height must be > 0")
if msg.ConsensusHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "consensus height must be non-zero")
}
if msg.Signer.Empty() {
return sdkerrors.ErrInvalidAddress
@ -160,7 +160,7 @@ var _ sdk.Msg = &MsgConnectionOpenAck{}
func NewMsgConnectionOpenAck(
connectionID string, counterpartyClient exported.ClientState,
proofTry, proofClient, proofConsensus []byte,
proofHeight, consensusHeight uint64, version string,
proofHeight, consensusHeight clienttypes.Height, version string,
signer sdk.AccAddress,
) *MsgConnectionOpenAck {
csAny, _ := clienttypes.PackClientState(counterpartyClient)
@ -214,11 +214,11 @@ func (msg MsgConnectionOpenAck) ValidateBasic() error {
if len(msg.ProofConsensus) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof of consensus state")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
if msg.ConsensusHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "consensus height must be > 0")
if msg.ConsensusHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "consensus height must be non-zero")
}
if msg.Signer.Empty() {
return sdkerrors.ErrInvalidAddress
@ -240,7 +240,7 @@ var _ sdk.Msg = &MsgConnectionOpenConfirm{}
// NewMsgConnectionOpenConfirm creates a new MsgConnectionOpenConfirm instance
func NewMsgConnectionOpenConfirm(
connectionID string, proofAck []byte, proofHeight uint64,
connectionID string, proofAck []byte, proofHeight clienttypes.Height,
signer sdk.AccAddress,
) *MsgConnectionOpenConfirm {
return &MsgConnectionOpenConfirm{
@ -269,8 +269,8 @@ func (msg MsgConnectionOpenConfirm) ValidateBasic() error {
if len(msg.ProofAck) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof ack")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
if msg.Signer.Empty() {
return sdkerrors.ErrInvalidAddress

View File

@ -123,23 +123,23 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() {
)
testMsgs := []*types.MsgConnectionOpenTry{
types.NewMsgConnectionOpenTry("test/conn1", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "test/iris", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "ibc/test", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "test/conn1", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", nil, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
&types.MsgConnectionOpenTry{"ibcconntest", "clienttotesta", invalidAny, counterparty, []string{ibctesting.ConnectionVersion}, 10, suite.proof, suite.proof, suite.proof, 10, signer},
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", invalidClient, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, emptyPrefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, emptyProof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, emptyProof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, emptyProof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 0, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 0, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, nil),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{"(invalid version)"}, suite.proof, suite.proof, suite.proof, 10, 10, signer),
types.NewMsgConnectionOpenTry("test/conn1", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "test/iris", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "ibc/test", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "test/conn1", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", nil, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
&types.MsgConnectionOpenTry{"ibcconntest", "clienttotesta", invalidAny, counterparty, []string{ibctesting.ConnectionVersion}, clientHeight, suite.proof, suite.proof, suite.proof, clientHeight, signer},
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", invalidClient, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, emptyPrefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, emptyProof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, emptyProof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, emptyProof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clienttypes.Height{}, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clienttypes.Height{}, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, nil),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
types.NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []string{"(invalid version)"}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer),
}
var testCases = []struct {
@ -194,18 +194,18 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() {
)
testMsgs := []*types.MsgConnectionOpenAck{
types.NewMsgConnectionOpenAck("test/conn1", clientState, suite.proof, suite.proof, suite.proof, 10, 10, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", nil, suite.proof, suite.proof, suite.proof, 10, 10, ibctesting.ConnectionVersion, signer),
&types.MsgConnectionOpenAck{"ibcconntest", ibctesting.ConnectionVersion, invalidAny, 10, suite.proof, suite.proof, suite.proof, 10, signer},
types.NewMsgConnectionOpenAck("ibcconntest", invalidClient, suite.proof, suite.proof, suite.proof, 10, 10, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, emptyProof, suite.proof, suite.proof, 10, 10, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, emptyProof, suite.proof, 10, 10, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, emptyProof, 10, 10, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, 0, 10, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, 10, 0, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, 10, 10, "", signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, 10, 10, ibctesting.ConnectionVersion, nil),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, 10, 10, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("test/conn1", clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", nil, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer),
&types.MsgConnectionOpenAck{"ibcconntest", ibctesting.ConnectionVersion, invalidAny, clientHeight, suite.proof, suite.proof, suite.proof, clientHeight, signer},
types.NewMsgConnectionOpenAck("ibcconntest", invalidClient, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, emptyProof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, emptyProof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, emptyProof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, clienttypes.Height{}, clientHeight, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, clientHeight, clienttypes.Height{}, ibctesting.ConnectionVersion, signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, "", signer),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, nil),
types.NewMsgConnectionOpenAck("ibcconntest", clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer),
}
var testCases = []struct {
msg *types.MsgConnectionOpenAck
@ -240,11 +240,11 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenConfirm() {
signer, _ := sdk.AccAddressFromBech32("cosmos1ckgw5d7jfj7wwxjzs9fdrdev9vc8dzcw3n2lht")
testMsgs := []*types.MsgConnectionOpenConfirm{
types.NewMsgConnectionOpenConfirm("test/conn1", suite.proof, 10, signer),
types.NewMsgConnectionOpenConfirm("ibcconntest", emptyProof, 10, signer),
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, 0, signer),
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, 10, nil),
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, 10, signer),
types.NewMsgConnectionOpenConfirm("test/conn1", suite.proof, clientHeight, signer),
types.NewMsgConnectionOpenConfirm("ibcconntest", emptyProof, clientHeight, signer),
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, clienttypes.Height{}, signer),
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, clientHeight, nil),
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, clientHeight, signer),
}
var testCases = []struct {

View File

@ -7,31 +7,32 @@ import (
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// NewQueryConnectionResponse creates a new QueryConnectionResponse instance
func NewQueryConnectionResponse(
connectionID string, connection ConnectionEnd, proof []byte, height int64,
connectionID string, connection ConnectionEnd, proof []byte, height clienttypes.Height,
) *QueryConnectionResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.ConnectionPath(connectionID), "/"))
return &QueryConnectionResponse{
Connection: &connection,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
// NewQueryClientConnectionsResponse creates a new ConnectionPaths instance
func NewQueryClientConnectionsResponse(
clientID string, connectionPaths []string, proof []byte, height int64,
clientID string, connectionPaths []string, proof []byte, height clienttypes.Height,
) *QueryClientConnectionsResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.ClientConnectionsPath(clientID), "/"))
return &QueryClientConnectionsResponse{
ConnectionPaths: connectionPaths,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
@ -43,24 +44,24 @@ func NewQueryClientConnectionsRequest(clientID string) *QueryClientConnectionsRe
}
// NewQueryConnectionClientStateResponse creates a newQueryConnectionClientStateResponse instance
func NewQueryConnectionClientStateResponse(identifiedClientState clienttypes.IdentifiedClientState, proof []byte, height int64) *QueryConnectionClientStateResponse {
func NewQueryConnectionClientStateResponse(identifiedClientState clienttypes.IdentifiedClientState, proof []byte, height clienttypes.Height) *QueryConnectionClientStateResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(identifiedClientState.ClientId, host.ClientStatePath()), "/"))
return &QueryConnectionClientStateResponse{
IdentifiedClientState: &identifiedClientState,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
// NewQueryConnectionConsensusStateResponse creates a newQueryConnectionConsensusStateResponse instance
func NewQueryConnectionConsensusStateResponse(clientID string, anyConsensusState *codectypes.Any, consensusStateHeight uint64, proof []byte, height int64) *QueryConnectionConsensusStateResponse {
func NewQueryConnectionConsensusStateResponse(clientID string, anyConsensusState *codectypes.Any, consensusStateHeight exported.Height, proof []byte, height clienttypes.Height) *QueryConnectionConsensusStateResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(clientID, host.ConsensusStatePath(consensusStateHeight)), "/"))
return &QueryConnectionConsensusStateResponse{
ConsensusState: anyConsensusState,
ClientId: clientID,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}

View File

@ -90,7 +90,7 @@ type QueryConnectionResponse struct {
// merkle proof path
ProofPath string `protobuf:"bytes,3,opt,name=proof_path,json=proofPath,proto3" json:"proof_path,omitempty"`
// height at which the proof was retrieved
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"`
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"`
}
func (m *QueryConnectionResponse) Reset() { *m = QueryConnectionResponse{} }
@ -147,11 +147,11 @@ func (m *QueryConnectionResponse) GetProofPath() string {
return ""
}
func (m *QueryConnectionResponse) GetProofHeight() uint64 {
func (m *QueryConnectionResponse) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
// QueryConnectionsRequest is the request type for the Query/Connections RPC
@ -208,7 +208,7 @@ type QueryConnectionsResponse struct {
// pagination response
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
// query block height
Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
Height types.Height `protobuf:"bytes,3,opt,name=height,proto3" json:"height"`
}
func (m *QueryConnectionsResponse) Reset() { *m = QueryConnectionsResponse{} }
@ -258,11 +258,11 @@ func (m *QueryConnectionsResponse) GetPagination() *query.PageResponse {
return nil
}
func (m *QueryConnectionsResponse) GetHeight() int64 {
func (m *QueryConnectionsResponse) GetHeight() types.Height {
if m != nil {
return m.Height
}
return 0
return types.Height{}
}
// QueryClientConnectionsRequest is the request type for the
@ -322,7 +322,7 @@ type QueryClientConnectionsResponse struct {
// merkle proof path
ProofPath string `protobuf:"bytes,3,opt,name=proof_path,json=proofPath,proto3" json:"proof_path,omitempty"`
// height at which the proof was generated
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"`
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"`
}
func (m *QueryClientConnectionsResponse) Reset() { *m = QueryClientConnectionsResponse{} }
@ -379,11 +379,11 @@ func (m *QueryClientConnectionsResponse) GetProofPath() string {
return ""
}
func (m *QueryClientConnectionsResponse) GetProofHeight() uint64 {
func (m *QueryClientConnectionsResponse) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
// QueryConnectionClientStateRequest is the request type for the
@ -443,7 +443,7 @@ type QueryConnectionClientStateResponse struct {
// merkle proof path
ProofPath string `protobuf:"bytes,3,opt,name=proof_path,json=proofPath,proto3" json:"proof_path,omitempty"`
// height at which the proof was retrieved
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"`
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"`
}
func (m *QueryConnectionClientStateResponse) Reset() { *m = QueryConnectionClientStateResponse{} }
@ -500,11 +500,11 @@ func (m *QueryConnectionClientStateResponse) GetProofPath() string {
return ""
}
func (m *QueryConnectionClientStateResponse) GetProofHeight() uint64 {
func (m *QueryConnectionClientStateResponse) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
// QueryConnectionConsensusStateRequest is the request type for the
@ -512,7 +512,8 @@ func (m *QueryConnectionClientStateResponse) GetProofHeight() uint64 {
type QueryConnectionConsensusStateRequest struct {
// connection identifier
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
EpochNumber uint64 `protobuf:"varint,2,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"`
EpochHeight uint64 `protobuf:"varint,3,opt,name=epoch_height,json=epochHeight,proto3" json:"epoch_height,omitempty"`
}
func (m *QueryConnectionConsensusStateRequest) Reset() { *m = QueryConnectionConsensusStateRequest{} }
@ -555,9 +556,16 @@ func (m *QueryConnectionConsensusStateRequest) GetConnectionId() string {
return ""
}
func (m *QueryConnectionConsensusStateRequest) GetHeight() uint64 {
func (m *QueryConnectionConsensusStateRequest) GetEpochNumber() uint64 {
if m != nil {
return m.Height
return m.EpochNumber
}
return 0
}
func (m *QueryConnectionConsensusStateRequest) GetEpochHeight() uint64 {
if m != nil {
return m.EpochHeight
}
return 0
}
@ -574,7 +582,7 @@ type QueryConnectionConsensusStateResponse struct {
// merkle proof path
ProofPath string `protobuf:"bytes,4,opt,name=proof_path,json=proofPath,proto3" json:"proof_path,omitempty"`
// height at which the proof was retrieved
ProofHeight uint64 `protobuf:"varint,5,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"`
ProofHeight types.Height `protobuf:"bytes,5,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"`
}
func (m *QueryConnectionConsensusStateResponse) Reset() { *m = QueryConnectionConsensusStateResponse{} }
@ -638,11 +646,11 @@ func (m *QueryConnectionConsensusStateResponse) GetProofPath() string {
return ""
}
func (m *QueryConnectionConsensusStateResponse) GetProofHeight() uint64 {
func (m *QueryConnectionConsensusStateResponse) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func init() {
@ -661,60 +669,63 @@ func init() {
func init() { proto.RegisterFile("ibc/connection/query.proto", fileDescriptor_5ee60d8b08ce3606) }
var fileDescriptor_5ee60d8b08ce3606 = []byte{
// 840 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x4e, 0xd4, 0x5e,
0x14, 0xe6, 0xce, 0x00, 0xbf, 0xdf, 0x9c, 0x41, 0xd4, 0x9b, 0x01, 0x6a, 0x95, 0x61, 0x28, 0xff,
0x46, 0x0d, 0xad, 0x0c, 0x42, 0x8c, 0x8a, 0x51, 0x08, 0x08, 0x71, 0x83, 0x75, 0xa5, 0x1b, 0xd2,
0xce, 0x94, 0x4e, 0x23, 0xf4, 0x0e, 0xdc, 0x8e, 0x71, 0x62, 0xd8, 0xb8, 0x35, 0x26, 0x26, 0xee,
0xdc, 0xfa, 0x02, 0xc6, 0x57, 0x70, 0xc3, 0x92, 0x44, 0x13, 0x4d, 0x4c, 0x8c, 0x01, 0x9f, 0xc0,
0x27, 0x30, 0xbd, 0xf7, 0x0e, 0x6d, 0xe7, 0x8f, 0x05, 0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0x4c, 0x81, 0x0a, 0xe4, 0x63, 0x0a, 0x00, 0x00,
// 891 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x6f, 0xe3, 0x44,
0x14, 0xce, 0x24, 0xe9, 0x42, 0x5e, 0xc2, 0x02, 0xa3, 0x2c, 0x35, 0x86, 0xa6, 0xad, 0xf7, 0x57,
0x00, 0xd5, 0xb3, 0x4d, 0xd9, 0x15, 0x62, 0x29, 0x82, 0x20, 0x4a, 0x7b, 0x41, 0xc5, 0x9c, 0xe0,
0x12, 0xd9, 0xce, 0xd4, 0xb1, 0x68, 0x3c, 0x6e, 0xec, 0x54, 0x44, 0x55, 0x2e, 0xdc, 0x91, 0x90,
0xb8, 0xf1, 0x2f, 0x70, 0xe3, 0xc0, 0x8d, 0x7b, 0xc5, 0xa9, 0x12, 0x17, 0x2e, 0x54, 0xa8, 0xe5,
0x1f, 0x00, 0x89, 0x33, 0xc8, 0x33, 0xe3, 0xda, 0xce, 0x0f, 0xdc, 0x56, 0x48, 0x3d, 0xc5, 0x9e,
0xf7, 0xde, 0xcc, 0xf7, 0x7d, 0xef, 0xcd, 0xe7, 0x80, 0xea, 0x5a, 0x36, 0xb1, 0x99, 0xe7, 0x51,
0x3b, 0x74, 0x99, 0x47, 0x0e, 0x86, 0x74, 0x30, 0xd2, 0xfd, 0x01, 0x0b, 0x19, 0xbe, 0xed, 0x5a,
0xb6, 0x9e, 0xc4, 0xd4, 0xba, 0xc3, 0x1c, 0xc6, 0x43, 0x24, 0x7a, 0x12, 0x59, 0xea, 0xeb, 0x36,
0x0b, 0xfa, 0x2c, 0x20, 0x96, 0x19, 0x50, 0x51, 0x4e, 0x0e, 0xd7, 0x2d, 0x1a, 0x9a, 0xeb, 0xc4,
0x37, 0x1d, 0xd7, 0x33, 0xa3, 0x5a, 0x99, 0xbb, 0xc8, 0x4f, 0xdb, 0x77, 0xa9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, 0x6c, 0xba, 0x44, 0xf8, 0x2e, 0x47, 0xf8, 0x16, 0x7e, 0x32, 0x17, 0xa1, 0x18,
0xac, 0xac, 0x90, 0xf1, 0xb0, 0x8d, 0xf1, 0x31, 0x82, 0x3b, 0x33, 0x0d, 0x08, 0xaf, 0xe7, 0xa8,
0x34, 0xed, 0x88, 0x6a, 0xeb, 0x2a, 0x25, 0x92, 0xc0, 0x36, 0x27, 0xd0, 0xc6, 0xef, 0x5d, 0x63,
0x04, 0x48, 0xda, 0x0e, 0xf1, 0x3f, 0x08, 0x94, 0x79, 0x37, 0x15, 0xbf, 0x99, 0x07, 0x6d, 0x96,
0x0d, 0xa9, 0x8f, 0xaf, 0x58, 0x25, 0x39, 0x1d, 0x72, 0x4e, 0x3e, 0xf6, 0xae, 0xc5, 0x29, 0x6b,
0x24, 0x84, 0x3b, 0x12, 0x39, 0x4a, 0xfb, 0xd9, 0x98, 0x88, 0x6b, 0x1d, 0xaf, 0x8a, 0xb7, 0x71,
0x7b, 0xf7, 0xf8, 0xac, 0x81, 0x4e, 0xce, 0x1a, 0xe8, 0xf7, 0xb3, 0x06, 0xfa, 0xe6, 0xbc, 0x51,
0x38, 0x39, 0x6f, 0x14, 0x7e, 0x3d, 0x6f, 0x14, 0x3e, 0x7f, 0xe2, 0xb8, 0x61, 0x6f, 0x68, 0xe9,
0x36, 0xeb, 0x13, 0xf9, 0x3f, 0x56, 0xfc, 0xac, 0x05, 0xdd, 0x2f, 0xc8, 0x97, 0x1c, 0xe7, 0xa3,
0x8d, 0xb5, 0x14, 0xd4, 0x70, 0xe4, 0xd3, 0xc0, 0xba, 0xc5, 0x7d, 0x6b, 0xe3, 0xdf, 0x00, 0x00,
0x00, 0xff, 0xff, 0x06, 0x48, 0xe9, 0x03, 0x3f, 0x0b, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1007,11 +1018,16 @@ func (m *QueryConnectionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
_ = i
var l int
_ = l
if m.ProofHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.ProofPath) > 0 {
i -= len(m.ProofPath)
copy(dAtA[i:], m.ProofPath)
@ -1096,11 +1112,16 @@ func (m *QueryConnectionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error
_ = i
var l int
_ = l
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x18
{
size, err := m.Height.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
@ -1180,11 +1201,16 @@ func (m *QueryClientConnectionsResponse) MarshalToSizedBuffer(dAtA []byte) (int,
_ = i
var l int
_ = l
if m.ProofHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.ProofPath) > 0 {
i -= len(m.ProofPath)
copy(dAtA[i:], m.ProofPath)
@ -1261,11 +1287,16 @@ func (m *QueryConnectionClientStateResponse) MarshalToSizedBuffer(dAtA []byte) (
_ = i
var l int
_ = l
if m.ProofHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.ProofPath) > 0 {
i -= len(m.ProofPath)
copy(dAtA[i:], m.ProofPath)
@ -1315,8 +1346,13 @@ func (m *QueryConnectionConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte)
_ = i
var l int
_ = l
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
if m.EpochHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.EpochHeight))
i--
dAtA[i] = 0x18
}
if m.EpochNumber != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.EpochNumber))
i--
dAtA[i] = 0x10
}
@ -1350,11 +1386,16 @@ func (m *QueryConnectionConsensusStateResponse) MarshalToSizedBuffer(dAtA []byte
_ = i
var l int
_ = l
if m.ProofHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x28
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
if len(m.ProofPath) > 0 {
i -= len(m.ProofPath)
copy(dAtA[i:], m.ProofPath)
@ -1433,9 +1474,8 @@ func (m *QueryConnectionResponse) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovQuery(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
@ -1468,9 +1508,8 @@ func (m *QueryConnectionsResponse) Size() (n int) {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
}
l = m.Height.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
@ -1507,9 +1546,8 @@ func (m *QueryClientConnectionsResponse) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovQuery(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
@ -1544,9 +1582,8 @@ func (m *QueryConnectionClientStateResponse) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovQuery(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
@ -1560,8 +1597,11 @@ func (m *QueryConnectionConsensusStateRequest) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
if m.EpochNumber != 0 {
n += 1 + sovQuery(uint64(m.EpochNumber))
}
if m.EpochHeight != 0 {
n += 1 + sovQuery(uint64(m.EpochHeight))
}
return n
}
@ -1588,9 +1628,8 @@ func (m *QueryConnectionConsensusStateResponse) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovQuery(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
@ -1817,10 +1856,10 @@ func (m *QueryConnectionResponse) Unmarshal(dAtA []byte) error {
m.ProofPath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -1830,11 +1869,25 @@ func (m *QueryConnectionResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@ -2048,10 +2101,10 @@ func (m *QueryConnectionsResponse) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 3:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -2061,11 +2114,25 @@ func (m *QueryConnectionsResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Height.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@ -2303,10 +2370,10 @@ func (m *QueryClientConnectionsResponse) Unmarshal(dAtA []byte) error {
m.ProofPath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -2316,11 +2383,25 @@ func (m *QueryClientConnectionsResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@ -2562,10 +2643,10 @@ func (m *QueryConnectionClientStateResponse) Unmarshal(dAtA []byte) error {
m.ProofPath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -2575,11 +2656,25 @@ func (m *QueryConnectionClientStateResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@ -2667,9 +2762,9 @@ func (m *QueryConnectionConsensusStateRequest) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType)
}
m.Height = 0
m.EpochNumber = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -2679,7 +2774,26 @@ func (m *QueryConnectionConsensusStateRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= uint64(b&0x7F) << shift
m.EpochNumber |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field EpochHeight", wireType)
}
m.EpochHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.EpochHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@ -2872,10 +2986,10 @@ func (m *QueryConnectionConsensusStateResponse) Unmarshal(dAtA []byte) error {
m.ProofPath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -2885,11 +2999,25 @@ func (m *QueryConnectionConsensusStateResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])

View File

@ -229,10 +229,6 @@ func local_request_Query_ConnectionClientState_0(ctx context.Context, marshaler
}
var (
filter_Query_ConnectionConsensusState_0 = &utilities.DoubleArray{Encoding: map[string]int{"connection_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_Query_ConnectionConsensusState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryConnectionConsensusStateRequest
var metadata runtime.ServerMetadata
@ -255,11 +251,26 @@ func request_Query_ConnectionConsensusState_0(ctx context.Context, marshaler run
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
val, ok = pathParams["epoch_number"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_number")
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ConnectionConsensusState_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
protoReq.EpochNumber, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_number", err)
}
val, ok = pathParams["epoch_height"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_height")
}
protoReq.EpochHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_height", err)
}
msg, err := client.ConnectionConsensusState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -289,11 +300,26 @@ func local_request_Query_ConnectionConsensusState_0(ctx context.Context, marshal
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
val, ok = pathParams["epoch_number"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_number")
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ConnectionConsensusState_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
protoReq.EpochNumber, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_number", err)
}
val, ok = pathParams["epoch_height"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_height")
}
protoReq.EpochHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_height", err)
}
msg, err := server.ConnectionConsensusState(ctx, &protoReq)
@ -559,7 +585,7 @@ var (
pattern_Query_ConnectionClientState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"ibc", "connection", "v1beta1", "connections", "connection_id", "client_state"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ConnectionConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"ibc", "connection", "v1beta1", "connections", "connection_id", "consensus_state"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ConnectionConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"ibc", "connection", "v1beta1", "connections", "connection_id", "consensus_state", "epoch", "epoch_number", "height", "epoch_height"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (

View File

@ -340,7 +340,7 @@ func GetCmdQueryNextSequenceReceive() *cobra.Command {
return err
}
clientCtx = clientCtx.WithHeight(int64(sequenceRes.ProofHeight))
clientCtx = clientCtx.WithHeight(int64(sequenceRes.ProofHeight.EpochHeight))
return clientCtx.PrintOutput(sequenceRes)
},
}

View File

@ -1,7 +1,6 @@
package cli
import (
"strconv"
"strings"
"github.com/spf13/cobra"
@ -11,6 +10,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectionutils "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/client/utils"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
)
@ -89,7 +89,7 @@ func NewChannelOpenTryCmd() *cobra.Command {
return err
}
proofHeight, err := strconv.ParseInt(args[6], 10, 64)
proofHeight, err := clienttypes.ParseHeight(args[6])
if err != nil {
return err
}
@ -97,7 +97,7 @@ func NewChannelOpenTryCmd() *cobra.Command {
msg := types.NewMsgChannelOpenTry(
portID, channelID, version, order, hops,
counterpartyPortID, counterpartyChannelID, version,
proofInit, uint64(proofHeight), clientCtx.GetFromAddress(),
proofInit, proofHeight, clientCtx.GetFromAddress(),
)
if err := msg.ValidateBasic(); err != nil {
return err
@ -133,18 +133,18 @@ func NewChannelOpenAckCmd() *cobra.Command {
// TODO: Differentiate between channel and counterparty versions.
version, _ := cmd.Flags().GetString(FlagIBCVersion)
proofTry, err := connectionutils.ParseProof(clientCtx.LegacyAmino, args[5])
proofTry, err := connectionutils.ParseProof(clientCtx.LegacyAmino, args[2])
if err != nil {
return err
}
proofHeight, err := strconv.ParseInt(args[3], 10, 64)
proofHeight, err := clienttypes.ParseHeight(args[3])
if err != nil {
return err
}
msg := types.NewMsgChannelOpenAck(
portID, channelID, version, proofTry, uint64(proofHeight), clientCtx.GetFromAddress(),
portID, channelID, version, proofTry, proofHeight, clientCtx.GetFromAddress(),
)
if err := msg.ValidateBasic(); err != nil {
return err
@ -175,18 +175,18 @@ func NewChannelOpenConfirmCmd() *cobra.Command {
portID := args[0]
channelID := args[1]
proofAck, err := connectionutils.ParseProof(clientCtx.LegacyAmino, args[5])
proofAck, err := connectionutils.ParseProof(clientCtx.LegacyAmino, args[2])
if err != nil {
return err
}
proofHeight, err := strconv.ParseInt(args[3], 10, 64)
proofHeight, err := clienttypes.ParseHeight(args[3])
if err != nil {
return err
}
msg := types.NewMsgChannelOpenConfirm(
portID, channelID, proofAck, uint64(proofHeight), clientCtx.GetFromAddress(),
portID, channelID, proofAck, proofHeight, clientCtx.GetFromAddress(),
)
if err := msg.ValidateBasic(); err != nil {
return err
@ -247,18 +247,18 @@ func NewChannelCloseConfirmCmd() *cobra.Command {
portID := args[0]
channelID := args[1]
proofInit, err := connectionutils.ParseProof(clientCtx.LegacyAmino, args[5])
proofInit, err := connectionutils.ParseProof(clientCtx.LegacyAmino, args[2])
if err != nil {
return err
}
proofHeight, err := strconv.ParseInt(args[3], 10, 64)
proofHeight, err := clienttypes.ParseHeight(args[3])
if err != nil {
return err
}
msg := types.NewMsgChannelCloseConfirm(
portID, channelID, proofInit, uint64(proofHeight), clientCtx.GetFromAddress(),
portID, channelID, proofInit, proofHeight, clientCtx.GetFromAddress(),
)
if err := msg.ValidateBasic(); err != nil {
return err

View File

@ -8,6 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clientutils "github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/utils"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
@ -59,7 +60,9 @@ func queryPacketCommitmentABCI(
// FIXME: height + 1 is returned as the proof height
// Issue: https://github.com/cosmos/cosmos-sdk/issues/6567
return types.NewQueryPacketCommitmentResponse(portID, channelID, sequence, res.Value, proofBz, res.Height+1), nil
// TODO: retrieve epoch number from chain-id
height := clienttypes.NewHeight(0, uint64(res.Height+1))
return types.NewQueryPacketCommitmentResponse(portID, channelID, sequence, res.Value, proofBz, height), nil
}
// QueryChannel returns a channel end.
@ -105,7 +108,9 @@ func queryChannelABCI(clientCtx client.Context, portID, channelID string) (*type
return nil, err
}
return types.NewQueryChannelResponse(portID, channelID, channel, proofBz, res.Height), nil
// TODO: retrieve epoch number from chain-id
height := clienttypes.NewHeight(0, uint64(res.Height))
return types.NewQueryChannelResponse(portID, channelID, channel, proofBz, height), nil
}
// QueryChannelClientState returns the ClientState of a channel end. If
@ -137,7 +142,7 @@ func QueryChannelClientState(
ClientId: res.IdentifiedClientState.ClientId,
ClientState: clientStateRes.ClientState,
}
res = types.NewQueryChannelClientStateResponse(identifiedClientState, clientStateRes.Proof, int64(clientStateRes.ProofHeight))
res = types.NewQueryChannelClientStateResponse(identifiedClientState, clientStateRes.Proof, clientStateRes.ProofHeight)
}
return res, nil
@ -147,14 +152,15 @@ func QueryChannelClientState(
// prove is true, it performs an ABCI store query in order to retrieve the
// merkle proof. Otherwise, it uses the gRPC query client.
func QueryChannelConsensusState(
clientCtx client.Context, portID, channelID string, height uint64, prove bool,
clientCtx client.Context, portID, channelID string, height clienttypes.Height, prove bool,
) (*types.QueryChannelConsensusStateResponse, error) {
queryClient := types.NewQueryClient(clientCtx)
req := &types.QueryChannelConsensusStateRequest{
PortId: portID,
ChannelId: channelID,
Height: height,
PortId: portID,
ChannelId: channelID,
EpochNumber: height.EpochNumber,
EpochHeight: height.EpochHeight,
}
res, err := queryClient.ChannelConsensusState(context.Background(), req)
@ -173,31 +179,39 @@ func QueryChannelConsensusState(
return nil, err
}
res = types.NewQueryChannelConsensusStateResponse(res.ClientId, consensusStateRes.ConsensusState, consensusState.GetHeight(), consensusStateRes.Proof, int64(consensusStateRes.ProofHeight))
res = types.NewQueryChannelConsensusStateResponse(res.ClientId, consensusStateRes.ConsensusState, height, consensusStateRes.Proof, consensusStateRes.ProofHeight)
}
return res, nil
}
// QueryCounterpartyConsensusState uses the channel Querier to return the
// counterparty ConsensusState given the source port ID and source channel ID.
func QueryCounterpartyConsensusState(
clientCtx client.Context, portID, channelID string, height uint64,
) (exported.ConsensusState, uint64, error) {
channelRes, err := QueryChannel(clientCtx, portID, channelID, false)
// QueryLatestConsensusState uses the channel Querier to return the
// latest ConsensusState given the source port ID and source channel ID.
func QueryLatestConsensusState(
clientCtx client.Context, portID, channelID string,
) (exported.ConsensusState, clienttypes.Height, error) {
clientRes, err := QueryChannelClientState(clientCtx, portID, channelID, false)
if err != nil {
return nil, 0, err
return nil, clienttypes.Height{}, err
}
clientState, err := clienttypes.UnpackClientState(clientRes.IdentifiedClientState.ClientState)
if err != nil {
return nil, clienttypes.Height{}, err
}
counterparty := channelRes.Channel.Counterparty
res, err := QueryChannelConsensusState(clientCtx, counterparty.PortId, counterparty.ChannelId, height, false)
clientHeight, ok := clientState.GetLatestHeight().(clienttypes.Height)
if !ok {
return nil, clienttypes.Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid height type. expected type: %T, got: %T",
clienttypes.Height{}, clientHeight)
}
res, err := QueryChannelConsensusState(clientCtx, portID, channelID, clientHeight, false)
if err != nil {
return nil, 0, err
return nil, clienttypes.Height{}, err
}
consensusState, err := clienttypes.UnpackConsensusState(res.ConsensusState)
if err != nil {
return nil, 0, err
return nil, clienttypes.Height{}, err
}
return consensusState, res.ProofHeight, nil
@ -242,5 +256,7 @@ func queryNextSequenceRecvABCI(clientCtx client.Context, portID, channelID strin
}
sequence := binary.BigEndian.Uint64(res.Value)
return types.NewQueryNextSequenceReceiveResponse(portID, channelID, sequence, proofBz, res.Height), nil
// TODO: retrieve epoch number from chain-id
height := clienttypes.NewHeight(0, uint64(res.Height))
return types.NewQueryNextSequenceReceiveResponse(portID, channelID, sequence, proofBz, height), nil
}

View File

@ -39,7 +39,8 @@ func (q Keeper) Channel(c context.Context, req *types.QueryChannelRequest) (*typ
)
}
return types.NewQueryChannelResponse(req.PortId, req.ChannelId, channel, nil, ctx.BlockHeight()), nil
selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryChannelResponse(req.PortId, req.ChannelId, channel, nil, selfHeight), nil
}
// Channels implements the Query/Channels gRPC method
@ -73,10 +74,11 @@ func (q Keeper) Channels(c context.Context, req *types.QueryChannelsRequest) (*t
return nil, err
}
selfHeight := clienttypes.GetSelfHeight(ctx)
return &types.QueryChannelsResponse{
Channels: channels,
Pagination: pageRes,
Height: ctx.BlockHeight(),
Height: selfHeight,
}, nil
}
@ -121,10 +123,11 @@ func (q Keeper) ConnectionChannels(c context.Context, req *types.QueryConnection
return nil, err
}
selfHeight := clienttypes.GetSelfHeight(ctx)
return &types.QueryConnectionChannelsResponse{
Channels: channels,
Pagination: pageRes,
Height: ctx.BlockHeight(),
Height: selfHeight,
}, nil
}
@ -166,8 +169,8 @@ func (q Keeper) ChannelClientState(c context.Context, req *types.QueryChannelCli
identifiedClientState := clienttypes.NewIdentifiedClientState(connection.ClientId, clientState)
return types.NewQueryChannelClientStateResponse(identifiedClientState, nil, ctx.BlockHeight()), nil
selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryChannelClientStateResponse(identifiedClientState, nil, selfHeight), nil
}
// ChannelConsensusState implements the Query/ChannelConsensusState gRPC method
@ -198,7 +201,8 @@ func (q Keeper) ChannelConsensusState(c context.Context, req *types.QueryChannel
)
}
consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientId, req.Height)
consHeight := clienttypes.NewHeight(req.EpochNumber, req.EpochHeight)
consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientId, consHeight)
if !found {
return nil, status.Error(
codes.NotFound,
@ -211,7 +215,8 @@ func (q Keeper) ChannelConsensusState(c context.Context, req *types.QueryChannel
return nil, status.Error(codes.Internal, err.Error())
}
return types.NewQueryChannelConsensusStateResponse(connection.ClientId, anyConsensusState, consensusState.GetHeight(), nil, ctx.BlockHeight()), nil
selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryChannelConsensusStateResponse(connection.ClientId, anyConsensusState, consHeight, nil, selfHeight), nil
}
// PacketCommitment implements the Query/PacketCommitment gRPC method
@ -235,7 +240,8 @@ func (q Keeper) PacketCommitment(c context.Context, req *types.QueryPacketCommit
return nil, status.Error(codes.NotFound, "packet commitment hash not found")
}
return types.NewQueryPacketCommitmentResponse(req.PortId, req.ChannelId, req.Sequence, commitmentBz, nil, ctx.BlockHeight()), nil
selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryPacketCommitmentResponse(req.PortId, req.ChannelId, req.Sequence, commitmentBz, nil, selfHeight), nil
}
// PacketCommitments implements the Query/PacketCommitments gRPC method
@ -270,10 +276,11 @@ func (q Keeper) PacketCommitments(c context.Context, req *types.QueryPacketCommi
return nil, err
}
selfHeight := clienttypes.GetSelfHeight(ctx)
return &types.QueryPacketCommitmentsResponse{
Commitments: commitments,
Pagination: pageRes,
Height: ctx.BlockHeight(),
Height: selfHeight,
}, nil
}
@ -298,7 +305,8 @@ func (q Keeper) PacketAcknowledgement(c context.Context, req *types.QueryPacketA
return nil, status.Error(codes.NotFound, "packet acknowledgement hash not found")
}
return types.NewQueryPacketAcknowledgementResponse(req.PortId, req.ChannelId, req.Sequence, acknowledgementBz, nil, ctx.BlockHeight()), nil
selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryPacketAcknowledgementResponse(req.PortId, req.ChannelId, req.Sequence, acknowledgementBz, nil, selfHeight), nil
}
// UnrelayedPackets implements the Query/UnrelayedPackets gRPC method. Given
@ -336,9 +344,11 @@ func (q Keeper) UnrelayedPackets(c context.Context, req *types.QueryUnrelayedPac
}
}
selfHeight := clienttypes.GetSelfHeight(ctx)
return &types.QueryUnrelayedPacketsResponse{
Sequences: unrelayedSequences,
Height: ctx.BlockHeight(),
Height: selfHeight,
}, nil
}
@ -361,7 +371,8 @@ func (q Keeper) NextSequenceReceive(c context.Context, req *types.QueryNextSeque
)
}
return types.NewQueryNextSequenceReceiveResponse(req.PortId, req.ChannelId, sequence, nil, ctx.BlockHeight()), nil
selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryNextSequenceReceiveResponse(req.PortId, req.ChannelId, sequence, nil, selfHeight), nil
}
func validategRPCRequest(portID, channelID string) error {

View File

@ -437,9 +437,10 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
"invalid port ID",
func() {
req = &types.QueryChannelConsensusStateRequest{
PortId: "",
ChannelId: "test-channel-id",
Height: 1,
PortId: "",
ChannelId: "test-channel-id",
EpochNumber: 0,
EpochHeight: 1,
}
},
false,
@ -448,9 +449,10 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
"invalid channel ID",
func() {
req = &types.QueryChannelConsensusStateRequest{
PortId: "test-port-id",
ChannelId: "",
Height: 1,
PortId: "test-port-id",
ChannelId: "",
EpochNumber: 0,
EpochHeight: 1,
}
},
false,
@ -459,9 +461,10 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
"channel not found",
func() {
req = &types.QueryChannelConsensusStateRequest{
PortId: "test-port-id",
ChannelId: "test-channel-id",
Height: 1,
PortId: "test-port-id",
ChannelId: "test-channel-id",
EpochNumber: 0,
EpochHeight: 1,
}
},
false,
@ -479,9 +482,10 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
req = &types.QueryChannelConsensusStateRequest{
PortId: channelA.PortID,
ChannelId: channelA.ID,
Height: 1,
PortId: channelA.PortID,
ChannelId: channelA.ID,
EpochNumber: 0,
EpochHeight: 1,
}
}, false,
},
@ -491,9 +495,10 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
_, _, _, _, channelA, _ := suite.coordinator.Setup(suite.chainA, suite.chainB, types.UNORDERED)
req = &types.QueryChannelConsensusStateRequest{
PortId: channelA.PortID,
ChannelId: channelA.ID,
Height: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
PortId: channelA.PortID,
ChannelId: channelA.ID,
EpochNumber: 0,
EpochHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
}
}, false,
},
@ -511,9 +516,10 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
expClientID = clientA
req = &types.QueryChannelConsensusStateRequest{
PortId: channelA.PortID,
ChannelId: channelA.ID,
Height: expConsensusState.GetHeight(),
PortId: channelA.PortID,
ChannelId: channelA.ID,
EpochNumber: expConsensusState.GetHeight().GetEpochNumber(),
EpochHeight: expConsensusState.GetHeight().GetEpochHeight(),
}
},
true,

View File

@ -10,6 +10,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// CounterpartyHops returns the connection hops of the counterparty channel.
@ -105,7 +106,7 @@ func (k Keeper) ChanOpenTry(
version,
counterpartyVersion string,
proofInit []byte,
proofHeight uint64,
proofHeight exported.Height,
) (*capabilitytypes.Capability, error) {
// channel identifier and connection hop length checked on msg.ValidateBasic()
previousChannel, found := k.GetChannel(ctx, portID, channelID)
@ -199,7 +200,7 @@ func (k Keeper) ChanOpenAck(
chanCap *capabilitytypes.Capability,
counterpartyVersion string,
proofTry []byte,
proofHeight uint64,
proofHeight exported.Height,
) error {
channel, found := k.GetChannel(ctx, portID, channelID)
if !found {
@ -267,7 +268,7 @@ func (k Keeper) ChanOpenConfirm(
channelID string,
chanCap *capabilitytypes.Capability,
proofAck []byte,
proofHeight uint64,
proofHeight exported.Height,
) error {
channel, found := k.GetChannel(ctx, portID, channelID)
if !found {
@ -378,7 +379,7 @@ func (k Keeper) ChanCloseConfirm(
channelID string,
chanCap *capabilitytypes.Capability,
proofInit []byte,
proofHeight uint64,
proofHeight exported.Height,
) error {
if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) {
return sdkerrors.Wrap(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)")

View File

@ -4,6 +4,7 @@ import (
"fmt"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
@ -263,7 +264,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
cap, err := suite.chainB.App.IBCKeeper.ChannelKeeper.ChanOpenTry(
suite.chainB.GetContext(), types.ORDERED, []string{connB.ID},
channelB.PortID, channelB.ID, portCap, counterparty, channelB.Version, connA.FirstOrNextTestChannel(ibctesting.TransferPort).Version,
proof, proofHeight+heightDiff,
proof, malleateHeight(proofHeight, heightDiff),
)
if tc.expPass {
@ -391,7 +392,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
err := suite.chainA.App.IBCKeeper.ChannelKeeper.ChanOpenAck(
suite.chainA.GetContext(), channelA.PortID, channelA.ID, channelCap, channelB.Version,
proof, proofHeight+heightDiff,
proof, malleateHeight(proofHeight, heightDiff),
)
if tc.expPass {
@ -519,7 +520,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
err := suite.chainB.App.IBCKeeper.ChannelKeeper.ChanOpenConfirm(
suite.chainB.GetContext(), channelB.PortID, channelB.ID,
channelCap, proof, proofHeight+heightDiff,
channelCap, proof, malleateHeight(proofHeight, heightDiff),
)
if tc.expPass {
@ -720,7 +721,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() {
err := suite.chainB.App.IBCKeeper.ChannelKeeper.ChanCloseConfirm(
suite.chainB.GetContext(), channelB.PortID, channelB.ID, channelCap,
proof, proofHeight+heightDiff,
proof, malleateHeight(proofHeight, heightDiff),
)
if tc.expPass {
@ -731,3 +732,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() {
})
}
}
func malleateHeight(height exported.Height, diff uint64) exported.Height {
return clienttypes.NewHeight(height.GetEpochNumber(), height.GetEpochHeight()+diff)
}

View File

@ -77,10 +77,11 @@ func (k Keeper) SendPacket(
// check if packet timeouted on the receiving chain
latestHeight := clientState.GetLatestHeight()
if packet.GetTimeoutHeight() != 0 && latestHeight >= packet.GetTimeoutHeight() {
timeoutHeight := packet.GetTimeoutHeight()
if !timeoutHeight.IsZero() && latestHeight.GTE(timeoutHeight) {
return sdkerrors.Wrapf(
types.ErrPacketTimeout,
"receiving chain block height >= packet timeout height (%d >= %d)", latestHeight, packet.GetTimeoutHeight(),
"receiving chain block height >= packet timeout height (%s >= %s)", latestHeight, timeoutHeight,
)
}
@ -121,7 +122,7 @@ func (k Keeper) SendPacket(
sdk.NewEvent(
types.EventTypeSendPacket,
sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())),
sdk.NewAttribute(types.AttributeKeyTimeoutHeight, fmt.Sprintf("%d", packet.GetTimeoutHeight())),
sdk.NewAttribute(types.AttributeKeyTimeoutHeight, timeoutHeight.String()),
sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())),
sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.GetSequence())),
sdk.NewAttribute(types.AttributeKeySrcPort, packet.GetSourcePort()),
@ -146,7 +147,7 @@ func (k Keeper) RecvPacket(
ctx sdk.Context,
packet exported.PacketI,
proof []byte,
proofHeight uint64,
proofHeight exported.Height,
) error {
channel, found := k.GetChannel(ctx, packet.GetDestPort(), packet.GetDestChannel())
if !found {
@ -191,10 +192,12 @@ func (k Keeper) RecvPacket(
}
// check if packet timeouted by comparing it with the latest height of the chain
if packet.GetTimeoutHeight() != 0 && uint64(ctx.BlockHeight()) >= packet.GetTimeoutHeight() {
selfHeight := clienttypes.GetSelfHeight(ctx)
timeoutHeight := packet.GetTimeoutHeight()
if !timeoutHeight.IsZero() && selfHeight.GTE(timeoutHeight) {
return sdkerrors.Wrapf(
types.ErrPacketTimeout,
"block height >= packet timeout height (%d >= %d)", uint64(ctx.BlockHeight()), packet.GetTimeoutHeight(),
"block height >= packet timeout height (%s >= %s)", selfHeight, timeoutHeight,
)
}
@ -313,7 +316,7 @@ func (k Keeper) ReceiveExecuted(
types.EventTypeRecvPacket,
sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())),
sdk.NewAttribute(types.AttributeKeyAck, string(acknowledgement)),
sdk.NewAttribute(types.AttributeKeyTimeoutHeight, fmt.Sprintf("%d", packet.GetTimeoutHeight())),
sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()),
sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())),
sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.GetSequence())),
sdk.NewAttribute(types.AttributeKeySrcPort, packet.GetSourcePort()),
@ -342,7 +345,7 @@ func (k Keeper) AcknowledgePacket(
packet exported.PacketI,
acknowledgement []byte,
proof []byte,
proofHeight uint64,
proofHeight exported.Height,
) error {
channel, found := k.GetChannel(ctx, packet.GetSourcePort(), packet.GetSourceChannel())
if !found {
@ -476,7 +479,7 @@ func (k Keeper) AcknowledgementExecuted(
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeAcknowledgePacket,
sdk.NewAttribute(types.AttributeKeyTimeoutHeight, fmt.Sprintf("%d", packet.GetTimeoutHeight())),
sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()),
sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())),
sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.GetSequence())),
sdk.NewAttribute(types.AttributeKeySrcPort, packet.GetSourcePort()),

View File

@ -4,6 +4,7 @@ import (
"fmt"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
@ -14,8 +15,8 @@ import (
var (
validPacketData = []byte("VALID PACKET DATA")
disabledTimeoutTimestamp = uint64(0)
disabledTimeoutHeight = uint64(0)
timeoutHeight = uint64(100)
disabledTimeoutHeight = clienttypes.Height{}
timeoutHeight = clienttypes.NewHeight(0, 100)
// for when the testing package cannot be used
clientIDA = "clientA"
@ -132,7 +133,7 @@ func (suite *KeeperTestSuite) TestSendPacket() {
clientA, _, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.UNORDERED)
// use client state latest height for timeout
clientState := suite.chainA.GetClientState(clientA)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clientState.GetLatestHeight(), disabledTimeoutTimestamp)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clientState.GetLatestHeight().(clienttypes.Height), disabledTimeoutTimestamp)
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
{"timeout timestamp passed", func() {
@ -292,7 +293,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
}, false},
{"timeout height passed", func() {
_, _, _, _, 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, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
}, false},
{"timeout timestamp passed", func() {
_, _, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.UNORDERED)

View File

@ -23,7 +23,7 @@ func (k Keeper) TimeoutPacket(
ctx sdk.Context,
packet exported.PacketI,
proof []byte,
proofHeight,
proofHeight exported.Height,
nextSequenceRecv uint64,
) error {
channel, found := k.GetChannel(ctx, packet.GetSourcePort(), packet.GetSourceChannel())
@ -72,7 +72,8 @@ func (k Keeper) TimeoutPacket(
return err
}
if (packet.GetTimeoutHeight() == 0 || proofHeight < packet.GetTimeoutHeight()) &&
timeoutHeight := packet.GetTimeoutHeight()
if (timeoutHeight.IsZero() || proofHeight.LT(timeoutHeight)) &&
(packet.GetTimeoutTimestamp() == 0 || proofTimestamp < packet.GetTimeoutTimestamp()) {
return sdkerrors.Wrap(types.ErrPacketTimeout, "packet timeout has not been reached for height or timestamp")
}
@ -151,7 +152,7 @@ func (k Keeper) TimeoutExecuted(
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeTimeoutPacket,
sdk.NewAttribute(types.AttributeKeyTimeoutHeight, fmt.Sprintf("%d", packet.GetTimeoutHeight())),
sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()),
sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())),
sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.GetSequence())),
sdk.NewAttribute(types.AttributeKeySrcPort, packet.GetSourcePort()),
@ -178,7 +179,7 @@ func (k Keeper) TimeoutOnClose(
packet exported.PacketI,
proof,
proofClosed []byte,
proofHeight,
proofHeight exported.Height,
nextSequenceRecv uint64,
) error {
channel, found := k.GetChannel(ctx, packet.GetSourcePort(), packet.GetSourceChannel())

View File

@ -4,6 +4,7 @@ import (
"fmt"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
@ -25,7 +26,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
ordered = true
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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
@ -34,7 +35,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
ordered = false
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, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
// need to update chainA's client representing chainB to prove missing ack
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
@ -97,7 +98,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
ordered = false
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, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, false},
@ -106,7 +107,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
ordered = true
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, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
}, false},
@ -117,7 +118,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
suite.Run(fmt.Sprintf("Case %s, %d/%d tests", tc.msg, i, len(testCases)), func() {
var (
proof []byte
proofHeight uint64
proofHeight exported.Height
)
suite.SetupTest() // reset
@ -155,7 +156,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() {
testCases := []testCase{
{"success ORDERED", func() {
_, 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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
@ -167,7 +168,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() {
}, false},
{"incorrect capability", func() {
_, 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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
chanCap = capabilitytypes.NewCapability(100)
@ -208,7 +209,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
{"success: ORDERED", func() {
ordered = true
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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
// need to update chainA's client representing chainB to prove missing ack
@ -219,7 +220,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
{"success: UNORDERED", func() {
ordered = false
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, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
// need to update chainA's client representing chainB to prove missing ack
@ -261,14 +262,14 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
}, false},
{"packet hasn't been sent", func() {
_, _, _, _, 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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
{"packet already received", func() {
nextSeqRecv = 2
ordered = true
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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
// need to update chainA's client representing chainB to prove missing ack
@ -279,7 +280,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
{"channel verification failed", func() {
ordered = true
_, 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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
}, false},
@ -287,7 +288,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
// set ordered to false providing the wrong proof for ORDERED case
ordered = false
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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
@ -297,7 +298,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
// set ordered to true providing the wrong proof for UNORDERED case
ordered = true
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, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
@ -306,7 +307,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
{"channel capability not found", func() {
ordered = true
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()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
// need to update chainA's client representing chainB to prove missing ack

View File

@ -6,6 +6,7 @@ package types
import (
fmt "fmt"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
@ -178,7 +179,7 @@ type MsgChannelOpenTry struct {
Channel Channel `protobuf:"bytes,3,opt,name=channel,proto3" json:"channel"`
CounterpartyVersion string `protobuf:"bytes,4,opt,name=counterparty_version,json=counterpartyVersion,proto3" json:"counterparty_version,omitempty" yaml:"counterparty_version"`
ProofInit []byte `protobuf:"bytes,5,opt,name=proof_init,json=proofInit,proto3" json:"proof_init,omitempty" yaml:"proof_init"`
ProofHeight uint64 `protobuf:"varint,6,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types.Height `protobuf:"bytes,6,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,7,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -250,11 +251,11 @@ func (m *MsgChannelOpenTry) GetProofInit() []byte {
return nil
}
func (m *MsgChannelOpenTry) GetProofHeight() uint64 {
func (m *MsgChannelOpenTry) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func (m *MsgChannelOpenTry) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -271,7 +272,7 @@ type MsgChannelOpenAck struct {
ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"`
CounterpartyVersion string `protobuf:"bytes,3,opt,name=counterparty_version,json=counterpartyVersion,proto3" json:"counterparty_version,omitempty" yaml:"counterparty_version"`
ProofTry []byte `protobuf:"bytes,4,opt,name=proof_try,json=proofTry,proto3" json:"proof_try,omitempty" yaml:"proof_try"`
ProofHeight uint64 `protobuf:"varint,5,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types.Height `protobuf:"bytes,5,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,6,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -336,11 +337,11 @@ func (m *MsgChannelOpenAck) GetProofTry() []byte {
return nil
}
func (m *MsgChannelOpenAck) GetProofHeight() uint64 {
func (m *MsgChannelOpenAck) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func (m *MsgChannelOpenAck) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -356,7 +357,7 @@ type MsgChannelOpenConfirm struct {
PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"`
ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"`
ProofAck []byte `protobuf:"bytes,3,opt,name=proof_ack,json=proofAck,proto3" json:"proof_ack,omitempty" yaml:"proof_ack"`
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -414,11 +415,11 @@ func (m *MsgChannelOpenConfirm) GetProofAck() []byte {
return nil
}
func (m *MsgChannelOpenConfirm) GetProofHeight() uint64 {
func (m *MsgChannelOpenConfirm) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func (m *MsgChannelOpenConfirm) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -496,7 +497,7 @@ type MsgChannelCloseConfirm struct {
PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"`
ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"`
ProofInit []byte `protobuf:"bytes,3,opt,name=proof_init,json=proofInit,proto3" json:"proof_init,omitempty" yaml:"proof_init"`
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -554,11 +555,11 @@ func (m *MsgChannelCloseConfirm) GetProofInit() []byte {
return nil
}
func (m *MsgChannelCloseConfirm) GetProofHeight() uint64 {
func (m *MsgChannelCloseConfirm) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func (m *MsgChannelCloseConfirm) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -572,7 +573,7 @@ func (m *MsgChannelCloseConfirm) GetSigner() github_com_cosmos_cosmos_sdk_types.
type MsgRecvPacket struct {
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"`
ProofHeight uint64 `protobuf:"varint,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -623,11 +624,11 @@ func (m *MsgRecvPacket) GetProof() []byte {
return nil
}
func (m *MsgRecvPacket) GetProofHeight() uint64 {
func (m *MsgRecvPacket) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func (m *MsgRecvPacket) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -641,7 +642,7 @@ func (m *MsgRecvPacket) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddres
type MsgTimeout struct {
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"`
ProofHeight uint64 `protobuf:"varint,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
NextSequenceRecv uint64 `protobuf:"varint,4,opt,name=next_sequence_recv,json=nextSequenceRecv,proto3" json:"next_sequence_recv,omitempty" yaml:"next_sequence_recv"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -693,11 +694,11 @@ func (m *MsgTimeout) GetProof() []byte {
return nil
}
func (m *MsgTimeout) GetProofHeight() uint64 {
func (m *MsgTimeout) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func (m *MsgTimeout) GetNextSequenceRecv() uint64 {
@ -719,7 +720,7 @@ type MsgTimeoutOnClose struct {
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"`
ProofClose []byte `protobuf:"bytes,3,opt,name=proof_close,json=proofClose,proto3" json:"proof_close,omitempty" yaml:"proof_close"`
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
NextSequenceRecv uint64 `protobuf:"varint,5,opt,name=next_sequence_recv,json=nextSequenceRecv,proto3" json:"next_sequence_recv,omitempty" yaml:"next_sequence_recv"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,6,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -778,11 +779,11 @@ func (m *MsgTimeoutOnClose) GetProofClose() []byte {
return nil
}
func (m *MsgTimeoutOnClose) GetProofHeight() uint64 {
func (m *MsgTimeoutOnClose) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func (m *MsgTimeoutOnClose) GetNextSequenceRecv() uint64 {
@ -804,7 +805,7 @@ type MsgAcknowledgement struct {
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
Acknowledgement []byte `protobuf:"bytes,2,opt,name=acknowledgement,proto3" json:"acknowledgement,omitempty"`
Proof []byte `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"`
ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty" yaml:"proof_height"`
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"`
}
@ -862,11 +863,11 @@ func (m *MsgAcknowledgement) GetProof() []byte {
return nil
}
func (m *MsgAcknowledgement) GetProofHeight() uint64 {
func (m *MsgAcknowledgement) GetProofHeight() types.Height {
if m != nil {
return m.ProofHeight
}
return 0
return types.Height{}
}
func (m *MsgAcknowledgement) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress {
@ -1037,7 +1038,7 @@ type Packet struct {
// actual opaque bytes transferred directly to the application module
Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
// block height after which the packet times out
TimeoutHeight uint64 `protobuf:"varint,7,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty" yaml:"timeout_height"`
TimeoutHeight types.Height `protobuf:"bytes,7,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height" yaml:"timeout_height"`
// block timestamp (in nanoseconds) after which the packet times out
TimeoutTimestamp uint64 `protobuf:"varint,8,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty" yaml:"timeout_timestamp"`
}
@ -1144,89 +1145,91 @@ func init() {
func init() { proto.RegisterFile("ibc/channel/channel.proto", fileDescriptor_9277922ccfb7f043) }
var fileDescriptor_9277922ccfb7f043 = []byte{
// 1303 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xbd, 0x6f, 0xdb, 0x46,
0x14, 0x17, 0xf5, 0x69, 0x3d, 0x7f, 0xc9, 0x67, 0xc7, 0x91, 0x95, 0x44, 0x14, 0x88, 0x0e, 0x42,
0x8a, 0xc8, 0xcd, 0x07, 0x5a, 0x20, 0x53, 0x25, 0x59, 0x41, 0x84, 0xc6, 0x92, 0x71, 0x56, 0x0a,
0x34, 0x0b, 0x41, 0x53, 0x17, 0x89, 0x90, 0xc5, 0x53, 0x49, 0x3a, 0x89, 0xf7, 0x0e, 0x81, 0x81,
0x16, 0xfd, 0x07, 0x0c, 0x14, 0xe8, 0xd4, 0xa5, 0x53, 0x81, 0x76, 0xe9, 0xd4, 0x25, 0x5b, 0x33,
0x76, 0x62, 0x8a, 0x64, 0xea, 0xca, 0xa9, 0xe8, 0x54, 0xf0, 0xee, 0x28, 0x91, 0x72, 0x9a, 0xc1,
0x0a, 0x94, 0x0c, 0x9d, 0xc8, 0xf7, 0xde, 0xef, 0xee, 0xde, 0xfb, 0xbd, 0xc7, 0xf7, 0x4e, 0x82,
0x2d, 0xe3, 0x40, 0xdf, 0xd6, 0xfb, 0x9a, 0x69, 0x92, 0xc3, 0xe0, 0x59, 0x19, 0x59, 0xd4, 0xa1,
0x68, 0xd1, 0x38, 0xd0, 0x2b, 0x42, 0x55, 0xd8, 0xe8, 0xd1, 0x1e, 0x65, 0xfa, 0x6d, 0xff, 0x8d,
0x43, 0x94, 0xbf, 0x25, 0x40, 0xbb, 0x76, 0xaf, 0xce, 0x41, 0xed, 0x11, 0x31, 0x9b, 0xa6, 0xe1,
0xa0, 0x0f, 0x21, 0x33, 0xa2, 0x96, 0xa3, 0x1a, 0xdd, 0xbc, 0x54, 0x92, 0xca, 0xd9, 0x1a, 0xf2,
0x5c, 0x79, 0xe5, 0x58, 0x1b, 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xd9, 0x7f, 0x5f, 0x37, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xbc,
0xba, 0x59, 0x74, 0x3b, 0x13, 0x00, 0x00,
// 1330 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6b, 0x1b, 0x47,
0x14, 0xd7, 0xea, 0xd3, 0x7a, 0xfe, 0x92, 0xc7, 0x8e, 0x23, 0x2b, 0x89, 0x56, 0x2c, 0x3d, 0x98,
0x94, 0xc8, 0xcd, 0x07, 0x2d, 0xe4, 0x54, 0x49, 0x56, 0x88, 0x68, 0x2c, 0x99, 0xb1, 0x52, 0xda,
0x5c, 0xc4, 0x7a, 0x35, 0x91, 0x16, 0x59, 0x3b, 0xea, 0xee, 0x38, 0x89, 0x8f, 0xbd, 0x05, 0x43,
0xa1, 0x7f, 0x40, 0x0d, 0x85, 0x42, 0x8f, 0xbd, 0xf6, 0x5c, 0x7a, 0xc9, 0xa1, 0xd0, 0x5c, 0x0a,
0x3d, 0x2d, 0x25, 0xf9, 0x0f, 0x74, 0x49, 0xe9, 0xa9, 0xec, 0xcc, 0xac, 0xb4, 0x2b, 0x3b, 0x39,
0x44, 0xae, 0xf0, 0xa1, 0xa7, 0x9d, 0x79, 0xef, 0x37, 0x33, 0xef, 0xfd, 0xde, 0x9b, 0x37, 0x4f,
0x82, 0x0d, 0x73, 0xdf, 0xd8, 0x32, 0xba, 0xba, 0x65, 0x91, 0x03, 0xff, 0x5b, 0x1c, 0xd8, 0x94,
0x51, 0x34, 0x6f, 0xee, 0x1b, 0x45, 0x29, 0xca, 0xad, 0x75, 0x68, 0x87, 0x72, 0xf9, 0x96, 0x37,
0x12, 0x90, 0xdc, 0x65, 0xbe, 0xfa, 0xc0, 0x24, 0x16, 0x93, 0x1f, 0xa1, 0xd0, 0xfe, 0x56, 0x00,
0xed, 0x38, 0x9d, 0x8a, 0x58, 0xdd,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x95, 0x57, 0xfe, 0x7a, 0x95, 0x57, 0xbe, 0x7d,
0x9d, 0x8f, 0xbc, 0x7c, 0x9d, 0x8f, 0xfc, 0xf9, 0x3a, 0x1f, 0x79, 0x74, 0xfb, 0x9d, 0x2f, 0xe1,
0xb3, 0x2d, 0x73, 0xdf, 0xd8, 0xfa, 0xe8, 0xce, 0x0d, 0xff, 0x0f, 0x41, 0xfe, 0x34, 0xee, 0x27,
0xf9, 0x7f, 0x7a, 0xb7, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x07, 0x62, 0x39, 0x2c, 0x14,
0x00, 0x00,
}
func (m *MsgChannelOpenInit) Marshal() (dAtA []byte, err error) {
@ -1310,11 +1313,16 @@ func (m *MsgChannelOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x3a
}
if m.ProofHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x30
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
if len(m.ProofInit) > 0 {
i -= len(m.ProofInit)
copy(dAtA[i:], m.ProofInit)
@ -1383,11 +1391,16 @@ func (m *MsgChannelOpenAck) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x32
}
if m.ProofHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x28
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
if len(m.ProofTry) > 0 {
i -= len(m.ProofTry)
copy(dAtA[i:], m.ProofTry)
@ -1446,11 +1459,16 @@ func (m *MsgChannelOpenConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x2a
}
if m.ProofHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.ProofAck) > 0 {
i -= len(m.ProofAck)
copy(dAtA[i:], m.ProofAck)
@ -1546,11 +1564,16 @@ func (m *MsgChannelCloseConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error)
i--
dAtA[i] = 0x2a
}
if m.ProofHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.ProofInit) > 0 {
i -= len(m.ProofInit)
copy(dAtA[i:], m.ProofInit)
@ -1602,11 +1625,16 @@ func (m *MsgRecvPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x22
}
if m.ProofHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x18
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if len(m.Proof) > 0 {
i -= len(m.Proof)
copy(dAtA[i:], m.Proof)
@ -1659,11 +1687,16 @@ func (m *MsgTimeout) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x20
}
if m.ProofHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x18
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if len(m.Proof) > 0 {
i -= len(m.Proof)
copy(dAtA[i:], m.Proof)
@ -1716,11 +1749,16 @@ func (m *MsgTimeoutOnClose) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x28
}
if m.ProofHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.ProofClose) > 0 {
i -= len(m.ProofClose)
copy(dAtA[i:], m.ProofClose)
@ -1775,11 +1813,16 @@ func (m *MsgAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x2a
}
if m.ProofHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.ProofHeight))
i--
dAtA[i] = 0x20
{
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if len(m.Proof) > 0 {
i -= len(m.Proof)
copy(dAtA[i:], m.Proof)
@ -2001,11 +2044,16 @@ func (m *Packet) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x40
}
if m.TimeoutHeight != 0 {
i = encodeVarintChannel(dAtA, i, uint64(m.TimeoutHeight))
i--
dAtA[i] = 0x38
{
size, err := m.TimeoutHeight.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintChannel(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
if len(m.Data) > 0 {
i -= len(m.Data)
copy(dAtA[i:], m.Data)
@ -2156,9 +2204,8 @@ func (m *MsgChannelOpenTry) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovChannel(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovChannel(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
@ -2188,9 +2235,8 @@ func (m *MsgChannelOpenAck) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovChannel(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovChannel(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
@ -2216,9 +2262,8 @@ func (m *MsgChannelOpenConfirm) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovChannel(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovChannel(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
@ -2265,9 +2310,8 @@ func (m *MsgChannelCloseConfirm) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovChannel(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovChannel(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
@ -2287,9 +2331,8 @@ func (m *MsgRecvPacket) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovChannel(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovChannel(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
@ -2309,9 +2352,8 @@ func (m *MsgTimeout) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovChannel(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovChannel(uint64(l))
if m.NextSequenceRecv != 0 {
n += 1 + sovChannel(uint64(m.NextSequenceRecv))
}
@ -2338,9 +2380,8 @@ func (m *MsgTimeoutOnClose) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovChannel(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovChannel(uint64(l))
if m.NextSequenceRecv != 0 {
n += 1 + sovChannel(uint64(m.NextSequenceRecv))
}
@ -2367,9 +2408,8 @@ func (m *MsgAcknowledgement) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.ProofHeight != 0 {
n += 1 + sovChannel(uint64(m.ProofHeight))
}
l = m.ProofHeight.Size()
n += 1 + l + sovChannel(uint64(l))
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
@ -2485,9 +2525,8 @@ func (m *Packet) Size() (n int) {
if l > 0 {
n += 1 + l + sovChannel(uint64(l))
}
if m.TimeoutHeight != 0 {
n += 1 + sovChannel(uint64(m.TimeoutHeight))
}
l = m.TimeoutHeight.Size()
n += 1 + l + sovChannel(uint64(l))
if m.TimeoutTimestamp != 0 {
n += 1 + sovChannel(uint64(m.TimeoutTimestamp))
}
@ -2901,10 +2940,10 @@ func (m *MsgChannelOpenTry) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 6:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -2914,11 +2953,25 @@ func (m *MsgChannelOpenTry) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
@ -3137,10 +3190,10 @@ func (m *MsgChannelOpenAck) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 5:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -3150,11 +3203,25 @@ func (m *MsgChannelOpenAck) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
@ -3341,10 +3408,10 @@ func (m *MsgChannelOpenConfirm) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -3354,11 +3421,25 @@ func (m *MsgChannelOpenConfirm) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
@ -3696,10 +3777,10 @@ func (m *MsgChannelCloseConfirm) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -3709,11 +3790,25 @@ func (m *MsgChannelCloseConfirm) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
@ -3869,10 +3964,10 @@ func (m *MsgRecvPacket) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 3:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -3882,11 +3977,25 @@ func (m *MsgRecvPacket) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
@ -4042,10 +4151,10 @@ func (m *MsgTimeout) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 3:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -4055,11 +4164,25 @@ func (m *MsgTimeout) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NextSequenceRecv", wireType)
@ -4268,10 +4391,10 @@ func (m *MsgTimeoutOnClose) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -4281,11 +4404,25 @@ func (m *MsgTimeoutOnClose) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NextSequenceRecv", wireType)
@ -4494,10 +4631,10 @@ func (m *MsgAcknowledgement) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 4:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
}
m.ProofHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -4507,11 +4644,25 @@ func (m *MsgAcknowledgement) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ProofHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
@ -5338,10 +5489,10 @@ func (m *Packet) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 7:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType)
}
m.TimeoutHeight = 0
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowChannel
@ -5351,11 +5502,25 @@ func (m *Packet) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.TimeoutHeight |= uint64(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthChannel
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthChannel
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.TimeoutHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType)

View File

@ -10,7 +10,7 @@ import (
// ClientKeeper expected account IBC client keeper
type ClientKeeper interface {
GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height uint64) (exported.ConsensusState, bool)
GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool)
}
// ConnectionKeeper expected account IBC connection keeper
@ -19,12 +19,12 @@ type ConnectionKeeper interface {
GetTimestampAtHeight(
ctx sdk.Context,
connection connectiontypes.ConnectionEnd,
height uint64,
height exported.Height,
) (uint64, error)
VerifyChannelState(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,
@ -33,7 +33,7 @@ type ConnectionKeeper interface {
VerifyPacketCommitment(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,
@ -43,7 +43,7 @@ type ConnectionKeeper interface {
VerifyPacketAcknowledgement(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,
@ -53,7 +53,7 @@ type ConnectionKeeper interface {
VerifyPacketAcknowledgementAbsence(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,
@ -62,7 +62,7 @@ type ConnectionKeeper interface {
VerifyNextSequenceRecv(
ctx sdk.Context,
connection exported.ConnectionI,
height uint64,
height exported.Height,
proof []byte,
portID,
channelID string,

View File

@ -5,6 +5,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)
@ -64,7 +65,7 @@ var _ sdk.Msg = &MsgChannelOpenTry{}
func NewMsgChannelOpenTry(
portID, channelID, version string, channelOrder Order, connectionHops []string,
counterpartyPortID, counterpartyChannelID, counterpartyVersion string,
proofInit []byte, proofHeight uint64, signer sdk.AccAddress,
proofInit []byte, proofHeight clienttypes.Height, signer sdk.AccAddress,
) *MsgChannelOpenTry {
counterparty := NewCounterparty(counterpartyPortID, counterpartyChannelID)
channel := NewChannel(INIT, channelOrder, counterparty, connectionHops, version)
@ -100,8 +101,8 @@ func (msg MsgChannelOpenTry) ValidateBasic() error {
if len(msg.ProofInit) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof init")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
// Signer can be empty
return msg.Channel.ValidateBasic()
@ -121,7 +122,7 @@ var _ sdk.Msg = &MsgChannelOpenAck{}
// NewMsgChannelOpenAck creates a new MsgChannelOpenAck instance
func NewMsgChannelOpenAck(
portID, channelID string, cpv string, proofTry []byte, proofHeight uint64,
portID, channelID string, cpv string, proofTry []byte, proofHeight clienttypes.Height,
signer sdk.AccAddress,
) *MsgChannelOpenAck {
return &MsgChannelOpenAck{
@ -155,8 +156,8 @@ func (msg MsgChannelOpenAck) ValidateBasic() error {
if len(msg.ProofTry) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof try")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
// Signer can be empty
return nil
@ -176,7 +177,7 @@ var _ sdk.Msg = &MsgChannelOpenConfirm{}
// NewMsgChannelOpenConfirm creates a new MsgChannelOpenConfirm instance
func NewMsgChannelOpenConfirm(
portID, channelID string, proofAck []byte, proofHeight uint64,
portID, channelID string, proofAck []byte, proofHeight clienttypes.Height,
signer sdk.AccAddress,
) *MsgChannelOpenConfirm {
return &MsgChannelOpenConfirm{
@ -209,8 +210,8 @@ func (msg MsgChannelOpenConfirm) ValidateBasic() error {
if len(msg.ProofAck) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof ack")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
// Signer can be empty
return nil
@ -275,7 +276,7 @@ var _ sdk.Msg = &MsgChannelCloseConfirm{}
// NewMsgChannelCloseConfirm creates a new MsgChannelCloseConfirm instance
func NewMsgChannelCloseConfirm(
portID, channelID string, proofInit []byte, proofHeight uint64,
portID, channelID string, proofInit []byte, proofHeight clienttypes.Height,
signer sdk.AccAddress,
) *MsgChannelCloseConfirm {
return &MsgChannelCloseConfirm{
@ -308,8 +309,8 @@ func (msg MsgChannelCloseConfirm) ValidateBasic() error {
if len(msg.ProofInit) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof init")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
// Signer can be empty
return nil
@ -329,7 +330,7 @@ var _ sdk.Msg = &MsgRecvPacket{}
// NewMsgRecvPacket constructs new MsgRecvPacket
func NewMsgRecvPacket(
packet Packet, proof []byte, proofHeight uint64,
packet Packet, proof []byte, proofHeight clienttypes.Height,
signer sdk.AccAddress,
) *MsgRecvPacket {
return &MsgRecvPacket{
@ -350,8 +351,8 @@ func (msg MsgRecvPacket) ValidateBasic() error {
if len(msg.Proof) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
if msg.Signer.Empty() {
return sdkerrors.ErrInvalidAddress
@ -387,7 +388,7 @@ var _ sdk.Msg = &MsgTimeout{}
// NewMsgTimeout constructs new MsgTimeout
func NewMsgTimeout(
packet Packet, nextSequenceRecv uint64, proof []byte,
proofHeight uint64, signer sdk.AccAddress,
proofHeight clienttypes.Height, signer sdk.AccAddress,
) *MsgTimeout {
return &MsgTimeout{
Packet: packet,
@ -408,8 +409,8 @@ func (msg MsgTimeout) ValidateBasic() error {
if len(msg.Proof) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
if msg.Signer.Empty() {
return sdkerrors.ErrInvalidAddress
@ -437,7 +438,7 @@ func (msg MsgTimeout) Type() string {
func NewMsgTimeoutOnClose(
packet Packet, nextSequenceRecv uint64,
proof, proofClose []byte,
proofHeight uint64, signer sdk.AccAddress,
proofHeight clienttypes.Height, signer sdk.AccAddress,
) *MsgTimeoutOnClose {
return &MsgTimeoutOnClose{
Packet: packet,
@ -462,8 +463,8 @@ func (msg MsgTimeoutOnClose) ValidateBasic() error {
if len(msg.ProofClose) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof of closed counterparty channel end")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
if msg.Signer.Empty() {
return sdkerrors.ErrInvalidAddress
@ -491,7 +492,7 @@ var _ sdk.Msg = &MsgAcknowledgement{}
// NewMsgAcknowledgement constructs a new MsgAcknowledgement
func NewMsgAcknowledgement(
packet Packet, ack []byte, proof []byte, proofHeight uint64, signer sdk.AccAddress) *MsgAcknowledgement {
packet Packet, ack []byte, proof []byte, proofHeight clienttypes.Height, signer sdk.AccAddress) *MsgAcknowledgement {
return &MsgAcknowledgement{
Packet: packet,
Acknowledgement: ack,
@ -511,8 +512,8 @@ func (msg MsgAcknowledgement) ValidateBasic() error {
if len(msg.Proof) == 0 {
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof")
}
if msg.ProofHeight == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be > 0")
if msg.ProofHeight.IsZero() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
}
if msg.Signer.Empty() {
return sdkerrors.ErrInvalidAddress

View File

@ -14,6 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/store/rootmulti"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
@ -36,9 +37,10 @@ const (
// define variables used for testing
var (
timeoutHeight = uint64(100)
height = clienttypes.NewHeight(0, 1)
timeoutHeight = clienttypes.NewHeight(0, 100)
timeoutTimestamp = uint64(100)
disabledTimeout = uint64(0)
disabledTimeout = clienttypes.Height{}
validPacketData = []byte("testdata")
unknownPacketData = []byte("unknown")
@ -156,24 +158,24 @@ func (suite *MsgTestSuite) TestMsgChannelOpenInit() {
// TestMsgChannelOpenTry tests ValidateBasic for MsgChannelOpenTry
func (suite *MsgTestSuite) TestMsgChannelOpenTry() {
testMsgs := []*types.MsgChannelOpenTry{
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // valid msg
types.NewMsgChannelOpenTry(invalidShortPort, "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short port id
types.NewMsgChannelOpenTry(invalidLongPort, "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long port id
types.NewMsgChannelOpenTry(invalidPort, "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // port id contains non-alpha
types.NewMsgChannelOpenTry("testportid", invalidShortChannel, "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short channel id
types.NewMsgChannelOpenTry("testportid", invalidLongChannel, "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long channel id
types.NewMsgChannelOpenTry("testportid", invalidChannel, "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // channel id contains non-alpha
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "", suite.proof, 1, addr), // empty counterparty version
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 0, addr), // suite.proof height is zero
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.Order(4), connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // invalid channel order
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, invalidConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // connection hops more than 1
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, invalidShortConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short connection id
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, invalidLongConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long connection id
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, []string{invalidConnection}, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // connection id contains non-alpha
types.NewMsgChannelOpenTry("testportid", "testchannel", "", types.UNORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // empty channel version
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, connHops, invalidPort, "testcpchannel", "1.0", suite.proof, 1, addr), // invalid counterparty port id
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, connHops, "testcpport", invalidChannel, "1.0", suite.proof, 1, addr), // invalid counterparty channel id
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, connHops, "testcpport", "testcpchannel", "1.0", emptyProof, 1, addr), // empty proof
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // valid msg
types.NewMsgChannelOpenTry(invalidShortPort, "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // too short port id
types.NewMsgChannelOpenTry(invalidLongPort, "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // too long port id
types.NewMsgChannelOpenTry(invalidPort, "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // port id contains non-alpha
types.NewMsgChannelOpenTry("testportid", invalidShortChannel, "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // too short channel id
types.NewMsgChannelOpenTry("testportid", invalidLongChannel, "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // too long channel id
types.NewMsgChannelOpenTry("testportid", invalidChannel, "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // channel id contains non-alpha
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "", suite.proof, height, addr), // empty counterparty version
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, clienttypes.Height{}, addr), // suite.proof height is zero
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.Order(4), connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // invalid channel order
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, invalidConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // connection hops more than 1
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, invalidShortConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // too short connection id
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, invalidLongConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // too long connection id
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, []string{invalidConnection}, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // connection id contains non-alpha
types.NewMsgChannelOpenTry("testportid", "testchannel", "", types.UNORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, height, addr), // empty channel version
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, connHops, invalidPort, "testcpchannel", "1.0", suite.proof, height, addr), // invalid counterparty port id
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, connHops, "testcpport", invalidChannel, "1.0", suite.proof, height, addr), // invalid counterparty channel id
types.NewMsgChannelOpenTry("testportid", "testchannel", "1.0", types.UNORDERED, connHops, "testcpport", "testcpchannel", "1.0", emptyProof, height, addr), // empty proof
}
testCases := []struct {
@ -214,16 +216,16 @@ func (suite *MsgTestSuite) TestMsgChannelOpenTry() {
// TestMsgChannelOpenAck tests ValidateBasic for MsgChannelOpenAck
func (suite *MsgTestSuite) TestMsgChannelOpenAck() {
testMsgs := []*types.MsgChannelOpenAck{
types.NewMsgChannelOpenAck("testportid", "testchannel", "1.0", suite.proof, 1, addr), // valid msg
types.NewMsgChannelOpenAck(invalidShortPort, "testchannel", "1.0", suite.proof, 1, addr), // too short port id
types.NewMsgChannelOpenAck(invalidLongPort, "testchannel", "1.0", suite.proof, 1, addr), // too long port id
types.NewMsgChannelOpenAck(invalidPort, "testchannel", "1.0", suite.proof, 1, addr), // port id contains non-alpha
types.NewMsgChannelOpenAck("testportid", invalidShortChannel, "1.0", suite.proof, 1, addr), // too short channel id
types.NewMsgChannelOpenAck("testportid", invalidLongChannel, "1.0", suite.proof, 1, addr), // too long channel id
types.NewMsgChannelOpenAck("testportid", invalidChannel, "1.0", suite.proof, 1, addr), // channel id contains non-alpha
types.NewMsgChannelOpenAck("testportid", "testchannel", "", suite.proof, 1, addr), // empty counterparty version
types.NewMsgChannelOpenAck("testportid", "testchannel", "1.0", emptyProof, 1, addr), // empty proof
types.NewMsgChannelOpenAck("testportid", "testchannel", "1.0", suite.proof, 0, addr), // proof height is zero
types.NewMsgChannelOpenAck("testportid", "testchannel", "1.0", suite.proof, height, addr), // valid msg
types.NewMsgChannelOpenAck(invalidShortPort, "testchannel", "1.0", suite.proof, height, addr), // too short port id
types.NewMsgChannelOpenAck(invalidLongPort, "testchannel", "1.0", suite.proof, height, addr), // too long port id
types.NewMsgChannelOpenAck(invalidPort, "testchannel", "1.0", suite.proof, height, addr), // port id contains non-alpha
types.NewMsgChannelOpenAck("testportid", invalidShortChannel, "1.0", suite.proof, height, addr), // too short channel id
types.NewMsgChannelOpenAck("testportid", invalidLongChannel, "1.0", suite.proof, height, addr), // too long channel id
types.NewMsgChannelOpenAck("testportid", invalidChannel, "1.0", suite.proof, height, addr), // channel id contains non-alpha
types.NewMsgChannelOpenAck("testportid", "testchannel", "", suite.proof, height, addr), // empty counterparty version
types.NewMsgChannelOpenAck("testportid", "testchannel", "1.0", emptyProof, height, addr), // empty proof
types.NewMsgChannelOpenAck("testportid", "testchannel", "1.0", suite.proof, clienttypes.Height{}, addr), // proof height is zero
}
testCases := []struct {
@ -256,15 +258,15 @@ func (suite *MsgTestSuite) TestMsgChannelOpenAck() {
// TestMsgChannelOpenConfirm tests ValidateBasic for MsgChannelOpenConfirm
func (suite *MsgTestSuite) TestMsgChannelOpenConfirm() {
testMsgs := []*types.MsgChannelOpenConfirm{
types.NewMsgChannelOpenConfirm("testportid", "testchannel", suite.proof, 1, addr), // valid msg
types.NewMsgChannelOpenConfirm(invalidShortPort, "testchannel", suite.proof, 1, addr), // too short port id
types.NewMsgChannelOpenConfirm(invalidLongPort, "testchannel", suite.proof, 1, addr), // too long port id
types.NewMsgChannelOpenConfirm(invalidPort, "testchannel", suite.proof, 1, addr), // port id contains non-alpha
types.NewMsgChannelOpenConfirm("testportid", invalidShortChannel, suite.proof, 1, addr), // too short channel id
types.NewMsgChannelOpenConfirm("testportid", invalidLongChannel, suite.proof, 1, addr), // too long channel id
types.NewMsgChannelOpenConfirm("testportid", invalidChannel, suite.proof, 1, addr), // channel id contains non-alpha
types.NewMsgChannelOpenConfirm("testportid", "testchannel", emptyProof, 1, addr), // empty proof
types.NewMsgChannelOpenConfirm("testportid", "testchannel", suite.proof, 0, addr), // proof height is zero
types.NewMsgChannelOpenConfirm("testportid", "testchannel", suite.proof, height, addr), // valid msg
types.NewMsgChannelOpenConfirm(invalidShortPort, "testchannel", suite.proof, height, addr), // too short port id
types.NewMsgChannelOpenConfirm(invalidLongPort, "testchannel", suite.proof, height, addr), // too long port id
types.NewMsgChannelOpenConfirm(invalidPort, "testchannel", suite.proof, height, addr), // port id contains non-alpha
types.NewMsgChannelOpenConfirm("testportid", invalidShortChannel, suite.proof, height, addr), // too short channel id
types.NewMsgChannelOpenConfirm("testportid", invalidLongChannel, suite.proof, height, addr), // too long channel id
types.NewMsgChannelOpenConfirm("testportid", invalidChannel, suite.proof, height, addr), // channel id contains non-alpha
types.NewMsgChannelOpenConfirm("testportid", "testchannel", emptyProof, height, addr), // empty proof
types.NewMsgChannelOpenConfirm("testportid", "testchannel", suite.proof, clienttypes.Height{}, addr), // proof height is zero
}
testCases := []struct {
@ -332,15 +334,15 @@ func (suite *MsgTestSuite) TestMsgChannelCloseInit() {
// TestMsgChannelCloseConfirm tests ValidateBasic for MsgChannelCloseConfirm
func (suite *MsgTestSuite) TestMsgChannelCloseConfirm() {
testMsgs := []*types.MsgChannelCloseConfirm{
types.NewMsgChannelCloseConfirm("testportid", "testchannel", suite.proof, 1, addr), // valid msg
types.NewMsgChannelCloseConfirm(invalidShortPort, "testchannel", suite.proof, 1, addr), // too short port id
types.NewMsgChannelCloseConfirm(invalidLongPort, "testchannel", suite.proof, 1, addr), // too long port id
types.NewMsgChannelCloseConfirm(invalidPort, "testchannel", suite.proof, 1, addr), // port id contains non-alpha
types.NewMsgChannelCloseConfirm("testportid", invalidShortChannel, suite.proof, 1, addr), // too short channel id
types.NewMsgChannelCloseConfirm("testportid", invalidLongChannel, suite.proof, 1, addr), // too long channel id
types.NewMsgChannelCloseConfirm("testportid", invalidChannel, suite.proof, 1, addr), // channel id contains non-alpha
types.NewMsgChannelCloseConfirm("testportid", "testchannel", emptyProof, 1, addr), // empty proof
types.NewMsgChannelCloseConfirm("testportid", "testchannel", suite.proof, 0, addr), // proof height is zero
types.NewMsgChannelCloseConfirm("testportid", "testchannel", suite.proof, height, addr), // valid msg
types.NewMsgChannelCloseConfirm(invalidShortPort, "testchannel", suite.proof, height, addr), // too short port id
types.NewMsgChannelCloseConfirm(invalidLongPort, "testchannel", suite.proof, height, addr), // too long port id
types.NewMsgChannelCloseConfirm(invalidPort, "testchannel", suite.proof, height, addr), // port id contains non-alpha
types.NewMsgChannelCloseConfirm("testportid", invalidShortChannel, suite.proof, height, addr), // too short channel id
types.NewMsgChannelCloseConfirm("testportid", invalidLongChannel, suite.proof, height, addr), // too long channel id
types.NewMsgChannelCloseConfirm("testportid", invalidChannel, suite.proof, height, addr), // channel id contains non-alpha
types.NewMsgChannelCloseConfirm("testportid", "testchannel", emptyProof, height, addr), // empty proof
types.NewMsgChannelCloseConfirm("testportid", "testchannel", suite.proof, clienttypes.Height{}, addr), // proof height is zero
}
testCases := []struct {
@ -371,7 +373,7 @@ func (suite *MsgTestSuite) TestMsgChannelCloseConfirm() {
// TestMsgRecvPacketType tests Type for MsgRecvPacket.
func (suite *MsgTestSuite) TestMsgRecvPacketType() {
msg := types.NewMsgRecvPacket(packet, suite.proof, 1, addr1)
msg := types.NewMsgRecvPacket(packet, suite.proof, height, addr1)
suite.Equal("recv_packet", msg.Type())
}
@ -379,11 +381,11 @@ func (suite *MsgTestSuite) TestMsgRecvPacketType() {
// TestMsgRecvPacketValidation tests ValidateBasic for MsgRecvPacket
func (suite *MsgTestSuite) TestMsgRecvPacketValidation() {
testMsgs := []*types.MsgRecvPacket{
types.NewMsgRecvPacket(packet, suite.proof, 1, addr1), // valid msg
types.NewMsgRecvPacket(packet, suite.proof, 0, addr1), // proof height is zero
types.NewMsgRecvPacket(packet, emptyProof, 1, addr1), // empty proof
types.NewMsgRecvPacket(packet, suite.proof, 1, emptyAddr), // missing signer address
types.NewMsgRecvPacket(invalidPacket, suite.proof, 1, addr1), // unknown packet
types.NewMsgRecvPacket(packet, suite.proof, height, addr1), // valid msg
types.NewMsgRecvPacket(packet, suite.proof, clienttypes.Height{}, addr1), // proof height is zero
types.NewMsgRecvPacket(packet, emptyProof, height, addr1), // empty proof
types.NewMsgRecvPacket(packet, suite.proof, height, emptyAddr), // missing signer address
types.NewMsgRecvPacket(invalidPacket, suite.proof, height, addr1), // unknown packet
}
testCases := []struct {
@ -410,11 +412,11 @@ func (suite *MsgTestSuite) TestMsgRecvPacketValidation() {
// TestMsgRecvPacketGetSignBytes tests GetSignBytes for MsgRecvPacket
func (suite *MsgTestSuite) TestMsgRecvPacketGetSignBytes() {
msg := types.NewMsgRecvPacket(packet, suite.proof, 1, addr1)
msg := types.NewMsgRecvPacket(packet, suite.proof, height, addr1)
res := msg.GetSignBytes()
expected := fmt.Sprintf(
`{"packet":{"data":%s,"destination_channel":"testcpchannel","destination_port":"testcpport","sequence":"1","source_channel":"testchannel","source_port":"testportid","timeout_height":"100","timeout_timestamp":"100"},"proof":"Co0BCi4KCmljczIzOmlhdmwSA0tFWRobChkKA0tFWRIFVkFMVUUaCwgBGAEgASoDAAICClsKDGljczIzOnNpbXBsZRIMaWF2bFN0b3JlS2V5Gj0KOwoMaWF2bFN0b3JlS2V5EiAcIiDXSHQRSvh/Wa07MYpTK0B4XtbaXtzxBED76xk0WhoJCAEYASABKgEA","proof_height":"1","signer":"cosmos1w3jhxarpv3j8yvg4ufs4x"}`,
`{"packet":{"data":%s,"destination_channel":"testcpchannel","destination_port":"testcpport","sequence":"1","source_channel":"testchannel","source_port":"testportid","timeout_height":{"epoch_height":"100","epoch_number":"0"},"timeout_timestamp":"100"},"proof":"Co0BCi4KCmljczIzOmlhdmwSA0tFWRobChkKA0tFWRIFVkFMVUUaCwgBGAEgASoDAAICClsKDGljczIzOnNpbXBsZRIMaWF2bFN0b3JlS2V5Gj0KOwoMaWF2bFN0b3JlS2V5EiAcIiDXSHQRSvh/Wa07MYpTK0B4XtbaXtzxBED76xk0WhoJCAEYASABKgEA","proof_height":{"epoch_height":"1","epoch_number":"0"},"signer":"cosmos1w3jhxarpv3j8yvg4ufs4x"}`,
string(msg.GetDataSignBytes()),
)
suite.Equal(expected, string(res))
@ -422,7 +424,7 @@ func (suite *MsgTestSuite) TestMsgRecvPacketGetSignBytes() {
// TestMsgRecvPacketGetSigners tests GetSigners for MsgRecvPacket
func (suite *MsgTestSuite) TestMsgRecvPacketGetSigners() {
msg := types.NewMsgRecvPacket(packet, suite.proof, 1, addr1)
msg := types.NewMsgRecvPacket(packet, suite.proof, height, addr1)
res := msg.GetSigners()
expected := "[746573746164647231]"
@ -432,11 +434,11 @@ func (suite *MsgTestSuite) TestMsgRecvPacketGetSigners() {
// TestMsgTimeout tests ValidateBasic for MsgTimeout
func (suite *MsgTestSuite) TestMsgTimeout() {
testMsgs := []*types.MsgTimeout{
types.NewMsgTimeout(packet, 1, suite.proof, 1, addr),
types.NewMsgTimeout(packet, 1, suite.proof, 0, addr),
types.NewMsgTimeout(packet, 1, suite.proof, 1, emptyAddr),
types.NewMsgTimeout(packet, 1, emptyProof, 1, addr),
types.NewMsgTimeout(invalidPacket, 1, suite.proof, 1, addr),
types.NewMsgTimeout(packet, 1, suite.proof, height, addr),
types.NewMsgTimeout(packet, 1, suite.proof, clienttypes.Height{}, addr),
types.NewMsgTimeout(packet, 1, suite.proof, height, emptyAddr),
types.NewMsgTimeout(packet, 1, emptyProof, height, addr),
types.NewMsgTimeout(invalidPacket, 1, suite.proof, height, addr),
}
testCases := []struct {
@ -468,12 +470,12 @@ func (suite *MsgTestSuite) TestMsgTimeoutOnClose() {
msg sdk.Msg
expPass bool
}{
{"success", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, suite.proof, 1, addr), true},
{"empty proof", types.NewMsgTimeoutOnClose(packet, 1, emptyProof, suite.proof, 1, addr), false},
{"empty proof close", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, emptyProof, 1, addr), false},
{"proof height is zero", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, suite.proof, 0, addr), false},
{"signer address is empty", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, suite.proof, 1, emptyAddr), false},
{"invalid packet", types.NewMsgTimeoutOnClose(invalidPacket, 1, suite.proof, suite.proof, 1, addr), false},
{"success", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, suite.proof, height, addr), true},
{"empty proof", types.NewMsgTimeoutOnClose(packet, 1, emptyProof, suite.proof, height, addr), false},
{"empty proof close", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, emptyProof, height, addr), false},
{"proof height is zero", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, suite.proof, clienttypes.Height{}, addr), false},
{"signer address is empty", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, suite.proof, height, emptyAddr), false},
{"invalid packet", types.NewMsgTimeoutOnClose(invalidPacket, 1, suite.proof, suite.proof, height, addr), false},
}
for _, tc := range testCases {
@ -494,11 +496,11 @@ func (suite *MsgTestSuite) TestMsgTimeoutOnClose() {
// TestMsgAcknowledgement tests ValidateBasic for MsgAcknowledgement
func (suite *MsgTestSuite) TestMsgAcknowledgement() {
testMsgs := []*types.MsgAcknowledgement{
types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, 1, addr),
types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, 0, addr),
types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, 1, emptyAddr),
types.NewMsgAcknowledgement(packet, packet.GetData(), emptyProof, 1, addr),
types.NewMsgAcknowledgement(invalidPacket, packet.GetData(), suite.proof, 1, addr),
types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, height, addr),
types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, clienttypes.Height{}, addr),
types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, height, emptyAddr),
types.NewMsgAcknowledgement(packet, packet.GetData(), emptyProof, height, addr),
types.NewMsgAcknowledgement(invalidPacket, packet.GetData(), suite.proof, height, addr),
}
testCases := []struct {

View File

@ -5,15 +5,17 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// CommitPacket returns a packet commitment bytes. The commitment consists of:
// hash(timeout_timestamp + timeout_height + data) from a given packet.
// hash(timeout_timestamp + timeout_epoch + timeout_height + data) from a given packet.
func CommitPacket(packet exported.PacketI) []byte {
buf := sdk.Uint64ToBigEndian(packet.GetTimeoutTimestamp())
buf = append(buf, sdk.Uint64ToBigEndian(packet.GetTimeoutHeight())...)
buf = append(buf, sdk.Uint64ToBigEndian(packet.GetTimeoutHeight().GetEpochNumber())...)
buf = append(buf, sdk.Uint64ToBigEndian(packet.GetTimeoutHeight().GetEpochHeight())...)
buf = append(buf, packet.GetData()...)
return tmhash.Sum(buf)
}
@ -31,7 +33,7 @@ func NewPacket(
data []byte,
sequence uint64, sourcePort, sourceChannel,
destinationPort, destinationChannel string,
timeoutHeight uint64, timeoutTimestamp uint64,
timeoutHeight clienttypes.Height, timeoutTimestamp uint64,
) Packet {
return Packet{
Data: data,
@ -64,7 +66,7 @@ func (p Packet) GetDestChannel() string { return p.DestinationChannel }
func (p Packet) GetData() []byte { return p.Data }
// GetTimeoutHeight implements PacketI interface
func (p Packet) GetTimeoutHeight() uint64 { return p.TimeoutHeight }
func (p Packet) GetTimeoutHeight() exported.Height { return p.TimeoutHeight }
// GetTimeoutTimestamp implements PacketI interface
func (p Packet) GetTimeoutTimestamp() uint64 { return p.TimeoutTimestamp }
@ -86,7 +88,7 @@ func (p Packet) ValidateBasic() error {
if p.Sequence == 0 {
return sdkerrors.Wrap(ErrInvalidPacket, "packet sequence cannot be 0")
}
if p.TimeoutHeight == 0 && p.TimeoutTimestamp == 0 {
if p.TimeoutHeight.IsZero() && p.TimeoutTimestamp == 0 {
return sdkerrors.Wrap(ErrInvalidPacket, "packet timeout height and packet timeout timestamp cannot both be 0")
}
if len(p.Data) == 0 {

View File

@ -20,9 +20,9 @@ func TestPacketValidateBasic(t *testing.T) {
{types.NewPacket(validPacketData, 1, portid, invalidChannel, cpportid, cpchanid, timeoutHeight, timeoutTimestamp), false, "invalid source channel"},
{types.NewPacket(validPacketData, 1, portid, chanid, invalidPort, cpchanid, timeoutHeight, timeoutTimestamp), false, "invalid destination port"},
{types.NewPacket(validPacketData, 1, portid, chanid, cpportid, invalidChannel, timeoutHeight, timeoutTimestamp), false, "invalid destination channel"},
{types.NewPacket(validPacketData, 1, portid, chanid, cpportid, cpchanid, disabledTimeout, disabledTimeout), false, "disabled both timeout height and timestamp"},
{types.NewPacket(validPacketData, 1, portid, chanid, cpportid, cpchanid, disabledTimeout, 0), false, "disabled both timeout height and timestamp"},
{types.NewPacket(validPacketData, 1, portid, chanid, cpportid, cpchanid, disabledTimeout, timeoutTimestamp), true, "disabled timeout height, valid timeout timestamp"},
{types.NewPacket(validPacketData, 1, portid, chanid, cpportid, cpchanid, timeoutHeight, disabledTimeout), true, "disabled timeout timestamp, valid timeout height"},
{types.NewPacket(validPacketData, 1, portid, chanid, cpportid, cpchanid, timeoutHeight, 0), true, "disabled timeout timestamp, valid timeout height"},
{types.NewPacket(unknownPacketData, 1, portid, chanid, cpportid, cpchanid, timeoutHeight, timeoutTimestamp), true, ""},
}

View File

@ -7,77 +7,78 @@ import (
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
// NewQueryChannelResponse creates a new QueryChannelResponse instance
func NewQueryChannelResponse(portID, channelID string, channel Channel, proof []byte, height int64) *QueryChannelResponse {
func NewQueryChannelResponse(portID, channelID string, channel Channel, proof []byte, height clienttypes.Height) *QueryChannelResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.ChannelPath(portID, channelID), "/"))
return &QueryChannelResponse{
Channel: &channel,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
// NewQueryChannelClientStateResponse creates a newQueryChannelClientStateResponse instance
func NewQueryChannelClientStateResponse(identifiedClientState clienttypes.IdentifiedClientState, proof []byte, height int64) *QueryChannelClientStateResponse {
func NewQueryChannelClientStateResponse(identifiedClientState clienttypes.IdentifiedClientState, proof []byte, height clienttypes.Height) *QueryChannelClientStateResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(identifiedClientState.ClientId, host.ClientStatePath()), "/"))
return &QueryChannelClientStateResponse{
IdentifiedClientState: &identifiedClientState,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
// NewQueryChannelConsensusStateResponse creates a newQueryChannelConsensusStateResponse instance
func NewQueryChannelConsensusStateResponse(clientID string, anyConsensusState *codectypes.Any, consensusStateHeight uint64, proof []byte, height int64) *QueryChannelConsensusStateResponse {
func NewQueryChannelConsensusStateResponse(clientID string, anyConsensusState *codectypes.Any, consensusStateHeight exported.Height, proof []byte, height clienttypes.Height) *QueryChannelConsensusStateResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(clientID, host.ConsensusStatePath(consensusStateHeight)), "/"))
return &QueryChannelConsensusStateResponse{
ConsensusState: anyConsensusState,
ClientId: clientID,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
// NewQueryPacketCommitmentResponse creates a new QueryPacketCommitmentResponse instance
func NewQueryPacketCommitmentResponse(
portID, channelID string, sequence uint64, commitment []byte, proof []byte, height int64,
portID, channelID string, sequence uint64, commitment []byte, proof []byte, height clienttypes.Height,
) *QueryPacketCommitmentResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.PacketCommitmentPath(portID, channelID, sequence), "/"))
return &QueryPacketCommitmentResponse{
Commitment: commitment,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
// NewQueryPacketAcknowledgementResponse creates a new QueryPacketAcknowledgementResponse instance
func NewQueryPacketAcknowledgementResponse(
portID, channelID string, sequence uint64, acknowledgement []byte, proof []byte, height int64,
portID, channelID string, sequence uint64, acknowledgement []byte, proof []byte, height clienttypes.Height,
) *QueryPacketAcknowledgementResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.PacketAcknowledgementPath(portID, channelID, sequence), "/"))
return &QueryPacketAcknowledgementResponse{
Acknowledgement: acknowledgement,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}
// NewQueryNextSequenceReceiveResponse creates a new QueryNextSequenceReceiveResponse instance
func NewQueryNextSequenceReceiveResponse(
portID, channelID string, sequence uint64, proof []byte, height int64,
portID, channelID string, sequence uint64, proof []byte, height clienttypes.Height,
) *QueryNextSequenceReceiveResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.NextSequenceRecvPath(portID, channelID), "/"))
return &QueryNextSequenceReceiveResponse{
NextSequenceReceive: sequence,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: uint64(height),
ProofHeight: height,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -324,15 +324,26 @@ func request_Query_ChannelConsensusState_0(ctx context.Context, marshaler runtim
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err)
}
val, ok = pathParams["height"]
val, ok = pathParams["epoch_number"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_number")
}
protoReq.Height, err = runtime.Uint64(val)
protoReq.EpochNumber, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_number", err)
}
val, ok = pathParams["epoch_height"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_height")
}
protoReq.EpochHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_height", err)
}
msg, err := client.ChannelConsensusState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -373,15 +384,26 @@ func local_request_Query_ChannelConsensusState_0(ctx context.Context, marshaler
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err)
}
val, ok = pathParams["height"]
val, ok = pathParams["epoch_number"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_number")
}
protoReq.Height, err = runtime.Uint64(val)
protoReq.EpochNumber, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_number", err)
}
val, ok = pathParams["epoch_height"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_height")
}
protoReq.EpochHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_height", err)
}
msg, err := server.ChannelConsensusState(ctx, &protoReq)
@ -1333,7 +1355,7 @@ var (
pattern_Query_ChannelClientState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7}, []string{"ibc", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "client_state"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ChannelConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8}, []string{"ibc", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "consensus_state", "height"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ChannelConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 2, 8, 1, 0, 4, 1, 5, 9, 2, 10, 1, 0, 4, 1, 5, 11}, []string{"ibc", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "consensus_state", "epoch", "epoch_number", "height", "epoch_height"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_PacketCommitment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8}, []string{"ibc", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "packet_commitments", "sequence"}, "", runtime.AssumeColonVerbOpt(true)))

View File

@ -116,8 +116,9 @@ func NewCreateClientCmd() *cobra.Command {
return err
}
height := header.GetHeight().(clienttypes.Height)
clientState := types.NewClientState(
header.GetHeader().GetChainID(), trustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(0, header.GetHeight()), specs,
header.GetHeader().GetChainID(), trustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, specs,
)
consensusState := header.ConsensusState()

View File

@ -49,9 +49,8 @@ func (cs ClientState) ClientType() exported.ClientType {
}
// GetLatestHeight returns latest block height.
// TODO: return clienttypes.Height once interface has changed
func (cs ClientState) GetLatestHeight() uint64 {
return cs.LatestHeight.EpochHeight
func (cs ClientState) GetLatestHeight() exported.Height {
return cs.LatestHeight
}
// IsFrozen returns true if the frozen height has been set.
@ -60,10 +59,9 @@ func (cs ClientState) IsFrozen() bool {
}
// GetFrozenHeight returns the height at which client is frozen
// NOTE: FrozenHeight is 0 if client is unfrozen
// TODO: return clienttypes.Height once interface has changed
func (cs ClientState) GetFrozenHeight() uint64 {
return cs.FrozenHeight.EpochHeight
// NOTE: FrozenHeight is zero if client is unfrozen
func (cs ClientState) GetFrozenHeight() exported.Height {
return cs.FrozenHeight
}
// Validate performs a basic validation of the client state fields.
@ -117,7 +115,7 @@ func (cs ClientState) VerifyClientState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
provingRoot exported.Root,
height uint64,
height exported.Height,
prefix exported.Prefix,
counterpartyClientIdentifier string,
proof []byte,
@ -157,9 +155,9 @@ func (cs ClientState) VerifyClientConsensusState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
provingRoot exported.Root,
height uint64,
height exported.Height,
counterpartyClientIdentifier string,
consensusHeight uint64,
consensusHeight exported.Height,
prefix exported.Prefix,
proof []byte,
consensusState exported.ConsensusState,
@ -201,7 +199,7 @@ func (cs ClientState) VerifyClientConsensusState(
func (cs ClientState) VerifyConnectionState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
connectionID string,
@ -239,7 +237,7 @@ func (cs ClientState) VerifyConnectionState(
func (cs ClientState) VerifyChannelState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
@ -278,7 +276,7 @@ func (cs ClientState) VerifyChannelState(
func (cs ClientState) VerifyPacketCommitment(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
@ -308,7 +306,7 @@ func (cs ClientState) VerifyPacketCommitment(
func (cs ClientState) VerifyPacketAcknowledgement(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
@ -339,7 +337,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
func (cs ClientState) VerifyPacketAcknowledgementAbsence(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
@ -368,7 +366,7 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
func (cs ClientState) VerifyNextSequenceRecv(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
@ -401,18 +399,18 @@ func produceVerificationArgs(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
cs ClientState,
height uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
) (merkleProof commitmenttypes.MerkleProof, consensusState *ConsensusState, err error) {
if cs.GetLatestHeight() < height {
if cs.GetLatestHeight().LT(height) {
return commitmenttypes.MerkleProof{}, nil, sdkerrors.Wrapf(
sdkerrors.ErrInvalidHeight,
"client state height < proof height (%d < %d)", cs.GetLatestHeight(), height,
)
}
if cs.IsFrozen() && !cs.FrozenHeight.GT(clienttypes.NewHeight(0, height)) {
if cs.IsFrozen() && !cs.FrozenHeight.GT(height) {
return commitmenttypes.MerkleProof{}, nil, clienttypes.ErrClientFrozen
}

View File

@ -155,7 +155,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() {
tc := tc
err := tc.clientState.VerifyClientConsensusState(
nil, suite.cdc, tc.consensusState.Root, height.EpochHeight, "chainA", tc.consensusState.GetHeight(), tc.prefix, tc.proof, tc.consensusState,
nil, suite.cdc, tc.consensusState.Root, height, "chainA", tc.consensusState.GetHeight(), tc.prefix, tc.proof, tc.consensusState,
)
if tc.expPass {
@ -172,7 +172,7 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() {
var (
clientState *types.ClientState
proof []byte
proofHeight uint64
proofHeight exported.Height
prefix commitmenttypes.MerklePrefix
)
@ -191,7 +191,7 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() {
},
{
"latest client height < height", func() {
proofHeight = clientState.LatestHeight.EpochHeight + 1
proofHeight = clientState.LatestHeight.Increment()
}, false,
},
{
@ -250,7 +250,7 @@ func (suite *TendermintTestSuite) TestVerifyChannelState() {
var (
clientState *types.ClientState
proof []byte
proofHeight uint64
proofHeight exported.Height
prefix commitmenttypes.MerklePrefix
)
@ -269,7 +269,7 @@ func (suite *TendermintTestSuite) TestVerifyChannelState() {
},
{
"latest client height < height", func() {
proofHeight = clientState.LatestHeight.EpochHeight + 1
proofHeight = clientState.LatestHeight.Increment()
}, false,
},
{
@ -329,7 +329,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketCommitment() {
var (
clientState *types.ClientState
proof []byte
proofHeight uint64
proofHeight exported.Height
prefix commitmenttypes.MerklePrefix
)
@ -348,7 +348,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketCommitment() {
},
{
"latest client height < height", func() {
proofHeight = clientState.LatestHeight.EpochHeight + 1
proofHeight = clientState.LatestHeight.Increment()
}, false,
},
{
@ -371,7 +371,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketCommitment() {
// setup testing conditions
clientA, _, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelB.PortID, channelB.ID, channelA.PortID, channelA.ID, 100, 0)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelB.PortID, channelB.ID, channelA.PortID, channelA.ID, clienttypes.NewHeight(0, 100), 0)
err := suite.coordinator.SendPacket(suite.chainB, suite.chainA, packet, clientA)
suite.Require().NoError(err)
@ -411,7 +411,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgement() {
var (
clientState *types.ClientState
proof []byte
proofHeight uint64
proofHeight exported.Height
prefix commitmenttypes.MerklePrefix
)
@ -430,7 +430,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgement() {
},
{
"latest client height < height", func() {
proofHeight = clientState.LatestHeight.EpochHeight + 1
proofHeight = clientState.LatestHeight.Increment()
}, false,
},
{
@ -453,7 +453,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgement() {
// setup testing conditions
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, 100, 0)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.NewHeight(0, 100), 0)
// send packet
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
@ -499,7 +499,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() {
var (
clientState *types.ClientState
proof []byte
proofHeight uint64
proofHeight exported.Height
prefix commitmenttypes.MerklePrefix
)
@ -518,7 +518,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() {
},
{
"latest client height < height", func() {
proofHeight = clientState.LatestHeight.EpochHeight + 1
proofHeight = clientState.LatestHeight.Increment()
}, false,
},
{
@ -541,7 +541,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() {
// setup testing conditions
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, 100, 0)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.NewHeight(0, 100), 0)
// send packet, but no recv
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
@ -586,7 +586,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() {
var (
clientState *types.ClientState
proof []byte
proofHeight uint64
proofHeight exported.Height
prefix commitmenttypes.MerklePrefix
)
@ -605,7 +605,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() {
},
{
"latest client height < height", func() {
proofHeight = clientState.LatestHeight.EpochHeight + 1
proofHeight = clientState.LatestHeight.Increment()
}, false,
},
{
@ -628,7 +628,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() {
// setup testing conditions
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, 100, 0)
packet := channeltypes.NewPacket(ibctesting.TestHash, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.NewHeight(0, 100), 0)
// send packet
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)

View File

@ -36,8 +36,8 @@ func (cs ConsensusState) GetRoot() exported.Root {
}
// GetHeight returns the height for the specific consensus state
func (cs ConsensusState) GetHeight() uint64 {
return cs.Height.EpochHeight
func (cs ConsensusState) GetHeight() exported.Height {
return cs.Height
}
// GetTimestamp returns block time in nanoseconds at which the consensus state was stored

View File

@ -22,7 +22,7 @@ func (h Header) ClientType() exported.ClientType {
// ConsensusState returns the updated consensus state associated with the header
func (h Header) ConsensusState() *ConsensusState {
return &ConsensusState{
Height: clienttypes.NewHeight(0, h.GetHeight()),
Height: h.GetHeight().(clienttypes.Height),
Timestamp: h.GetTime(),
Root: commitmenttypes.NewMerkleRoot(h.Header.GetAppHash()),
NextValidatorsHash: h.Header.NextValidatorsHash,
@ -32,14 +32,15 @@ func (h Header) ConsensusState() *ConsensusState {
// GetHeight returns the current height. It returns 0 if the tendermint
// header is nil.
//
// NOTE: also referred as `sequence`
// TODO: return clienttypes.Height once interface changes
func (h Header) GetHeight() uint64 {
func (h Header) GetHeight() exported.Height {
if h.Header == nil {
return 0
return clienttypes.Height{}
}
return uint64(h.Header.Height)
// Enforce clienttypes.Height to use 0 epoch number
// TODO: Retrieve epoch number from chain-id
return clienttypes.NewHeight(0, uint64(h.Header.Height))
}
// GetTime returns the current block timestamp. It returns a zero time if
@ -72,10 +73,9 @@ func (h Header) ValidateBasic() error {
// TrustedHeight is less than Header for updates
// and less than or equal to Header for misbehaviour
height := clienttypes.NewHeight(0, h.GetHeight())
if h.TrustedHeight.GT(height) {
if h.TrustedHeight.GT(h.GetHeight()) {
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "TrustedHeight %d must be less than or equal to header height %d",
h.TrustedHeight, height)
h.TrustedHeight, h.GetHeight())
}
if h.ValidatorSet == nil {

View File

@ -15,7 +15,7 @@ func (suite *TendermintTestSuite) TestGetHeight() {
suite.Require().NotEqual(uint64(0), header.GetHeight())
header.Header = nil
suite.Require().Equal(uint64(0), header.GetHeight())
suite.Require().Equal(clienttypes.Height{}, header.GetHeight())
}
func (suite *TendermintTestSuite) TestGetTime() {
@ -50,7 +50,7 @@ func (suite *TendermintTestSuite) TestHeaderValidateBasic() {
header.SignedHeader.Commit = nil
}, false},
{"trusted height is greater than header height", func() {
header.TrustedHeight = clienttypes.NewHeight(0, header.GetHeight()+1)
header.TrustedHeight = header.GetHeight().(clienttypes.Height).Increment()
}, false},
{"validator set nil", func() {
header.ValidatorSet = nil

View File

@ -53,8 +53,8 @@ func (misbehaviour Misbehaviour) String() string {
// GetHeight returns the height at which misbehaviour occurred
//
// NOTE: assumes that misbehaviour headers have the same height
func (misbehaviour Misbehaviour) GetHeight() uint64 {
return uint64(math.Min(float64(misbehaviour.Header1.GetHeight()), float64(misbehaviour.Header2.GetHeight())))
func (misbehaviour Misbehaviour) GetHeight() exported.Height {
return misbehaviour.Header1.GetHeight()
}
// GetTime returns the timestamp at which misbehaviour occurred. It uses the

View File

@ -31,29 +31,28 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
}
// If client is already frozen at earlier height than misbehaviour, return with error
height := clienttypes.NewHeight(0, misbehaviour.GetHeight())
if cs.IsFrozen() && cs.FrozenHeight.LTE(height) {
if cs.IsFrozen() && cs.FrozenHeight.LTE(misbehaviour.GetHeight()) {
return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour,
"client is already frozen at earlier height %d than misbehaviour height %d", cs.FrozenHeight, misbehaviour.GetHeight())
"client is already frozen at earlier height %s than misbehaviour height %s", cs.FrozenHeight, misbehaviour.GetHeight())
}
// Retrieve trusted consensus states for each Header in misbehaviour
// and unmarshal from clientStore
// Get consensus bytes from clientStore
tmConsensusState1, err := GetConsensusState(clientStore, cdc, tmMisbehaviour.Header1.TrustedHeight.EpochHeight)
tmConsensusState1, err := GetConsensusState(clientStore, cdc, tmMisbehaviour.Header1.TrustedHeight)
if err != nil {
return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header1 at TrustedHeight: %d", tmMisbehaviour.Header1.TrustedHeight)
return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header1 at TrustedHeight: %s", tmMisbehaviour.Header1)
}
// Get consensus bytes from clientStore
tmConsensusState2, err := GetConsensusState(clientStore, cdc, tmMisbehaviour.Header2.TrustedHeight.EpochHeight)
tmConsensusState2, err := GetConsensusState(clientStore, cdc, tmMisbehaviour.Header2.TrustedHeight)
if err != nil {
return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header2 at TrustedHeight: %d", tmMisbehaviour.Header2.TrustedHeight)
return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header2 at TrustedHeight: %s", tmMisbehaviour.Header2)
}
// calculate the age of the misbehaviour
infractionHeight := tmMisbehaviour.GetHeight()
infractionHeight := tmMisbehaviour.GetHeight().(clienttypes.Height).EpochHeight
infractionTime := tmMisbehaviour.GetTime()
ageDuration := ctx.BlockTime().Sub(infractionTime)
ageBlocks := int64(cs.LatestHeight.EpochHeight - infractionHeight)
@ -96,8 +95,7 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
return nil, sdkerrors.Wrap(err, "verifying Header2 in Misbehaviour failed")
}
frozenHeight := clienttypes.NewHeight(0, tmMisbehaviour.GetHeight())
cs.FrozenHeight = frozenHeight
cs.FrozenHeight = tmMisbehaviour.GetHeight().(clienttypes.Height)
return &cs, nil
}

View File

@ -326,8 +326,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
suite.Require().NoError(err, "valid test case %d failed: %s", i, tc.name)
suite.Require().NotNil(clientState, "valid test case %d failed: %s", i, tc.name)
suite.Require().True(clientState.IsFrozen(), "valid test case %d failed: %s", i, tc.name)
suite.Require().Equal(uint64(tc.misbehaviour.GetHeight()), clientState.GetFrozenHeight(),
"valid test case %d failed: %s. Expected FrozenHeight %d got %d", tc.misbehaviour.GetHeight(), clientState.GetFrozenHeight())
suite.Require().Equal(tc.misbehaviour.GetHeight(), clientState.GetFrozenHeight(),
"valid test case %d failed: %s. Expected FrozenHeight %s got %s", tc.misbehaviour.GetHeight(), clientState.GetFrozenHeight())
} else {
suite.Require().Error(err, "invalid test case %d passed: %s", i, tc.name)
suite.Require().Nil(clientState, "invalid test case %d passed: %s", i, tc.name)

View File

@ -24,7 +24,7 @@ func (suite *TendermintTestSuite) TestMisbehaviour() {
suite.Require().Equal(exported.Tendermint, misbehaviour.ClientType())
suite.Require().Equal(clientID, misbehaviour.GetClientID())
suite.Require().Equal(height.EpochHeight, misbehaviour.GetHeight())
suite.Require().Equal(height, misbehaviour.GetHeight())
}
func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
@ -209,13 +209,13 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
},
func(misbehaviour *types.Misbehaviour) error {
// voteSet contains only altVal which is less than 2/3 of total power (height/1height)
wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header1.GetHeight()), 1, tmproto.PrecommitType, altValSet)
wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header1.GetHeight().GetEpochHeight()), 1, tmproto.PrecommitType, altValSet)
blockID, err := tmtypes.BlockIDFromProto(&misbehaviour.Header1.Commit.BlockID)
if err != nil {
return err
}
tmCommit, err := tmtypes.MakeCommit(*blockID, int64(misbehaviour.Header2.GetHeight()), misbehaviour.Header1.Commit.Round, wrongVoteSet, altSigners, suite.now)
tmCommit, err := tmtypes.MakeCommit(*blockID, int64(misbehaviour.Header2.GetHeight().GetEpochHeight()), misbehaviour.Header1.Commit.Round, wrongVoteSet, altSigners, suite.now)
misbehaviour.Header1.Commit = tmCommit.ToProto()
return err
},
@ -231,13 +231,13 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
},
func(misbehaviour *types.Misbehaviour) error {
// voteSet contains only altVal which is less than 2/3 of total power (height/1height)
wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header2.GetHeight()), 1, tmproto.PrecommitType, altValSet)
wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header2.GetHeight().GetEpochHeight()), 1, tmproto.PrecommitType, altValSet)
blockID, err := tmtypes.BlockIDFromProto(&misbehaviour.Header2.Commit.BlockID)
if err != nil {
return err
}
tmCommit, err := tmtypes.MakeCommit(*blockID, int64(misbehaviour.Header2.GetHeight()), misbehaviour.Header2.Commit.Round, wrongVoteSet, altSigners, suite.now)
tmCommit, err := tmtypes.MakeCommit(*blockID, int64(misbehaviour.Header2.GetHeight().GetEpochHeight()), misbehaviour.Header2.Commit.Round, wrongVoteSet, altSigners, suite.now)
misbehaviour.Header2.Commit = tmCommit.ToProto()
return err
},

View File

@ -11,7 +11,7 @@ import (
// GetConsensusState retrieves the consensus state from the client prefixed
// store. An error is returned if the consensus state does not exist.
func GetConsensusState(store sdk.KVStore, cdc codec.BinaryMarshaler, height uint64) (*ConsensusState, error) {
func GetConsensusState(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height) (*ConsensusState, error) {
bz := store.Get(host.KeyConsensusState(height))
if bz == nil {
return nil, sdkerrors.Wrapf(

View File

@ -1,14 +1,16 @@
package types_test
import (
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
"github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
func (suite *TendermintTestSuite) TestGetConsensusState() {
var (
height uint64
height exported.Height
clientA string
)
@ -23,7 +25,7 @@ func (suite *TendermintTestSuite) TestGetConsensusState() {
{
"consensus state not found", func() {
// use height with no consensus state set
height = height + 1
height = height.(clienttypes.Height).Increment()
}, false,
},
{

View File

@ -46,10 +46,10 @@ func (cs ClientState) CheckHeaderAndUpdateState(
}
// Get consensus bytes from clientStore
tmConsState, err := GetConsensusState(clientStore, cdc, tmHeader.TrustedHeight.EpochHeight)
tmConsState, err := GetConsensusState(clientStore, cdc, tmHeader.TrustedHeight)
if err != nil {
return nil, nil, sdkerrors.Wrapf(
err, "could not get consensus state from clientstore at TrustedHeight: %d", tmHeader.TrustedHeight,
err, "could not get consensus state from clientstore at TrustedHeight: %s", tmHeader.TrustedHeight,
)
}
@ -115,8 +115,7 @@ func checkValidity(
}
// assert header height is newer than consensus state
height := clienttypes.NewHeight(0, header.GetHeight())
if height.LTE(consState.Height) {
if header.GetHeight().LTE(consState.Height) {
return sdkerrors.Wrapf(
clienttypes.ErrInvalidHeader,
"header height ≤ consensus state height (%d ≤ %d)", header.GetHeight(), consState.Height,
@ -152,7 +151,7 @@ func checkValidity(
// update the consensus state from a new header
func update(clientState *ClientState, header *Header) (*ClientState, *ConsensusState) {
height := clienttypes.NewHeight(0, header.GetHeight())
height := header.GetHeight().(clienttypes.Height)
if height.GT(clientState.LatestHeight) {
clientState.LatestHeight = height
}

View File

@ -204,9 +204,9 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
// Set trusted consensus state in client store
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientConsensusState(ctx, clientID, consensusState.GetHeight(), consensusState)
height := clienttypes.NewHeight(0, newHeader.GetHeight())
height := newHeader.GetHeight()
expectedConsensus := &types.ConsensusState{
Height: height,
Height: height.(clienttypes.Height),
Timestamp: newHeader.GetTime(),
Root: commitmenttypes.NewMerkleRoot(newHeader.Header.GetAppHash()),
NextValidatorsHash: newHeader.Header.NextValidatorsHash,
@ -226,10 +226,10 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
// TODO: check the entire Height struct once GetLatestHeight returns clienttypes.Height
if height.GT(clientState.LatestHeight) {
// Header Height is greater than clientState latest Height, clientState should be updated with header.GetHeight()
suite.Require().Equal(height.EpochHeight, newClientState.GetLatestHeight(), "clientstate height did not update")
suite.Require().Equal(height, newClientState.GetLatestHeight(), "clientstate height did not update")
} else {
// Update will add past consensus state, clientState should not be updated at all
suite.Require().Equal(clientState.LatestHeight.EpochHeight, newClientState.GetLatestHeight(), "client state height updated for past header")
suite.Require().Equal(clientState.LatestHeight, newClientState.GetLatestHeight(), "client state height updated for past header")
}
suite.Require().Equal(expectedConsensus, consensusState, "valid test case %d failed: %s", i, tc.name)

View File

@ -39,8 +39,8 @@ func (cs ClientState) ClientType() exported.ClientType {
}
// GetLatestHeight returns the latest height stored.
func (cs ClientState) GetLatestHeight() uint64 {
return cs.Height.EpochHeight
func (cs ClientState) GetLatestHeight() exported.Height {
return cs.Height
}
// IsFrozen returns false.
@ -48,9 +48,9 @@ func (cs ClientState) IsFrozen() bool {
return false
}
// GetFrozenHeight returns 0.
func (cs ClientState) GetFrozenHeight() uint64 {
return 0
// GetFrozenHeight returns an uninitialized IBC Height.
func (cs ClientState) GetFrozenHeight() exported.Height {
return clienttypes.Height{}
}
// Validate performs a basic validation of the client state fields.
@ -93,7 +93,7 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
// VerifyClientState verifies that the localhost client state is stored locally
func (cs ClientState) VerifyClientState(
store sdk.KVStore, cdc codec.BinaryMarshaler, _ exported.Root,
_ uint64, _ exported.Prefix, _ string, _ []byte, clientState exported.ClientState,
_ exported.Height, _ exported.Prefix, _ string, _ []byte, clientState exported.ClientState,
) error {
path := host.KeyClientState()
bz := store.Get(path)
@ -117,7 +117,8 @@ func (cs ClientState) VerifyClientState(
// states.
func (cs ClientState) VerifyClientConsensusState(
sdk.KVStore, codec.BinaryMarshaler, exported.Root,
uint64, string, uint64, exported.Prefix, []byte, exported.ConsensusState,
exported.Height, string, exported.Height, exported.Prefix,
[]byte, exported.ConsensusState,
) error {
return nil
}
@ -127,7 +128,7 @@ func (cs ClientState) VerifyClientConsensusState(
func (cs ClientState) VerifyConnectionState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
_ uint64,
_ exported.Height,
_ exported.Prefix,
_ []byte,
connectionID string,
@ -160,7 +161,7 @@ func (cs ClientState) VerifyConnectionState(
func (cs ClientState) VerifyChannelState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
_ uint64,
_ exported.Height,
prefix exported.Prefix,
_ []byte,
portID,
@ -194,7 +195,7 @@ func (cs ClientState) VerifyChannelState(
func (cs ClientState) VerifyPacketCommitment(
store sdk.KVStore,
_ codec.BinaryMarshaler,
_ uint64,
_ exported.Height,
_ exported.Prefix,
_ []byte,
portID,
@ -224,7 +225,7 @@ func (cs ClientState) VerifyPacketCommitment(
func (cs ClientState) VerifyPacketAcknowledgement(
store sdk.KVStore,
_ codec.BinaryMarshaler,
_ uint64,
_ exported.Height,
_ exported.Prefix,
_ []byte,
portID,
@ -255,7 +256,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
func (cs ClientState) VerifyPacketAcknowledgementAbsence(
store sdk.KVStore,
_ codec.BinaryMarshaler,
_ uint64,
_ exported.Height,
_ exported.Prefix,
_ []byte,
portID,
@ -277,7 +278,7 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
func (cs ClientState) VerifyNextSequenceRecv(
store sdk.KVStore,
_ codec.BinaryMarshaler,
_ uint64,
_ exported.Height,
_ exported.Prefix,
_ []byte,
portID,

View File

@ -98,7 +98,7 @@ func (suite *LocalhostTestSuite) TestVerifyClientState() {
tc.malleate()
err := tc.clientState.VerifyClientState(
suite.store, suite.cdc, nil, 10, nil, "", []byte{}, tc.counterparty,
suite.store, suite.cdc, nil, clienttypes.NewHeight(0, 10), nil, "", []byte{}, tc.counterparty,
)
if tc.expPass {
@ -114,15 +114,17 @@ func (suite *LocalhostTestSuite) TestVerifyClientState() {
func (suite *LocalhostTestSuite) TestVerifyClientConsensusState() {
clientState := types.NewClientState("chainID", clientHeight)
err := clientState.VerifyClientConsensusState(
nil, nil, nil, 0, "", 0, nil, nil, nil,
nil, nil, nil, nil, "", nil, nil, nil, nil,
)
suite.Require().NoError(err)
}
func (suite *LocalhostTestSuite) TestCheckHeaderAndUpdateState() {
clientState := types.NewClientState("chainID", clientHeight)
cs, _, err := clientState.CheckHeaderAndUpdateState(suite.ctx, nil, nil, nil)
suite.Require().NoError(err)
suite.Require().Equal(suite.ctx.BlockHeight(), int64(cs.GetLatestHeight()))
suite.Require().Equal(uint64(0), cs.GetLatestHeight().GetEpochNumber())
suite.Require().Equal(suite.ctx.BlockHeight(), int64(cs.GetLatestHeight().GetEpochHeight()))
suite.Require().Equal(suite.ctx.BlockHeader().ChainID, clientState.ChainId)
}
@ -186,7 +188,7 @@ func (suite *LocalhostTestSuite) TestVerifyConnectionState() {
tc.malleate()
err := tc.clientState.VerifyConnectionState(
suite.store, suite.cdc, height, nil, []byte{}, testConnectionID, &tc.connection,
suite.store, suite.cdc, clientHeight, nil, []byte{}, testConnectionID, &tc.connection,
)
if tc.expPass {
@ -260,7 +262,7 @@ func (suite *LocalhostTestSuite) TestVerifyChannelState() {
tc.malleate()
err := tc.clientState.VerifyChannelState(
suite.store, suite.cdc, height, nil, []byte{}, testPortID, testChannelID, &tc.channel,
suite.store, suite.cdc, clientHeight, nil, []byte{}, testPortID, testChannelID, &tc.channel,
)
if tc.expPass {
@ -319,7 +321,7 @@ func (suite *LocalhostTestSuite) TestVerifyPacketCommitment() {
tc.malleate()
err := tc.clientState.VerifyPacketCommitment(
suite.store, suite.cdc, height, nil, []byte{}, testPortID, testChannelID, testSequence, tc.commitment,
suite.store, suite.cdc, clientHeight, nil, []byte{}, testPortID, testChannelID, testSequence, tc.commitment,
)
if tc.expPass {
@ -378,7 +380,7 @@ func (suite *LocalhostTestSuite) TestVerifyPacketAcknowledgement() {
tc.malleate()
err := tc.clientState.VerifyPacketAcknowledgement(
suite.store, suite.cdc, height, nil, []byte{}, testPortID, testChannelID, testSequence, tc.ack,
suite.store, suite.cdc, clientHeight, nil, []byte{}, testPortID, testChannelID, testSequence, tc.ack,
)
if tc.expPass {
@ -394,7 +396,7 @@ func (suite *LocalhostTestSuite) TestVerifyPacketAcknowledgementAbsence() {
clientState := types.NewClientState("chainID", clientHeight)
err := clientState.VerifyPacketAcknowledgementAbsence(
suite.store, suite.cdc, height, nil, nil, testPortID, testChannelID, testSequence,
suite.store, suite.cdc, clientHeight, nil, nil, testPortID, testChannelID, testSequence,
)
suite.Require().NoError(err, "ack absence failed")
@ -402,7 +404,7 @@ func (suite *LocalhostTestSuite) TestVerifyPacketAcknowledgementAbsence() {
suite.store.Set(host.KeyPacketAcknowledgement(testPortID, testChannelID, testSequence), []byte("ack"))
err = clientState.VerifyPacketAcknowledgementAbsence(
suite.store, suite.cdc, height, nil, nil, testPortID, testChannelID, testSequence,
suite.store, suite.cdc, clientHeight, nil, nil, testPortID, testChannelID, testSequence,
)
suite.Require().Error(err, "ack exists in store")
}
@ -458,7 +460,7 @@ func (suite *LocalhostTestSuite) TestVerifyNextSeqRecv() {
tc.malleate()
err := tc.clientState.VerifyNextSequenceRecv(
suite.store, suite.cdc, height, nil, []byte{}, testPortID, testChannelID, nextSeqRecv,
suite.store, suite.cdc, clientHeight, nil, []byte{}, testPortID, testChannelID, nextSeqRecv,
)
if tc.expPass {

View File

@ -2,6 +2,8 @@ package host
import (
"fmt"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
)
const (
@ -69,8 +71,8 @@ func ClientTypePath() string {
// ConsensusStatePath takes an Identifier and returns a Path under which to
// store the consensus state of a client.
func ConsensusStatePath(height uint64) string {
return fmt.Sprintf("consensusState/%d", height)
func ConsensusStatePath(height exported.Height) string {
return fmt.Sprintf("consensusState/%s", height)
}
// KeyClientState returns the store key for a particular client state
@ -85,7 +87,7 @@ func KeyClientType() []byte {
// KeyConsensusState returns the store key for the consensus state of a particular
// client
func KeyConsensusState(height uint64) []byte {
func KeyConsensusState(height exported.Height) []byte {
return []byte(ConsensusStatePath(height))
}

View File

@ -21,7 +21,7 @@ type CounterpartyChannelI interface {
// PacketI defines the standard interface for IBC packets
type PacketI interface {
GetSequence() uint64
GetTimeoutHeight() uint64
GetTimeoutHeight() Height
GetTimeoutTimestamp() uint64
GetSourcePort() string
GetSourceChannel() string

View File

@ -14,9 +14,9 @@ import (
// ClientState defines the required common functions for light clients.
type ClientState interface {
ClientType() ClientType
GetLatestHeight() uint64
GetLatestHeight() Height
IsFrozen() bool
GetFrozenHeight() uint64
GetFrozenHeight() Height
Validate() error
GetProofSpecs() []*ics23.ProofSpec
@ -31,7 +31,7 @@ type ClientState interface {
store sdk.KVStore,
cdc codec.BinaryMarshaler,
root Root,
height uint64,
height Height,
prefix Prefix,
counterpartyClientIdentifier string,
proof []byte,
@ -41,9 +41,9 @@ type ClientState interface {
store sdk.KVStore,
cdc codec.BinaryMarshaler,
root Root,
height uint64,
height Height,
counterpartyClientIdentifier string,
consensusHeight uint64,
consensusHeight Height,
prefix Prefix,
proof []byte,
consensusState ConsensusState,
@ -51,7 +51,7 @@ type ClientState interface {
VerifyConnectionState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height Height,
prefix Prefix,
proof []byte,
connectionID string,
@ -60,7 +60,7 @@ type ClientState interface {
VerifyChannelState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height Height,
prefix Prefix,
proof []byte,
portID,
@ -70,7 +70,7 @@ type ClientState interface {
VerifyPacketCommitment(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height Height,
prefix Prefix,
proof []byte,
portID,
@ -81,7 +81,7 @@ type ClientState interface {
VerifyPacketAcknowledgement(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height Height,
prefix Prefix,
proof []byte,
portID,
@ -92,7 +92,7 @@ type ClientState interface {
VerifyPacketAcknowledgementAbsence(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height Height,
prefix Prefix,
proof []byte,
portID,
@ -102,7 +102,7 @@ type ClientState interface {
VerifyNextSequenceRecv(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
height uint64,
height Height,
prefix Prefix,
proof []byte,
portID,
@ -116,7 +116,7 @@ type ConsensusState interface {
ClientType() ClientType // Consensus kind
// GetHeight returns the height of the consensus state
GetHeight() uint64
GetHeight() Height
// GetRoot returns the commitment root of the consensus state,
// which is used for key-value pair verification.
@ -139,13 +139,13 @@ type Misbehaviour interface {
ValidateBasic() error
// Height at which the infraction occurred
GetHeight() uint64
GetHeight() Height
}
// Header is the consensus state update information
type Header interface {
ClientType() ClientType
GetHeight() uint64
GetHeight() Height
ValidateBasic() error
}
@ -158,6 +158,10 @@ type Height interface {
EQ(Height) bool
GT(Height) bool
GTE(Height) bool
GetEpochNumber() uint64
GetEpochHeight() uint64
Decrement() (Height, bool)
String() string
}
// ClientType defines the type of the consensus algorithm

View File

@ -48,7 +48,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
clientID,
[]exported.ConsensusState{
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), suite.header.GetHeight().(clienttypes.Height), suite.header.Header.NextValidatorsHash,
),
},
),
@ -177,7 +177,7 @@ func (suite *IBCTestSuite) TestInitGenesis() {
clientID,
[]exported.ConsensusState{
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), suite.header.GetHeight().(clienttypes.Height), suite.header.Header.NextValidatorsHash,
),
},
),

View File

@ -6,14 +6,15 @@ import (
"github.com/stretchr/testify/suite"
"github.com/cosmos/cosmos-sdk/x/ibc"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
)
const (
timeoutHeight = uint64(10000)
var (
timeoutHeight = clienttypes.NewHeight(0, 10000)
maxSequence = uint64(10)
)
@ -316,7 +317,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
}{
{"success: ORDERED", func() {
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.ORDERED)
packet = channeltypes.NewPacket(ibctesting.MockCommitment, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = channeltypes.NewPacket(ibctesting.MockCommitment, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
// create packet commitment
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
@ -329,7 +330,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
}, true},
{"success: UNORDERED", func() {
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
packet = channeltypes.NewPacket(ibctesting.MockCommitment, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
packet = channeltypes.NewPacket(ibctesting.MockCommitment, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
// create packet commitment
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
@ -347,7 +348,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
// attempts to timeout the last packet sent without timing out the first packet
// packet sequences begin at 1
for i := uint64(1); i < maxSequence; i++ {
packet = channeltypes.NewPacket(ibctesting.MockCommitment, i, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), 0)
packet = channeltypes.NewPacket(ibctesting.MockCommitment, i, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), 0)
// create packet commitment
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
@ -364,7 +365,7 @@ func (suite *HandlerTestSuite) TestHandleTimeoutPacket() {
// attempts to timeout the last packet sent without timing out the first packet
// packet sequences begin at 1
for i := uint64(1); i < maxSequence; i++ {
packet = channeltypes.NewPacket(ibctesting.MockCommitment, i, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, uint64(suite.chainB.GetContext().BlockHeight()), 0)
packet = channeltypes.NewPacket(ibctesting.MockCommitment, i, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), 0)
// create packet commitment
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)

View File

@ -28,8 +28,10 @@ func (cs ClientState) ClientType() exported.ClientType {
}
// GetLatestHeight returns the latest sequence number.
func (cs ClientState) GetLatestHeight() uint64 {
return cs.ConsensusState.Sequence
// Return exported.Height to satisfy interface
// Epoch number is always 0 for a solo-machine
func (cs ClientState) GetLatestHeight() exported.Height {
return clienttypes.NewHeight(0, cs.ConsensusState.Sequence)
}
// IsFrozen returns true if the client is frozen.
@ -38,8 +40,10 @@ func (cs ClientState) IsFrozen() bool {
}
// GetFrozenHeight returns the frozen sequence of the client.
func (cs ClientState) GetFrozenHeight() uint64 {
return cs.FrozenSequence
// Return exported.Height to satisfy interface
// Epoch number is always 0 for a solo-machine
func (cs ClientState) GetFrozenHeight() exported.Height {
return clienttypes.NewHeight(0, cs.FrozenSequence)
}
// GetProofSpecs returns nil proof specs since client state verification uses signatures.
@ -61,13 +65,13 @@ func (cs ClientState) VerifyClientState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
_ exported.Root,
sequence uint64,
height exported.Height,
prefix exported.Prefix,
counterpartyClientIdentifier string,
proof []byte,
clientState exported.ClientState,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
signature, sequence, err := produceVerificationArgs(cdc, cs, height, prefix, proof)
if err != nil {
return err
}
@ -99,14 +103,14 @@ func (cs ClientState) VerifyClientConsensusState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
_ exported.Root,
sequence uint64,
height exported.Height,
counterpartyClientIdentifier string,
consensusHeight uint64,
consensusHeight exported.Height,
prefix exported.Prefix,
proof []byte,
consensusState exported.ConsensusState,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
signature, sequence, err := produceVerificationArgs(cdc, cs, height, prefix, proof)
if err != nil {
return err
}
@ -137,13 +141,13 @@ func (cs ClientState) VerifyClientConsensusState(
func (cs ClientState) VerifyConnectionState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
connectionID string,
connectionEnd exported.ConnectionI,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
signature, sequence, err := produceVerificationArgs(cdc, cs, height, prefix, proof)
if err != nil {
return err
}
@ -173,14 +177,14 @@ func (cs ClientState) VerifyConnectionState(
func (cs ClientState) VerifyChannelState(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
channel exported.ChannelI,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
signature, sequence, err := produceVerificationArgs(cdc, cs, height, prefix, proof)
if err != nil {
return err
}
@ -210,7 +214,7 @@ func (cs ClientState) VerifyChannelState(
func (cs ClientState) VerifyPacketCommitment(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
@ -218,7 +222,7 @@ func (cs ClientState) VerifyPacketCommitment(
packetSequence uint64,
commitmentBytes []byte,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
signature, sequence, err := produceVerificationArgs(cdc, cs, height, prefix, proof)
if err != nil {
return err
}
@ -245,7 +249,7 @@ func (cs ClientState) VerifyPacketCommitment(
func (cs ClientState) VerifyPacketAcknowledgement(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
@ -253,7 +257,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
packetSequence uint64,
acknowledgement []byte,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
signature, sequence, err := produceVerificationArgs(cdc, cs, height, prefix, proof)
if err != nil {
return err
}
@ -281,14 +285,14 @@ func (cs ClientState) VerifyPacketAcknowledgement(
func (cs ClientState) VerifyPacketAcknowledgementAbsence(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
packetSequence uint64,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
signature, sequence, err := produceVerificationArgs(cdc, cs, height, prefix, proof)
if err != nil {
return err
}
@ -315,14 +319,14 @@ func (cs ClientState) VerifyPacketAcknowledgementAbsence(
func (cs ClientState) VerifyNextSequenceRecv(
store sdk.KVStore,
cdc codec.BinaryMarshaler,
sequence uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
portID,
channelID string,
nextSequenceRecv uint64,
) error {
signature, err := produceVerificationArgs(cdc, cs, sequence, prefix, proof)
signature, sequence, err := produceVerificationArgs(cdc, cs, height, prefix, proof)
if err != nil {
return err
}
@ -346,51 +350,58 @@ func (cs ClientState) VerifyNextSequenceRecv(
// produceVerificationArgs perfoms the basic checks on the arguments that are
// shared between the verification functions and returns the unmarshalled
// proof representing the signature and timestamp.
// proof representing the signature and timestamp along with the solo-machine sequence
// encoded in the proofHeight.
func produceVerificationArgs(
cdc codec.BinaryMarshaler,
cs ClientState,
sequence uint64,
height exported.Height,
prefix exported.Prefix,
proof []byte,
) (signature TimestampedSignature, err error) {
) (signature TimestampedSignature, sequence uint64, err error) {
if epoch := height.GetEpochNumber(); epoch != 0 {
return TimestampedSignature{}, 0, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "epoch must be 0 for solomachine, got epoch-number: %d", epoch)
}
// sequence is encoded in the epoch height of height struct
sequence = height.GetEpochHeight()
if cs.IsFrozen() {
return TimestampedSignature{}, clienttypes.ErrClientFrozen
return TimestampedSignature{}, 0, clienttypes.ErrClientFrozen
}
if prefix == nil {
return TimestampedSignature{}, sdkerrors.Wrap(commitmenttypes.ErrInvalidPrefix, "prefix cannot be empty")
return TimestampedSignature{}, 0, sdkerrors.Wrap(commitmenttypes.ErrInvalidPrefix, "prefix cannot be empty")
}
_, ok := prefix.(commitmenttypes.MerklePrefix)
if !ok {
return TimestampedSignature{}, sdkerrors.Wrapf(commitmenttypes.ErrInvalidPrefix, "invalid prefix type %T, expected MerklePrefix", prefix)
return TimestampedSignature{}, 0, sdkerrors.Wrapf(commitmenttypes.ErrInvalidPrefix, "invalid prefix type %T, expected MerklePrefix", prefix)
}
if proof == nil {
return TimestampedSignature{}, sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "proof cannot be empty")
return TimestampedSignature{}, 0, sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "proof cannot be empty")
}
if err = cdc.UnmarshalBinaryBare(proof, &signature); err != nil {
return TimestampedSignature{}, sdkerrors.Wrapf(ErrInvalidProof, "failed to unmarshal proof into type %T", TimestampedSignature{})
return TimestampedSignature{}, 0, sdkerrors.Wrapf(ErrInvalidProof, "failed to unmarshal proof into type %T", TimestampedSignature{})
}
if cs.ConsensusState == nil {
return TimestampedSignature{}, sdkerrors.Wrap(clienttypes.ErrInvalidConsensus, "consensus state cannot be empty")
return TimestampedSignature{}, 0, sdkerrors.Wrap(clienttypes.ErrInvalidConsensus, "consensus state cannot be empty")
}
if cs.GetLatestHeight() < sequence {
return TimestampedSignature{}, sdkerrors.Wrapf(
latestSequence := cs.GetLatestHeight().GetEpochHeight()
if latestSequence < sequence {
return TimestampedSignature{}, 0, sdkerrors.Wrapf(
sdkerrors.ErrInvalidHeight,
"client state sequence < proof sequence (%d < %d)", cs.GetLatestHeight(), sequence,
"client state sequence < proof sequence (%d < %d)", latestSequence, sequence,
)
}
if cs.ConsensusState.GetTimestamp() > signature.Timestamp {
return TimestampedSignature{}, sdkerrors.Wrapf(ErrInvalidProof, "the consensus state timestamp is greater than the signature timestamp (%d >= %d)", cs.ConsensusState.GetTimestamp(), signature.Timestamp)
return TimestampedSignature{}, 0, sdkerrors.Wrapf(ErrInvalidProof, "the consensus state timestamp is greater than the signature timestamp (%d >= %d)", cs.ConsensusState.GetTimestamp(), signature.Timestamp)
}
return signature, nil
return signature, sequence, nil
}
// sets the client state to the store

View File

@ -1,6 +1,7 @@
package types_test
import (
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
@ -11,14 +12,14 @@ import (
const (
counterpartyClientIdentifier = "chainA"
consensusHeight = uint64(0)
testConnectionID = "connectionid"
testChannelID = "testchannelid"
testPortID = "testportid"
)
var (
prefix = commitmenttypes.NewMerklePrefix([]byte("ibc"))
prefix = commitmenttypes.NewMerklePrefix([]byte("ibc"))
consensusHeight = clienttypes.Height{}
)
func (suite *SoloMachineTestSuite) TestClientStateValidateBasic() {
@ -180,7 +181,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientState() {
}
err := tc.clientState.VerifyClientState(
suite.store, suite.chainA.Codec, nil, suite.solomachine.Sequence, tc.prefix, counterpartyClientIdentifier, tc.proof, clientState,
suite.store, suite.chainA.Codec, nil, suite.solomachine.GetHeight(), tc.prefix, counterpartyClientIdentifier, tc.proof, clientState,
)
if tc.expPass {
@ -305,7 +306,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
}
err := tc.clientState.VerifyClientConsensusState(
suite.store, suite.chainA.Codec, nil, suite.solomachine.Sequence, counterpartyClientIdentifier, consensusHeight, tc.prefix, tc.proof, consensusState,
suite.store, suite.chainA.Codec, nil, suite.solomachine.GetHeight(), counterpartyClientIdentifier, consensusHeight, tc.prefix, tc.proof, consensusState,
)
if tc.expPass {
@ -389,7 +390,7 @@ func (suite *SoloMachineTestSuite) TestVerifyConnectionState() {
expSeq := tc.clientState.ConsensusState.Sequence + 1
err := tc.clientState.VerifyConnectionState(
suite.store, suite.chainA.Codec, suite.solomachine.Sequence, tc.prefix, tc.proof, testConnectionID, conn,
suite.store, suite.chainA.Codec, suite.solomachine.GetHeight(), tc.prefix, tc.proof, testConnectionID, conn,
)
if tc.expPass {
@ -472,7 +473,7 @@ func (suite *SoloMachineTestSuite) TestVerifyChannelState() {
expSeq := tc.clientState.ConsensusState.Sequence + 1
err := tc.clientState.VerifyChannelState(
suite.store, suite.chainA.Codec, suite.solomachine.Sequence, tc.prefix, tc.proof, testPortID, testChannelID, ch,
suite.store, suite.chainA.Codec, suite.solomachine.GetHeight(), tc.prefix, tc.proof, testPortID, testChannelID, ch,
)
if tc.expPass {
@ -552,7 +553,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketCommitment() {
expSeq := tc.clientState.ConsensusState.Sequence + 1
err := tc.clientState.VerifyPacketCommitment(
suite.store, suite.chainA.Codec, suite.solomachine.Sequence, tc.prefix, tc.proof, testPortID, testChannelID, suite.solomachine.Sequence, commitmentBytes,
suite.store, suite.chainA.Codec, suite.solomachine.GetHeight(), tc.prefix, tc.proof, testPortID, testChannelID, suite.solomachine.Sequence, commitmentBytes,
)
if tc.expPass {
@ -632,7 +633,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketAcknowledgement() {
expSeq := tc.clientState.ConsensusState.Sequence + 1
err := tc.clientState.VerifyPacketAcknowledgement(
suite.store, suite.chainA.Codec, suite.solomachine.Sequence, tc.prefix, tc.proof, testPortID, testChannelID, suite.solomachine.Sequence, ack,
suite.store, suite.chainA.Codec, suite.solomachine.GetHeight(), tc.prefix, tc.proof, testPortID, testChannelID, suite.solomachine.Sequence, ack,
)
if tc.expPass {
@ -711,7 +712,7 @@ func (suite *SoloMachineTestSuite) TestVerifyPacketAcknowledgementAbsence() {
expSeq := tc.clientState.ConsensusState.Sequence + 1
err := tc.clientState.VerifyPacketAcknowledgementAbsence(
suite.store, suite.chainA.Codec, suite.solomachine.Sequence, tc.prefix, tc.proof, testPortID, testChannelID, suite.solomachine.Sequence,
suite.store, suite.chainA.Codec, suite.solomachine.GetHeight(), tc.prefix, tc.proof, testPortID, testChannelID, suite.solomachine.Sequence,
)
if tc.expPass {
@ -791,7 +792,7 @@ func (suite *SoloMachineTestSuite) TestVerifyNextSeqRecv() {
expSeq := tc.clientState.ConsensusState.Sequence + 1
err := tc.clientState.VerifyNextSequenceRecv(
suite.store, suite.chainA.Codec, suite.solomachine.Sequence, tc.prefix, tc.proof, testPortID, testChannelID, nextSeqRecv,
suite.store, suite.chainA.Codec, suite.solomachine.GetHeight(), tc.prefix, tc.proof, testPortID, testChannelID, nextSeqRecv,
)
if tc.expPass {

View File

@ -17,8 +17,10 @@ func (ConsensusState) ClientType() exported.ClientType {
}
// GetHeight returns the sequence number.
func (cs ConsensusState) GetHeight() uint64 {
return cs.Sequence
// Return clientexported.Height to satisfy interface
// Epoch number is always 0 for a solo-machine
func (cs ConsensusState) GetHeight() exported.Height {
return clienttypes.NewHeight(0, cs.Sequence)
}
// GetTimestamp returns zero.

View File

@ -9,7 +9,8 @@ func (suite *SoloMachineTestSuite) TestConsensusState() {
consensusState := suite.solomachine.ConsensusState()
suite.Require().Equal(exported.SoloMachine, consensusState.ClientType())
suite.Require().Equal(suite.solomachine.Sequence, consensusState.GetHeight())
suite.Require().Equal(uint64(0), consensusState.GetHeight().GetEpochNumber())
suite.Require().Equal(suite.solomachine.Sequence, consensusState.GetHeight().GetEpochHeight())
suite.Require().Equal(suite.solomachine.Time, consensusState.GetTimestamp())
suite.Require().Nil(consensusState.GetRoot())
}

View File

@ -17,8 +17,10 @@ func (Header) ClientType() exported.ClientType {
}
// GetHeight returns the current sequence number as the height.
func (h Header) GetHeight() uint64 {
return h.Sequence
// Return clientexported.Height to satisfy interface
// Epoch number is always 0 for a solo-machine
func (h Header) GetHeight() exported.Height {
return clienttypes.NewHeight(0, h.Sequence)
}
// GetPubKey unmarshals the new public key into a tmcrypto.PubKey type.

View File

@ -37,8 +37,10 @@ func (misbehaviour Misbehaviour) String() string {
}
// GetHeight returns the sequence at which misbehaviour occurred.
func (misbehaviour Misbehaviour) GetHeight() uint64 {
return misbehaviour.Sequence
// Return exported.Height to satisfy interface
// Epoch number is always 0 for a solo-machine
func (misbehaviour Misbehaviour) GetHeight() exported.Height {
return clienttypes.NewHeight(0, misbehaviour.Sequence)
}
// ValidateBasic implements Evidence interface.

View File

@ -34,7 +34,7 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
return nil, err
}
cs.FrozenSequence = soloMisbehaviour.GetHeight()
cs.FrozenSequence = soloMisbehaviour.Sequence
return cs, nil
}

View File

@ -10,7 +10,8 @@ func (suite *SoloMachineTestSuite) TestMisbehaviour() {
suite.Require().Equal(exported.SoloMachine, misbehaviour.ClientType())
suite.Require().Equal(suite.solomachine.ClientID, misbehaviour.GetClientID())
suite.Require().Equal(suite.solomachine.Sequence, misbehaviour.GetHeight())
suite.Require().Equal(uint64(0), misbehaviour.GetHeight().GetEpochNumber())
suite.Require().Equal(suite.solomachine.Sequence, misbehaviour.GetHeight().GetEpochHeight())
}
func (suite *SoloMachineTestSuite) TestMisbehaviourValidateBasic() {

Some files were not shown because too many files have changed in this diff Show More