Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b5d368d
Add TeeEnabled to template generator, and add a new requirements call…
nolag Apr 8, 2026
660e58a
Add region
nolag Apr 22, 2026
4294618
Requirements selecting runner
nolag Apr 22, 2026
0a4ed20
Merge branch 'main' into rtinianov_teeWorkflows
nolag Apr 23, 2026
a869861
update proto and fix requirement not met test
nolag Apr 24, 2026
16dba12
Update proto, allow individual triggers to choose where to run
nolag Apr 27, 2026
cf01251
Add max time for requirements selection
nolag Apr 27, 2026
b8745af
Use subscription for the trigger requirement
nolag Apr 27, 2026
2b8b244
Main module satisfies requirements
nolag Apr 28, 2026
58ec02d
remove unused hook from module, the selecting one is now responsible …
nolag Apr 29, 2026
937bc20
Hook to ask implementation to determine if it supports regions
nolag Apr 30, 2026
e578b91
Update protos to use full TEE requirement and not use bytes for the e…
nolag Apr 30, 2026
98d72c5
Send full requirements to modules that accept them
nolag Apr 30, 2026
8e8598d
Regions with any is allowed too, and let the TEE say everything it is…
nolag May 1, 2026
f0dfd6b
Update protos for unknown TEE Type
nolag May 4, 2026
b213255
Merge branch 'main' into rtinianov_teeWorkflows
nolag May 12, 2026
3860740
Fix misc tests that were fixed on a different branch, update to use p…
nolag May 20, 2026
179ae0e
Merge branch 'main' into rtinianov_teeWorkflows
nolag May 20, 2026
e612a5e
Remove file left from prior genreation and update to use the one from…
nolag May 20, 2026
7236bc1
Merge branch 'main' into rtinianov_teeWorkflows
nolag May 20, 2026
d826341
AI feedback addressed
nolag May 20, 2026
50c6721
Pin artifacts test build
nolag May 21, 2026
6762215
Merge branch 'main' into rtinianov_teeWorkflows
nolag May 21, 2026
ead638e
Merge branch 'main' into rtinianov_teeWorkflows
nolag May 29, 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
11 changes: 5 additions & 6 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ packages:
github.com/smartcontractkit/chainlink-common/pkg/workflows/wasm/host:
interfaces:
ModuleV1: {}
ModuleV2: {}
github.com/smartcontractkit/chainlink-common/pkg/workflows/host:
interfaces:
Module: {}
ExecutionHelper:
config:
inpackage: true
filename: "mock_{{.InterfaceName | snakecase}}_test.go"
mockname: "Mock{{.InterfaceName}}"
dir: "{{.InterfaceDir}}"
mockname: "Mock{{.InterfaceName}}"
github.com/smartcontractkit/chainlink-common/pkg/custmsg:
interfaces:
MessageEmitter:
Expand All @@ -64,4 +63,4 @@ packages:
dir: "{{.InterfaceDir}}/limits"
outpkg: limits
interfaces:
Getter:
Getter:
2 changes: 1 addition & 1 deletion pkg/beholder/chip_ingress_emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (c ChipIngressEmitterConfig) New(client chipingress.Client) (Emitter, error

return &ChipIngressEmitter{
client: client,
lggr: lggr,
lggr: lggr,
stopCh: make(services.StopChan),
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/beholder/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ func TestClient_batchEmitterService(t *testing.T) {
newBatchClient := func(t *testing.T) *beholder.Client {
t.Helper()
client, err := beholder.NewClient(beholder.Config{
OtelExporterGRPCEndpoint: "localhost:4317",
OtelExporterGRPCEndpoint: "localhost:4317",
// Use simple exporter in this lifecycle test to avoid batch flush/shutdown delays.
EmitterBatchProcessor: false,
LogBatchProcessor: false,
Expand Down
8 changes: 4 additions & 4 deletions pkg/beholder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Config struct {
EmitterMaxQueueSize int
// EmitterBatchProcessor controls custom-message export mode:
// true = batched async export; false = immediate per-record export.
EmitterBatchProcessor bool
EmitterBatchProcessor bool

// OTel Trace
TraceSampleRatio float64
Expand Down Expand Up @@ -127,7 +127,7 @@ func DefaultConfig() Config {
EmitterExportInterval: 1 * time.Second,
EmitterMaxQueueSize: 2048,
// Keep batched export enabled by default for throughput.
EmitterBatchProcessor: true,
EmitterBatchProcessor: true,
// OTel message log exporter retry config
LogRetryConfig: defaultRetryConfig.Copy(),
// Trace
Expand All @@ -148,8 +148,8 @@ func DefaultConfig() Config {
LogMaxQueueSize: 2048,
LogBatchProcessor: true,
LogStreamingEnabled: true, // Enable logs streaming by default
LogLevel: zapcore.InfoLevel,
LogCompressor: "gzip",
LogLevel: zapcore.InfoLevel,
LogCompressor: "gzip",
// Chip Ingress Batch Emitter
ChipIngressBatchEmitterEnabled: false,
ChipIngressBufferSize: 1000,
Expand Down
64 changes: 32 additions & 32 deletions pkg/capabilities/errors/error_codes.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,44 +144,44 @@ func (e ErrorCode) String() string {
}

var errorCodeToString = map[ErrorCode]string{
Canceled: "Canceled",
Unknown: "Unknown",
InvalidArgument: "InvalidArgument",
DeadlineExceeded: "DeadlineExceeded",
NotFound: "NotFound",
AlreadyExists: "AlreadyExists",
PermissionDenied: "PermissionDenied",
ResourceExhausted: "ResourceExhausted",
FailedPrecondition: "FailedPrecondition",
Aborted: "Aborted",
OutOfRange: "OutOfRange",
Unimplemented: "Unimplemented",
Internal: "Internal",
Unavailable: "Unavailable",
DataLoss: "DataLoss",
Unauthenticated: "Unauthenticated",
Canceled: "Canceled",
Unknown: "Unknown",
InvalidArgument: "InvalidArgument",
DeadlineExceeded: "DeadlineExceeded",
NotFound: "NotFound",
AlreadyExists: "AlreadyExists",
PermissionDenied: "PermissionDenied",
ResourceExhausted: "ResourceExhausted",
FailedPrecondition: "FailedPrecondition",
Aborted: "Aborted",
OutOfRange: "OutOfRange",
Unimplemented: "Unimplemented",
Internal: "Internal",
Unavailable: "Unavailable",
DataLoss: "DataLoss",
Unauthenticated: "Unauthenticated",
ConsensusFailed: "ConsensusFailed",
LimitExceeded: "LimitExceeded",
InsufficientObservations: "InsufficientObservations",
}

var stringToErrorCode = map[string]ErrorCode{
"Canceled": Canceled,
"Unknown": Unknown,
"InvalidArgument": InvalidArgument,
"DeadlineExceeded": DeadlineExceeded,
"NotFound": NotFound,
"AlreadyExists": AlreadyExists,
"PermissionDenied": PermissionDenied,
"ResourceExhausted": ResourceExhausted,
"FailedPrecondition": FailedPrecondition,
"Aborted": Aborted,
"OutOfRange": OutOfRange,
"Unimplemented": Unimplemented,
"Internal": Internal,
"Unavailable": Unavailable,
"DataLoss": DataLoss,
"Unauthenticated": Unauthenticated,
"Canceled": Canceled,
"Unknown": Unknown,
"InvalidArgument": InvalidArgument,
"DeadlineExceeded": DeadlineExceeded,
"NotFound": NotFound,
"AlreadyExists": AlreadyExists,
"PermissionDenied": PermissionDenied,
"ResourceExhausted": ResourceExhausted,
"FailedPrecondition": FailedPrecondition,
"Aborted": Aborted,
"OutOfRange": OutOfRange,
"Unimplemented": Unimplemented,
"Internal": Internal,
"Unavailable": Unavailable,
"DataLoss": DataLoss,
"Unauthenticated": Unauthenticated,
"ConsensusFailed": ConsensusFailed,
"LimitExceeded": LimitExceeded,
"InsufficientObservations": InsufficientObservations,
Expand Down
3 changes: 2 additions & 1 deletion pkg/capabilities/v2/actions/confidentialrelay/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
"hash"
"sort"

"github.com/smartcontractkit/chainlink-common/pkg/teeattestation"
"github.com/smartcontractkit/libocr/ragep2p/peeridhelper"

"github.com/smartcontractkit/chainlink-common/pkg/teeattestation"
)

const (
Expand Down
16 changes: 14 additions & 2 deletions pkg/capabilities/v2/protoc/pkg/template_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ func (t *TemplateGenerator) runTemplate(name, tmplText string, args any, partial

if md == nil {
return false, nil
} else {
return md.MapToUntypedApi, nil
}

return md.MapToUntypedApi, nil
},
"addImport": func(importPath protogen.GoImportPath, ignore string) string {
importName := importPath.String()
Expand Down Expand Up @@ -259,6 +259,18 @@ func (t *TemplateGenerator) runTemplate(name, tmplText string, args any, partial
return line
}
},
"TeeEnabled": func(s *protogen.Service) (bool, error) {
md, err := getCapabilityMetadata(s)
if err != nil {
return false, err
}
for _, env := range md.AdditionalEnvironments {
if env == generator.AdditionalEnvironments_ADDITIONAL_ENVIRONMENTS_TEE {
return true, nil
}
}
return false, nil
},
}).Funcs(t.ExtraFns)

// Register partials
Expand Down
40 changes: 20 additions & 20 deletions pkg/chipingress/batch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ type Client struct {
maxGRPCRequestSize int // configured max, used for metrics/error reporting
effectiveMaxRequestSize int // maxGRPCRequestSize minus grpcFramingOverhead, used for splitting
cloneEvent bool
maxConcurrentSends chan struct{}
batchInterval time.Duration
maxPublishTimeout time.Duration
messageBuffer chan *messageWithCallback
stopCh stopCh
log *zap.SugaredLogger
callbackWg sync.WaitGroup
shutdownTimeout time.Duration
shutdownOnce sync.Once
batcherDone chan struct{}
started bool
counters sync.Map // map[seqnumKey]*atomic.Uint64 for per-(source,type) seqnum, cleared on Stop()
maxConcurrentSends chan struct{}
batchInterval time.Duration
maxPublishTimeout time.Duration
messageBuffer chan *messageWithCallback
stopCh stopCh
log *zap.SugaredLogger
callbackWg sync.WaitGroup
shutdownTimeout time.Duration
shutdownOnce sync.Once
batcherDone chan struct{}
started bool
counters sync.Map // map[seqnumKey]*atomic.Uint64 for per-(source,type) seqnum, cleared on Stop()

metrics batchClientMetrics
}
Expand Down Expand Up @@ -77,14 +77,14 @@ func NewBatchClient(client chipingress.Client, opts ...Opt) (*Client, error) {
maxGRPCRequestSize: 10 * 1024 * 1024,
effectiveMaxRequestSize: 10*1024*1024 - grpcFramingOverhead,
cloneEvent: true,
maxConcurrentSends: make(chan struct{}, 1),
messageBuffer: make(chan *messageWithCallback, 200),
batchInterval: 100 * time.Millisecond,
maxPublishTimeout: 5 * time.Second,
stopCh: make(chan struct{}),
callbackWg: sync.WaitGroup{},
shutdownTimeout: 5 * time.Second,
batcherDone: make(chan struct{}),
maxConcurrentSends: make(chan struct{}, 1),
messageBuffer: make(chan *messageWithCallback, 200),
batchInterval: 100 * time.Millisecond,
maxPublishTimeout: 5 * time.Second,
stopCh: make(chan struct{}),
callbackWg: sync.WaitGroup{},
shutdownTimeout: 5 * time.Second,
batcherDone: make(chan struct{}),
}

for _, opt := range opts {
Expand Down
8 changes: 4 additions & 4 deletions pkg/workflows/artifacts/artifacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ func (s *ArtifactsTestSuite) TestArtifacts() {

s.lggr.Info("WorkflowCompiledBinary Size", "size", len(b64EncodedBinaryData))

// Compare the keccak256 hash of the binary data with the keccak256 hash of the
// base64 encoded binary from CRE-CLI
// Compare the keccak256 hash of the binary data against a value produced by
// the pinned Go toolchain (see GetBuildCmd in utils.go). Because Compile sets
// GOTOOLCHAIN from the nearest go.mod, this hash is stable across machines.
expKeccak256Hash, err := hex.DecodeString("a057a58ff8212122016515b2922b7c3893525f7f5afe95c8442e0cd629d68420")
s.NoError(err, "failed to decode expected keccak256 hash")
keccak256FromSha3Lib := sha3.NewLegacyKeccak256()
Expand All @@ -58,8 +59,7 @@ func (s *ArtifactsTestSuite) TestArtifacts() {
s.NoError(err, "failed to prepare artifacts")

base64EncodedBinaryData := artifacts.GetBinaryData()
// Compare if the compiled WASM binary is the same as the CRE-CLI output
s.Len(base64EncodedBinaryData, 636684, "binary data size should be same as CRE-CLI output")
s.Len(base64EncodedBinaryData, 636684, "binary data size should match the pinned toolchain output")
s.Equal("m1upG3s6AJQvOA8AAK295+EaARsHAADf/YcBgFURwPQAANDq5wFQVVVVVVVVVVVV3ZMQEI7ZtgMAAKqq",
string(base64EncodedBinaryData[0:80]))
s.Equal("gUEoFNoVRfyHGTsZmdg7wCJbGVibOhmYmsDAytgg92FTTmiddpI/x8SYzdANBkPGhtLoj/Hn7jvK26YE",
Expand Down
71 changes: 70 additions & 1 deletion pkg/workflows/artifacts/utils.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package artifacts

import (
"bufio"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)

Expand Down Expand Up @@ -78,10 +80,77 @@ func GetBuildCmd(inputFile string, outputFile string, rootFolder string) *exec.C
"-buildvcs=false",
inputFile,
)
buildCmd.Env = append(os.Environ(), "GOOS=wasip1", "GOARCH=wasm", "CGO_ENABLED=0")
env := append(os.Environ(), "GOOS=wasip1", "GOARCH=wasm", "CGO_ENABLED=0")
// Pin GOTOOLCHAIN to the version declared in the nearest go.mod so the
// compiled WASM is reproducible across machines whose local Go differs
// from go.mod (GOTOOLCHAIN=auto uses the local Go when it's newer).
if toolchain := goToolchainFromMod(rootFolder); toolchain != "" {
env = append(env, "GOTOOLCHAIN="+toolchain)
}
buildCmd.Env = env
}

buildCmd.Dir = rootFolder

return buildCmd
}

// goToolchainFromMod returns a GOTOOLCHAIN value (e.g. "go1.26.2") derived
// from the nearest go.mod walking up from startDir. Prefers the toolchain
// directive when present, falling back to the go directive. Returns "" when
// no go.mod or version can be determined.
func goToolchainFromMod(startDir string) string {
goModPath := findNearestGoMod(startDir)
if goModPath == "" {
return ""
}
f, err := os.Open(goModPath)
if err != nil {
return ""
}
defer f.Close()

var goVersion, toolchain string
scanner := bufio.NewScanner(f)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line == "" || strings.HasPrefix(line, "//") {
continue
}
fields := strings.Fields(line)
if len(fields) < 2 {
continue
}
switch fields[0] {
case "go":
goVersion = fields[1]
case "toolchain":
toolchain = fields[1]
}
}
if toolchain != "" {
return toolchain
}
if goVersion != "" {
return "go" + goVersion
}
return ""
}

func findNearestGoMod(startDir string) string {
dir, err := filepath.Abs(startDir)
if err != nil {
return ""
}
for {
candidate := filepath.Join(dir, "go.mod")
if info, err := os.Stat(candidate); err == nil && !info.IsDir() {
return candidate
}
parent := filepath.Dir(dir)
if parent == dir {
return ""
}
dir = parent
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading