Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Abstract Height in IBC Clients #6686

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e3ee983
add abstract height method
AdityaSripal Jul 7, 2020
6233c94
convert 07-tendermint to abstract height
AdityaSripal Jul 10, 2020
c51bab1
make localhost build pass
AdityaSripal Jul 10, 2020
ee5edcc
make client keeper changes
AdityaSripal Jul 10, 2020
488d232
fix connection and update proto
AdityaSripal Jul 14, 2020
10c3a3f
update all proto files correctly
AdityaSripal Jul 14, 2020
8fa0e2f
fix all non-test builds
AdityaSripal Jul 14, 2020
b405b9e
fix clients
AdityaSripal Jul 14, 2020
5adc5bc
fix ibc testing package
AdityaSripal Jul 14, 2020
6c494bb
fix tmtypes test
AdityaSripal Jul 15, 2020
faafff7
fix tendermint package tests
AdityaSripal Jul 16, 2020
660b0ff
fix localhost tests
AdityaSripal Jul 16, 2020
04cb265
fix client tests
AdityaSripal Jul 16, 2020
179943d
fix connection tests
AdityaSripal Jul 21, 2020
452a66f
fix channel tests
AdityaSripal Jul 21, 2020
ac32c79
fix all x/ibc tests
AdityaSripal Jul 21, 2020
7dfe1c9
fix all tests
AdityaSripal Jul 21, 2020
2bdf31f
fmt proto files
AdityaSripal Jul 21, 2020
fcefa34
add tendermint abstract height handling tests
AdityaSripal Jul 22, 2020
ff89df0
move frozen test case to appropriate pkg
AdityaSripal Jul 23, 2020
f3f4d3b
fix merge
AdityaSripal Jul 23, 2020
c2e0cd7
fix lint bugs
AdityaSripal Jul 23, 2020
aa0a342
Apply suggestions from code review
AdityaSripal Jul 29, 2020
c74bec9
make Compare more idiomatic
AdityaSripal Jul 29, 2020
b612ac7
fix godoc
AdityaSripal Jul 30, 2020
363287c
address @colin-axner comments
AdityaSripal Jul 30, 2020
28585e9
fix merge in x/ibc
AdityaSripal Aug 25, 2020
aa9d1e6
fix rest of merges
AdityaSripal Aug 25, 2020
3f77210
refix some builds
AdityaSripal Aug 25, 2020
541737c
cleanup last merge issues
AdityaSripal Aug 25, 2020
898c363
start migrating fields to use proto Height
AdityaSripal Aug 25, 2020
cde1aea
start using Height in 02-client
AdityaSripal Aug 25, 2020
3a7910b
start updating clients with proto Height
AdityaSripal Aug 26, 2020
43ec7bf
fix client types
AdityaSripal Aug 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions proto/ibc/channel/channel.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ message MsgChannelOpenTry {
Channel channel = 3 [(gogoproto.nullable) = false];
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\""];
bytes signer = 7 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
uint64 proof_epoch = 6 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 7 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 8 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge
Expand All @@ -33,8 +34,9 @@ message MsgChannelOpenAck {
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
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\""];
bytes signer = 6 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
uint64 proof_epoch = 5 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 6 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 7 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to acknowledge
Expand All @@ -43,8 +45,9 @@ message MsgChannelOpenConfirm {
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
bytes proof_ack = 3 [(gogoproto.moretags) = "yaml:\"proof_ack\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 5 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
uint64 proof_epoch = 4 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 5 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 6 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain A
Expand All @@ -61,34 +64,38 @@ message MsgChannelCloseConfirm {
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
bytes proof_init = 3 [(gogoproto.moretags) = "yaml:\"proof_init\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 5 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
uint64 proof_epoch = 4 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 5 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 6 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// MsgRecvPacket receives incoming IBC packet
message MsgRecvPacket {
Packet packet = 1 [(gogoproto.nullable) = false];
bytes proof = 2;
uint64 proof_height = 3 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
uint64 proof_epoch = 3 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 5 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// MsgTimeout receives timed-out packet
message MsgTimeout {
Packet packet = 1 [(gogoproto.nullable) = false];
bytes proof = 2;
uint64 proof_height = 3 [(gogoproto.moretags) = "yaml:\"proof_height\""];
uint64 next_sequence_recv = 4 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""];
bytes signer = 5 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
uint64 proof_epoch = 3 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
uint64 next_sequence_recv = 5 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""];
bytes signer = 6 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// MsgAcknowledgement receives incoming IBC acknowledgement
message MsgAcknowledgement {
Packet packet = 1 [(gogoproto.nullable) = false];
bytes acknowledgement = 2;
bytes proof = 3;
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 5 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
uint64 proof_epoch = 4 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 5 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 6 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// Channel defines pipeline for exactly-once packet delivery between specific
Expand Down Expand Up @@ -190,10 +197,12 @@ message Packet {
string destination_channel = 5 [(gogoproto.moretags) = "yaml:\"destination_channel\""];
// actual opaque bytes transferred directly to the application module
bytes data = 6;
// block epoch on which packet times out
uint64 timeout_epoch = 7 [(gogoproto.moretags) = "yaml:\"timeout_epoch\""];
// block height after which the packet times out
uint64 timeout_height = 7 [(gogoproto.moretags) = "yaml:\"timeout_height\""];
uint64 timeout_height = 8 [(gogoproto.moretags) = "yaml:\"timeout_height\""];
// block timestamp (in nanoseconds) after which the packet times out
uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
uint64 timeout_timestamp = 9 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
}

// PacketAckCommitment defines the genesis type necessary to retrieve and store
Expand Down
25 changes: 15 additions & 10 deletions proto/ibc/connection/connection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ message MsgConnectionOpenTry {
// proof of the initialization the connection on Chain A: `UNITIALIZED ->
// INIT`
bytes proof_init = 5 [(gogoproto.moretags) = "yaml:\"proof_init\""];
uint64 proof_height = 6;
uint64 proof_epoch = 6 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 7 [(gogoproto.moretags) = "yaml:\"proof_height\""];
// proof of client consensus state
bytes proof_consensus = 7 [(gogoproto.moretags) = "yaml:\"proof_consensus\""];
uint64 consensus_height = 8
bytes proof_consensus = 8 [(gogoproto.moretags) = "yaml:\"proof_consensus\""];
uint64 consensus_epoch = 9 [(gogoproto.moretags) = "yaml:\"consensus_epoch\""];
uint64 consensus_height = 10
[(gogoproto.moretags) = "yaml:\"consensus_height\""];
bytes signer = 9
bytes signer = 11
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

Expand All @@ -59,12 +61,14 @@ message MsgConnectionOpenAck {
// proof of the initialization the connection on Chain B: `UNITIALIZED ->
// TRYOPEN`
bytes proof_try = 3 [(gogoproto.moretags) = "yaml:\"proof_try\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
uint64 proof_epoch = 4 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 5 [(gogoproto.moretags) = "yaml:\"proof_height\""];
// proof of client consensus state
bytes proof_consensus = 5 [(gogoproto.moretags) = "yaml:\"proof_consensus\""];
uint64 consensus_height = 6
bytes proof_consensus = 6 [(gogoproto.moretags) = "yaml:\"proof_consensus\""];
uint64 consensus_epoch = 7 [(gogoproto.moretags) = "yaml:\"consensus_epoch\""];
uint64 consensus_height = 8
[(gogoproto.moretags) = "yaml:\"consensus_height\""];
bytes signer = 7
bytes signer = 9
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

Expand All @@ -77,8 +81,9 @@ 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\""];
bytes signer = 4
uint64 proof_epoch = 3 [(gogoproto.moretags) = "yaml:\"proof_epoch\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 5
[(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

Expand Down
6 changes: 4 additions & 2 deletions proto/ibc/transfer/transfer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ message MsgTransfer {
];
// the recipient address on the destination chain
string receiver = 5;
// Timeout epoch is epoch in which timeout occurs
uint64 timeout_epoch = 6 [(gogoproto.moretags) = "yaml:\"timeout_epoch\""];
// 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\""];
uint64 timeout_height = 7 [(gogoproto.moretags) = "yaml:\"timeout_height\""];
// 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\""];
uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
}

// FungibleTokenPacketData defines a struct for the packet payload
Expand Down
16 changes: 14 additions & 2 deletions x/ibc-transfer/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

const (
flagTimeoutEpoch = "timeout-epoch"
flagTimeoutHeight = "timeout-height"
flagTimeoutTimestamp = "timeout-timestamp"
flagAbsoluteTimeouts = "absolute-timeouts"
Expand Down Expand Up @@ -54,6 +55,11 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
return err
}

timeoutEpoch, err := cmd.Flags().GetUint64(flagTimeoutEpoch)
if err != nil {
return err
}

timeoutTimestamp, err := cmd.Flags().GetUint64(flagTimeoutHeight)
if err != nil {
return err
Expand All @@ -72,8 +78,13 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
return err
}

// If timeoutEpoch is not specified, use same epoch as latest consensus state
if timeoutEpoch != 0 {
timeoutEpoch = consensusState.GetHeight().EpochNumber
}

if timeoutHeight != 0 {
timeoutHeight = consensusState.GetHeight() + timeoutHeight
timeoutHeight = consensusState.GetHeight().EpochHeight + timeoutHeight
}

if timeoutTimestamp != 0 {
Expand All @@ -82,7 +93,7 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
}

msg := types.NewMsgTransfer(
srcPort, srcChannel, coins, sender, receiver, timeoutHeight, timeoutTimestamp,
srcPort, srcChannel, coins, sender, receiver, timeoutEpoch, timeoutHeight, timeoutTimestamp,
)
if err := msg.ValidateBasic(); err != nil {
return err
Expand All @@ -92,6 +103,7 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
},
}

cmd.Flags().Uint64(flagTimeoutEpoch, 0, "Absolute timeout block epoch.")
AdityaSripal marked this conversation as resolved.
Show resolved Hide resolved
cmd.Flags().Uint64(flagTimeoutHeight, types.DefaultRelativePacketTimeoutHeight, "Timeout block height. The timeout is disabled when set to 0.")
cmd.Flags().Uint64(flagTimeoutTimestamp, types.DefaultRelativePacketTimeoutTimestamp, "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.")
Expand Down
1 change: 1 addition & 0 deletions x/ibc-transfer/client/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type TransferTxReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
Amount sdk.Coins `json:"amount" yaml:"amount"`
Receiver string `json:"receiver" yaml:"receiver"`
TimeoutEpoch uint64 `json:"timeout_epoch" yaml:"timeout_epoch"`
TimeoutHeight uint64 `json:"timeout_height" yaml:"timeout_height"`
TimeoutTimestamp uint64 `json:"timeout_timestamp" yaml:"timeout_timestamp"`
}
1 change: 1 addition & 0 deletions x/ibc-transfer/client/rest/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func transferHandlerFn(clientCtx client.Context) http.HandlerFunc {
req.Amount,
fromAddr,
req.Receiver,
req.TimeoutEpoch,
req.TimeoutHeight,
req.TimeoutTimestamp,
)
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-transfer/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// See createOutgoingPacket in spec:https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#packet-relay
func handleMsgTransfer(ctx sdk.Context, k keeper.Keeper, msg *types.MsgTransfer) (*sdk.Result, error) {
if err := k.SendTransfer(
ctx, msg.SourcePort, msg.SourceChannel, msg.Amount, msg.Sender, msg.Receiver, msg.TimeoutHeight, msg.TimeoutTimestamp,
ctx, msg.SourcePort, msg.SourceChannel, msg.Amount, msg.Sender, msg.Receiver, msg.TimeoutEpoch, msg.TimeoutHeight, msg.TimeoutTimestamp,
); err != nil {
return nil, err
}
Expand Down
18 changes: 11 additions & 7 deletions x/ibc-transfer/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
transfer "github.com/cosmos/cosmos-sdk/x/ibc-transfer"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
Expand Down Expand Up @@ -79,7 +80,7 @@ func (suite *HandlerTestSuite) TestHandleMsgTransfer() {
suite.Require().Nil(err, "transfer module could not claim capability")

ctx := suite.chainA.GetContext()
msg := types.NewMsgTransfer(testPort1, testChannel1, testPrefixedCoins2, testAddr1, testAddr2.String(), 110, 0)
msg := types.NewMsgTransfer(testPort1, testChannel1, testPrefixedCoins2, testAddr1, testAddr2.String(), 3, 110, 0)
res, err := handler(ctx, msg)
suite.Require().Error(err)
suite.Require().Nil(res, "%+v", res) // channel does not exist
Expand All @@ -105,14 +106,14 @@ func (suite *HandlerTestSuite) TestHandleMsgTransfer() {
suite.Require().NotNil(res, "%+v", res) // successfully executed

// test when the source is false
msg = types.NewMsgTransfer(testPort1, testChannel1, testPrefixedCoins2, testAddr1, testAddr2.String(), 110, 0)
msg = types.NewMsgTransfer(testPort1, testChannel1, testPrefixedCoins2, testAddr1, testAddr2.String(), 3, 110, 0)
_ = suite.chainA.App.BankKeeper.SetBalances(ctx, testAddr1, testPrefixedCoins2)

res, err = handler(ctx, msg)
suite.Require().Error(err)
suite.Require().Nil(res, "%+v", res) // incorrect denom prefix

msg = types.NewMsgTransfer(testPort1, testChannel1, testPrefixedCoins1, testAddr1, testAddr2.String(), 110, 0)
msg = types.NewMsgTransfer(testPort1, testChannel1, testPrefixedCoins1, testAddr1, testAddr2.String(), 3, 110, 0)
suite.chainA.App.BankKeeper.SetSupply(ctx, banktypes.NewSupply(testPrefixedCoins1))
_ = suite.chainA.App.BankKeeper.SetBalances(ctx, testAddr1, testPrefixedCoins1)

Expand Down Expand Up @@ -146,7 +147,8 @@ func NewTestChain(clientID string) *TestChain {
signers := []tmtypes.PrivValidator{privVal}
now := time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)

header := ibctmtypes.CreateTestHeader(clientID, 1, now, valSet, signers)
height := clientexported.NewHeight(0, 1)
header := ibctmtypes.CreateTestHeader(clientID, height, now, valSet, signers)

return &TestChain{
ClientID: clientID,
Expand Down Expand Up @@ -248,15 +250,16 @@ func (chain *TestChain) updateClient(client *TestChain) {
}
client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.SignedHeader.Header.Height, histInfo)

height := clientexported.NewHeight(0, uint64(client.Header.SignedHeader.Header.Height))
consensusState := ibctmtypes.ConsensusState{
Height: uint64(client.Header.SignedHeader.Header.Height),
Height: height,
Timestamp: client.Header.Time,
Root: commitmenttypes.NewMerkleRoot(commitID.Hash),
ValidatorSet: client.Vals,
}

chain.App.IBCKeeper.ClientKeeper.SetClientConsensusState(
ctxTarget, client.ClientID, uint64(client.Header.SignedHeader.Header.Height), consensusState,
ctxTarget, client.ClientID, height, consensusState,
)
chain.App.IBCKeeper.ClientKeeper.SetClientState(
ctxTarget, ibctmtypes.NewClientState(client.ClientID, lite.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, client.Header, commitmenttypes.GetSDKSpecs()),
Expand Down Expand Up @@ -306,6 +309,7 @@ func (chain *TestChain) createChannel(
}

func nextHeader(chain *TestChain) ibctmtypes.Header {
return ibctmtypes.CreateTestHeader(chain.Header.SignedHeader.Header.ChainID, chain.Header.SignedHeader.Header.Height+1,
height := clientexported.NewHeight(0, uint64(chain.Header.SignedHeader.Header.Height+1))
return ibctmtypes.CreateTestHeader(chain.Header.SignedHeader.Header.ChainID, height,
chain.Header.Time.Add(time.Minute), chain.Vals, chain.Signers)
}
7 changes: 5 additions & 2 deletions x/ibc-transfer/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
connectiontypes "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"
Expand Down Expand Up @@ -121,7 +122,8 @@ func NewTestChain(clientID string) *TestChain {
signers := []tmtypes.PrivValidator{privVal}
now := time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)

header := ibctmtypes.CreateTestHeader(clientID, 1, now, valSet, signers)
height := clientexported.NewHeight(0, 1)
header := ibctmtypes.CreateTestHeader(clientID, height, now, valSet, signers)

return &TestChain{
ClientID: clientID,
Expand Down Expand Up @@ -280,6 +282,7 @@ func (chain *TestChain) createChannel(
}

func nextHeader(chain *TestChain) ibctmtypes.Header {
return ibctmtypes.CreateTestHeader(chain.Header.SignedHeader.Header.ChainID, chain.Header.SignedHeader.Header.Height+1,
height := clientexported.NewHeight(0, uint64(chain.Header.SignedHeader.Header.Height+1))
return ibctmtypes.CreateTestHeader(chain.Header.SignedHeader.Header.ChainID, height,
chain.Header.Time.Add(time.Minute), chain.Vals, chain.Signers)
}
6 changes: 4 additions & 2 deletions x/ibc-transfer/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func (k Keeper) SendTransfer(
amount sdk.Coins,
sender sdk.AccAddress,
receiver string,
timeoutEpoch,
timeoutHeight,
timeoutTimestamp uint64,
) error {
Expand All @@ -49,7 +50,7 @@ func (k Keeper) SendTransfer(

return k.createOutgoingPacket(
ctx, sequence, sourcePort, sourceChannel, destinationPort, destinationChannel,
amount, sender, receiver, timeoutHeight, timeoutTimestamp,
amount, sender, receiver, timeoutEpoch, timeoutHeight, timeoutTimestamp,
)
}

Expand All @@ -62,7 +63,7 @@ func (k Keeper) createOutgoingPacket(
amount sdk.Coins,
sender sdk.AccAddress,
receiver string,
timeoutHeight, timeoutTimestamp uint64,
timeoutEpoch, timeoutHeight, timeoutTimestamp uint64,
) error {
channelCap, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(sourcePort, sourceChannel))
if !ok {
Expand Down Expand Up @@ -141,6 +142,7 @@ func (k Keeper) createOutgoingPacket(
sourceChannel,
destinationPort,
destinationChannel,
timeoutEpoch,
timeoutHeight,
timeoutTimestamp,
)
Expand Down
Loading