Skip to content

Commit

Permalink
Bump common
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-cordenier committed Nov 7, 2024
1 parent fe4e07c commit 444ffa0
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 52 deletions.
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/prometheus/client_golang v1.20.5
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4
github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241106193309-5560cd76211a
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae h1:uqce0bjNVYzFrrVLafXgyn8SVNdfOtZekLfAwQihHiA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae/go.mod h1:TQ9/KKXZ9vr8QAlUquqGpSvDCpR+DtABKPXZY4CiRns=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4 h1:2k65bPK7j7nnX1sn3PCJ543jtyd5wl4LJl5n41jl1hk=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4/go.mod h1:TQ9/KKXZ9vr8QAlUquqGpSvDCpR+DtABKPXZY4CiRns=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down
2 changes: 1 addition & 1 deletion core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
srvcs = append(srvcs, workflowRegistrySyncer)

delegates[job.Workflow] = workflows.NewDelegate(
globalLogger,
globalLogger.Named("WorkflowRegistrySyncer"),
opts.CapabilitiesRegistry,
workflowRegistrySyncer,
workflowORM,
Expand Down
98 changes: 59 additions & 39 deletions core/services/workflows/syncer/workflow_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
_ "embed"
"sync"
"time"

"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/types/core"
Expand Down Expand Up @@ -39,51 +40,70 @@ type WorkflowRegistry struct {
}

func (w *WorkflowRegistry) Start(ctx context.Context) error {
w.wg.Add(1)
go func() {
w.Logger.Info("starting hardcoded workflow...")

// HACK: don't load the workflow if we aren't a workflow node.
_, err := w.Registry.Get(ctx, "[email protected]")
if err != nil {
w.Logger.Info("not a workflow node, skipping hardcoded workflow")
return
}

moduleConfig := &host.ModuleConfig{Logger: logger.NullLogger, IsUncompressed: true}
spec, err := host.GetWorkflowSpec(ctx, moduleConfig, workflow, config)
if err != nil {
w.Logger.Errorf("failed to get workflow spec", err)
return
}

cfg := workflows.Config{
Lggr: w.Logger,
Workflow: *spec,
WorkflowID: workflowID,
WorkflowOwner: workflowOwner,
WorkflowName: workflowName,
Registry: w.Registry,
Store: w.Store,
Config: config,
Binary: workflow,
SecretsFetcher: w,
}
engine, err := workflows.NewEngine(ctx, cfg)
if err != nil {
w.Logger.Errorf("failed to create engine: %w", err)
return
}
err = engine.Start(ctx)
if err != nil {
w.Logger.Errorf("failed to start hardcoded workflow: %w", err)
return
timeout := time.After(5 * time.Minute)
ticker := time.NewTicker(10 * time.Second)

for {
select {
case <-timeout:
w.Logger.Info("timed out setting up hardcoded workflow")
return
case <-ticker.C:
success := w.trySetup()
if success {
return
}
}
}
w.subServices = []job.ServiceCtx{engine}
}()
return nil
}

func (w *WorkflowRegistry) trySetup() bool {
ctx := context.Background()
w.Logger.Info("starting hardcoded workflow...")

// HACK: don't load the workflow if we aren't a workflow node.
_, err := w.Registry.Get(ctx, "[email protected]")
if err != nil {
w.Logger.Info("not a workflow node, skipping hardcoded workflow")
return true
}

moduleConfig := &host.ModuleConfig{Logger: logger.NullLogger, IsUncompressed: true}
spec, err := host.GetWorkflowSpec(ctx, moduleConfig, workflow, config)
if err != nil {
w.Logger.Errorf("failed to get workflow spec", err)
return false
}

cfg := workflows.Config{
Lggr: w.Logger,
Workflow: *spec,
WorkflowID: workflowID,
WorkflowOwner: workflowOwner,
WorkflowName: workflowName,
Registry: w.Registry,
Store: w.Store,
Config: config,
Binary: workflow,
SecretsFetcher: w,
}
engine, err := workflows.NewEngine(ctx, cfg)
if err != nil {
w.Logger.Errorf("failed to create engine: %w", err)
return false
}
err = engine.Start(ctx)
if err != nil {
w.Logger.Errorf("failed to start hardcoded workflow: %w", err)
return false
}
w.subServices = []job.ServiceCtx{engine}
return true
}

func (w *WorkflowRegistry) Close() error {
for _, s := range w.subServices {
err := s.Close()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.27
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e
github.com/smartcontractkit/chainlink-feeds v0.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1077,8 +1077,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae h1:uqce0bjNVYzFrrVLafXgyn8SVNdfOtZekLfAwQihHiA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae/go.mod h1:TQ9/KKXZ9vr8QAlUquqGpSvDCpR+DtABKPXZY4CiRns=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4 h1:2k65bPK7j7nnX1sn3PCJ543jtyd5wl4LJl5n41jl1hk=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4/go.mod h1:TQ9/KKXZ9vr8QAlUquqGpSvDCpR+DtABKPXZY4CiRns=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.27
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4
github.com/smartcontractkit/chainlink-protos/job-distributor v0.4.0
github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.2
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1405,8 +1405,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae h1:uqce0bjNVYzFrrVLafXgyn8SVNdfOtZekLfAwQihHiA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae/go.mod h1:TQ9/KKXZ9vr8QAlUquqGpSvDCpR+DtABKPXZY4CiRns=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4 h1:2k65bPK7j7nnX1sn3PCJ543jtyd5wl4LJl5n41jl1hk=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4/go.mod h1:TQ9/KKXZ9vr8QAlUquqGpSvDCpR+DtABKPXZY4CiRns=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.33.0
github.com/slack-go/slack v0.15.0
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.5
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae h1:uqce0bjNVYzFrrVLafXgyn8SVNdfOtZekLfAwQihHiA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106142051-c7bded1c08ae/go.mod h1:TQ9/KKXZ9vr8QAlUquqGpSvDCpR+DtABKPXZY4CiRns=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4 h1:2k65bPK7j7nnX1sn3PCJ543jtyd5wl4LJl5n41jl1hk=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241106202532-3b320ad9b7c4/go.mod h1:TQ9/KKXZ9vr8QAlUquqGpSvDCpR+DtABKPXZY4CiRns=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down

0 comments on commit 444ffa0

Please sign in to comment.