From 493f94c688a4cc850f7401155cf1eb867cc130cf Mon Sep 17 00:00:00 2001 From: David Orchard Date: Tue, 10 Sep 2024 11:19:58 -0700 Subject: [PATCH] add logs to figure out Sign issue --- core/capabilities/gateway_connector/service_wrapper.go | 9 ++++++++- .../gateway_connector/service_wrapper_test.go | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/capabilities/gateway_connector/service_wrapper.go b/core/capabilities/gateway_connector/service_wrapper.go index de8696f182b..e0d31c78935 100644 --- a/core/capabilities/gateway_connector/service_wrapper.go +++ b/core/capabilities/gateway_connector/service_wrapper.go @@ -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) return gwCommon.SignData(h.signerKey, data...) } @@ -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 { @@ -119,6 +120,8 @@ func (e *ServiceWrapper) Start(ctx context.Context) error { return errors.New("node address mismatch") } + e.lggr.Infow("GatewayConnectorServiceWrapper signerKey", signerKey) + signer, err := NewConnectorSigner(e.config, signerKey, e.lggr) if err != nil { return err @@ -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 +} diff --git a/core/capabilities/gateway_connector/service_wrapper_test.go b/core/capabilities/gateway_connector/service_wrapper_test.go index 4da82fcfb30..6c517cff9ee 100644 --- a/core/capabilities/gateway_connector/service_wrapper_test.go +++ b/core/capabilities/gateway_connector/service_wrapper_test.go @@ -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) { @@ -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)