Skip to content

Commit 6db2b42

Browse files
committed
Merge branch 'main' into bump-go-1-24
2 parents fbed7e7 + 0f9c523 commit 6db2b42

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

framework/clclient/client.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ import (
55
"crypto/rand"
66
"crypto/tls"
77
"fmt"
8-
"github.com/ethereum/go-ethereum/accounts/keystore"
9-
"github.com/ethereum/go-ethereum/crypto"
10-
"github.com/pkg/errors"
11-
"github.com/smartcontractkit/chainlink-testing-framework/framework"
12-
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/clnode"
138
"math/big"
149
"net/http"
1510
"os"
1611
"strings"
1712
"sync"
1813
"time"
1914

15+
"github.com/ethereum/go-ethereum/accounts/keystore"
16+
"github.com/ethereum/go-ethereum/crypto"
17+
"github.com/pkg/errors"
18+
"github.com/smartcontractkit/chainlink-testing-framework/framework"
19+
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/clnode"
20+
2021
"github.com/ethereum/go-ethereum/common"
2122
"github.com/go-resty/resty/v2"
2223
"github.com/rs/zerolog/log"
@@ -1239,19 +1240,21 @@ func (c *ChainlinkClient) GetForwarders() (*Forwarders, *http.Response, error) {
12391240
return response, resp.RawResponse, err
12401241
}
12411242

1242-
func NewETHKey(password string) ([]byte, error) {
1243+
func NewETHKey(password string) ([]byte, common.Address, error) {
12431244
privateKey, err := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
1245+
var address common.Address
12441246
if err != nil {
1245-
return nil, errors.Wrap(err, "failed to generate private key")
1247+
return nil, address, errors.Wrap(err, "failed to generate private key")
12461248
}
1249+
address = crypto.PubkeyToAddress(privateKey.PublicKey)
12471250
jsonKey, err := keystore.EncryptKey(&keystore.Key{
12481251
PrivateKey: privateKey,
1249-
Address: crypto.PubkeyToAddress(privateKey.PublicKey),
1252+
Address: address,
12501253
}, password, keystore.StandardScryptN, keystore.StandardScryptP)
12511254
if err != nil {
1252-
return nil, errors.Wrap(err, "failed to encrypt the keystore")
1255+
return nil, address, errors.Wrap(err, "failed to encrypt the keystore")
12531256
}
1254-
return jsonKey, nil
1257+
return jsonKey, address, nil
12551258
}
12561259

12571260
// ImportEVMKey imports EVM key to the node (encrypted go-ethereum JSON wallet format)

framework/examples/myproject/smoke_import_keys_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func generateP2PKeys(pwd string, n int) ([][]byte, error) {
3535
func generateEVMKeys(pwd string, n int) ([][]byte, error) {
3636
encryptedEVMKeyJSONs := make([][]byte, 0)
3737
for i := 0; i < n; i++ {
38-
key, err := clclient.NewETHKey(pwd)
38+
key, _, err := clclient.NewETHKey(pwd)
3939
if err != nil {
4040
return nil, err
4141
}

0 commit comments

Comments
 (0)