From d0d1dd9e84a127853025c60584edaa087bcefb47 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 4 Oct 2024 09:08:32 -0400 Subject: [PATCH] Add LLOConfigMode in preparation for blue/green deploys (#14634) - Currently only "mercury" is supported, in future additional config modes will be available --- core/services/ocr2/plugins/llo/integration_test.go | 1 + core/services/relay/evm/evm.go | 6 ++++++ core/services/relay/evm/types/types.go | 13 ++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/core/services/ocr2/plugins/llo/integration_test.go b/core/services/ocr2/plugins/llo/integration_test.go index a6de2172346..ae3fc07cf4f 100644 --- a/core/services/ocr2/plugins/llo/integration_test.go +++ b/core/services/ocr2/plugins/llo/integration_test.go @@ -255,6 +255,7 @@ func TestIntegration_LLO(t *testing.T) { chainID = "%s" fromBlock = %d lloDonID = %d +lloConfigMode = "mercury" `, chainID, fromBlock, donID) addBootstrapJob(t, bootstrapNode, configuratorAddress, "job-2", relayType, relayConfig) diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 6031d396936..40a081024d2 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -477,6 +477,12 @@ func (r *Relayer) NewLLOProvider(rargs commontypes.RelayArgs, pargs commontypes. return nil, fmt.Errorf("failed to get relay config: %w", err) } } + if relayConfig.LLODONID == 0 { + return nil, errors.New("donID must be specified in relayConfig for LLO jobs") + } + if relayConfig.LLOConfigMode != types.LLOConfigModeMercury { + return nil, fmt.Errorf("LLOConfigMode must be specified in relayConfig for LLO jobs (only %q is currently supported)", types.LLOConfigModeMercury) + } var lloCfg lloconfig.PluginConfig if err := json.Unmarshal(pargs.PluginConfig, &lloCfg); err != nil { diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index 1a824f3d162..df049a70693 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -173,6 +173,16 @@ func (r *ReadType) UnmarshalText(text []byte) error { return fmt.Errorf("unrecognized ReadType: %s", string(text)) } +type LLOConfigMode string + +const ( + LLOConfigModeMercury LLOConfigMode = "mercury" +) + +func (c LLOConfigMode) String() string { + return string(c) +} + type RelayConfig struct { ChainID *big.Big `json:"chainID"` FromBlock uint64 `json:"fromBlock"` @@ -192,7 +202,8 @@ type RelayConfig struct { EnableTriggerCapability bool `json:"enableTriggerCapability"` // LLO-specific - LLODONID uint32 `json:"lloDonID" toml:"lloDonID"` + LLODONID uint32 `json:"lloDonID" toml:"lloDonID"` + LLOConfigMode LLOConfigMode `json:"lloConfigMode" toml:"lloConfigMode"` } var ErrBadRelayConfig = errors.New("bad relay config")