Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d61bee9
Add workflow key to standardcapabilities keystore, and update other k…
vreff Aug 7, 2025
bd3b5ce
bump chainlink-common & chainlink-evm
vreff Aug 12, 2025
538c8a4
add changeset
vreff Aug 12, 2025
82cd084
Merge remote-tracking branch 'origin' into PRIV-126-workflow-key
vreff Aug 13, 2025
649adf6
Merge remote-tracking branch 'origin' into PRIV-126-workflow-key
vreff Aug 13, 2025
c1012f8
fix merge conflict
vreff Aug 13, 2025
6c4d7a6
bump chainlink-solana
vreff Aug 13, 2025
5be22ee
fix changeset tag
vreff Aug 13, 2025
2ba7eb6
fix changeset 2
vreff Aug 13, 2025
e892fa6
undo change to wrong changeset
vreff Aug 13, 2025
f89a922
bump chainlink-deployments-framework
vreff Aug 13, 2025
9fecb7e
fix lint
vreff Aug 13, 2025
8014faf
chore: bump chainlink-tron/relayer
vreff Aug 15, 2025
c5c173e
Update capabilities test framework to provide workflow key
vreff Aug 15, 2025
0d043d9
Merge branch 'develop' into PRIV-126-workflow-key
vreff Aug 15, 2025
f3ea83a
fix merge conflicts
vreff Aug 15, 2025
7580df8
remove unused decrypts
vreff Aug 15, 2025
13f6dcf
remove cosmos decrypt
vreff Aug 15, 2025
f40060d
fix use of workflow key in testing framework
vreff Aug 15, 2025
b0160ee
temp fix for workflow key use
vreff Aug 15, 2025
b174796
Revert "temp fix for workflow key use"
vreff Aug 15, 2025
47e78c9
Revert "fix use of workflow key in testing framework"
vreff Aug 15, 2025
d617e7a
Revert "Update capabilities test framework to provide workflow key"
vreff Aug 15, 2025
9b0e4a7
Expose workflow public keys
vreff Aug 15, 2025
d5324d5
refactor NewSignerDecrypter in standardcapabilities delegate
vreff Aug 15, 2025
fc4ec74
Merge remote-tracking branch 'origin' into PRIV-126-workflow-key
vreff Aug 21, 2025
c5e8c7e
bump chainlink-common
vreff Aug 21, 2025
ed8399a
fix lint
vreff Aug 21, 2025
16713d4
Merge remote-tracking branch 'origin' into PRIV-126-workflow-key
vreff Aug 21, 2025
83ef402
remove unnecessary decrypt calls
vreff Aug 21, 2025
e7001bb
fix comment typo
vreff Aug 26, 2025
66fd626
Merge remote-tracking branch 'origin' into PRIV-126-workflow-key
vreff Aug 27, 2025
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/flat-snails-send.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#changed: add workflowKey to StandardCapabilities keystore
31 changes: 26 additions & 5 deletions core/capabilities/integration_tests/framework/don.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
coretypes "github.com/smartcontractkit/chainlink-common/pkg/types/core"
"github.com/smartcontractkit/chainlink-protos/cre/go/values"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/workflowkey"

kcr "github.com/smartcontractkit/chainlink-evm/gethwrappers/keystone/generated/capabilities_registry_1_1_0"
"github.com/smartcontractkit/chainlink-evm/pkg/assets"
Expand Down Expand Up @@ -111,11 +112,12 @@ func (c DonContext) WaitForWorkflowRegistryMetadata(t *testing.T, workflowName s

type capabilityNode struct {
*cltest.TestApplication
registry *capabilities.Registry
key ethkey.KeyV2
KeyBundle ocr2key.KeyBundle
peer peerIDAndOCRSigner
start func()
registry *capabilities.Registry
key ethkey.KeyV2
KeyBundle ocr2key.KeyBundle
peer peerIDAndOCRSigner
workflowKey *workflowkey.Key
start func()
}

type DON struct {
Expand Down Expand Up @@ -190,6 +192,14 @@ func NewDON(ctx context.Context, t *testing.T, lggr logger.Logger, donConfig Don
}
}, donContext.syncerFetcherFunc, donContext.computeFetcherFactory)
require.NoError(t, node.KeyStore.P2P().Add(ctx, donConfig.p2pKeys[i]))
workflowKeys, err := node.KeyStore.Workflow().GetAll()
require.NoError(t, err)

// Workflow nodes should only have at most 1 workflow key.
require.LessOrEqual(t, len(workflowKeys), 1)
if len(workflowKeys) == 1 {
cn.workflowKey = &workflowKeys[0]
}
require.NoError(t, node.Start(testutils.Context(t)))
cn.TestApplication = node
}
Expand Down Expand Up @@ -260,6 +270,17 @@ func (d *DON) GetPeerIDsAndOCRSigners() []peerIDAndOCRSigner {
return peers
}

func (d *DON) GetWorkflowPublicKeys() []*[32]byte {
keys := make([]*[32]byte, 0, len(d.nodes))
for _, node := range d.nodes {
if node.workflowKey != nil {
pubKey := node.workflowKey.PublicKey()
keys = append(keys, &pubKey)
}
}
return keys
}

func (d *DON) Start(ctx context.Context) error {
for _, triggerFactory := range d.triggerFactories {
for _, node := range d.nodes {
Expand Down
32 changes: 20 additions & 12 deletions core/services/standardcapabilities/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package standardcapabilities

import (
"context"
"crypto"
"fmt"

"github.com/google/uuid"
Expand Down Expand Up @@ -118,22 +119,29 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser

kvStore := job.NewKVStore(spec.ID, d.ds)

var keystore core.Keystore
if d.ks.P2P() != nil && d.externalPeerWrapper != nil {
key, err := d.ks.P2P().GetOrFirst(p2pkey.PeerID(d.externalPeerWrapper.GetPeer().ID()))
// Enable signing and decryption for the capability, if available.
var ks core.Keystore
var decrypter core.Decrypter
var signer crypto.Signer
if d.ks.Workflow() != nil {
workflowKeys, err := d.ks.Workflow().GetAll()
if err != nil {
return nil, fmt.Errorf("external peer wrapper does not pertain to a valid P2P key %x: %w", d.externalPeerWrapper.GetPeer().ID(), err)
return nil, fmt.Errorf("failed to get workflow keys: %w", err)
}
keystore, err = core.NewSingleAccountSigner(&core.P2PAccountKey, key)
if err != nil {
return nil, fmt.Errorf("failed to create single account signer for P2P key: %w", err)
if len(workflowKeys) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log a warning if the number of keys is more than 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decrypter = &workflowKeys[0]
}
} else {
var err error
keystore, err = core.NewSingleAccountSigner(nil, nil)
}
if d.ks.P2P() != nil && d.externalPeerWrapper != nil {
p2pKey, err := d.ks.P2P().GetOrFirst(p2pkey.PeerID(d.externalPeerWrapper.GetPeer().ID()))
if err != nil {
return nil, fmt.Errorf("failed to create empty single account signer: %w", err)
return nil, fmt.Errorf("external peer wrapper does not pertain to a valid P2P key %x: %w", d.externalPeerWrapper.GetPeer().ID(), err)
}
signer = p2pKey
}
ks, err := core.NewSignerDecrypter(core.StandardCapabilityAccount, signer, decrypter)
if err != nil {
return nil, fmt.Errorf("failed to create signer decrypter: %w", err)
}

telemetryService := generic.NewTelemetryAdapter(d.monitoringEndpointGen)
Expand Down Expand Up @@ -293,7 +301,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser
}

standardCapability := NewStandardCapabilities(log, spec.StandardCapabilitiesSpec, d.cfg, telemetryService, kvStore, d.registry, errorLog,
pr, relayerSet, oracleFactory, connector, keystore)
pr, relayerSet, oracleFactory, connector, ks)

return []job.ServiceCtx{standardCapability}, nil
}
Expand Down
Loading