From 0120624bfd2b97fefb44cb4f868b3d25be86c07d Mon Sep 17 00:00:00 2001 From: anirudhwarrier <12178754+anirudhwarrier@users.noreply.github.com> Date: Fri, 9 Jan 2026 14:19:41 +0400 Subject: [PATCH] feat: update standalone engine to take workflow limit settings --- core/services/workflows/cmd/cre/main.go | 11 +++++++++++ core/services/workflows/cmd/cre/utils/runner.go | 4 +++- .../workflows/cmd/cre/utils/standalone_engine.go | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/services/workflows/cmd/cre/main.go b/core/services/workflows/cmd/cre/main.go index c1ff4426eb0..54c18481fca 100644 --- a/core/services/workflows/cmd/cre/main.go +++ b/core/services/workflows/cmd/cre/main.go @@ -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" ) @@ -23,6 +26,7 @@ func main() { enableBeholder bool enableBilling bool enableStandardCapabilities bool + enableAllChains bool ) flag.StringVar(&wasmPath, "wasm", "", "Path to the WASM binary file") @@ -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 == "" { @@ -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{}, + ) + }, }) } diff --git a/core/services/workflows/cmd/cre/utils/runner.go b/core/services/workflows/cmd/cre/utils/runner.go index a5db791a78e..6dafad457d9 100644 --- a/core/services/workflows/cmd/cre/utils/runner.go +++ b/core/services/workflows/cmd/cre/utils/runner.go @@ -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" @@ -22,6 +23,7 @@ type RunnerConfig struct { EnableStandardCapabilities bool Lggr logger.Logger LifecycleHooks v2.LifecycleHooks + WorkflowSettingsCfgFn func(*cresettings.Workflows) } type RunnerHooks struct { @@ -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) diff --git a/core/services/workflows/cmd/cre/utils/standalone_engine.go b/core/services/workflows/cmd/cre/utils/standalone_engine.go index d1eb04f9335..96aaf1399b0 100644 --- a/core/services/workflows/cmd/cre/utils/standalone_engine.go +++ b/core/services/workflows/cmd/cre/utils/standalone_engine.go @@ -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" @@ -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() @@ -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 }