Skip to content

Commit

Permalink
Migrate OCR configs to EVM configs
Browse files Browse the repository at this point in the history
  • Loading branch information
dimriou committed Mar 29, 2024
1 parent d44abe3 commit 7d1339e
Show file tree
Hide file tree
Showing 45 changed files with 187 additions and 379 deletions.
2 changes: 1 addition & 1 deletion charts/chainlink-cluster/templates/chainlink-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ data:
UICSAKeys = true
[OCR]
Enabled = true
DefaultTransactionQueueDepth = 0
[P2P]
[P2P.V2]
Enabled = true
Expand All @@ -46,6 +45,7 @@ data:
MinContractPayment = '0'
AutoCreateKey = true
FinalityDepth = 1
DefaultTransactionQueueDepth = 0
{{- if (hasKey $chainCfg "customEVMConfigToml") }}
{{- $chainCfg.customEVMConfigToml | nindent 4 }}
{{- end }}
Expand Down
8 changes: 8 additions & 0 deletions core/chains/evm/config/chain_scoped.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,11 @@ func (e *EVMConfig) OperatorFactoryAddress() string {
func (e *EVMConfig) LogPrunePageSize() uint32 {
return *e.C.LogPrunePageSize
}

func (e *EVMConfig) SimulateTransactions() bool {
return *e.C.SimulateTransactions
}

func (e *EVMConfig) DefaultTransactionQueueDepth() uint32 {
return *e.C.DefaultTransactionQueueDepth
}
2 changes: 2 additions & 0 deletions core/chains/evm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type EVM interface {
OperatorFactoryAddress() string
RPCDefaultBatchSize() uint32
NodeNoNewHeadsThreshold() time.Duration
SimulateTransactions() bool
DefaultTransactionQueueDepth() uint32

IsEnabled() bool
TOMLString() (string, error)
Expand Down
42 changes: 22 additions & 20 deletions core/chains/evm/config/toml/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,26 +342,28 @@ func (c *EVMConfig) TOMLString() (string, error) {
}

type Chain struct {
AutoCreateKey *bool
BlockBackfillDepth *uint32
BlockBackfillSkip *bool
ChainType *string
FinalityDepth *uint32
FinalityTagEnabled *bool
FlagsContractAddress *types.EIP55Address
LinkContractAddress *types.EIP55Address
LogBackfillBatchSize *uint32
LogPollInterval *commonconfig.Duration
LogKeepBlocksDepth *uint32
LogPrunePageSize *uint32
BackupLogPollerBlockDelay *uint64
MinIncomingConfirmations *uint32
MinContractPayment *commonassets.Link
NonceAutoSync *bool
NoNewHeadsThreshold *commonconfig.Duration
OperatorFactoryAddress *types.EIP55Address
RPCDefaultBatchSize *uint32
RPCBlockQueryDelay *uint16
AutoCreateKey *bool
BlockBackfillDepth *uint32
BlockBackfillSkip *bool
ChainType *string
FinalityDepth *uint32
FinalityTagEnabled *bool
FlagsContractAddress *types.EIP55Address
LinkContractAddress *types.EIP55Address
LogBackfillBatchSize *uint32
LogPollInterval *commonconfig.Duration
LogKeepBlocksDepth *uint32
LogPrunePageSize *uint32
BackupLogPollerBlockDelay *uint64
MinIncomingConfirmations *uint32
MinContractPayment *commonassets.Link
NonceAutoSync *bool
NoNewHeadsThreshold *commonconfig.Duration
OperatorFactoryAddress *types.EIP55Address
RPCDefaultBatchSize *uint32
RPCBlockQueryDelay *uint16
SimulateTransactions *bool
DefaultTransactionQueueDepth *uint32

Transactions Transactions `toml:",omitempty"`
BalanceMonitor BalanceMonitor `toml:",omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions core/chains/evm/config/toml/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ func (c *Chain) SetFrom(f *Chain) {
if v := f.RPCBlockQueryDelay; v != nil {
c.RPCBlockQueryDelay = v
}
if v:= f.SimulateTransactions; v != nil {
c.SimulateTransactions = v
}
if v:= f.DefaultTransactionQueueDepth; v != nil {
c.DefaultTransactionQueueDepth = v
}

c.Transactions.setFrom(&f.Transactions)
c.BalanceMonitor.setFrom(&f.BalanceMonitor)
Expand Down
2 changes: 2 additions & 0 deletions core/chains/evm/config/toml/defaults/fallback.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ NonceAutoSync = true
NoNewHeadsThreshold = '3m'
RPCDefaultBatchSize = 250
RPCBlockQueryDelay = 1
SimulateTransactions = false
DefaultTransactionQueueDepth = 1

[Transactions]
ForwardersEnabled = false
Expand Down
1 change: 0 additions & 1 deletion core/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type AppConfig interface {
Capabilities() Capabilities
Database() Database
Feature() Feature
FluxMonitor() FluxMonitor
Insecure() Insecure
JobPipeline() JobPipeline
Keeper() Keeper
Expand Down
4 changes: 4 additions & 0 deletions core/config/docs/chains-evm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ RPCDefaultBatchSize = 250 # Default
# available from the connected node via RPC, due to race conditions in the code of the remote ETH node. In this case you will get false
# "zero" blocks that are missing transactions.
RPCBlockQueryDelay = 1 # Default
# DefaultTransactionQueueDepth controls the queue size for `DropOldestStrategy` in TXM. Set to 0 to use `SendEvery` strategy instead.
DefaultTransactionQueueDepth = 1 # Default
# SimulateTransactions enables transaction simulation for TransmitChecker.
SimulateTransactions = false # Default

[EVM.Transactions]
# ForwardersEnabled enables or disables sending transactions through forwarder contracts.
Expand Down
19 changes: 0 additions & 19 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,6 @@ DefaultTimeout = '15s' # Default
# MaxSize defines the maximum size for HTTP requests and responses made by `http` and `bridge` adapters.
MaxSize = '32768' # Default

[FluxMonitor]
# **ADVANCED**
# DefaultTransactionQueueDepth controls the queue size for `DropOldestStrategy` in Flux Monitor. Set to 0 to use `SendEvery` strategy instead.
DefaultTransactionQueueDepth = 1 # Default
# SimulateTransactions enables transaction simulation for Flux Monitor.
SimulateTransactions = false # Default

[OCR2]
# Enabled enables OCR2 jobs.
Enabled = false # Default
Expand Down Expand Up @@ -355,10 +348,6 @@ KeyBundleID = '7a5f66bbe6594259325bf2b4f5b1a9c900000000000000000000000000000000'
CaptureEATelemetry = false # Default
# CaptureAutomationCustomTelemetry toggles collecting automation specific telemetry
CaptureAutomationCustomTelemetry = true # Default
# DefaultTransactionQueueDepth controls the queue size for `DropOldestStrategy` in OCR2. Set to 0 to use `SendEvery` strategy instead.
DefaultTransactionQueueDepth = 1 # Default
# SimulateTransactions enables transaction simulation for OCR2.
SimulateTransactions = false # Default
# TraceLogging enables trace level logging.
TraceLogging = false # Default

Expand All @@ -382,13 +371,8 @@ ContractPollInterval = '1m' # Default
# ContractSubscribeInterval is the interval at which we try to establish a subscription on ContractConfigTracker
# if one doesn't exist. Recommended values are between two and five minutes.
ContractSubscribeInterval = '2m' # Default
# **ADVANCED**
# DefaultTransactionQueueDepth controls the queue size for `DropOldestStrategy` in OCR. Set to 0 to use `SendEvery` strategy instead.
DefaultTransactionQueueDepth = 1 # Default
# KeyBundleID is the default key bundle ID to use for OCR jobs. If you have an OCR job that does not explicitly specify a key bundle ID, it will fall back to this value.
KeyBundleID = 'acdd42797a8b921b2910497badc5000600000000000000000000000000000000' # Example
# SimulateTransactions enables transaction simulation for OCR.
SimulateTransactions = false # Default
# TransmitterAddress is the default sending address to use for OCR. If you have an OCR job that does not explicitly specify a transmitter address, it will fall back to this value.
TransmitterAddress = '0xa0788FC17B1dEe36f057c42B6F373A34B014687e' # Example
# CaptureEATelemetry toggles collecting extra information from External Adaptares
Expand Down Expand Up @@ -483,9 +467,6 @@ ListenAddresses = ['1.2.3.4:9999', '[a52d:0:a88:1274::abcd]:1337'] # Example

[Keeper]
# **ADVANCED**
# DefaultTransactionQueueDepth controls the queue size for `DropOldestStrategy` in Keeper. Set to 0 to use `SendEvery` strategy instead.
DefaultTransactionQueueDepth = 1 # Default
# **ADVANCED**
# GasPriceBufferPercent specifies the percentage to add to the gas price used for checking whether to perform an upkeep. Only applies in legacy mode (EIP-1559 off).
GasPriceBufferPercent = 20 # Default
# **ADVANCED**
Expand Down
1 change: 0 additions & 1 deletion core/config/keeper_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type Registry interface {
}

type Keeper interface {
DefaultTransactionQueueDepth() uint32
GasPriceBufferPercent() uint16
GasTipCapBufferPercent() uint16
BaseFeeBufferPercent() uint16
Expand Down
2 changes: 0 additions & 2 deletions core/config/ocr2_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ type OCR2 interface {
// OCR2 config, cannot override in jobs
TraceLogging() bool
CaptureEATelemetry() bool
DefaultTransactionQueueDepth() uint32
SimulateTransactions() bool
CaptureAutomationCustomTelemetry() bool
}
2 changes: 0 additions & 2 deletions core/config/ocr_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ type OCR interface {
ContractSubscribeInterval() time.Duration
KeyBundleID() (string, error)
ObservationTimeout() time.Duration
SimulateTransactions() bool
TransmitterAddress() (types.EIP55Address, error) // OCR2 can support non-evm changes
// OCR1 config, cannot override in jobs
TraceLogging() bool
DefaultTransactionQueueDepth() uint32
CaptureEATelemetry() bool
}
36 changes: 0 additions & 36 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type Core struct {
Log Log `toml:",omitempty"`
WebServer WebServer `toml:",omitempty"`
JobPipeline JobPipeline `toml:",omitempty"`
FluxMonitor FluxMonitor `toml:",omitempty"`
OCR2 OCR2 `toml:",omitempty"`
OCR OCR `toml:",omitempty"`
P2P P2P `toml:",omitempty"`
Expand Down Expand Up @@ -80,7 +79,6 @@ func (c *Core) SetFrom(f *Core) {
c.WebServer.setFrom(&f.WebServer)
c.JobPipeline.setFrom(&f.JobPipeline)

c.FluxMonitor.setFrom(&f.FluxMonitor)
c.OCR2.setFrom(&f.OCR2)
c.OCR.setFrom(&f.OCR)
c.P2P.setFrom(&f.P2P)
Expand Down Expand Up @@ -899,20 +897,6 @@ func (j *JobPipelineHTTPRequest) setFrom(f *JobPipelineHTTPRequest) {
}
}

type FluxMonitor struct {
DefaultTransactionQueueDepth *uint32
SimulateTransactions *bool
}

func (m *FluxMonitor) setFrom(f *FluxMonitor) {
if v := f.DefaultTransactionQueueDepth; v != nil {
m.DefaultTransactionQueueDepth = v
}
if v := f.SimulateTransactions; v != nil {
m.SimulateTransactions = v
}
}

type OCR2 struct {
Enabled *bool
ContractConfirmations *uint32
Expand All @@ -924,8 +908,6 @@ type OCR2 struct {
KeyBundleID *models.Sha256Hash
CaptureEATelemetry *bool
CaptureAutomationCustomTelemetry *bool
DefaultTransactionQueueDepth *uint32
SimulateTransactions *bool
TraceLogging *bool
}

Expand Down Expand Up @@ -960,12 +942,6 @@ func (o *OCR2) setFrom(f *OCR2) {
if v := f.CaptureAutomationCustomTelemetry; v != nil {
o.CaptureAutomationCustomTelemetry = v
}
if v := f.DefaultTransactionQueueDepth; v != nil {
o.DefaultTransactionQueueDepth = v
}
if v := f.SimulateTransactions; v != nil {
o.SimulateTransactions = v
}
if v := f.TraceLogging; v != nil {
o.TraceLogging = v
}
Expand All @@ -977,10 +953,8 @@ type OCR struct {
BlockchainTimeout *commonconfig.Duration
ContractPollInterval *commonconfig.Duration
ContractSubscribeInterval *commonconfig.Duration
DefaultTransactionQueueDepth *uint32
// Optional
KeyBundleID *models.Sha256Hash
SimulateTransactions *bool
TransmitterAddress *types.EIP55Address
CaptureEATelemetry *bool
TraceLogging *bool
Expand All @@ -1002,15 +976,9 @@ func (o *OCR) setFrom(f *OCR) {
if v := f.ContractSubscribeInterval; v != nil {
o.ContractSubscribeInterval = v
}
if v := f.DefaultTransactionQueueDepth; v != nil {
o.DefaultTransactionQueueDepth = v
}
if v := f.KeyBundleID; v != nil {
o.KeyBundleID = v
}
if v := f.SimulateTransactions; v != nil {
o.SimulateTransactions = v
}
if v := f.TransmitterAddress; v != nil {
o.TransmitterAddress = v
}
Expand Down Expand Up @@ -1079,7 +1047,6 @@ func (p *P2PV2) setFrom(f *P2PV2) {
}

type Keeper struct {
DefaultTransactionQueueDepth *uint32
GasPriceBufferPercent *uint16
GasTipCapBufferPercent *uint16
BaseFeeBufferPercent *uint16
Expand All @@ -1090,9 +1057,6 @@ type Keeper struct {
}

func (k *Keeper) setFrom(f *Keeper) {
if v := f.DefaultTransactionQueueDepth; v != nil {
k.DefaultTransactionQueueDepth = v
}
if v := f.GasPriceBufferPercent; v != nil {
k.GasPriceBufferPercent = v
}
Expand Down
15 changes: 0 additions & 15 deletions core/services/chainlink/config_flux_monitor.go

This file was deleted.

21 changes: 0 additions & 21 deletions core/services/chainlink/config_flux_monitor_test.go

This file was deleted.

4 changes: 0 additions & 4 deletions core/services/chainlink/config_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,6 @@ func (g *generalConfig) ShutdownGracePeriod() time.Duration {
return g.c.ShutdownGracePeriod.Duration()
}

func (g *generalConfig) FluxMonitor() config.FluxMonitor {
return &fluxMonitorConfig{c: g.c.FluxMonitor}
}

func (g *generalConfig) InsecureFastScrypt() bool {
return *g.c.InsecureFastScrypt
}
Expand Down
4 changes: 0 additions & 4 deletions core/services/chainlink/config_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ func (k *keeperConfig) Registry() config.Registry {
return &registryConfig{c: k.c.Registry}
}

func (k *keeperConfig) DefaultTransactionQueueDepth() uint32 {
return *k.c.DefaultTransactionQueueDepth
}

func (k *keeperConfig) GasPriceBufferPercent() uint16 {
return *k.c.GasPriceBufferPercent
}
Expand Down
1 change: 0 additions & 1 deletion core/services/chainlink/config_keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func TestKeeperConfig(t *testing.T) {

keeper := cfg.Keeper()

assert.Equal(t, uint32(17), keeper.DefaultTransactionQueueDepth())
assert.Equal(t, uint16(12), keeper.GasPriceBufferPercent())
assert.Equal(t, uint16(43), keeper.GasTipCapBufferPercent())
assert.Equal(t, uint16(89), keeper.BaseFeeBufferPercent())
Expand Down
8 changes: 0 additions & 8 deletions core/services/chainlink/config_ocr.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ func (o *ocrConfig) ObservationTimeout() time.Duration {
return o.c.ObservationTimeout.Duration()
}

func (o *ocrConfig) SimulateTransactions() bool {
return *o.c.SimulateTransactions
}

func (o *ocrConfig) TransmitterAddress() (types.EIP55Address, error) {
a := *o.c.TransmitterAddress
if a.IsZero() {
Expand All @@ -60,10 +56,6 @@ func (o *ocrConfig) TraceLogging() bool {
return *o.c.TraceLogging
}

func (o *ocrConfig) DefaultTransactionQueueDepth() uint32 {
return *o.c.DefaultTransactionQueueDepth
}

func (o *ocrConfig) CaptureEATelemetry() bool {
return *o.c.CaptureEATelemetry
}
Loading

0 comments on commit 7d1339e

Please sign in to comment.