Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
7b5f25e
resolve go.mod conflicts
nadahalli Mar 24, 2026
5599420
Revert file fetcher HTTP URL handling
nadahalli Mar 24, 2026
c1b8c7e
Restore comments in startAndRegisterEngine, extract newV2EngineConfig
nadahalli Mar 24, 2026
6667183
Unify engine creation flow for confidential and normal paths
nadahalli Apr 1, 2026
5036ad6
Restore initDone comment in tryEngineCreate
nadahalli Mar 24, 2026
417f1d3
Inline startAndRegisterEngine back into tryEngineCreate
nadahalli Mar 24, 2026
f0d05e0
Restore inline comments in wireInitDoneHook
nadahalli Mar 24, 2026
b0fdf2d
Restore original BeholderEmitter closure pattern in newV2EngineConfig
nadahalli Mar 24, 2026
b44ba45
Clean up factory signatures and newV2EngineConfig param ordering
nadahalli Apr 1, 2026
c438c07
Fix lint: errors.New, assert.Empty
nadahalli Mar 25, 2026
d112624
Add BinaryURLResolver to ConfidentialModule for presigned URL support
nadahalli Mar 26, 2026
5692670
add EmitUserMetric to stubExecutionHelper
nadahalli Apr 8, 2026
737f336
fix struct field alignment in ConfidentialModule
nadahalli Apr 8, 2026
7a33bf3
[CRE] [2/5] Relay DON node handler for confidential relay
nadahalli Mar 23, 2026
559b906
Add ConfidentialRelay config for relay DON handler
nadahalli Mar 24, 2026
74476ac
Remove Nitro-specific wording from attestation comments
nadahalli Mar 25, 2026
13bcba5
Look up trusted measurements from cap registry instead of TOML config
nadahalli Mar 25, 2026
009f21e
Also read CARootsPEM from cap registry, remove from TOML config
nadahalli Mar 25, 2026
8f0d5a2
Remove CARootsPEM from relay handler
nadahalli Mar 26, 2026
82126a9
Relay handler: use CARootsPEM from registry for fake enclave attestation
nadahalli Mar 27, 2026
745a181
forward relay metadata for remote capability execution
nadahalli Mar 31, 2026
1fd4841
add relay request metrics and use exported connector type
nadahalli Apr 1, 2026
86d5740
sanitize internal relay error messages
nadahalli Apr 1, 2026
31c3a1c
bump chainlink-common and sync relay config snapshots
nadahalli Apr 2, 2026
cacc2cc
[CRE] [5/5] Wire confidential workflow execution into CRE
nadahalli Apr 1, 2026
6800659
Remove launcher fix (relay DON will be configured as workflow DON ins…
nadahalli Mar 26, 2026
1b77006
Sync with latest PR 1/2/4 branches for E2E
nadahalli Mar 26, 2026
4943e46
Simplify relay feature plugin: only set Enabled, drop TrustedPCRs/CAR…
nadahalli Mar 26, 2026
9be708c
Update CC plugin refs to b7f4350
nadahalli Mar 26, 2026
f197519
Fix mock capability on-chain type: ACTION not TRIGGER
nadahalli Mar 26, 2026
8f38b3c
Make BinaryURLResolver injectable via WithBinaryURLResolver option
nadahalli Mar 26, 2026
7fb5ae5
Revert BinaryURLResolver changes
nadahalli Mar 26, 2026
b099f98
File fetcher: extract filename from HTTP URLs for local resolution
nadahalli Mar 27, 2026
50f3262
Update CC plugin refs to d7848a5
nadahalli Mar 27, 2026
6297bdd
Bump chainlink-common to c1870a5e, merge PR 1/5 review fixes, update …
nadahalli Mar 30, 2026
134c0a6
Unify sendResponseAndCleanup to handle both success and error paths
nadahalli Mar 30, 2026
bfa245d
Simplify `sendResponseAndCleanup`.
pavel-raykov Mar 30, 2026
1d331d8
Fix exhaustive lint: restore missing switch cases in recordMetrics an…
nadahalli Mar 31, 2026
5c6e446
fan out relay requests to don nodes concurrently
nadahalli Apr 1, 2026
a9cd43b
use cre settings for relay gateway rate limits
nadahalli Apr 2, 2026
8023f55
Rebase cw-5 on updated cw-4 and fix private plugin build
nadahalli Apr 8, 2026
82dd837
resolve go.mod conflicts
nadahalli Mar 24, 2026
30b0951
Revert file fetcher HTTP URL handling
nadahalli Mar 24, 2026
1d3412b
Restore comments in startAndRegisterEngine, extract newV2EngineConfig
nadahalli Mar 24, 2026
b8bf181
Unify engine creation flow for confidential and normal paths
nadahalli Apr 1, 2026
061f553
Restore initDone comment in tryEngineCreate
nadahalli Mar 24, 2026
0e00660
Inline startAndRegisterEngine back into tryEngineCreate
nadahalli Mar 24, 2026
edf7566
Restore inline comments in wireInitDoneHook
nadahalli Mar 24, 2026
6f3e39e
Restore original BeholderEmitter closure pattern in newV2EngineConfig
nadahalli Mar 24, 2026
d6d20dd
Clean up factory signatures and newV2EngineConfig param ordering
nadahalli Apr 1, 2026
71ae90f
Fix lint: errors.New, assert.Empty
nadahalli Mar 25, 2026
90c0f05
Add BinaryURLResolver to ConfidentialModule for presigned URL support
nadahalli Mar 26, 2026
830c81f
add EmitUserMetric to stubExecutionHelper
nadahalli Apr 8, 2026
5a538a0
fix struct field alignment in ConfidentialModule
nadahalli Apr 8, 2026
433ecda
set org_id on WorkflowExecution from CRE context
nadahalli Apr 10, 2026
7cc19be
merge develop into cw-4 for vault org_id changes
nadahalli Apr 10, 2026
626dbcb
plugins: pin confidential plugins to latest cc-test commit
nadahalli Apr 14, 2026
ab3c0c5
revert: keep t_helpers unchanged on cw-5 branch
nadahalli Apr 14, 2026
87a0d3b
plugins: bump confidential plugin refs to db40fb4
nadahalli Apr 14, 2026
e95b0e9
Revert "revert: keep t_helpers unchanged on cw-5 branch"
nadahalli Apr 14, 2026
e072e2b
Carry PR 21641 test delta missing from PR 21642
nadahalli Apr 14, 2026
352c861
block user workflows from calling system-only capabilities
nadahalli Apr 15, 2026
675426b
merge cw-4 (confidential module) into cw-5 (wire and tests)
nadahalli Apr 15, 2026
463ff00
Fix confidential relay service wiring to pass limits factory
nadahalli Apr 14, 2026
9c073ea
gofmt core/services/cre/cre.go after relay limits factory fix
nadahalli Apr 15, 2026
ef57b77
fix: restore relay handler and aggregator to develop versions
nadahalli Apr 16, 2026
00f883e
chore: rename confidential_relay to confidentialrelay
nadahalli Apr 16, 2026
87ed27e
revert: restore client_request_test.go to develop version
nadahalli Apr 16, 2026
940d1ec
fix comments: BinaryURLResolver is nil by design (PRIV-389)
nadahalli Apr 16, 2026
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
5 changes: 5 additions & 0 deletions .changeset/confidential-workflow-execution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Add confidential workflow execution: ConfidentialModule, relay handler, gateway wiring, single-DON capability fix #added #db_update
2 changes: 1 addition & 1 deletion core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1985,7 +1985,7 @@ type CreConfig struct {
// Requires [Tracing].Enabled = true for traces to be exported (trace export is gated by
// Tracing.Enabled in initGlobals; Telemetry.Enabled is optional—traces work with or without it).
// WARNING: This is not suitable for production use due to performance overhead.
DebugMode *bool `toml:",omitempty"`
DebugMode *bool `toml:",omitempty"`
ConfidentialRelay *ConfidentialRelayConfig `toml:",omitempty"`
}

Expand Down
2 changes: 1 addition & 1 deletion core/scripts/cre/environment/environment/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ func deployWorkflow(

fmt.Printf("\n⚙️ Registering workflow '%s' with the workflow registry\n\n", workflowNameFlag)

workflowID, registerErr := creworkflow.RegisterWithContract(ctx, sethClient, common.HexToAddress(workflowRegistryAddress), workflowRegistryVersion, uint64(donIDFlag), workflowNameFlag, "file://"+wasmWorkflowFilePathFlag, configPath, secretsPath, &containerTargetDirFlag)
workflowID, registerErr := creworkflow.RegisterWithContract(ctx, sethClient, common.HexToAddress(workflowRegistryAddress), workflowRegistryVersion, uint64(donIDFlag), workflowNameFlag, "file://"+wasmWorkflowFilePathFlag, configPath, secretsPath, nil, &containerTargetDirFlag)
if registerErr != nil {
return errors.Wrapf(registerErr, "❌ failed to register workflow %s", workflowNameFlag)
}
Expand Down
9 changes: 9 additions & 0 deletions core/services/cre/cre.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (

"github.com/smartcontractkit/chainlink/v2/core/capabilities"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/compute"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/confidentialrelay"
gatewayconnector "github.com/smartcontractkit/chainlink/v2/core/capabilities/gateway_connector"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/localcapmgr"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/remote"
Expand Down Expand Up @@ -171,6 +172,14 @@ func (s *Services) newSubservices(
}
s.GatewayConnectorWrapper = gatewayConnectorWrapper
srvs = append(srvs, gatewayConnectorWrapper)

relayService := confidentialrelay.NewService(
gatewayConnectorWrapper,
opts.CapabilitiesRegistry,
lggr,
opts.LimitsFactory,
)
srvs = append(srvs, relayService)
}

if cfg.CRE().Linking().URL() != "" {
Expand Down
1 change: 1 addition & 0 deletions core/services/job/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ type WorkflowSpec struct {
CreatedAt time.Time `toml:"-"`
UpdatedAt time.Time `toml:"-"`
SpecType WorkflowSpecType `toml:"spec_type" db:"spec_type"`
Attributes []byte `db:"attributes"`
sdkWorkflow *sdk.WorkflowSpec
rawSpec []byte
config []byte
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func GetCapabilityIDFromCommand(command string, config string) string {
return "http-trigger@1.0.0-alpha"
case "http_action":
return "http-actions@1.0.0-alpha" // plural "actions"
case "mock":
return "mock@1.0.0"
default:
return ""
}
Expand All @@ -71,6 +73,8 @@ func GetCommandFromCapabilityID(capabilityID string) string {
return "http_trigger"
case strings.HasPrefix(capabilityID, "http-actions"):
return "http_action"
case strings.HasPrefix(capabilityID, "mock"):
return "mock"
default:
return ""
}
Expand Down
9 changes: 6 additions & 3 deletions core/services/workflows/artifacts/v2/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ func (orm *orm) UpsertWorkflowSpec(ctx context.Context, spec *job.WorkflowSpec)
config_url,
created_at,
updated_at,
spec_type
spec_type,
attributes
) VALUES (
:workflow,
:config,
Expand All @@ -76,7 +77,8 @@ func (orm *orm) UpsertWorkflowSpec(ctx context.Context, spec *job.WorkflowSpec)
:config_url,
:created_at,
:updated_at,
:spec_type
:spec_type,
:attributes
) ON CONFLICT (workflow_id) DO UPDATE
SET
workflow = EXCLUDED.workflow,
Expand All @@ -89,7 +91,8 @@ func (orm *orm) UpsertWorkflowSpec(ctx context.Context, spec *job.WorkflowSpec)
config_url = EXCLUDED.config_url,
created_at = EXCLUDED.created_at,
updated_at = EXCLUDED.updated_at,
spec_type = EXCLUDED.spec_type
spec_type = EXCLUDED.spec_type,
attributes = EXCLUDED.attributes
RETURNING id
`

Expand Down
3 changes: 3 additions & 0 deletions core/services/workflows/syncer/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ func newFileFetcher(basePath string, lggr logger.Logger) types.FetcherFunc {
if err != nil {
return nil, fmt.Errorf("invalid URL: %w", err)
}
if u.Scheme == "http" || u.Scheme == "https" {
u.Path = filepath.Base(u.Path)
}
fullPath := filepath.Clean(u.Path)

// ensure that the incoming request URL is either relative or absolute but within the basePath
Expand Down
5 changes: 5 additions & 0 deletions core/services/workflows/syncer/v2/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ func newFileFetcher(basePath string, lggr logger.Logger) types.FetcherFunc {
if err != nil {
return nil, fmt.Errorf("invalid URL: %w", err)
}
// Confidential workflows register with HTTP URLs (for the enclave).
// Extract the filename so the file fetcher can find the local copy.
if u.Scheme == "http" || u.Scheme == "https" {
u.Path = filepath.Base(u.Path)
}
fullPath := filepath.Clean(u.Path)

// ensure that the incoming request URL is either relative or absolute but within the basePath
Expand Down
200 changes: 133 additions & 67 deletions core/services/workflows/syncer/v2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ func (h *eventHandler) createWorkflowSpec(ctx context.Context, payload WorkflowR
SpecType: job.WASMFile,
BinaryURL: payload.BinaryURL,
ConfigURL: payload.ConfigURL,
Attributes: payload.Attributes,
}

if _, err = h.workflowArtifactsStore.UpsertWorkflowSpec(ctx, entry); err != nil {
Expand Down Expand Up @@ -658,60 +659,9 @@ func (h *eventHandler) engineFactoryFn(ctx context.Context, workflowID string, o
}

// V2 aka "NoDAG"
cfg := &v2.EngineConfig{
Lggr: h.lggr,
Module: module,
WorkflowConfig: config,
CapRegistry: h.capRegistry,
DonSubscriber: h.workflowDonSubscriber,
UseLocalTimeProvider: h.useLocalTimeProvider,
DonTimeStore: h.donTimeStore,
ExecutionsStore: h.workflowStore,
WorkflowID: workflowID,
WorkflowOwner: owner,
WorkflowName: name,
WorkflowTag: tag,
WorkflowEncryptionKey: h.workflowEncryptionKey,

LocalLimits: v2.EngineLimits{}, // all defaults
LocalLimiters: h.engineLimiters,
FeatureFlags: h.featureFlags,
GlobalExecutionConcurrencyLimiter: h.workflowLimits,

BeholderEmitter: func() custmsg.MessageEmitter {
h.emitterMu.RLock()
defer h.emitterMu.RUnlock()
return h.emitter
}(),
BillingClient: h.billingClient,

WorkflowRegistryAddress: h.workflowRegistryAddress,
WorkflowRegistryChainSelector: h.workflowRegistryChainSelector,
OrgResolver: h.orgResolver,
DebugMode: h.debugMode,
SecretsFetcher: h.secretsFetcher,
SdkName: sdkName,
cfg := h.newV2EngineConfig(module, workflowID, owner, tag, sdkName, name, config)

ShardOrchestratorClient: h.shardOrchestratorClient,
ShardingEnabled: h.shardingEnabled,
MyShardID: h.myShardID,
ShardRoutingSteady: h.shardRoutingSteady,
}

// Wire the initDone channel to the OnInitialized lifecycle hook.
// This will be called when the engine completes initialization (including trigger subscriptions).
// We compose with any existing hook to avoid overwriting test hooks or other user-provided hooks.
if initDone != nil {
existingHook := cfg.Hooks.OnInitialized
cfg.Hooks.OnInitialized = func(err error) {
// Signal completion to the handler first
initDone <- err
// Then call any existing hook (e.g., from tests)
if existingHook != nil {
existingHook(err)
}
}
}
h.wireInitDoneHook(cfg, initDone)

return v2.NewEngine(cfg)
}
Expand Down Expand Up @@ -824,24 +774,35 @@ func (h *eventHandler) tryEngineCreate(ctx context.Context, spec *job.WorkflowSp
return fmt.Errorf("invalid workflow name: %w", err)
}

confidential, err := v2.IsConfidential(spec.Attributes)
if err != nil {
return fmt.Errorf("failed to parse workflow attributes: %w", err)
}

// Create a channel to receive the initialization result.
// This allows us to wait for the engine to complete initialization (including trigger subscriptions)
// before emitting the workflowActivated event, ensuring the event accurately reflects deployment status.
initDone := make(chan error, 1)

// Scope the engineFactory call so that decodedBinary goes out of scope immediately after the factory returns
engine, err := func() (services.Service, error) {
return h.engineFactory(
ctx,
spec.WorkflowID,
spec.WorkflowOwner,
workflowName,
spec.WorkflowTag,
configBytes,
decodedBinary,
initDone,
)
}()
var engine services.Service

if confidential {
h.lggr.Infow("routing workflow to confidential execution", "workflowID", spec.WorkflowID)
engine, err = h.confidentialEngineFactory(spec, workflowName, decodedBinary, initDone)
} else {
// Scope the engineFactory call so that decodedBinary goes out of scope immediately after the factory returns
engine, err = func() (services.Service, error) {
return h.engineFactory(
ctx,
spec.WorkflowID,
spec.WorkflowOwner,
workflowName,
spec.WorkflowTag,
configBytes,
decodedBinary,
initDone,
)
}()
}
if err != nil {
return fmt.Errorf("failed to create workflow engine: %w", err)
}
Expand Down Expand Up @@ -898,6 +859,111 @@ func (h *eventHandler) tryEngineCreate(ctx context.Context, spec *job.WorkflowSp
return nil
}

// newV2EngineConfig builds the common EngineConfig shared by both the normal
// WASM engine and the confidential engine paths. Caller supplies the module.
func (h *eventHandler) newV2EngineConfig(
module host.ModuleV2,
workflowID, owner, tag, sdkName string,
name types.WorkflowName,
config []byte,
) *v2.EngineConfig {
return &v2.EngineConfig{
Lggr: h.lggr,
Module: module,
WorkflowConfig: config,
CapRegistry: h.capRegistry,
DonSubscriber: h.workflowDonSubscriber,
UseLocalTimeProvider: h.useLocalTimeProvider,
DonTimeStore: h.donTimeStore,
ExecutionsStore: h.workflowStore,
WorkflowID: workflowID,
WorkflowOwner: owner,
WorkflowName: name,
WorkflowTag: tag,
WorkflowEncryptionKey: h.workflowEncryptionKey,

LocalLimits: v2.EngineLimits{}, // all defaults
LocalLimiters: h.engineLimiters,
FeatureFlags: h.featureFlags,
GlobalExecutionConcurrencyLimiter: h.workflowLimits,

BeholderEmitter: func() custmsg.MessageEmitter {
h.emitterMu.RLock()
defer h.emitterMu.RUnlock()
return h.emitter
}(),
BillingClient: h.billingClient,

WorkflowRegistryAddress: h.workflowRegistryAddress,
WorkflowRegistryChainSelector: h.workflowRegistryChainSelector,
OrgResolver: h.orgResolver,
SecretsFetcher: h.secretsFetcher,
DebugMode: h.debugMode,
SdkName: sdkName,

ShardOrchestratorClient: h.shardOrchestratorClient,
ShardingEnabled: h.shardingEnabled,
MyShardID: h.myShardID,
ShardRoutingSteady: h.shardRoutingSteady,
}
}

// wireInitDoneHook wires the initDone channel to the OnInitialized lifecycle hook.
// This will be called when the engine completes initialization (including trigger subscriptions).
// We compose with any existing hook to avoid overwriting test hooks or other user-provided hooks.
func (h *eventHandler) wireInitDoneHook(cfg *v2.EngineConfig, initDone chan<- error) {
if initDone == nil {
return
}
existingHook := cfg.Hooks.OnInitialized
cfg.Hooks.OnInitialized = func(err error) {
// Signal completion to the handler first
initDone <- err
// Then call any existing hook (e.g., from tests)
if existingHook != nil {
existingHook(err)
}
}
}

// confidentialEngineFactory creates a V2 engine backed by a ConfidentialModule
// instead of a local WASM module. The ConfidentialModule delegates execution to
// the confidential-workflows capability which runs the WASM inside a TEE.
func (h *eventHandler) confidentialEngineFactory(
spec *job.WorkflowSpec,
workflowName types.WorkflowName,
decodedBinary []byte,
initDone chan<- error,
) (services.Service, error) {
attrs, err := v2.ParseWorkflowAttributes(spec.Attributes)
if err != nil {
return nil, fmt.Errorf("failed to parse workflow attributes: %w", err)
}

binaryHash := v2.ComputeBinaryHash(decodedBinary)

lggr := logger.Named(h.lggr, "WorkflowEngine.ConfidentialModule")
lggr = logger.With(lggr, "workflowID", spec.WorkflowID, "workflowName", spec.WorkflowName, "workflowOwner", spec.WorkflowOwner)

// nil resolver: raw binaryURL (an identifier, not directly fetchable) is passed
// to the enclave as-is. The enclave fetches the binary via a credentials sidecar
// that authenticates to the storage service directly (PRIV-389).
module := v2.NewConfidentialModule(
h.capRegistry,
spec.BinaryURL,
binaryHash,
spec.WorkflowID, spec.WorkflowOwner, workflowName.String(), spec.WorkflowTag,
attrs.VaultDonSecrets,
nil,
lggr,
)

cfg := h.newV2EngineConfig(module, spec.WorkflowID, spec.WorkflowOwner, spec.WorkflowTag, "", workflowName, []byte(spec.Config))
h.wireInitDoneHook(cfg, initDone)

return v2.NewEngine(cfg)
}

// logCustMsg emits a custom message to the external sink and logs an error if that fails.
func logCustMsg(ctx context.Context, cma custmsg.MessageEmitter, msg string, log logger.Logger) {
err := cma.Emit(ctx, msg)
Expand Down
Loading
Loading