Skip to content

Commit

Permalink
PR comments, remove Config from names etc
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidOrchard committed Sep 5, 2024
1 parent 518b858 commit 6f0e185
Show file tree
Hide file tree
Showing 24 changed files with 133 additions and 126 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-eggs-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

configuration updates
8 changes: 4 additions & 4 deletions core/config/capabilities_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ type CapabilitiesExternalRegistry interface {
RelayID() types.RelayID
}

type GatewayConnectorConfig interface {
type GatewayConnector interface {
ChainIDForNodeKey() string
NodeAddress() string
DonID() string
Gateways() []ConnectorGatewayConfig
Gateways() []ConnectorGateway
WsHandshakeTimeoutMillis() uint32
AuthMinChallengeLen() int
AuthTimestampToleranceSec() uint32
}

type ConnectorGatewayConfig interface {
type ConnectorGateway interface {
ID() string
URL() string
}
Expand All @@ -30,5 +30,5 @@ type Capabilities interface {
Peering() P2P
Dispatcher() Dispatcher
ExternalRegistry() CapabilitiesExternalRegistry
GatewayConnectorConfig() GatewayConnectorConfig
GatewayConnector() GatewayConnector
}
14 changes: 7 additions & 7 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -509,25 +509,25 @@ 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.GatewayConnectorConfig]
# ChainIDForNodeKey is the ChainID of the network
ChainIDForNodeKey = '0xfd29Dd9C980D715a64dace97F7A2AB98bcaE0fed' # Default
# NodeAddress is Workflow Node address
[Capabilities.GatewayConnector]
# ChainIDForNodeKey is the ChainID of the network associated with a private key to be used for authentication with Gateway nodes
ChainIDForNodeKey = '11155111' # Example
# NodeAddress is the address of the desired private key to be used for authentication with Gateway nodes
NodeAddress = '0x68902d681c28119f9b2531473a417088bf008e59' # Example
# DonID is the Id of the Don
DonID = 'example_don' # Example
# WsHandshakeTimeoutMillis is Websocket handshake timeout
WsHandshakeTimeoutMillis = 1000 # Example
# AuthMinChallengeLen is the minimum number of bytes in Authentication
# AuthMinChallengeLen is the minimum number of bytes in authentication challenge payload
AuthMinChallengeLen = 10 # Example
# AuthTimestampToleranceSec is Authentication timestamp tolerance
AuthTimestampToleranceSec = 10 # Example

[[Capabilities.GatewayConnectorConfig.Gateways]]
[[Capabilities.GatewayConnector.Gateways]]
# ID of the Gateway
ID = 'example_gateway' # Example
# URL of the Gateway
URL = 'ws://localhost:8081/node' # Example
URL = 'wss://localhost:8081/node' # Example

[Keeper]
# **ADVANCED**
Expand Down
19 changes: 9 additions & 10 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1480,17 +1480,17 @@ func (drl *DispatcherRateLimit) setFrom(f *DispatcherRateLimit) {
}
}

type GatewayConnectorConfig struct {
type GatewayConnector struct {
ChainIDForNodeKey *string
NodeAddress *string
DonID *string
Gateways []ConnectorGatewayConfig
Gateways []ConnectorGateway
WsHandshakeTimeoutMillis *uint32
AuthMinChallengeLen *int
AuthTimestampToleranceSec *uint32
}

func (r *GatewayConnectorConfig) setFrom(f *GatewayConnectorConfig) {
func (r *GatewayConnector) setFrom(f *GatewayConnector) {
if f.ChainIDForNodeKey != nil {
r.ChainIDForNodeKey = f.ChainIDForNodeKey
}
Expand All @@ -1503,7 +1503,6 @@ func (r *GatewayConnectorConfig) setFrom(f *GatewayConnectorConfig) {
r.DonID = f.DonID
}

// TODO: verify this copy by reference is ok, or does array need to be copied by value
if f.Gateways != nil {
r.Gateways = f.Gateways
}
Expand All @@ -1521,23 +1520,23 @@ func (r *GatewayConnectorConfig) setFrom(f *GatewayConnectorConfig) {
}
}

type ConnectorGatewayConfig struct {
type ConnectorGateway struct {
ID *string
URL *string
}

type Capabilities struct {
Peering P2P `toml:",omitempty"`
Dispatcher Dispatcher `toml:",omitempty"`
ExternalRegistry ExternalRegistry `toml:",omitempty"`
GatewayConnectorConfig GatewayConnectorConfig `toml:", omitempty"`
Peering P2P `toml:",omitempty"`
Dispatcher Dispatcher `toml:",omitempty"`
ExternalRegistry ExternalRegistry `toml:",omitempty"`
GatewayConnector GatewayConnector `toml:",omitempty"`
}

func (c *Capabilities) setFrom(f *Capabilities) {
c.Peering.setFrom(&f.Peering)
c.ExternalRegistry.setFrom(&f.ExternalRegistry)
c.Dispatcher.setFrom(&f.Dispatcher)
c.GatewayConnectorConfig.setFrom(&f.GatewayConnectorConfig)
c.GatewayConnector.setFrom(&f.GatewayConnector)
}

type ThresholdKeyShareSecrets struct {
Expand Down
36 changes: 18 additions & 18 deletions core/services/chainlink/config_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func (r *dispatcherRateLimit) PerSenderBurst() int {
return *r.r.PerSenderBurst
}

func (c *capabilitiesConfig) GatewayConnectorConfig() config.GatewayConnectorConfig {
return &gatewayConnectorConfig{
c: c.c.GatewayConnectorConfig,
func (c *capabilitiesConfig) GatewayConnector() config.GatewayConnector {
return &gatewayConnector{
c: c.c.GatewayConnector,
}
}

Expand All @@ -88,49 +88,49 @@ func (c *capabilitiesExternalRegistry) Address() string {
return *c.c.Address
}

type gatewayConnectorConfig struct {
c toml.GatewayConnectorConfig
type gatewayConnector struct {
c toml.GatewayConnector
}

func (c *gatewayConnectorConfig) ChainIDForNodeKey() string {
func (c *gatewayConnector) ChainIDForNodeKey() string {
return *c.c.ChainIDForNodeKey
}
func (c *gatewayConnectorConfig) NodeAddress() string {
func (c *gatewayConnector) NodeAddress() string {
return *c.c.NodeAddress
}

func (c *gatewayConnectorConfig) DonID() string {
func (c *gatewayConnector) DonID() string {
return *c.c.DonID
}

func (c *gatewayConnectorConfig) Gateways() []config.ConnectorGatewayConfig {
t := []config.ConnectorGatewayConfig{}
func (c *gatewayConnector) Gateways() []config.ConnectorGateway {
t := []config.ConnectorGateway{}
for index, element := range c.c.Gateways {
t[index] = &connectorGatewayConfig{element}
t[index] = &connectorGateway{element}
}
return t
}

func (c *gatewayConnectorConfig) WsHandshakeTimeoutMillis() uint32 {
func (c *gatewayConnector) WsHandshakeTimeoutMillis() uint32 {
return *c.c.WsHandshakeTimeoutMillis
}

func (c *gatewayConnectorConfig) AuthMinChallengeLen() int {
func (c *gatewayConnector) AuthMinChallengeLen() int {
return *c.c.AuthMinChallengeLen
}

func (c *gatewayConnectorConfig) AuthTimestampToleranceSec() uint32 {
func (c *gatewayConnector) AuthTimestampToleranceSec() uint32 {
return *c.c.AuthTimestampToleranceSec
}

type connectorGatewayConfig struct {
c toml.ConnectorGatewayConfig
type connectorGateway struct {
c toml.ConnectorGateway
}

func (c *connectorGatewayConfig) ID() string {
func (c *connectorGateway) ID() string {
return *c.c.ID
}

func (c *connectorGatewayConfig) URL() string {
func (c *connectorGateway) URL() string {
return *c.c.URL
}
18 changes: 9 additions & 9 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,15 @@ func TestConfig_Marshal(t *testing.T) {
PerSenderBurst: ptr(50),
},
},
GatewayConnectorConfig: toml.GatewayConnectorConfig{
ChainIDForNodeKey: ptr("0xfd29Dd9C980D715a64dace97F7A2AB98bcaE0fed"),
NodeAddress: ptr(""),
DonID: ptr(""),
WsHandshakeTimeoutMillis: ptr[uint32](0),
AuthMinChallengeLen: ptr[int](0),
AuthTimestampToleranceSec: ptr[uint32](0),
Gateways: []toml.ConnectorGatewayConfig{
{ID: ptr(""), URL: ptr("")},
GatewayConnector: toml.GatewayConnector{
ChainIDForNodeKey: ptr("11155111"),
NodeAddress: ptr("0x68902d681c28119f9b2531473a417088bf008e59"),
DonID: ptr("example_don"),
WsHandshakeTimeoutMillis: ptr[uint32](100),
AuthMinChallengeLen: ptr[int](10),
AuthTimestampToleranceSec: ptr[uint32](10),
Gateways: []toml.ConnectorGateway{
{ID: ptr("example_gateway"), URL: ptr("wss://localhost:8081/node")},
},
},
}
Expand Down
6 changes: 3 additions & 3 deletions core/services/chainlink/testdata/config-empty-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ Address = ''
NetworkID = 'evm'
ChainID = '1'

[Capabilities.GatewayConnectorConfig]
ChainIDForNodeKey = '0xfd29Dd9C980D715a64dace97F7A2AB98bcaE0fed'
[Capabilities.GatewayConnector]
ChainIDForNodeKey = ''
NodeAddress = ''
DonID = ''
WsHandshakeTimeoutMillis = 0
AuthMinChallengeLen = 0
AuthTimestampToleranceSec = 0

[[Capabilities.GatewayConnectorConfig.Gateways]]
[[Capabilities.GatewayConnector.Gateways]]
ID = ''
URL = ''
22 changes: 11 additions & 11 deletions core/services/chainlink/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,17 @@ Address = ''
NetworkID = 'evm'
ChainID = '1'

[Capabilities.GatewayConnectorConfig]
ChainIDForNodeKey = '0xfd29Dd9C980D715a64dace97F7A2AB98bcaE0fed'
NodeAddress = ''
DonID = ''
WsHandshakeTimeoutMillis = 0
AuthMinChallengeLen = 0
AuthTimestampToleranceSec = 0

[[Capabilities.GatewayConnectorConfig.Gateways]]
ID = ''
URL = ''
[Capabilities.GatewayConnector]
ChainIDForNodeKey = '11155111'
NodeAddress = '0x68902d681c28119f9b2531473a417088bf008e59'
DonID = 'example_don'
WsHandshakeTimeoutMillis = 100
AuthMinChallengeLen = 10
AuthTimestampToleranceSec = 10

[[Capabilities.GatewayConnector.Gateways]]
ID = 'example_gateway'
URL = 'wss://localhost:8081/node'

[[EVM]]
ChainID = '1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ Address = ''
NetworkID = 'evm'
ChainID = '1'

[Capabilities.GatewayConnectorConfig]
ChainIDForNodeKey = '0xfd29Dd9C980D715a64dace97F7A2AB98bcaE0fed'
[Capabilities.GatewayConnector]
ChainIDForNodeKey = ''
NodeAddress = ''
DonID = ''
WsHandshakeTimeoutMillis = 0
AuthMinChallengeLen = 0
AuthTimestampToleranceSec = 0

[[Capabilities.GatewayConnectorConfig.Gateways]]
[[Capabilities.GatewayConnector.Gateways]]
ID = ''
URL = ''

Expand Down
6 changes: 3 additions & 3 deletions core/web/resolver/testdata/config-empty-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ Address = ''
NetworkID = 'evm'
ChainID = '1'

[Capabilities.GatewayConnectorConfig]
ChainIDForNodeKey = '0xfd29Dd9C980D715a64dace97F7A2AB98bcaE0fed'
[Capabilities.GatewayConnector]
ChainIDForNodeKey = ''
NodeAddress = ''
DonID = ''
WsHandshakeTimeoutMillis = 0
AuthMinChallengeLen = 0
AuthTimestampToleranceSec = 0

[[Capabilities.GatewayConnectorConfig.Gateways]]
[[Capabilities.GatewayConnector.Gateways]]
ID = ''
URL = ''
22 changes: 11 additions & 11 deletions core/web/resolver/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,17 @@ Address = ''
NetworkID = 'evm'
ChainID = '1'

[Capabilities.GatewayConnectorConfig]
ChainIDForNodeKey = '0xfd29Dd9C980D715a64dace97F7A2AB98bcaE0fed'
NodeAddress = ''
DonID = ''
WsHandshakeTimeoutMillis = 0
AuthMinChallengeLen = 0
AuthTimestampToleranceSec = 0

[[Capabilities.GatewayConnectorConfig.Gateways]]
ID = ''
URL = ''
[Capabilities.GatewayConnector]
ChainIDForNodeKey = '11155111'
NodeAddress = '0x68902d681c28119f9b2531473a417088bf008e59'
DonID = 'example_don'
WsHandshakeTimeoutMillis = 100
AuthMinChallengeLen = 10
AuthTimestampToleranceSec = 10

[[Capabilities.GatewayConnector.Gateways]]
ID = 'example_gateway'
URL = 'wss://localhost:8081/node'

[[EVM]]
ChainID = '1'
Expand Down
6 changes: 3 additions & 3 deletions core/web/resolver/testdata/config-multi-chain-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ Address = ''
NetworkID = 'evm'
ChainID = '1'

[Capabilities.GatewayConnectorConfig]
ChainIDForNodeKey = '0xfd29Dd9C980D715a64dace97F7A2AB98bcaE0fed'
[Capabilities.GatewayConnector]
ChainIDForNodeKey = ''
NodeAddress = ''
DonID = ''
WsHandshakeTimeoutMillis = 0
AuthMinChallengeLen = 0
AuthTimestampToleranceSec = 0

[[Capabilities.GatewayConnectorConfig.Gateways]]
[[Capabilities.GatewayConnector.Gateways]]
ID = ''
URL = ''

Expand Down
Loading

0 comments on commit 6f0e185

Please sign in to comment.