Skip to content

Commit 29fb066

Browse files
committed
Add context.Context to Signer methods
For more details, see hyperledger-labs/yui-relayer#153 Signed-off-by: abicky <takeshi.arabiki@datachain.jp>
1 parent 1add2df commit 29fb066

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/cosmos/cosmos-sdk v0.50.5
99
github.com/cosmos/gogoproto v1.4.11
1010
github.com/ethereum/go-ethereum v1.14.12
11-
github.com/hyperledger-labs/yui-relayer v0.5.10
11+
github.com/hyperledger-labs/yui-relayer v0.5.11
1212
github.com/spf13/cobra v1.8.0
1313
github.com/tyler-smith/go-bip39 v1.1.0
1414
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0Jr
731731
github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw=
732732
github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w=
733733
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
734-
github.com/hyperledger-labs/yui-relayer v0.5.10 h1:j35SRowNfVDU3gvq4Th3Wy8ufRD5K4wbXDLQAGOgT8w=
735-
github.com/hyperledger-labs/yui-relayer v0.5.10/go.mod h1:kJvSmuagdDsSlvbnHtEHbhmkUlAS43/ArLDwukOKSlo=
734+
github.com/hyperledger-labs/yui-relayer v0.5.11 h1:tBDWJa96jQhxL9zLDbB94VvSgw0f8Xk9tqPuKMT3ARw=
735+
github.com/hyperledger-labs/yui-relayer v0.5.11/go.mod h1:kJvSmuagdDsSlvbnHtEHbhmkUlAS43/ArLDwukOKSlo=
736736
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
737737
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
738738
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=

pkg/hd/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package hd
22

33
import (
4-
fmt "fmt"
4+
"fmt"
55

66
"github.com/datachainlab/ibc-hd-signer/pkg/wallet"
77
"github.com/hyperledger-labs/yui-relayer/signer"

pkg/hd/signer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package hd
22

33
import (
4+
"context"
45
"crypto/ecdsa"
56
"fmt"
67

@@ -23,11 +24,11 @@ func NewSigner(mnemonic, path string) (*Signer, error) {
2324
return &Signer{key}, nil
2425
}
2526

26-
func (s *Signer) GetPublicKey() ([]byte, error) {
27+
func (s *Signer) GetPublicKey(_ context.Context) ([]byte, error) {
2728
return gethcrypto.CompressPubkey(&s.key.PublicKey), nil
2829
}
2930

30-
func (s *Signer) Sign(digest []byte) ([]byte, error) {
31+
func (s *Signer) Sign(_ context.Context, digest []byte) ([]byte, error) {
3132
sig, err := gethcrypto.Sign(digest, s.key)
3233
if err != nil {
3334
return nil, fmt.Errorf("failed to sign tx: %v", err)

pkg/hd/signer_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package hd
22

33
import (
4+
"context"
45
"encoding/hex"
56
"slices"
67
"testing"
@@ -28,7 +29,7 @@ func TestGetPublicKey(t *testing.T) {
2829
continue
2930
}
3031

31-
pkBytes, err := signer.GetPublicKey()
32+
pkBytes, err := signer.GetPublicKey(context.TODO())
3233
if c.isErr {
3334
if err == nil {
3435
t.Errorf("GetPublicKey(%s, %s) unexpectedly returned %v", c.mnemonic, c.path, pkBytes)
@@ -72,7 +73,7 @@ func TestSign(t *testing.T) {
7273
continue
7374
}
7475

75-
sign, err := signer.Sign(digest)
76+
sign, err := signer.Sign(context.TODO(), digest)
7677
if c.isErr {
7778
if err == nil {
7879
t.Errorf("Sign(%s, %s) unexpectedly returned %v", c.mnemonic, c.path, sign)

0 commit comments

Comments
 (0)