From ec2d169924273547bf0a75dd58dd0683a065131a Mon Sep 17 00:00:00 2001 From: "Abdelrahman Soliman (Boda)" <2677789+asoliman92@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:11:13 +0200 Subject: [PATCH] Transmission delay config for exec plugin (#380) Transmission delay config for exec plugin --- pluginconfig/execute.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pluginconfig/execute.go b/pluginconfig/execute.go index e4b9bcf9d..37a0373ba 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,9 +37,23 @@ 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 { +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? @@ -77,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