From fa15a32b11a0f91529de0bd6f6ed04d5e59d9337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=BF=AA?= Date: Mon, 26 Oct 2020 15:10:18 +0800 Subject: [PATCH 1/3] fix some bugs --- modules/htlc/client/cli/tx.go | 14 ++++++++------ modules/oracle/client/cli/tx.go | 8 ++++---- modules/service/client/cli/tx.go | 8 ++++---- modules/token/client/cli/query.go | 24 ++++++++++++------------ modules/token/client/cli/tx.go | 26 +++++++++++++------------- 5 files changed, 41 insertions(+), 39 deletions(-) diff --git a/modules/htlc/client/cli/tx.go b/modules/htlc/client/cli/tx.go index 487846e2..4e762be4 100644 --- a/modules/htlc/client/cli/tx.go +++ b/modules/htlc/client/cli/tx.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "encoding/hex" "fmt" + "strconv" "strings" "github.com/spf13/cobra" @@ -92,7 +93,7 @@ func GetCmdCreateHTLC() *cobra.Command { if err != nil { return err } - timeLock, err := cmd.Flags().GetInt64(FlagTimeLock) + timeLock, err := cmd.Flags().GetString(FlagTimeLock) if err != nil { return err } @@ -102,20 +103,20 @@ func GetCmdCreateHTLC() *cobra.Command { flags := cmd.Flags() if flags.Changed(FlagHashLock) { - rawHashLock, err := cmd.Flags().GetString(FlagHashLock) + rawHashLock, err := cmd.Flags().GetBytesHex(FlagHashLock) if err != nil { return err } - hashLockStr := strings.TrimSpace(rawHashLock) + hashLockStr := strings.TrimSpace(hex.EncodeToString(rawHashLock)) if hashLock, err = hex.DecodeString(hashLockStr); err != nil { return err } } else { - rawSecret, err := cmd.Flags().GetString(FlagSecret) + rawSecret, err := cmd.Flags().GetBytesHex(FlagSecret) if err != nil { return err } - secretStr := strings.TrimSpace(rawSecret) + secretStr := strings.TrimSpace(hex.EncodeToString(rawSecret)) if len(secretStr) > 0 { if len(secretStr) != 2*types.SecretLength { return fmt.Errorf("length of the secret must be %d in bytes", types.SecretLength) @@ -133,9 +134,10 @@ func GetCmdCreateHTLC() *cobra.Command { hashLock = types.GetHashLock(secret, uint64(timestamp)) } + timeLockRes,_ :=strconv.ParseUint(timeLock, 10, 64) msg := types.NewMsgCreateHTLC( sender, to, receiverOnOtherChain, amount, - hashLock, uint64(timestamp), uint64(timeLock), + hashLock, uint64(timestamp), timeLockRes, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/modules/oracle/client/cli/tx.go b/modules/oracle/client/cli/tx.go index 1bccf819..68c1ce57 100644 --- a/modules/oracle/client/cli/tx.go +++ b/modules/oracle/client/cli/tx.go @@ -142,7 +142,7 @@ func GetCmdCreateFeed() *cobra.Command { if err != nil { return err } - threshold, err := cmd.Flags().GetUint32(FlagThreshold) + threshold, err := cmd.Flags().GetUint16(FlagThreshold) if err != nil { return err } @@ -158,7 +158,7 @@ func GetCmdCreateFeed() *cobra.Command { Timeout: timeout, ServiceFeeCap: serviceFeeCap, RepeatedFrequency: frequency, - ResponseThreshold: threshold, + ResponseThreshold: uint32(threshold), Creator: creator, } if err := msg.ValidateBasic(); err != nil { @@ -312,7 +312,7 @@ func GetCmdEditFeed() *cobra.Command { if err != nil { return err } - threshold, err := cmd.Flags().GetUint32(FlagThreshold) + threshold, err := cmd.Flags().GetUint16(FlagThreshold) if err != nil { return err } @@ -324,7 +324,7 @@ func GetCmdEditFeed() *cobra.Command { Timeout: timeout, ServiceFeeCap: serviceFeeCap, RepeatedFrequency: frequency, - ResponseThreshold: threshold, + ResponseThreshold: uint32(threshold), Creator: creator, } if err := msg.ValidateBasic(); err != nil { diff --git a/modules/service/client/cli/tx.go b/modules/service/client/cli/tx.go index 6caade90..d9025db9 100644 --- a/modules/service/client/cli/tx.go +++ b/modules/service/client/cli/tx.go @@ -598,7 +598,7 @@ func GetCmdCallService() *cobra.Command { } input = buf.String() - timeout, err := cmd.Flags().GetInt64(FlagTimeout) + timeout, err := cmd.Flags().GetUint64(FlagTimeout) if err != nil { return err } @@ -627,7 +627,7 @@ func GetCmdCallService() *cobra.Command { msg := types.NewMsgCallService( serviceName, providers, consumer, input, serviceFeeCap, - timeout, superMode, repeated, frequency, total, + int64(timeout), superMode, repeated, frequency, total, ) if err := msg.ValidateBasic(); err != nil { return err @@ -913,7 +913,7 @@ func GetCmdUpdateRequestContext() *cobra.Command { } } - timeout, err := cmd.Flags().GetInt64(FlagTimeout) + timeout, err := cmd.Flags().GetUint64(FlagTimeout) if err != nil { return err } @@ -928,7 +928,7 @@ func GetCmdUpdateRequestContext() *cobra.Command { msg := types.NewMsgUpdateRequestContext( requestContextID, providers, serviceFeeCap, - timeout, frequency, total, consumer, + int64(timeout), frequency, total, consumer, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/modules/token/client/cli/query.go b/modules/token/client/cli/query.go index 41e020dd..b9665647 100644 --- a/modules/token/client/cli/query.go +++ b/modules/token/client/cli/query.go @@ -23,17 +23,17 @@ func GetQueryCmd() *cobra.Command { } queryCmd.AddCommand( - getCmdQueryToken(), - getCmdQueryTokens(), - getCmdQueryFee(), - getCmdQueryParams(), + GetCmdQueryToken(), + GetCmdQueryTokens(), + GetCmdQueryFee(), + GetCmdQueryParams(), ) return queryCmd } -// getCmdQueryToken implements the query token command. -func getCmdQueryToken() *cobra.Command { +// GetCmdQueryToken implements the query token command. +func GetCmdQueryToken() *cobra.Command { cmd := &cobra.Command{ Use: "token [denom]", Long: "Query a token by symbol or minUnit.", @@ -69,8 +69,8 @@ func getCmdQueryToken() *cobra.Command { return cmd } -// getCmdQueryTokens implements the query tokens command. -func getCmdQueryTokens() *cobra.Command { +// GetCmdQueryTokens implements the query tokens command. +func GetCmdQueryTokens() *cobra.Command { cmd := &cobra.Command{ Use: "tokens [owner]", Long: "Query token by the owner.", @@ -118,8 +118,8 @@ func getCmdQueryTokens() *cobra.Command { return cmd } -// getCmdQueryFee implements the query token related fees command. -func getCmdQueryFee() *cobra.Command { +// GetCmdQueryFee implements the query token related fees command. +func GetCmdQueryFee() *cobra.Command { cmd := &cobra.Command{ Use: "fee [symbol]", Args: cobra.ExactArgs(1), @@ -157,8 +157,8 @@ func getCmdQueryFee() *cobra.Command { return cmd } -// getCmdQueryParams implements the query token related param command. -func getCmdQueryParams() *cobra.Command { +// GetCmdQueryParams implements the query token related param command. +func GetCmdQueryParams() *cobra.Command { cmd := &cobra.Command{ Use: "params", Long: "Query values set as token parameters.", diff --git a/modules/token/client/cli/tx.go b/modules/token/client/cli/tx.go index 000207c5..5c9e7af5 100644 --- a/modules/token/client/cli/tx.go +++ b/modules/token/client/cli/tx.go @@ -29,17 +29,17 @@ func NewTxCmd() *cobra.Command { } txCmd.AddCommand( - getCmdIssueToken(), - getCmdEditToken(), - getCmdMintToken(), - getCmdTransferTokenOwner(), + GetCmdIssueToken(), + GetCmdEditToken(), + GetCmdMintToken(), + GetCmdTransferTokenOwner(), ) return txCmd } -// getCmdIssueToken implements the issue token command -func getCmdIssueToken() *cobra.Command { +// GetCmdIssueToken implements the issue token command +func GetCmdIssueToken() *cobra.Command { cmd := &cobra.Command{ Use: "issue", Long: "Issue a new token.", @@ -77,7 +77,7 @@ func getCmdIssueToken() *cobra.Command { if err != nil { return err } - scale, err := cmd.Flags().GetUint32(FlagScale) + scale, err := cmd.Flags().GetUint8(FlagScale) if err != nil { return err } @@ -98,7 +98,7 @@ func getCmdIssueToken() *cobra.Command { Symbol: symbol, Name: name, MinUnit: minUnit, - Scale: scale, + Scale: uint32(scale), InitialSupply: initialSupply, MaxSupply: maxSupply, Mintable: mintable, @@ -153,8 +153,8 @@ func getCmdIssueToken() *cobra.Command { return cmd } -// getCmdEditToken implements the edit token command -func getCmdEditToken() *cobra.Command { +// GetCmdEditToken implements the edit token command +func GetCmdEditToken() *cobra.Command { cmd := &cobra.Command{ Use: "edit [symbol]", Long: "Edit an existing token.", @@ -210,7 +210,7 @@ func getCmdEditToken() *cobra.Command { return cmd } -func getCmdMintToken() *cobra.Command { +func GetCmdMintToken() *cobra.Command { cmd := &cobra.Command{ Use: "mint [symbol]", Long: "Mint tokens to a specified address.", @@ -298,8 +298,8 @@ func getCmdMintToken() *cobra.Command { return cmd } -// getCmdTransferTokenOwner implements the transfer token owner command -func getCmdTransferTokenOwner() *cobra.Command { +// GetCmdTransferTokenOwner implements the transfer token owner command +func GetCmdTransferTokenOwner() *cobra.Command { cmd := &cobra.Command{ Use: "transfer [symbol]", Long: "Transfer the owner of a token to a new owner.", From 4c679200fe718de9fe45816b8e46bc8cdfe45de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=BF=AA?= Date: Mon, 26 Oct 2020 16:00:32 +0800 Subject: [PATCH 2/3] update flag files --- modules/htlc/client/cli/flags.go | 6 +++--- modules/htlc/client/cli/tx.go | 18 ++++++++---------- modules/oracle/client/cli/flags.go | 2 +- modules/oracle/client/cli/tx.go | 8 ++++---- modules/service/client/cli/flags.go | 2 +- modules/service/client/cli/tx.go | 8 ++++---- modules/token/client/cli/flags.go | 2 +- modules/token/client/cli/tx.go | 4 ++-- 8 files changed, 24 insertions(+), 26 deletions(-) diff --git a/modules/htlc/client/cli/flags.go b/modules/htlc/client/cli/flags.go index f43323bc..a23b7438 100644 --- a/modules/htlc/client/cli/flags.go +++ b/modules/htlc/client/cli/flags.go @@ -23,8 +23,8 @@ func init() { FsCreateHTLC.String(FlagTo, "", "Bech32 encoding address to receive tokens") FsCreateHTLC.String(FlagReceiverOnOtherChain, "", "Receiving address on the other chain") FsCreateHTLC.String(FlagAmount, "", "Amount to be transferred") - FsCreateHTLC.BytesHex(FlagSecret, nil, "The secret for generating the hash lock, randomly generated if omitted") - FsCreateHTLC.BytesHex(FlagHashLock, nil, "The sha256 hash generated from secret (and timestamp if provided), generated according to the secret flag if omitted") + FsCreateHTLC.String(FlagSecret, "", "The secret for generating the hash lock, randomly generated if omitted") + FsCreateHTLC.String(FlagHashLock, "", "The sha256 hash generated from secret (and timestamp if provided), generated according to the secret flag if omitted") FsCreateHTLC.Uint64(FlagTimestamp, 0, "The timestamp in seconds for generating the hash lock if provided") - FsCreateHTLC.String(FlagTimeLock, "", "The number of blocks to wait before tokens may be refunded") + FsCreateHTLC.Uint64(FlagTimeLock, 0, "The number of blocks to wait before tokens may be refunded") } diff --git a/modules/htlc/client/cli/tx.go b/modules/htlc/client/cli/tx.go index 4e762be4..6124f110 100644 --- a/modules/htlc/client/cli/tx.go +++ b/modules/htlc/client/cli/tx.go @@ -4,7 +4,6 @@ import ( "crypto/rand" "encoding/hex" "fmt" - "strconv" "strings" "github.com/spf13/cobra" @@ -89,11 +88,11 @@ func GetCmdCreateHTLC() *cobra.Command { return err } - timestamp, err := cmd.Flags().GetInt64(FlagTimestamp) + timestamp, err := cmd.Flags().GetUint64(FlagTimestamp) if err != nil { return err } - timeLock, err := cmd.Flags().GetString(FlagTimeLock) + timeLock, err := cmd.Flags().GetUint64(FlagTimeLock) if err != nil { return err } @@ -103,20 +102,20 @@ func GetCmdCreateHTLC() *cobra.Command { flags := cmd.Flags() if flags.Changed(FlagHashLock) { - rawHashLock, err := cmd.Flags().GetBytesHex(FlagHashLock) + rawHashLock, err := cmd.Flags().GetString(FlagHashLock) if err != nil { return err } - hashLockStr := strings.TrimSpace(hex.EncodeToString(rawHashLock)) + hashLockStr := strings.TrimSpace(rawHashLock) if hashLock, err = hex.DecodeString(hashLockStr); err != nil { return err } } else { - rawSecret, err := cmd.Flags().GetBytesHex(FlagSecret) + rawSecret, err := cmd.Flags().GetString(FlagSecret) if err != nil { return err } - secretStr := strings.TrimSpace(hex.EncodeToString(rawSecret)) + secretStr := strings.TrimSpace(rawSecret) if len(secretStr) > 0 { if len(secretStr) != 2*types.SecretLength { return fmt.Errorf("length of the secret must be %d in bytes", types.SecretLength) @@ -131,13 +130,12 @@ func GetCmdCreateHTLC() *cobra.Command { } } - hashLock = types.GetHashLock(secret, uint64(timestamp)) + hashLock = types.GetHashLock(secret, timestamp) } - timeLockRes,_ :=strconv.ParseUint(timeLock, 10, 64) msg := types.NewMsgCreateHTLC( sender, to, receiverOnOtherChain, amount, - hashLock, uint64(timestamp), timeLockRes, + hashLock, timestamp, timeLock, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/modules/oracle/client/cli/flags.go b/modules/oracle/client/cli/flags.go index 735bde76..06ad1bc5 100644 --- a/modules/oracle/client/cli/flags.go +++ b/modules/oracle/client/cli/flags.go @@ -43,7 +43,7 @@ func init() { FsCreateFeed.Int64(FlagTimeout, 0, "The maximum number of blocks to wait for a response since a request is sent, beyond which the request will be ignored") FsCreateFeed.String(FlagServiceFeeCap, "", "Only providers charging a fee lower than the cap will be invoked") FsCreateFeed.Uint64(FlagFrequency, 0, "The invocation frequency of sending repeated requests") - FsCreateFeed.Uint16(FlagThreshold, 0, "The minimum number of responses needed for aggregation, range [1, Length(providers)]") + FsCreateFeed.Uint32(FlagThreshold, 0, "The minimum number of responses needed for aggregation, range [1, Length(providers)]") FsCreateFeed.String(FlagCreator, "", "Address of the feed creator") FsStartFeed.String(FlagFeedName, "", "The unique identifier of the feed") diff --git a/modules/oracle/client/cli/tx.go b/modules/oracle/client/cli/tx.go index 68c1ce57..1bccf819 100644 --- a/modules/oracle/client/cli/tx.go +++ b/modules/oracle/client/cli/tx.go @@ -142,7 +142,7 @@ func GetCmdCreateFeed() *cobra.Command { if err != nil { return err } - threshold, err := cmd.Flags().GetUint16(FlagThreshold) + threshold, err := cmd.Flags().GetUint32(FlagThreshold) if err != nil { return err } @@ -158,7 +158,7 @@ func GetCmdCreateFeed() *cobra.Command { Timeout: timeout, ServiceFeeCap: serviceFeeCap, RepeatedFrequency: frequency, - ResponseThreshold: uint32(threshold), + ResponseThreshold: threshold, Creator: creator, } if err := msg.ValidateBasic(); err != nil { @@ -312,7 +312,7 @@ func GetCmdEditFeed() *cobra.Command { if err != nil { return err } - threshold, err := cmd.Flags().GetUint16(FlagThreshold) + threshold, err := cmd.Flags().GetUint32(FlagThreshold) if err != nil { return err } @@ -324,7 +324,7 @@ func GetCmdEditFeed() *cobra.Command { Timeout: timeout, ServiceFeeCap: serviceFeeCap, RepeatedFrequency: frequency, - ResponseThreshold: uint32(threshold), + ResponseThreshold: threshold, Creator: creator, } if err := msg.ValidateBasic(); err != nil { diff --git a/modules/service/client/cli/flags.go b/modules/service/client/cli/flags.go index 2ec86860..5a17ee52 100644 --- a/modules/service/client/cli/flags.go +++ b/modules/service/client/cli/flags.go @@ -67,7 +67,7 @@ func init() { FsCallService.StringSlice(FlagProviders, []string{}, "provider list to request") FsCallService.String(FlagServiceFeeCap, "", "maximum service fee to pay for a single request") FsCallService.String(FlagData, "", "content or file path of the request input, which is an Input JSON schema instance") - FsCallService.Uint64(FlagTimeout, 0, "request timeout") + FsCallService.Int64(FlagTimeout, 0, "request timeout") FsCallService.Bool(FlagSuperMode, false, "indicate if the signer is a super user") FsCallService.Bool(FlagRepeated, false, "indicate if the request is repetitive") FsCallService.Uint64(FlagFrequency, 0, "request frequency when repeated, default to timeout") diff --git a/modules/service/client/cli/tx.go b/modules/service/client/cli/tx.go index d9025db9..6caade90 100644 --- a/modules/service/client/cli/tx.go +++ b/modules/service/client/cli/tx.go @@ -598,7 +598,7 @@ func GetCmdCallService() *cobra.Command { } input = buf.String() - timeout, err := cmd.Flags().GetUint64(FlagTimeout) + timeout, err := cmd.Flags().GetInt64(FlagTimeout) if err != nil { return err } @@ -627,7 +627,7 @@ func GetCmdCallService() *cobra.Command { msg := types.NewMsgCallService( serviceName, providers, consumer, input, serviceFeeCap, - int64(timeout), superMode, repeated, frequency, total, + timeout, superMode, repeated, frequency, total, ) if err := msg.ValidateBasic(); err != nil { return err @@ -913,7 +913,7 @@ func GetCmdUpdateRequestContext() *cobra.Command { } } - timeout, err := cmd.Flags().GetUint64(FlagTimeout) + timeout, err := cmd.Flags().GetInt64(FlagTimeout) if err != nil { return err } @@ -928,7 +928,7 @@ func GetCmdUpdateRequestContext() *cobra.Command { msg := types.NewMsgUpdateRequestContext( requestContextID, providers, serviceFeeCap, - int64(timeout), frequency, total, consumer, + timeout, frequency, total, consumer, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/modules/token/client/cli/flags.go b/modules/token/client/cli/flags.go index 8a454ab3..6c373a0f 100644 --- a/modules/token/client/cli/flags.go +++ b/modules/token/client/cli/flags.go @@ -29,7 +29,7 @@ func init() { FsIssueToken.String(FlagSymbol, "", "the token symbol. Once created, it cannot be modified") FsIssueToken.String(FlagName, "", "the token name, e.g. IRIS Network") FsIssueToken.String(FlagMinUnit, "", "the minimum unit name of the token, e.g. wei") - FsIssueToken.Uint8(FlagScale, 0, "the token decimal. The maximum value is 18") + FsIssueToken.Uint32(FlagScale, 0, "the token decimal. The maximum value is 18") FsIssueToken.Uint64(FlagInitialSupply, 0, "the initial supply of the token") FsIssueToken.Uint64(FlagMaxSupply, types.MaximumMaxSupply, "the max supply of the token") FsIssueToken.Bool(FlagMintable, false, "whether the token can be minted, default to false") diff --git a/modules/token/client/cli/tx.go b/modules/token/client/cli/tx.go index 5c9e7af5..970914ac 100644 --- a/modules/token/client/cli/tx.go +++ b/modules/token/client/cli/tx.go @@ -77,7 +77,7 @@ func GetCmdIssueToken() *cobra.Command { if err != nil { return err } - scale, err := cmd.Flags().GetUint8(FlagScale) + scale, err := cmd.Flags().GetUint32(FlagScale) if err != nil { return err } @@ -98,7 +98,7 @@ func GetCmdIssueToken() *cobra.Command { Symbol: symbol, Name: name, MinUnit: minUnit, - Scale: uint32(scale), + Scale: scale, InitialSupply: initialSupply, MaxSupply: maxSupply, Mintable: mintable, From b2f678ae7608bceae68d330d2adb8d1b2c475b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=BF=AA?= Date: Mon, 26 Oct 2020 17:51:19 +0800 Subject: [PATCH 3/3] update flag files --- modules/htlc/client/cli/flags.go | 4 ++-- modules/htlc/client/cli/tx.go | 26 ++------------------------ 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/modules/htlc/client/cli/flags.go b/modules/htlc/client/cli/flags.go index a23b7438..15a99985 100644 --- a/modules/htlc/client/cli/flags.go +++ b/modules/htlc/client/cli/flags.go @@ -23,8 +23,8 @@ func init() { FsCreateHTLC.String(FlagTo, "", "Bech32 encoding address to receive tokens") FsCreateHTLC.String(FlagReceiverOnOtherChain, "", "Receiving address on the other chain") FsCreateHTLC.String(FlagAmount, "", "Amount to be transferred") - FsCreateHTLC.String(FlagSecret, "", "The secret for generating the hash lock, randomly generated if omitted") - FsCreateHTLC.String(FlagHashLock, "", "The sha256 hash generated from secret (and timestamp if provided), generated according to the secret flag if omitted") + FsCreateHTLC.BytesHex(FlagSecret, nil, "The secret for generating the hash lock, randomly generated if omitted") + FsCreateHTLC.BytesHex(FlagHashLock, nil, "The sha256 hash generated from secret (and timestamp if provided), generated according to the secret flag if omitted") FsCreateHTLC.Uint64(FlagTimestamp, 0, "The timestamp in seconds for generating the hash lock if provided") FsCreateHTLC.Uint64(FlagTimeLock, 0, "The number of blocks to wait before tokens may be refunded") } diff --git a/modules/htlc/client/cli/tx.go b/modules/htlc/client/cli/tx.go index 6124f110..5346afd1 100644 --- a/modules/htlc/client/cli/tx.go +++ b/modules/htlc/client/cli/tx.go @@ -1,11 +1,8 @@ package cli import ( - "crypto/rand" "encoding/hex" "fmt" - "strings" - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -102,34 +99,15 @@ func GetCmdCreateHTLC() *cobra.Command { flags := cmd.Flags() if flags.Changed(FlagHashLock) { - rawHashLock, err := cmd.Flags().GetString(FlagHashLock) + hashLock, err = cmd.Flags().GetBytesHex(FlagHashLock) if err != nil { return err } - hashLockStr := strings.TrimSpace(rawHashLock) - if hashLock, err = hex.DecodeString(hashLockStr); err != nil { - return err - } } else { - rawSecret, err := cmd.Flags().GetString(FlagSecret) + secret, err = cmd.Flags().GetBytesHex(FlagSecret) if err != nil { return err } - secretStr := strings.TrimSpace(rawSecret) - if len(secretStr) > 0 { - if len(secretStr) != 2*types.SecretLength { - return fmt.Errorf("length of the secret must be %d in bytes", types.SecretLength) - } - - if secret, err = hex.DecodeString(secretStr); err != nil { - return err - } - } else { - if _, err := rand.Read(secret); err != nil { - return err - } - } - hashLock = types.GetHashLock(secret, timestamp) }