Skip to content

Commit 3b3438a

Browse files
fix: only use relative timeout timestamps in ica cli (#7961)
* fix: only use relative timeout timestamps in ica cli * chore: added changelog --------- Co-authored-by: Gjermund Garaba <[email protected]>
1 parent 79218a5 commit 3b3438a

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
5555
* (core/05-port) [\#7252](https://github.com/cosmos/ibc-go/pull/7252) Removed function `LookupModuleByPort`
5656
* (core/24-host) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) Removed function `ChannelCapabilityPath`
5757
* (apps/27-interchain-accounts) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) The following functions have been removed: `AuthenticateCapability`, `ClaimCapability`
58+
* (apps/27-interchain-accounts) [\#7961](https://github.com/cosmos/ibc-go/pull/7961) Removed `absolute-timeouts` flag from `send-tx` in the ICA CLI.
5859
* (apps/transfer) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) The following functions have been removed: `BindPort`, `AuthenticateCapability`, `ClaimCapability`
5960
* (capability) [\#7279](https://github.com/cosmos/ibc-go/pull/7279) The module `capability` has been removed.
6061
* (testing) [\#7305](https://github.com/cosmos/ibc-go/pull/7305) Added `TrustedValidators` map to `TestChain`. This removes the dependency on the `x/staking` module for retrieving trusted validator sets at a given height, and removes the `GetTrustedValidators` method from the `TestChain` struct.

modules/apps/27-interchain-accounts/controller/client/cli/tx.go

+2-27
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cli
22

33
import (
4-
"errors"
54
"fmt"
65
"os"
76
"strings"
@@ -26,7 +25,6 @@ const (
2625
// The channel ordering
2726
flagOrdering = "ordering"
2827
flagPacketTimeoutTimestamp = "packet-timeout-timestamp"
29-
flagAbsoluteTimeouts = "absolute-timeouts"
3028
)
3129

3230
// defaultRelativePacketTimeoutTimestamp is the default packet timeout timestamp (in nanoseconds)
@@ -81,10 +79,8 @@ func newSendTxCmd() *cobra.Command {
8179
Use: "send-tx [connection-id] [path/to/packet_msg.json]",
8280
Short: "Send an interchain account tx on the provided connection.",
8381
Long: strings.TrimSpace(`Submits pre-built packet data containing messages to be executed on the host chain and attempts to send the packet.
84-
Packet data is provided as json, file or string. A timeout timestamp can be provided using the flag {packet-timeout-timestamp}.
85-
By default timeout timestamps are calculated relatively, adding {packet-timeout-timestamp} to the user's local system clock time.
86-
Absolute timeout timestamp values can be used by setting the {absolute-timeouts} flag to true.
87-
If no timeout value is set then a default relative timeout value of 10 minutes is used.`),
82+
Packet data is provided as json, file or string. A relative timeout timestamp can be provided using the flag {packet-timeout-timestamp}.
83+
An absolute timeout is calculated on chain using the current block time. If no timeout value is set then a default relative timeout value of 10 minutes is used.`),
8884
Args: cobra.ExactArgs(2),
8985
RunE: func(cmd *cobra.Command, args []string) error {
9086
clientCtx, err := client.GetClientTxContext(cmd)
@@ -116,34 +112,13 @@ If no timeout value is set then a default relative timeout value of 10 minutes i
116112
return err
117113
}
118114

119-
absoluteTimeouts, err := cmd.Flags().GetBool(flagAbsoluteTimeouts)
120-
if err != nil {
121-
return err
122-
}
123-
124-
// NOTE: relative timeouts using block height are not supported.
125-
if !absoluteTimeouts {
126-
if timeoutTimestamp == 0 {
127-
return errors.New("relative timeouts must provide a non zero value timestamp")
128-
}
129-
130-
// use local clock time as reference time for calculating timeout timestamp.
131-
now := time.Now().UnixNano()
132-
if now <= 0 {
133-
return errors.New("local clock time is not greater than Jan 1st, 1970 12:00 AM")
134-
}
135-
136-
timeoutTimestamp = uint64(now) + timeoutTimestamp
137-
}
138-
139115
msg := types.NewMsgSendTx(owner, connectionID, timeoutTimestamp, icaMsgData)
140116

141117
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
142118
},
143119
}
144120

145121
cmd.Flags().Uint64(flagPacketTimeoutTimestamp, defaultRelativePacketTimeoutTimestamp, "Packet timeout timestamp in nanoseconds from now. Default is 10 minutes.")
146-
cmd.Flags().Bool(flagAbsoluteTimeouts, false, "Timeout flags are used as absolute timeouts.")
147122
flags.AddTxFlagsToCmd(cmd)
148123

149124
return cmd

0 commit comments

Comments
 (0)