From 0f28d042c3b8cf002af5ed09b74ba4797f5e0b31 Mon Sep 17 00:00:00 2001 From: asoliman Date: Wed, 18 Dec 2024 14:43:31 +0200 Subject: [PATCH 1/2] transmission delay config for exec plugin --- pluginconfig/execute.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pluginconfig/execute.go b/pluginconfig/execute.go index e4b9bcf9d..ab0f4ad83 100644 --- a/pluginconfig/execute.go +++ b/pluginconfig/execute.go @@ -3,6 +3,7 @@ package pluginconfig import ( "encoding/json" "errors" + "time" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" ) @@ -36,6 +37,20 @@ type ExecuteOffchainConfig struct { // TokenDataObservers registers different strategies for processing token data. TokenDataObservers []TokenDataObserverConfig `json:"tokenDataObservers"` + + // transmissionDelayMultiplier is used to calculate the transmission delay for each oracle. + TransmissionDelayMultiplier time.Duration `json:"transmissionDelayMultiplier"` +} + +func (e ExecuteOffchainConfig) ApplyDefaultsAndValidate() error { + e.applyDefaults() + return e.Validate() +} + +func (e ExecuteOffchainConfig) applyDefaults() { + if e.TransmissionDelayMultiplier == 0 { + e.TransmissionDelayMultiplier = defaultTransmissionDelayMultiplier + } } func (e ExecuteOffchainConfig) Validate() error { From 05807c4aef3a121c8465c12439786d28ed926eeb Mon Sep 17 00:00:00 2001 From: asoliman Date: Wed, 18 Dec 2024 14:47:27 +0200 Subject: [PATCH 2/2] fix lint --- pluginconfig/execute.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pluginconfig/execute.go b/pluginconfig/execute.go index ab0f4ad83..37a0373ba 100644 --- a/pluginconfig/execute.go +++ b/pluginconfig/execute.go @@ -42,18 +42,18 @@ type ExecuteOffchainConfig struct { TransmissionDelayMultiplier time.Duration `json:"transmissionDelayMultiplier"` } -func (e ExecuteOffchainConfig) ApplyDefaultsAndValidate() error { +func (e *ExecuteOffchainConfig) ApplyDefaultsAndValidate() error { e.applyDefaults() return e.Validate() } -func (e ExecuteOffchainConfig) applyDefaults() { +func (e *ExecuteOffchainConfig) applyDefaults() { if e.TransmissionDelayMultiplier == 0 { e.TransmissionDelayMultiplier = defaultTransmissionDelayMultiplier } } -func (e ExecuteOffchainConfig) Validate() error { +func (e *ExecuteOffchainConfig) Validate() error { // TODO: this doesn't really make much sense for non-EVM chains. // Maybe we need to have a field in the config that is not JSON-encoded // that indicates chain family? @@ -92,7 +92,7 @@ func (e ExecuteOffchainConfig) Validate() error { return nil } -func (e ExecuteOffchainConfig) IsUSDCEnabled() bool { +func (e *ExecuteOffchainConfig) IsUSDCEnabled() bool { for _, ob := range e.TokenDataObservers { if ob.WellFormed() != nil { continue