Skip to content

Commit

Permalink
add logs to figure out Sign issue
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidOrchard committed Sep 10, 2024
1 parent 6519107 commit 493f94c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion core/capabilities/gateway_connector/service_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func NewConnectorSigner(config config.GatewayConnector, signerKey *ecdsa.Private
}

func (h *connectorSigner) Sign(data ...[]byte) ([]byte, error) {
h.lggr.Debugw("Sign signerKey", h.signerKey)

Check failure on line 53 in core/capabilities/gateway_connector/service_wrapper.go

View workflow job for this annotation

GitHub Actions / lint

odd number of arguments passed as key-value pairs for logging (loggercheck)
return gwCommon.SignData(h.signerKey, data...)
}

Expand Down Expand Up @@ -100,7 +101,7 @@ func NewGatewayConnectorServiceWrapper(config config.GatewayConnector, keystore
func (e *ServiceWrapper) Start(ctx context.Context) error {
return e.StartOnce("GatewayConnectorServiceWrapper", func() error {
conf := e.config
e.lggr.Infow("Starting GatewayConnectorServiceWrapper2", "chainID", conf.ChainIDForNodeKey())
e.lggr.Infow("Starting GatewayConnectorServiceWrapper", "chainID", conf.ChainIDForNodeKey())
chainID, _ := new(big.Int).SetString(conf.ChainIDForNodeKey(), 0)
enabledKeys, err := e.keystore.EnabledKeysForChain(ctx, chainID)
if err != nil {
Expand All @@ -119,6 +120,8 @@ func (e *ServiceWrapper) Start(ctx context.Context) error {
return errors.New("node address mismatch")
}

e.lggr.Infow("GatewayConnectorServiceWrapper signerKey", signerKey)

Check failure on line 123 in core/capabilities/gateway_connector/service_wrapper.go

View workflow job for this annotation

GitHub Actions / lint

odd number of arguments passed as key-value pairs for logging (loggercheck)

signer, err := NewConnectorSigner(e.config, signerKey, e.lggr)
if err != nil {
return err
Expand Down Expand Up @@ -149,3 +152,7 @@ func (e *ServiceWrapper) HealthReport() map[string]error {
func (e *ServiceWrapper) Name() string {
return "GatewayConnectorServiceWrapper"
}

func (e *ServiceWrapper) GetGatewayConnecgtor() connector.GatewayConnector {
return e.connector
}
6 changes: 3 additions & 3 deletions core/capabilities/gateway_connector/service_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey"
ksmocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/test-go/testify/mock"
)

func generateWrapper(t *testing.T, addr common.Address, keystoreAddr common.Address) (*ServiceWrapper, error) {
Expand All @@ -37,16 +37,16 @@ func generateWrapper(t *testing.T, addr common.Address, keystoreAddr common.Addr
}.New()
ethKeystore := ksmocks.NewEth(t)
ethKeystore.On("EnabledKeysForChain", mock.Anything, mock.Anything).Return([]ethkey.KeyV2{{Address: keystoreAddr}}, nil)

gc := config.Capabilities().GatewayConnector()
wrapper := NewGatewayConnectorServiceWrapper(gc, ethKeystore, logger)
require.NoError(t, err)
return wrapper, err

}

func TestGatewayConnectorServiceWrapper_CleanStartClose(t *testing.T) {
t.Parallel()
logger := logger.TestLogger(t)
logger.Infow("TestGatewayConnectorServiceWrapper_CleanStartClose")

_, addr := testutils.NewPrivateKeyAndAddress(t)
wrapper, err := generateWrapper(t, addr, addr)
Expand Down

0 comments on commit 493f94c

Please sign in to comment.