Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core/services/workflows/cmd/cre/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (

"go.uber.org/zap/zapcore"

"github.com/smartcontractkit/chainlink-common/pkg/settings"
"github.com/smartcontractkit/chainlink-common/pkg/settings/cresettings"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/workflows/cmd/cre/utils"
)
Expand All @@ -23,6 +26,7 @@ func main() {
enableBeholder bool
enableBilling bool
enableStandardCapabilities bool
enableAllChains bool
)

flag.StringVar(&wasmPath, "wasm", "", "Path to the WASM binary file")
Expand All @@ -32,6 +36,7 @@ func main() {
flag.BoolVar(&enableBeholder, "beholder", false, "Enable printing beholder messages to standard log")
flag.BoolVar(&enableBilling, "billing", false, "Enable to run a faked billing service that prints to the standard log.")
flag.BoolVar(&enableStandardCapabilities, "standardCapabilities", true, "Enable to use the latest production standard capability binaries for capabilities. The binaries must be available in local GOBIN.")
flag.BoolVar(&enableAllChains, "allChains", false, "Enable all chains in the workflow execution (for testing purposes).")
flag.Parse()

if wasmPath == "" {
Expand Down Expand Up @@ -81,5 +86,11 @@ func main() {
EnableBeholder: enableBeholder,
EnableStandardCapabilities: enableStandardCapabilities,
Lggr: lggr,
WorkflowSettingsCfgFn: func(cfg *cresettings.Workflows) {
cfg.ChainAllowed = settings.PerChainSelector(
settings.Bool(enableAllChains),
map[string]bool{},
)
},
})
}
4 changes: 3 additions & 1 deletion core/services/workflows/cmd/cre/utils/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/settings/cresettings"
"github.com/smartcontractkit/chainlink-protos/cre/go/sdk"
"github.com/smartcontractkit/chainlink/v2/core/capabilities"
v2 "github.com/smartcontractkit/chainlink/v2/core/services/workflows/v2"
Expand All @@ -22,6 +23,7 @@ type RunnerConfig struct {
EnableStandardCapabilities bool
Lggr logger.Logger
LifecycleHooks v2.LifecycleHooks
WorkflowSettingsCfgFn func(*cresettings.Workflows)
}

type RunnerHooks struct {
Expand Down Expand Up @@ -148,7 +150,7 @@ func (r *Runner) Run(
billingAddress = "localhost:4319"
}

engine, triggerSub, err := NewStandaloneEngine(ctx, cfg.Lggr, registry, binary, config, secrets, billingAddress, cfg.LifecycleHooks, workflowName)
engine, triggerSub, err := NewStandaloneEngine(ctx, cfg.Lggr, registry, binary, config, secrets, billingAddress, cfg.LifecycleHooks, workflowName, cfg.WorkflowSettingsCfgFn)
if err != nil {
fmt.Printf("Failed to create engine: %v\n", err)
os.Exit(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/custmsg"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/settings/cresettings"
"github.com/smartcontractkit/chainlink-common/pkg/settings/limits"
"github.com/smartcontractkit/chainlink-common/pkg/workflows/wasm/host"
sdkpb "github.com/smartcontractkit/chainlink-protos/cre/go/sdk"
Expand Down Expand Up @@ -60,6 +61,7 @@ func NewStandaloneEngine(
billingClientAddr string,
lifecycleHooks v2.LifecycleHooks,
workflowName string,
workflowSettingsCfgFn func(*cresettings.Workflows),
) (services.Service, []*sdkpb.TriggerSubscription, error) {
ctx = contexts.WithCRE(ctx, contexts.CRE{Owner: defaultOwner, Workflow: defaultWorkflowID})
labeler := custmsg.NewLabeler()
Expand All @@ -86,7 +88,7 @@ func NewStandaloneEngine(
}

lf := limits.Factory{Logger: logger.Named(lggr, "Limits")}
limiters, err := v2.NewLimiters(lf, nil)
limiters, err := v2.NewLimiters(lf, workflowSettingsCfgFn)
if err != nil {
return nil, nil, err
}
Expand Down
Loading