From ecf40ebe5be2b862618d4d274eef8b8c65828d2a Mon Sep 17 00:00:00 2001 From: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:41:41 +0100 Subject: [PATCH] Fixed lint errors --- core/capabilities/testutils/chain_reader.go | 2 +- core/capabilities/triggers/logevent/service.go | 17 +++++++---------- .../triggers/logevent/service_test.go | 9 ++++----- .../cmd/capabilities/log-event-trigger/main.go | 6 +----- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/core/capabilities/testutils/chain_reader.go b/core/capabilities/testutils/chain_reader.go index 976099c2a73..90b4e4ff478 100644 --- a/core/capabilities/testutils/chain_reader.go +++ b/core/capabilities/testutils/chain_reader.go @@ -8,7 +8,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" - "github.com/test-go/testify/require" + "github.com/stretchr/testify/require" commoncaps "github.com/smartcontractkit/chainlink-common/pkg/capabilities" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" diff --git a/core/capabilities/triggers/logevent/service.go b/core/capabilities/triggers/logevent/service.go index 36b6b467d53..8e19b8f62c2 100644 --- a/core/capabilities/triggers/logevent/service.go +++ b/core/capabilities/triggers/logevent/service.go @@ -44,27 +44,24 @@ func (config Config) Version(capabilityVersion string) string { return fmt.Sprintf(capabilityVersion, config.Network, config.ChainID) } -type Params struct { - Logger logger.Logger - Relayer core.Relayer - LogEventConfig Config -} - var _ capabilities.TriggerCapability = (*TriggerService)(nil) var _ services.Service = &TriggerService{} // Creates a new Cron Trigger Service. // Scheduling will commence on calling .Start() -func NewTriggerService(ctx context.Context, p Params) (*TriggerService, error) { - l := logger.Named(p.Logger, "LogEventTriggerCapabilityService") +func NewTriggerService(ctx context.Context, + lggr logger.Logger, + relayer core.Relayer, + logEventConfig Config) (*TriggerService, error) { + l := logger.Named(lggr, "LogEventTriggerCapabilityService") logEventStore := NewCapabilitiesStore[logEventTrigger, capabilities.TriggerResponse]() s := &TriggerService{ lggr: l, triggers: logEventStore, - relayer: p.Relayer, - logEventConfig: p.LogEventConfig, + relayer: relayer, + logEventConfig: logEventConfig, stopCh: make(services.StopChan), } var err error diff --git a/core/capabilities/triggers/logevent/service_test.go b/core/capabilities/triggers/logevent/service_test.go index 4c573a20839..f96411a4bc2 100644 --- a/core/capabilities/triggers/logevent/service_test.go +++ b/core/capabilities/triggers/logevent/service_test.go @@ -45,11 +45,10 @@ func TestLogEventTriggerEVMHappyPath(t *testing.T) { }, nil).Once() // Create Log Event Trigger Service and register trigger - logEventTriggerService, err := logevent.NewTriggerService(ctx, logevent.Params{ - Logger: th.BackendTH.Lggr, - Relayer: relayer, - LogEventConfig: logEventConfig, - }) + logEventTriggerService, err := logevent.NewTriggerService(ctx, + th.BackendTH.Lggr, + relayer, + logEventConfig) require.NoError(t, err) log1Ch, err := logEventTriggerService.RegisterTrigger(ctx, th.LogEmitterRegRequest) require.NoError(t, err) diff --git a/plugins/cmd/capabilities/log-event-trigger/main.go b/plugins/cmd/capabilities/log-event-trigger/main.go index 0c5f7d07aee..8abecf54aeb 100644 --- a/plugins/cmd/capabilities/log-event-trigger/main.go +++ b/plugins/cmd/capabilities/log-event-trigger/main.go @@ -105,11 +105,7 @@ func (cs *LogEventTriggerGRPCService) Initialise( // Set relayer and trigger in LogEventTriggerGRPCService cs.config = logEventConfig - cs.trigger, err = logevent.NewTriggerService(ctx, logevent.Params{ - Logger: cs.s.Logger, - Relayer: relayer, - LogEventConfig: logEventConfig, - }) + cs.trigger, err = logevent.NewTriggerService(ctx, cs.s.Logger, relayer, logEventConfig) if err != nil { return fmt.Errorf("error creating new trigger for chainID %s: %v", logEventConfig.ChainID, err) }