diff --git a/core/cmd/shell_local.go b/core/cmd/shell_local.go index 50411e10d42..8645dafede1 100644 --- a/core/cmd/shell_local.go +++ b/core/cmd/shell_local.go @@ -469,7 +469,7 @@ func (s *Shell) runNode(c *cli.Context) error { } } - if s.Config.Capabilities().Peering().Enabled() { + if s.Config.Capabilities().WorkflowRegistry().Address() != "" { err2 := app.GetKeyStore().Workflow().EnsureKey(rootCtx) if err2 != nil { return errors.Wrap(err2, "failed to ensure workflow key") diff --git a/core/config/capabilities_config.go b/core/config/capabilities_config.go index b7e5a3b86a7..74e06bf8bbb 100644 --- a/core/config/capabilities_config.go +++ b/core/config/capabilities_config.go @@ -11,6 +11,13 @@ type CapabilitiesExternalRegistry interface { RelayID() types.RelayID } +type CapabilitiesWorkflowRegistry interface { + Address() string + NetworkID() string + ChainID() string + RelayID() types.RelayID +} + type GatewayConnector interface { ChainIDForNodeKey() string NodeAddress() string @@ -30,5 +37,6 @@ type Capabilities interface { Peering() P2P Dispatcher() Dispatcher ExternalRegistry() CapabilitiesExternalRegistry + WorkflowRegistry() CapabilitiesWorkflowRegistry GatewayConnector() GatewayConnector } diff --git a/core/config/docs/core.toml b/core/config/docs/core.toml index e0fc76f449c..7227973f049 100644 --- a/core/config/docs/core.toml +++ b/core/config/docs/core.toml @@ -444,6 +444,14 @@ DeltaReconcile = '1m' # Default # but the host and port must be fully specified and cannot be empty. You can specify `0.0.0.0` (IPv4) or `::` (IPv6) to listen on all interfaces, but that is not recommended. ListenAddresses = ['1.2.3.4:9999', '[a52d:0:a88:1274::abcd]:1337'] # Example +[Capabilities.WorkflowRegistry] +# Address is the address for the workflow registry contract. +Address = '0x0' # Example +# NetworkID identifies the target network where the remote registry is located. +NetworkID = 'evm' # Default +# ChainID identifies the target chain id where the remote registry is located. +ChainID = '1' # Default + [Capabilities.ExternalRegistry] # Address is the address for the capabilities registry contract. Address = '0x0' # Example diff --git a/core/config/toml/types.go b/core/config/toml/types.go index d9302b81fb0..e1bc400b543 100644 --- a/core/config/toml/types.go +++ b/core/config/toml/types.go @@ -1448,6 +1448,26 @@ func (r *ExternalRegistry) setFrom(f *ExternalRegistry) { } } +type WorkflowRegistry struct { + Address *string + NetworkID *string + ChainID *string +} + +func (r *WorkflowRegistry) setFrom(f *WorkflowRegistry) { + if f.Address != nil { + r.Address = f.Address + } + + if f.NetworkID != nil { + r.NetworkID = f.NetworkID + } + + if f.ChainID != nil { + r.ChainID = f.ChainID + } +} + type Dispatcher struct { SupportedVersion *int ReceiverBufferSize *int @@ -1537,12 +1557,14 @@ type Capabilities struct { Peering P2P `toml:",omitempty"` Dispatcher Dispatcher `toml:",omitempty"` ExternalRegistry ExternalRegistry `toml:",omitempty"` + WorkflowRegistry WorkflowRegistry `toml:",omitempty"` GatewayConnector GatewayConnector `toml:",omitempty"` } func (c *Capabilities) setFrom(f *Capabilities) { c.Peering.setFrom(&f.Peering) c.ExternalRegistry.setFrom(&f.ExternalRegistry) + c.WorkflowRegistry.setFrom(&f.WorkflowRegistry) c.Dispatcher.setFrom(&f.Dispatcher) c.GatewayConnector.setFrom(&f.GatewayConnector) } diff --git a/core/services/chainlink/config_capabilities.go b/core/services/chainlink/config_capabilities.go index 032eec58bea..37ab1fce72f 100644 --- a/core/services/chainlink/config_capabilities.go +++ b/core/services/chainlink/config_capabilities.go @@ -22,6 +22,12 @@ func (c *capabilitiesConfig) ExternalRegistry() config.CapabilitiesExternalRegis } } +func (c *capabilitiesConfig) WorkflowRegistry() config.CapabilitiesWorkflowRegistry { + return &capabilitiesWorkflowRegistry{ + c: c.c.WorkflowRegistry, + } +} + func (c *capabilitiesConfig) Dispatcher() config.Dispatcher { return &dispatcher{d: c.c.Dispatcher} } @@ -88,6 +94,26 @@ func (c *capabilitiesExternalRegistry) Address() string { return *c.c.Address } +type capabilitiesWorkflowRegistry struct { + c toml.WorkflowRegistry +} + +func (c *capabilitiesWorkflowRegistry) RelayID() types.RelayID { + return types.NewRelayID(c.NetworkID(), c.ChainID()) +} + +func (c *capabilitiesWorkflowRegistry) NetworkID() string { + return *c.c.NetworkID +} + +func (c *capabilitiesWorkflowRegistry) ChainID() string { + return *c.c.ChainID +} + +func (c *capabilitiesWorkflowRegistry) Address() string { + return *c.c.Address +} + type gatewayConnector struct { c toml.GatewayConnector } diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 76b80672dbb..f8f3ea63193 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -494,6 +494,11 @@ func TestConfig_Marshal(t *testing.T) { ChainID: ptr("1"), NetworkID: ptr("evm"), }, + WorkflowRegistry: toml.WorkflowRegistry{ + Address: ptr(""), + ChainID: ptr("1"), + NetworkID: ptr("evm"), + }, Dispatcher: toml.Dispatcher{ SupportedVersion: ptr(1), ReceiverBufferSize: ptr(10000), diff --git a/core/services/chainlink/testdata/config-empty-effective.toml b/core/services/chainlink/testdata/config-empty-effective.toml index cd51afac5f8..93307673984 100644 --- a/core/services/chainlink/testdata/config-empty-effective.toml +++ b/core/services/chainlink/testdata/config-empty-effective.toml @@ -268,6 +268,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/core/services/chainlink/testdata/config-full.toml b/core/services/chainlink/testdata/config-full.toml index c6a5302a459..6b0e3f13390 100644 --- a/core/services/chainlink/testdata/config-full.toml +++ b/core/services/chainlink/testdata/config-full.toml @@ -278,6 +278,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '11155111' NodeAddress = '0x68902d681c28119f9b2531473a417088bf008e59' diff --git a/core/services/chainlink/testdata/config-multi-chain-effective.toml b/core/services/chainlink/testdata/config-multi-chain-effective.toml index e8da8142181..e32e42d7509 100644 --- a/core/services/chainlink/testdata/config-multi-chain-effective.toml +++ b/core/services/chainlink/testdata/config-multi-chain-effective.toml @@ -268,6 +268,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/core/web/resolver/testdata/config-empty-effective.toml b/core/web/resolver/testdata/config-empty-effective.toml index cd51afac5f8..93307673984 100644 --- a/core/web/resolver/testdata/config-empty-effective.toml +++ b/core/web/resolver/testdata/config-empty-effective.toml @@ -268,6 +268,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/core/web/resolver/testdata/config-full.toml b/core/web/resolver/testdata/config-full.toml index bfb0dcb9961..1ecc81b757c 100644 --- a/core/web/resolver/testdata/config-full.toml +++ b/core/web/resolver/testdata/config-full.toml @@ -278,6 +278,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '11155111' NodeAddress = '0x68902d681c28119f9b2531473a417088bf008e59' diff --git a/core/web/resolver/testdata/config-multi-chain-effective.toml b/core/web/resolver/testdata/config-multi-chain-effective.toml index 074cb82482b..ddea971d806 100644 --- a/core/web/resolver/testdata/config-multi-chain-effective.toml +++ b/core/web/resolver/testdata/config-multi-chain-effective.toml @@ -268,6 +268,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/docs/CONFIG.md b/docs/CONFIG.md index ff918468c07..05232f78b0e 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -1213,6 +1213,33 @@ ListenAddresses = ['1.2.3.4:9999', '[a52d:0:a88:1274::abcd]:1337'] # Example ListenAddresses is the addresses the peer will listen to on the network in `host:port` form as accepted by `net.Listen()`, but the host and port must be fully specified and cannot be empty. You can specify `0.0.0.0` (IPv4) or `::` (IPv6) to listen on all interfaces, but that is not recommended. +## Capabilities.WorkflowRegistry +```toml +[Capabilities.WorkflowRegistry] +Address = '0x0' # Example +NetworkID = 'evm' # Default +ChainID = '1' # Default +``` + + +### Address +```toml +Address = '0x0' # Example +``` +Address is the address for the workflow registry contract. + +### NetworkID +```toml +NetworkID = 'evm' # Default +``` +NetworkID identifies the target network where the remote registry is located. + +### ChainID +```toml +ChainID = '1' # Default +``` +ChainID identifies the target chain id where the remote registry is located. + ## Capabilities.ExternalRegistry ```toml [Capabilities.ExternalRegistry] diff --git a/testdata/scripts/config/merge_raw_configs.txtar b/testdata/scripts/config/merge_raw_configs.txtar index b3d50f22b36..500f19a17e2 100644 --- a/testdata/scripts/config/merge_raw_configs.txtar +++ b/testdata/scripts/config/merge_raw_configs.txtar @@ -415,6 +415,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/default.txtar b/testdata/scripts/node/validate/default.txtar index 5e8b847ceda..6c7d5c41a4f 100644 --- a/testdata/scripts/node/validate/default.txtar +++ b/testdata/scripts/node/validate/default.txtar @@ -280,6 +280,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/defaults-override.txtar b/testdata/scripts/node/validate/defaults-override.txtar index bf8bece28bf..ca03ab8e93e 100644 --- a/testdata/scripts/node/validate/defaults-override.txtar +++ b/testdata/scripts/node/validate/defaults-override.txtar @@ -341,6 +341,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/disk-based-logging-disabled.txtar b/testdata/scripts/node/validate/disk-based-logging-disabled.txtar index 2e72ed7e9bb..348014ff4aa 100644 --- a/testdata/scripts/node/validate/disk-based-logging-disabled.txtar +++ b/testdata/scripts/node/validate/disk-based-logging-disabled.txtar @@ -324,6 +324,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar b/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar index 7b27328f7a6..8a6ab802c8e 100644 --- a/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar +++ b/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar @@ -324,6 +324,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/disk-based-logging.txtar b/testdata/scripts/node/validate/disk-based-logging.txtar index 83d23546175..d5d1ae57a8a 100644 --- a/testdata/scripts/node/validate/disk-based-logging.txtar +++ b/testdata/scripts/node/validate/disk-based-logging.txtar @@ -324,6 +324,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/invalid-ocr-p2p.txtar b/testdata/scripts/node/validate/invalid-ocr-p2p.txtar index 3fccffc4e69..7e4cb786129 100644 --- a/testdata/scripts/node/validate/invalid-ocr-p2p.txtar +++ b/testdata/scripts/node/validate/invalid-ocr-p2p.txtar @@ -309,6 +309,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/invalid.txtar b/testdata/scripts/node/validate/invalid.txtar index 5ea0aa289a8..7da223c0253 100644 --- a/testdata/scripts/node/validate/invalid.txtar +++ b/testdata/scripts/node/validate/invalid.txtar @@ -314,6 +314,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/valid.txtar b/testdata/scripts/node/validate/valid.txtar index 26641c0ef76..a8936a38ce7 100644 --- a/testdata/scripts/node/validate/valid.txtar +++ b/testdata/scripts/node/validate/valid.txtar @@ -321,6 +321,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = '' diff --git a/testdata/scripts/node/validate/warnings.txtar b/testdata/scripts/node/validate/warnings.txtar index 51b3e897741..b8bbe1e78c1 100644 --- a/testdata/scripts/node/validate/warnings.txtar +++ b/testdata/scripts/node/validate/warnings.txtar @@ -303,6 +303,11 @@ Address = '' NetworkID = 'evm' ChainID = '1' +[Capabilities.WorkflowRegistry] +Address = '' +NetworkID = 'evm' +ChainID = '1' + [Capabilities.GatewayConnector] ChainIDForNodeKey = '' NodeAddress = ''