diff --git a/core/chains/evm/config/config.go b/core/chains/evm/config/config.go index 5af2bfbd0bc..af020d68ce1 100644 --- a/core/chains/evm/config/config.go +++ b/core/chains/evm/config/config.go @@ -55,15 +55,6 @@ type ChainScopedOnlyConfig interface { OperatorFactoryAddress() string MinIncomingConfirmations() uint32 MinimumContractPayment() *assets.Link - - // OCR1 chain specific config - OCRContractConfirmations() uint16 - OCRContractTransmitterTransmitTimeout() time.Duration - OCRObservationGracePeriod() time.Duration - OCRDatabaseTimeout() time.Duration - - // OCR2 chain specific config - OCR2AutomationGasLimit() uint32 } type EVM interface { @@ -71,6 +62,23 @@ type EVM interface { BalanceMonitor() BalanceMonitor Transactions() Transactions GasEstimator() GasEstimator + OCR() OCR + OCR2() OCR2 +} + +type OCR interface { + ContractConfirmations() uint16 + ContractTransmitterTransmitTimeout() time.Duration + ObservationGracePeriod() time.Duration + DatabaseTimeout() time.Duration +} + +type OCR2 interface { + Automation() OCR2Automation +} + +type OCR2Automation interface { + GasLimit() uint32 } type HeadTracker interface { diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index 28b2d3925ea..3a6c56c1bd7 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -265,11 +265,11 @@ func TestChainScopedConfig_BSCDefaults(t *testing.T) { }) cfg := evmtest.NewChainScopedConfig(t, gcfg) - timeout := cfg.OCRDatabaseTimeout() + timeout := cfg.EVM().OCR().DatabaseTimeout() require.Equal(t, 2*time.Second, timeout) - timeout = cfg.OCRContractTransmitterTransmitTimeout() + timeout = cfg.EVM().OCR().ContractTransmitterTransmitTimeout() require.Equal(t, 2*time.Second, timeout) - timeout = cfg.OCRObservationGracePeriod() + timeout = cfg.EVM().OCR().ObservationGracePeriod() require.Equal(t, 500*time.Millisecond, timeout) } diff --git a/core/chains/evm/config/mocks/chain_scoped_config.go b/core/chains/evm/config/mocks/chain_scoped_config.go index 640af58dcc3..021ef788fae 100644 --- a/core/chains/evm/config/mocks/chain_scoped_config.go +++ b/core/chains/evm/config/mocks/chain_scoped_config.go @@ -992,76 +992,6 @@ func (_m *ChainScopedConfig) OCR2() coreconfig.OCR2 { return r0 } -// OCR2AutomationGasLimit provides a mock function with given fields: -func (_m *ChainScopedConfig) OCR2AutomationGasLimit() uint32 { - ret := _m.Called() - - var r0 uint32 - if rf, ok := ret.Get(0).(func() uint32); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(uint32) - } - - return r0 -} - -// OCRContractConfirmations provides a mock function with given fields: -func (_m *ChainScopedConfig) OCRContractConfirmations() uint16 { - ret := _m.Called() - - var r0 uint16 - if rf, ok := ret.Get(0).(func() uint16); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(uint16) - } - - return r0 -} - -// OCRContractTransmitterTransmitTimeout provides a mock function with given fields: -func (_m *ChainScopedConfig) OCRContractTransmitterTransmitTimeout() time.Duration { - ret := _m.Called() - - var r0 time.Duration - if rf, ok := ret.Get(0).(func() time.Duration); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(time.Duration) - } - - return r0 -} - -// OCRDatabaseTimeout provides a mock function with given fields: -func (_m *ChainScopedConfig) OCRDatabaseTimeout() time.Duration { - ret := _m.Called() - - var r0 time.Duration - if rf, ok := ret.Get(0).(func() time.Duration); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(time.Duration) - } - - return r0 -} - -// OCRObservationGracePeriod provides a mock function with given fields: -func (_m *ChainScopedConfig) OCRObservationGracePeriod() time.Duration { - ret := _m.Called() - - var r0 time.Duration - if rf, ok := ret.Get(0).(func() time.Duration); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(time.Duration) - } - - return r0 -} - // OperatorFactoryAddress provides a mock function with given fields: func (_m *ChainScopedConfig) OperatorFactoryAddress() string { ret := _m.Called() diff --git a/core/chains/evm/config/v2/chain_scoped.go b/core/chains/evm/config/v2/chain_scoped.go index 46935c702d8..3372ee96002 100644 --- a/core/chains/evm/config/v2/chain_scoped.go +++ b/core/chains/evm/config/v2/chain_scoped.go @@ -43,13 +43,13 @@ func (c *ChainScoped) Validate() (err error) { // Most per-chain validation is done on startup, but this combines globals as well. lc := ocrtypes.LocalConfig{ BlockchainTimeout: c.OCR().BlockchainTimeout(), - ContractConfigConfirmations: c.OCRContractConfirmations(), + ContractConfigConfirmations: c.EVM().OCR().ContractConfirmations(), ContractConfigTrackerPollInterval: c.OCR().ContractPollInterval(), ContractConfigTrackerSubscribeInterval: c.OCR().ContractSubscribeInterval(), - ContractTransmitterTransmitTimeout: c.OCRContractTransmitterTransmitTimeout(), - DatabaseTimeout: c.OCRDatabaseTimeout(), + ContractTransmitterTransmitTimeout: c.EVM().OCR().ContractTransmitterTransmitTimeout(), + DatabaseTimeout: c.EVM().OCR().DatabaseTimeout(), DataSourceTimeout: c.OCR().ObservationTimeout(), - DataSourceGracePeriod: c.OCRObservationGracePeriod(), + DataSourceGracePeriod: c.EVM().OCR().ObservationGracePeriod(), } if ocrerr := ocr.SanityCheckLocalConfig(lc); ocrerr != nil { err = multierr.Append(err, ocrerr) @@ -73,6 +73,14 @@ func (e *evmConfig) HeadTracker() config.HeadTracker { return &headTrackerConfig{c: e.c.HeadTracker} } +func (e *evmConfig) OCR() config.OCR { + return &ocrConfig{c: e.c.OCR} +} + +func (e *evmConfig) OCR2() config.OCR2 { + return &ocr2Config{c: e.c.OCR2} +} + func (e *evmConfig) GasEstimator() config.GasEstimator { return &gasEstimatorConfig{c: e.c.GasEstimator, blockDelay: e.c.RPCBlockQueryDelay} } @@ -283,26 +291,6 @@ func (c *ChainScoped) NodeSyncThreshold() uint32 { return *c.cfg.NodePool.SyncThreshold } -func (c *ChainScoped) OCRContractConfirmations() uint16 { - return *c.cfg.OCR.ContractConfirmations -} - -func (c *ChainScoped) OCRContractTransmitterTransmitTimeout() time.Duration { - return c.cfg.OCR.ContractTransmitterTransmitTimeout.Duration() -} - -func (c *ChainScoped) OCRObservationGracePeriod() time.Duration { - return c.cfg.OCR.ObservationGracePeriod.Duration() -} - -func (c *ChainScoped) OCRDatabaseTimeout() time.Duration { - return c.cfg.OCR.DatabaseTimeout.Duration() -} - -func (c *ChainScoped) OCR2AutomationGasLimit() uint32 { - return *c.cfg.OCR2.Automation.GasLimit -} - type balanceMonitorConfig struct { c BalanceMonitor } diff --git a/core/chains/evm/config/v2/config_ocr.go b/core/chains/evm/config/v2/config_ocr.go new file mode 100644 index 00000000000..4b95dbd35a8 --- /dev/null +++ b/core/chains/evm/config/v2/config_ocr.go @@ -0,0 +1,23 @@ +package v2 + +import "time" + +type ocrConfig struct { + c OCR +} + +func (o *ocrConfig) ContractConfirmations() uint16 { + return *o.c.ContractConfirmations +} + +func (o *ocrConfig) ContractTransmitterTransmitTimeout() time.Duration { + return o.c.ContractTransmitterTransmitTimeout.Duration() +} + +func (o *ocrConfig) ObservationGracePeriod() time.Duration { + return o.c.ObservationGracePeriod.Duration() +} + +func (o *ocrConfig) DatabaseTimeout() time.Duration { + return o.c.DatabaseTimeout.Duration() +} diff --git a/core/chains/evm/config/v2/config_ocr2.go b/core/chains/evm/config/v2/config_ocr2.go new file mode 100644 index 00000000000..c18bc3dc7e2 --- /dev/null +++ b/core/chains/evm/config/v2/config_ocr2.go @@ -0,0 +1,23 @@ +package v2 + +import "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" + +type ocr2Automation struct { + c Automation +} + +func (o *ocr2Automation) GasLimit() uint32 { + return *o.c.GasLimit +} + +type ocr2Config struct { + c OCR2 +} + +func (o *ocr2Config) Automation() config.OCR2Automation { + return &ocr2Automation{c: o.c.Automation} +} + +func (o *ocr2Config) ContractConfirmations() uint16 { + return uint16(*o.c.Automation.GasLimit) +} diff --git a/core/chains/evm/config/v2/config_ocr2_test.go b/core/chains/evm/config/v2/config_ocr2_test.go new file mode 100644 index 00000000000..b4a4ba525df --- /dev/null +++ b/core/chains/evm/config/v2/config_ocr2_test.go @@ -0,0 +1,14 @@ +package v2_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" +) + +func Test_ocr2Config(t *testing.T) { + evmOcrCfg := cltest.NewTestChainScopedConfig(t) //fallback.toml values + require.Equal(t, uint32(5300000), evmOcrCfg.EVM().OCR2().Automation().GasLimit()) +} diff --git a/core/chains/evm/config/v2/config_ocr_test.go b/core/chains/evm/config/v2/config_ocr_test.go new file mode 100644 index 00000000000..19b2233c407 --- /dev/null +++ b/core/chains/evm/config/v2/config_ocr_test.go @@ -0,0 +1,17 @@ +package v2_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" +) + +func Test_ocrConfig(t *testing.T) { + evmOcrCfg := cltest.NewTestChainScopedConfig(t) //fallback.toml values + require.Equal(t, uint16(4), evmOcrCfg.EVM().OCR().ContractConfirmations()) + require.Equal(t, cltest.MustParseDuration(t, "10s"), evmOcrCfg.EVM().OCR().ContractTransmitterTransmitTimeout()) + require.Equal(t, cltest.MustParseDuration(t, "10s"), evmOcrCfg.EVM().OCR().DatabaseTimeout()) + require.Equal(t, cltest.MustParseDuration(t, "1s"), evmOcrCfg.EVM().OCR().ObservationGracePeriod()) +} diff --git a/core/services/job/orm.go b/core/services/job/orm.go index c7fef594dfa..97fa141a886 100644 --- a/core/services/job/orm.go +++ b/core/services/job/orm.go @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/null" @@ -653,7 +654,7 @@ func (o *orm) LoadEnvConfigVars(jb *Job) error { if err != nil { return err } - newSpec, err := LoadEnvConfigVarsOCR(ch.Config(), ch.Config().OCR(), *jb.OCROracleSpec) + newSpec, err := LoadEnvConfigVarsOCR(ch.Config().EVM().OCR(), ch.Config().OCR(), *jb.OCROracleSpec) if err != nil { return err } @@ -698,13 +699,6 @@ func LoadEnvConfigVarsDR(cfg DRSpecConfig, drs DirectRequestSpec) *DirectRequest return &drs } -type OCRSpecConfig interface { - OCRContractConfirmations() uint16 - OCRContractTransmitterTransmitTimeout() time.Duration - OCRDatabaseTimeout() time.Duration - OCRObservationGracePeriod() time.Duration -} - type OCRConfig interface { BlockchainTimeout() time.Duration CaptureEATelemetry() bool @@ -716,7 +710,7 @@ type OCRConfig interface { } // LoadEnvConfigVarsLocalOCR loads local OCR env vars into the OCROracleSpec. -func LoadEnvConfigVarsLocalOCR(cfg OCRSpecConfig, os OCROracleSpec, ocrCfg OCRConfig) *OCROracleSpec { +func LoadEnvConfigVarsLocalOCR(evmOcrCfg evmconfig.OCR, os OCROracleSpec, ocrCfg OCRConfig) *OCROracleSpec { if os.ObservationTimeout == 0 { os.ObservationTimeoutEnv = true os.ObservationTimeout = models.Interval(ocrCfg.ObservationTimeout()) @@ -735,19 +729,19 @@ func LoadEnvConfigVarsLocalOCR(cfg OCRSpecConfig, os OCROracleSpec, ocrCfg OCRCo } if os.ContractConfigConfirmations == 0 { os.ContractConfigConfirmationsEnv = true - os.ContractConfigConfirmations = cfg.OCRContractConfirmations() + os.ContractConfigConfirmations = evmOcrCfg.ContractConfirmations() } if os.DatabaseTimeout == nil { os.DatabaseTimeoutEnv = true - os.DatabaseTimeout = models.NewInterval(cfg.OCRDatabaseTimeout()) + os.DatabaseTimeout = models.NewInterval(evmOcrCfg.DatabaseTimeout()) } if os.ObservationGracePeriod == nil { os.ObservationGracePeriodEnv = true - os.ObservationGracePeriod = models.NewInterval(cfg.OCRObservationGracePeriod()) + os.ObservationGracePeriod = models.NewInterval(evmOcrCfg.ObservationGracePeriod()) } if os.ContractTransmitterTransmitTimeout == nil { os.ContractTransmitterTransmitTimeoutEnv = true - os.ContractTransmitterTransmitTimeout = models.NewInterval(cfg.OCRContractTransmitterTransmitTimeout()) + os.ContractTransmitterTransmitTimeout = models.NewInterval(evmOcrCfg.ContractTransmitterTransmitTimeout()) } os.CaptureEATelemetry = ocrCfg.CaptureEATelemetry() @@ -755,7 +749,7 @@ func LoadEnvConfigVarsLocalOCR(cfg OCRSpecConfig, os OCROracleSpec, ocrCfg OCRCo } // LoadEnvConfigVarsOCR loads OCR env vars into the OCROracleSpec. -func LoadEnvConfigVarsOCR(cfg OCRSpecConfig, ocrCfg OCRConfig, os OCROracleSpec) (*OCROracleSpec, error) { +func LoadEnvConfigVarsOCR(evmOcrCfg evmconfig.OCR, ocrCfg OCRConfig, os OCROracleSpec) (*OCROracleSpec, error) { if os.TransmitterAddress == nil { ta, err := ocrCfg.TransmitterAddress() if !errors.Is(errors.Cause(err), config.ErrEnvUnset) { @@ -780,7 +774,7 @@ func LoadEnvConfigVarsOCR(cfg OCRSpecConfig, ocrCfg OCRConfig, os OCROracleSpec) os.EncryptedOCRKeyBundleID = &encryptedOCRKeyBundleID } - return LoadEnvConfigVarsLocalOCR(cfg, os, ocrCfg), nil + return LoadEnvConfigVarsLocalOCR(evmOcrCfg, os, ocrCfg), nil } func (o *orm) FindJobTx(id int32) (Job, error) { diff --git a/core/services/job/orm_test.go b/core/services/job/orm_test.go index 44950f75755..c4f3d91a69a 100644 --- a/core/services/job/orm_test.go +++ b/core/services/job/orm_test.go @@ -33,7 +33,7 @@ func TestLoadEnvConfigVarsLocalOCR(t *testing.T) { chainConfig := evmtest.NewChainScopedConfig(t, config) jobSpec := &job.OCROracleSpec{} - jobSpec = job.LoadEnvConfigVarsLocalOCR(chainConfig, *jobSpec, chainConfig.OCR()) + jobSpec = job.LoadEnvConfigVarsLocalOCR(chainConfig.EVM().OCR(), *jobSpec, chainConfig.OCR()) require.True(t, jobSpec.ObservationTimeoutEnv) require.True(t, jobSpec.BlockchainTimeoutEnv) diff --git a/core/services/job/runner_integration_test.go b/core/services/job/runner_integration_test.go index e384ce79efd..5e673fd5faa 100644 --- a/core/services/job/runner_integration_test.go +++ b/core/services/job/runner_integration_test.go @@ -13,9 +13,7 @@ import ( "testing" "time" - evmconfigmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/mocks" evmmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/mocks" - "github.com/smartcontractkit/chainlink/v2/core/config" configtest2 "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" @@ -26,7 +24,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/auth" "github.com/smartcontractkit/chainlink/v2/core/bridges" - pkgconfig "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" @@ -53,15 +50,6 @@ import ( var monitoringEndpoint = telemetry.MonitoringEndpointGenerator(&telemetry.NoopAgent{}) -type insecureConfig struct { - config.Insecure - ocrDevMode bool -} - -func (i *insecureConfig) OCRDevelopmentMode() bool { - return i.ocrDevMode -} - func TestRunner(t *testing.T) { db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db, pgtest.NewQConfig(true)) @@ -84,8 +72,11 @@ func TestRunner(t *testing.T) { c.OCR.TransmitterAddress = &taddress c.OCR2.DatabaseTimeout = models.MustNewDuration(time.Second) c.OCR2.ContractTransmitterTransmitTimeout = models.MustNewDuration(time.Second) + c.Insecure.OCRDevelopmentMode = ptr(true) }) + chainScopedConfig := evmtest.NewChainScopedConfig(t, config) + ethClient := cltest.NewEthMocksWithDefaultChain(t) ethClient.On("HeadByNumber", mock.Anything, (*big.Int)(nil)).Return(cltest.Head(10), nil) ethClient.On("CallContract", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(nil, nil) @@ -200,13 +191,8 @@ func TestRunner(t *testing.T) { _, b := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) // Reference a different one - cfg := new(evmconfigmocks.ChainScopedConfig) - ocrCfg := config.OCR() - cfg.On("Insecure").Return(&insecureConfig{ocrDevMode: true}) - cfg.On("ChainType").Return(pkgconfig.ChainType("")) - cfg.On("OCR").Return(ocrCfg) c := new(evmmocks.Chain) - c.On("Config").Return(cfg) + c.On("Config").Return(chainScopedConfig) cs := evmmocks.NewChainSet(t) cs.On("Get", mock.Anything).Return(c, nil) @@ -239,7 +225,7 @@ func TestRunner(t *testing.T) { assert.Contains(t, err.Error(), "not all bridges exist") // Same for ocr2 - jb2, err := validate.ValidatedOracleSpecToml(config.OCR2(), &insecureConfig{ocrDevMode: true}, fmt.Sprintf(` + jb2, err := validate.ValidatedOracleSpecToml(config.OCR2(), config.Insecure(), fmt.Sprintf(` type = "offchainreporting2" pluginType = "median" schemaVersion = 1 @@ -273,7 +259,7 @@ answer1 [type=median index=0]; assert.Contains(t, err.Error(), "not all bridges exist") // Duplicate bridge names that exist is ok - jb3, err := validate.ValidatedOracleSpecToml(config.OCR2(), &insecureConfig{ocrDevMode: true}, fmt.Sprintf(` + jb3, err := validate.ValidatedOracleSpecToml(config.OCR2(), config.Insecure(), fmt.Sprintf(` type = "offchainreporting2" pluginType = "median" schemaVersion = 1 @@ -1124,3 +1110,5 @@ func TestRunner_Error_Callback_AsyncJob(t *testing.T) { require.Eventually(t, func() bool { return eiNotifiedOfDelete }, 5*time.Second, 10*time.Millisecond, "expected external initiator to be notified of deleted job") } } + +func ptr[T any](t T) *T { return &t } diff --git a/core/services/ocr/config.go b/core/services/ocr/config.go index 4ad8fbe1714..e1bc997f269 100644 --- a/core/services/ocr/config.go +++ b/core/services/ocr/config.go @@ -3,6 +3,7 @@ package ocr import ( ocrtypes "github.com/smartcontractkit/libocr/offchainreporting/types" + evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/pg" ) @@ -12,8 +13,8 @@ type Config interface { pg.QConfig } -func toLocalConfig(cfg ValidationConfig, insecureCfg insecureConfig, spec job.OCROracleSpec, ocrConfig job.OCRConfig) ocrtypes.LocalConfig { - concreteSpec := job.LoadEnvConfigVarsLocalOCR(cfg, spec, ocrConfig) +func toLocalConfig(cfg ValidationConfig, evmOcrConfig evmconfig.OCR, insecureCfg insecureConfig, spec job.OCROracleSpec, ocrConfig job.OCRConfig) ocrtypes.LocalConfig { + concreteSpec := job.LoadEnvConfigVarsLocalOCR(evmOcrConfig, spec, ocrConfig) lc := ocrtypes.LocalConfig{ BlockchainTimeout: concreteSpec.BlockchainTimeout.Duration(), ContractConfigConfirmations: concreteSpec.ContractConfigConfirmations, diff --git a/core/services/ocr/delegate.go b/core/services/ocr/delegate.go index fb71b5953bd..35bc4872261 100644 --- a/core/services/ocr/delegate.go +++ b/core/services/ocr/delegate.go @@ -95,7 +95,7 @@ func (d *Delegate) ServicesForSpec(jb job.Job) (services []job.ServiceCtx, err e if err != nil { return nil, err } - concreteSpec, err := job.LoadEnvConfigVarsOCR(chain.Config(), chain.Config().OCR(), *jb.OCROracleSpec) + concreteSpec, err := job.LoadEnvConfigVarsOCR(chain.Config().EVM().OCR(), chain.Config().OCR(), *jb.OCROracleSpec) if err != nil { return nil, err } @@ -171,7 +171,7 @@ func (d *Delegate) ServicesForSpec(jb job.Job) (services []job.ServiceCtx, err e d.jobORM.TryRecordError(jb.ID, msg) }) - lc := toLocalConfig(chain.Config(), chain.Config().Insecure(), *concreteSpec, chain.Config().OCR()) + lc := toLocalConfig(chain.Config(), chain.Config().EVM().OCR(), chain.Config().Insecure(), *concreteSpec, chain.Config().OCR()) if err = ocr.SanityCheckLocalConfig(lc); err != nil { return nil, err } diff --git a/core/services/ocr/validate.go b/core/services/ocr/validate.go index 02d441fe52e..97e37ddc272 100644 --- a/core/services/ocr/validate.go +++ b/core/services/ocr/validate.go @@ -11,7 +11,7 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" - config2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" + evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" @@ -20,10 +20,6 @@ import ( type ValidationConfig interface { ChainType() config.ChainType - OCRContractConfirmations() uint16 - OCRContractTransmitterTransmitTimeout() time.Duration - OCRDatabaseTimeout() time.Duration - OCRObservationGracePeriod() time.Duration } type OCRValidationConfig interface { @@ -42,7 +38,7 @@ type insecureConfig interface { // ValidatedOracleSpecToml validates an oracle spec that came from TOML func ValidatedOracleSpecToml(chainSet evm.ChainSet, tomlString string) (job.Job, error) { - return ValidatedOracleSpecTomlCfg(func(id *big.Int) (config2.ChainScopedConfig, error) { + return ValidatedOracleSpecTomlCfg(func(id *big.Int) (evmconfig.ChainScopedConfig, error) { c, err := chainSet.Get(id) if err != nil { return nil, err @@ -51,7 +47,7 @@ func ValidatedOracleSpecToml(chainSet evm.ChainSet, tomlString string) (job.Job, }, tomlString) } -func ValidatedOracleSpecTomlCfg(configFn func(id *big.Int) (config2.ChainScopedConfig, error), tomlString string) (job.Job, error) { +func ValidatedOracleSpecTomlCfg(configFn func(id *big.Int) (evmconfig.ChainScopedConfig, error), tomlString string) (job.Job, error) { var jb = job.Job{} var spec job.OCROracleSpec tree, err := toml.Load(tomlString) @@ -106,7 +102,7 @@ func ValidatedOracleSpecTomlCfg(configFn func(id *big.Int) (config2.ChainScopedC } else if err := validateNonBootstrapSpec(tree, jb, cfg.OCR().ObservationTimeout()); err != nil { return jb, err } - if err := validateTimingParameters(cfg, cfg.Insecure(), spec, cfg.OCR()); err != nil { + if err := validateTimingParameters(cfg, cfg.EVM().OCR(), cfg.Insecure(), spec, cfg.OCR()); err != nil { return jb, err } return jb, nil @@ -129,8 +125,8 @@ var ( } ) -func validateTimingParameters(cfg ValidationConfig, insecureCfg insecureConfig, spec job.OCROracleSpec, ocrCfg job.OCRConfig) error { - lc := toLocalConfig(cfg, insecureCfg, spec, ocrCfg) +func validateTimingParameters(cfg ValidationConfig, evmOcrCfg evmconfig.OCR, insecureCfg insecureConfig, spec job.OCROracleSpec, ocrCfg job.OCRConfig) error { + lc := toLocalConfig(cfg, evmOcrCfg, insecureCfg, spec, ocrCfg) return errors.Wrap(offchainreporting.SanityCheckLocalConfig(lc), "offchainreporting.SanityCheckLocalConfig failed") } diff --git a/core/services/relay/evm/ocr2keeper.go b/core/services/relay/evm/ocr2keeper.go index ea32b0100d4..beab7f17700 100644 --- a/core/services/relay/evm/ocr2keeper.go +++ b/core/services/relay/evm/ocr2keeper.go @@ -71,7 +71,7 @@ func (r *ocr2keeperRelayer) NewOCR2KeeperProvider(rargs relaytypes.RelayArgs, pa return nil, err } - gasLimit := cfgWatcher.chain.Config().OCR2AutomationGasLimit() + gasLimit := cfgWatcher.chain.Config().EVM().OCR2().Automation().GasLimit() contractTransmitter, err := newPipelineContractTransmitter(r.lggr, rargs, pargs.TransmitterID, &gasLimit, cfgWatcher, r.spec, r.pr) if err != nil { return nil, err