Skip to content

Commit

Permalink
Remove AppConfig from ChainScoped (#12636)
Browse files Browse the repository at this point in the history
* Remove AppConfig from ChainScoped

* Fix shell_local

* Update configs for services

* Extend relay configs

* Add DefaultQueryTimeout as arg

* Fix lint

* Fix test cases in cmd

* Add changeset

* Remove unnecessary OCR check

* Update chain scoped mock

* Add default cases for relay args

* Remove unused Database config from OCR

* Add changeset

* Remove DefaultTimeout config from RelayArgs

* Address comments

* Remove unnecessary changeset

* Remove defaultquerytimeout from RelayConfig

* Update remaining relays

* Handle services collectively

* Update relayConfigsWithDefaults

* Update configs through JSONConfig

* Fix lint
  • Loading branch information
dimriou authored Apr 22, 2024
1 parent d1845e2 commit bdc076c
Show file tree
Hide file tree
Showing 48 changed files with 263 additions and 899 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-shoes-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Removed AppConfig from Evm config #internal
28 changes: 1 addition & 27 deletions core/chains/evm/config/chain_scoped.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,21 @@ import (
"math/big"
"time"

"go.uber.org/multierr"

ocr "github.com/smartcontractkit/libocr/offchainreporting"
ocrtypes "github.com/smartcontractkit/libocr/offchainreporting/types"

"github.com/smartcontractkit/chainlink-common/pkg/assets"
"github.com/smartcontractkit/chainlink-common/pkg/logger"

commonconfig "github.com/smartcontractkit/chainlink/v2/common/config"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml"
"github.com/smartcontractkit/chainlink/v2/core/config"
)

func NewTOMLChainScopedConfig(appCfg config.AppConfig, tomlConfig *toml.EVMConfig, lggr logger.Logger) *ChainScoped {
func NewTOMLChainScopedConfig(tomlConfig *toml.EVMConfig, lggr logger.Logger) *ChainScoped {
return &ChainScoped{
AppConfig: appCfg,
evmConfig: &EVMConfig{C: tomlConfig},
lggr: lggr}
}

// ChainScoped implements config.ChainScopedConfig with a gencfg.BasicConfig and EVMConfig.
type ChainScoped struct {
config.AppConfig
lggr logger.Logger

evmConfig *EVMConfig
Expand All @@ -44,24 +36,6 @@ func (c *ChainScoped) BlockEmissionIdleWarningThreshold() time.Duration {
return c.EVM().NodeNoNewHeadsThreshold()
}

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.EVM().OCR().ContractConfirmations(),
ContractConfigTrackerPollInterval: c.OCR().ContractPollInterval(),
ContractConfigTrackerSubscribeInterval: c.OCR().ContractSubscribeInterval(),
ContractTransmitterTransmitTimeout: c.EVM().OCR().ContractTransmitterTransmitTimeout(),
DatabaseTimeout: c.EVM().OCR().DatabaseTimeout(),
DataSourceTimeout: c.OCR().ObservationTimeout(),
DataSourceGracePeriod: c.EVM().OCR().ObservationGracePeriod(),
}
if ocrerr := ocr.SanityCheckLocalConfig(lc); ocrerr != nil {
err = multierr.Append(err, ocrerr)
}
return
}

type EVMConfig struct {
C *toml.EVMConfig
}
Expand Down
4 changes: 0 additions & 4 deletions core/chains/evm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
commonconfig "github.com/smartcontractkit/chainlink/v2/common/config"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/config"
)

type EVM interface {
Expand Down Expand Up @@ -148,8 +147,5 @@ type NodePool interface {
//
//go:generate mockery --quiet --name ChainScopedConfig --output ./mocks/ --case=underscore
type ChainScopedConfig interface {
config.AppConfig
Validate() error

EVM() EVM
}
Loading

0 comments on commit bdc076c

Please sign in to comment.