update linter
This commit is contained in:
parent
012a1b54bc
commit
1c33220834
2
Makefile
2
Makefile
|
@ -269,7 +269,7 @@ canary-test: node-canary
|
||||||
|
|
||||||
lint-install:
|
lint-install:
|
||||||
@# The following installs a specific version of golangci-lint, which is appropriate for a CI server to avoid different results from build to build
|
@# The following installs a specific version of golangci-lint, which is appropriate for a CI server to avoid different results from build to build
|
||||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $(GOPATH)/bin v1.10.2
|
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $(GOPATH)/bin v1.17.1
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
@echo "lint"
|
@echo "lint"
|
||||||
|
|
|
@ -95,9 +95,7 @@ func main() {
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
printUsage()
|
printUsage()
|
||||||
if err != nil {
|
|
||||||
logger.Error(err.Error())
|
logger.Error(err.Error())
|
||||||
}
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -617,7 +617,7 @@ func TestChildForPurpose(t *testing.T) {
|
||||||
|
|
||||||
// Check that the key generated by ChildForPurpose with KeyPurposeChat is different from the BIP44
|
// Check that the key generated by ChildForPurpose with KeyPurposeChat is different from the BIP44
|
||||||
if walletChild.String() == chatChild.String() {
|
if walletChild.String() == chatChild.String() {
|
||||||
t.Errorf("wrong chat key. expected to be diferrent from the wallet key")
|
t.Errorf("wrong chat key. expected to be different from the wallet key")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,8 @@ func TestGetFilterLogs(t *testing.T) {
|
||||||
logs, err := api.GetFilterLogs(context.TODO(), id)
|
logs, err := api.GetFilterLogs(context.TODO(), id)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Empty(t, logs)
|
require.Empty(t, logs)
|
||||||
require.Len(t, tracker.criterias, 1)
|
require.Len(t, tracker.criteria, 1)
|
||||||
rst, err := hexutil.DecodeBig(tracker.criterias[0]["fromBlock"].(string))
|
rst, err := hexutil.DecodeBig(tracker.criteria[0]["fromBlock"].(string))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, block, rst)
|
require.Equal(t, block, rst)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ type callTracker struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
calls int
|
calls int
|
||||||
reply [][]types.Log
|
reply [][]types.Log
|
||||||
criterias []map[string]interface{}
|
criteria []map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *callTracker) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error {
|
func (c *callTracker) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error {
|
||||||
|
@ -31,7 +31,7 @@ func (c *callTracker) CallContext(ctx context.Context, result interface{}, metho
|
||||||
return errors.New("unexpected length of args")
|
return errors.New("unexpected length of args")
|
||||||
}
|
}
|
||||||
crit := args[0].(map[string]interface{})
|
crit := args[0].(map[string]interface{})
|
||||||
c.criterias = append(c.criterias, crit)
|
c.criteria = append(c.criteria, crit)
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return errors.New("context canceled")
|
return errors.New("context canceled")
|
||||||
|
@ -73,7 +73,7 @@ func runLogsFetcherTest(t *testing.T, f *logsFilter, replies [][]types.Log, quer
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
require.Len(t, c.criterias, queries)
|
require.Len(t, c.criteria, queries)
|
||||||
return &c
|
return &c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ func TestLogsFetcherAdjusted(t *testing.T) {
|
||||||
{BlockNumber: 11}, {BlockNumber: 12},
|
{BlockNumber: 11}, {BlockNumber: 12},
|
||||||
}
|
}
|
||||||
c := runLogsFetcherTest(t, f, [][]types.Log{logs}, 2)
|
c := runLogsFetcherTest(t, f, [][]types.Log{logs}, 2)
|
||||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criterias[0]["fromBlock"])
|
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criteria[0]["fromBlock"])
|
||||||
require.Equal(t, c.criterias[1]["fromBlock"], "latest")
|
require.Equal(t, c.criteria[1]["fromBlock"], "latest")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAdjustedDueToReorg(t *testing.T) {
|
func TestAdjustedDueToReorg(t *testing.T) {
|
||||||
|
@ -110,9 +110,9 @@ func TestAdjustedDueToReorg(t *testing.T) {
|
||||||
{BlockNumber: 12, BlockHash: common.Hash{2, 2}},
|
{BlockNumber: 12, BlockHash: common.Hash{2, 2}},
|
||||||
}
|
}
|
||||||
c := runLogsFetcherTest(t, f, [][]types.Log{logs, reorg}, 3)
|
c := runLogsFetcherTest(t, f, [][]types.Log{logs, reorg}, 3)
|
||||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criterias[0]["fromBlock"])
|
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criteria[0]["fromBlock"])
|
||||||
require.Equal(t, "latest", c.criterias[1]["fromBlock"])
|
require.Equal(t, "latest", c.criteria[1]["fromBlock"])
|
||||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(11)), c.criterias[2]["fromBlock"])
|
require.Equal(t, hexutil.EncodeBig(big.NewInt(11)), c.criteria[2]["fromBlock"])
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLogsFetcherCanceledContext(t *testing.T) {
|
func TestLogsFetcherCanceledContext(t *testing.T) {
|
||||||
|
@ -127,6 +127,6 @@ func TestLogsFetcherCanceledContext(t *testing.T) {
|
||||||
}
|
}
|
||||||
cancel()
|
cancel()
|
||||||
c := runLogsFetcherTest(t, f, [][]types.Log{make([]types.Log, 2)}, 2)
|
c := runLogsFetcherTest(t, f, [][]types.Log{make([]types.Log, 2)}, 2)
|
||||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criterias[0]["fromBlock"])
|
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criteria[0]["fromBlock"])
|
||||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criterias[1]["fromBlock"])
|
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criteria[1]["fromBlock"])
|
||||||
}
|
}
|
||||||
|
|
|
@ -650,9 +650,6 @@ func (api *PublicAPI) SendPairingMessage(ctx context.Context, msg chat.SendDirec
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.PubKey = crypto.FromECDSAPub(&privateKey.PublicKey)
|
msg.PubKey = crypto.FromECDSAPub(&privateKey.PublicKey)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
protocolMessage, err := api.service.protocol.BuildDHMessage(privateKey, &privateKey.PublicKey, msg.Payload)
|
protocolMessage, err := api.service.protocol.BuildDHMessage(privateKey, &privateKey.PublicKey, msg.Payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -103,11 +104,7 @@ func EncryptSymmetric(key, plaintext []byte) ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
encrypted, err := aesgcm.Seal(nil, salt, plaintext, nil), nil
|
encrypted := aesgcm.Seal(nil, salt, plaintext, nil)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return append(encrypted, salt...), nil
|
return append(encrypted, salt...), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ func TestSymmetricEncryption(t *testing.T) {
|
||||||
t,
|
t,
|
||||||
32,
|
32,
|
||||||
len(cyphertext1),
|
len(cyphertext1),
|
||||||
"Cyphertext with the correct lenght should be generated")
|
"Cyphertext with the correct length should be generated")
|
||||||
|
|
||||||
require.NotEqualf(
|
require.NotEqualf(
|
||||||
t,
|
t,
|
||||||
|
|
|
@ -122,7 +122,7 @@ func (ps *ConnectionManager) Start() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
failuresPerServer[ev.Peer]++
|
failuresPerServer[ev.Peer]++
|
||||||
log.Debug("request to a mail server expired, disconncet a peer", "address", ev.Peer)
|
log.Debug("request to a mail server expired, disconnect a peer", "address", ev.Peer)
|
||||||
if failuresPerServer[ev.Peer] >= ps.maxFailures {
|
if failuresPerServer[ev.Peer] >= ps.maxFailures {
|
||||||
state.nodeDisconnected(ev.Peer)
|
state.nodeDisconnected(ev.Peer)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ const (
|
||||||
defaultTimeoutWaitAdded = 5 * time.Second
|
defaultTimeoutWaitAdded = 5 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var errProtocolNotInitialized = errors.New("procotol is not initialized")
|
var errProtocolNotInitialized = errors.New("protocol is not initialized")
|
||||||
|
|
||||||
// EnvelopeEventsHandler used for two different event types.
|
// EnvelopeEventsHandler used for two different event types.
|
||||||
type EnvelopeEventsHandler interface {
|
type EnvelopeEventsHandler interface {
|
||||||
|
|
Loading…
Reference in New Issue