Skip to content

Commit

Permalink
Fixed lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kidambisrinivas committed Sep 30, 2024
1 parent de4485c commit ecf40eb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion core/capabilities/testutils/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 7 additions & 10 deletions core/capabilities/triggers/logevent/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions core/capabilities/triggers/logevent/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions plugins/cmd/capabilities/log-event-trigger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit ecf40eb

Please sign in to comment.