Skip to content

Commit 16ed761

Browse files
backport #568
1 parent 77a0c79 commit 16ed761

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
4040

4141
* [\#567](https://github.com/cosmos/ibc-go/pull/567) Bump SDK version to v0.44.4
4242

43+
### Improvements
44+
45+
* (02-client) [\#568](https://github.com/cosmos/ibc-go/pull/568) In IBC `transfer` cli command use local clock time as reference for relative timestamp timeout if greater than the block timestamp queried from the latest consensus state corresponding to the counterparty channel.
46+
4347
### Bug Fixes
4448

4549
* (02-client) [\#500](https://github.com/cosmos/ibc-go/pull/500) Fix IBC `update-client proposal` cli command to expect correct number of args.
@@ -60,6 +64,12 @@ Ref: https://keepachangelog.com/en/1.0.0/
6064

6165
* [\#384](https://github.com/cosmos/ibc-go/pull/384) Added `NegotiateAppVersion` method to `IBCModule` interface supported by a gRPC query service in `05-port`. This provides routing of requests to the desired application module callback, which in turn performs application version negotiation.
6266

67+
## [v1.2.4](https://github.com/cosmos/ibc-go/releases/tag/v1.2.4) - 2021-13-02
68+
69+
### Dependencies
70+
71+
* [\#567](https://github.com/cosmos/ibc-go/pull/567) Bump SDK version to v0.44.4
72+
6373
## [v1.2.3](https://github.com/cosmos/ibc-go/releases/tag/v1.2.3) - 2021-11-09
6474

6575
### Dependencies
@@ -97,6 +107,12 @@ Ref: https://keepachangelog.com/en/1.0.0/
97107

98108
* [\#386](https://github.com/cosmos/ibc-go/pull/386) Bump [tendermint](https://github.com/tendermint/tendermint) from v0.34.12 to v0.34.13.
99109

110+
## [v1.1.4](https://github.com/cosmos/ibc-go/releases/tag/v1.2.4) - 2021-13-02
111+
112+
### Dependencies
113+
114+
* [\#567](https://github.com/cosmos/ibc-go/pull/567) Bump SDK version to v0.44.4
115+
100116
## [v1.1.3](https://github.com/cosmos/ibc-go/releases/tag/v1.1.3) - 2021-11-09
101117

102118
### Dependencies

modules/apps/transfer/client/cli/tx.go

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package cli
22

33
import (
4+
"errors"
45
"fmt"
56
"strings"
7+
"time"
68

79
"github.com/spf13/cobra"
810

@@ -29,9 +31,10 @@ func NewTransferTxCmd() *cobra.Command {
2931
Short: "Transfer a fungible token through IBC",
3032
Long: strings.TrimSpace(`Transfer a fungible token through IBC. Timeouts can be specified
3133
as absolute or relative using the "absolute-timeouts" flag. Timeout height can be set by passing in the height string
32-
in the form {revision}-{height} using the "packet-timeout-height" flag. Relative timeouts are added to
33-
the block height and block timestamp queried from the latest consensus state corresponding
34-
to the counterparty channel. Any timeout set to 0 is disabled.`),
34+
in the form {revision}-{height} using the "packet-timeout-height" flag. Relative timeout height is added to the block
35+
height queried from the latest consensus state corresponding to the counterparty channel. Relative timeout timestamp
36+
is added to the greater value of the local clock time and the block timestamp queried from the latest consensus state
37+
corresponding to the counterparty channel. Any timeout set to 0 is disabled.`),
3538
Example: fmt.Sprintf("%s tx ibc-transfer transfer [src-port] [src-channel] [receiver] [amount]", version.AppName),
3639
Args: cobra.ExactArgs(4),
3740
RunE: func(cmd *cobra.Command, args []string) error {
@@ -89,7 +92,21 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
8992
}
9093

9194
if timeoutTimestamp != 0 {
92-
timeoutTimestamp = consensusState.GetTimestamp() + timeoutTimestamp
95+
// use local clock time as reference time if it is later than the
96+
// consensus state timestamp of the counter party chain, otherwise
97+
// still use consensus state timestamp as reference
98+
now := time.Now().UnixNano()
99+
consensusStateTimestamp := consensusState.GetTimestamp()
100+
if now > 0 {
101+
now := uint64(now)
102+
if now > consensusStateTimestamp {
103+
timeoutTimestamp = now + timeoutTimestamp
104+
} else {
105+
timeoutTimestamp = consensusStateTimestamp + timeoutTimestamp
106+
}
107+
} else {
108+
return errors.New("local clock time is not greater than Jan 1st, 1970 12:00 AM")
109+
}
93110
}
94111
}
95112

0 commit comments

Comments
 (0)