From 6604c3f3a8dcc49a32d0fb43887b4f5850c90adf Mon Sep 17 00:00:00 2001 From: Cedric Date: Tue, 11 Jul 2023 12:29:37 +0100 Subject: [PATCH] [BCF-2261] Remove evm/config/v2; replace with evm/config and evm/config/toml. (#9753) * Move NodePoolConfig to config.go * Move chain_scoped to config package * Rename evm/config/v2 -> evm/config/toml * Run make generate --- core/chains/evm/chain.go | 12 +-- core/chains/evm/chain_set.go | 6 +- core/chains/evm/chain_set_test.go | 4 +- .../evm/config/{v2 => }/chain_scoped.go | 26 ++--- .../config/chain_scoped_balance_monitor.go | 11 ++ .../{v2 => }/chain_scoped_gas_estimator.go | 16 +-- .../{v2 => }/chain_scoped_head_tracker.go | 10 +- ...node_pool.go => chain_scoped_node_pool.go} | 6 +- .../evm/config/{v2 => }/chain_scoped_ocr.go | 10 +- .../evm/config/{v2 => }/chain_scoped_ocr2.go | 12 ++- .../config/{v2 => }/chain_scoped_ocr2_test.go | 2 +- .../config/{v2 => }/chain_scoped_ocr_test.go | 2 +- .../{v2 => }/chain_scoped_transactions.go | 10 +- core/chains/evm/config/config.go | 7 ++ core/chains/evm/config/config_node_pool.go | 10 -- .../evm/config/config_node_pool_test.go | 32 ------ core/chains/evm/config/config_test.go | 102 ++++++++++-------- core/chains/evm/config/{v2 => toml}/config.go | 2 +- .../evm/config/{v2 => toml}/defaults.go | 2 +- .../defaults/Arbitrum_Goerli.toml | 0 .../defaults/Arbitrum_Mainnet.toml | 0 .../defaults/Arbitrum_Rinkeby.toml | 0 .../{v2 => toml}/defaults/Avalanche_Fuji.toml | 0 .../defaults/Avalanche_Mainnet.toml | 0 .../{v2 => toml}/defaults/BSC_Mainnet.toml | 0 .../{v2 => toml}/defaults/Celo_Mainnet.toml | 0 .../{v2 => toml}/defaults/Celo_Testnet.toml | 0 .../defaults/Ethereum_Goerli.toml | 0 .../{v2 => toml}/defaults/Ethereum_Kovan.toml | 0 .../defaults/Ethereum_Mainnet.toml | 0 .../defaults/Ethereum_Rinkeby.toml | 0 .../defaults/Ethereum_Ropsten.toml | 0 .../defaults/Ethereum_Sepolia.toml | 0 .../{v2 => toml}/defaults/Fantom_Mainnet.toml | 0 .../{v2 => toml}/defaults/Fantom_Testnet.toml | 0 .../defaults/Harmony_Mainnet.toml | 0 .../defaults/Harmony_Testnet.toml | 0 .../{v2 => toml}/defaults/Heco_Mainnet.toml | 0 .../{v2 => toml}/defaults/Klaytn_Mainnet.toml | 0 .../{v2 => toml}/defaults/Klaytn_Testnet.toml | 0 .../{v2 => toml}/defaults/Metis_Mainnet.toml | 0 .../{v2 => toml}/defaults/Metis_Rinkeby.toml | 0 .../{v2 => toml}/defaults/OKX_Mainnet.toml | 0 .../{v2 => toml}/defaults/OKX_Testnet.toml | 0 .../defaults/Optimism_Goerli.toml | 0 .../defaults/Optimism_Mainnet.toml | 0 .../defaults/Polygon_Mainnet.toml | 0 .../{v2 => toml}/defaults/Polygon_Mumbai.toml | 0 .../config/{v2 => toml}/defaults/README.md | 0 .../{v2 => toml}/defaults/RSK_Mainnet.toml | 0 .../{v2 => toml}/defaults/RSK_Testnet.toml | 0 .../{v2 => toml}/defaults/Simulated.toml | 0 .../{v2 => toml}/defaults/fallback.toml | 0 .../{v2 => toml}/defaults/xDai_Mainnet.toml | 0 .../config/v2/chain_scoped_balance_monitor.go | 9 -- core/chains/evm/txmgr/resender_test.go | 8 +- core/cmd/evm_node_commands_test.go | 2 +- core/config/docs/docs_test.go | 2 +- core/config/docs/extended.go | 2 +- .../testutils/configtest/v2/general_config.go | 2 +- core/internal/testutils/evmtest/evmtest.go | 22 ++-- core/internal/testutils/evmtest/v2/evmtest.go | 6 +- core/services/chainlink/config.go | 2 +- core/services/chainlink/config_general.go | 2 +- core/services/chainlink/config_test.go | 2 +- .../chainlink/mocks/general_config.go | 12 +-- core/services/chainlink/types.go | 4 +- core/services/job/job_orm_test.go | 2 +- core/services/pipeline/common_test.go | 4 +- core/services/vrf/integration_helpers_test.go | 40 +++---- core/services/vrf/integration_v2_test.go | 52 ++++----- core/web/evm_chains_controller_test.go | 2 +- core/web/evm_forwarders_controller_test.go | 2 +- core/web/loader/loader_test.go | 6 +- core/web/resolver/chain_test.go | 10 +- core/web/resolver/eth_key_test.go | 10 +- core/web/resolver/eth_transaction_test.go | 6 +- core/web/resolver/node.go | 4 +- core/web/resolver/node_test.go | 6 +- 79 files changed, 250 insertions(+), 251 deletions(-) rename core/chains/evm/config/{v2 => }/chain_scoped.go (87%) create mode 100644 core/chains/evm/config/chain_scoped_balance_monitor.go rename core/chains/evm/config/{v2 => }/chain_scoped_gas_estimator.go (92%) rename core/chains/evm/config/{v2 => }/chain_scoped_head_tracker.go (70%) rename core/chains/evm/config/{v2/config_node_pool.go => chain_scoped_node_pool.go} (79%) rename core/chains/evm/config/{v2 => }/chain_scoped_ocr.go (79%) rename core/chains/evm/config/{v2 => }/chain_scoped_ocr2.go (60%) rename core/chains/evm/config/{v2 => }/chain_scoped_ocr2_test.go (94%) rename core/chains/evm/config/{v2 => }/chain_scoped_ocr_test.go (96%) rename core/chains/evm/config/{v2 => }/chain_scoped_transactions.go (82%) delete mode 100644 core/chains/evm/config/config_node_pool.go delete mode 100644 core/chains/evm/config/config_node_pool_test.go rename core/chains/evm/config/{v2 => toml}/config.go (99%) rename core/chains/evm/config/{v2 => toml}/defaults.go (99%) rename core/chains/evm/config/{v2 => toml}/defaults/Arbitrum_Goerli.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Arbitrum_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Arbitrum_Rinkeby.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Avalanche_Fuji.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Avalanche_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/BSC_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Celo_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Celo_Testnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Ethereum_Goerli.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Ethereum_Kovan.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Ethereum_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Ethereum_Rinkeby.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Ethereum_Ropsten.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Ethereum_Sepolia.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Fantom_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Fantom_Testnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Harmony_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Harmony_Testnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Heco_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Klaytn_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Klaytn_Testnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Metis_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Metis_Rinkeby.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/OKX_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/OKX_Testnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Optimism_Goerli.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Optimism_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Polygon_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Polygon_Mumbai.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/README.md (100%) rename core/chains/evm/config/{v2 => toml}/defaults/RSK_Mainnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/RSK_Testnet.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/Simulated.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/fallback.toml (100%) rename core/chains/evm/config/{v2 => toml}/defaults/xDai_Mainnet.toml (100%) delete mode 100644 core/chains/evm/config/v2/chain_scoped_balance_monitor.go diff --git a/core/chains/evm/chain.go b/core/chains/evm/chain.go index 56cbc1118a6..5e80b7601cc 100644 --- a/core/chains/evm/chain.go +++ b/core/chains/evm/chain.go @@ -15,7 +15,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" @@ -75,18 +75,18 @@ func (e errChainDisabled) Error() string { return fmt.Sprintf("cannot create new chain with ID %s, the chain is disabled", e.ChainID.String()) } -func newTOMLChain(ctx context.Context, chain *v2.EVMConfig, opts ChainSetOpts) (*chain, error) { +func newTOMLChain(ctx context.Context, chain *toml.EVMConfig, opts ChainSetOpts) (*chain, error) { chainID := chain.ChainID l := opts.Logger.With("evmChainID", chainID.String()) if !chain.IsEnabled() { return nil, errChainDisabled{ChainID: chainID} } - cfg := v2.NewTOMLChainScopedConfig(opts.Config, chain, l) + cfg := evmconfig.NewTOMLChainScopedConfig(opts.Config, chain, l) // note: per-chain validation is not ncessary at this point since everything is checked earlier on boot. return newChain(ctx, cfg, chain.Nodes, opts) } -func newChain(ctx context.Context, cfg evmconfig.ChainScopedConfig, nodes []*v2.Node, opts ChainSetOpts) (*chain, error) { +func newChain(ctx context.Context, cfg evmconfig.ChainScopedConfig, nodes []*toml.Node, opts ChainSetOpts) (*chain, error) { chainID, chainType := cfg.EVM().ChainID(), cfg.EVM().ChainType() l := opts.Logger.Named(chainID.String()).With("evmChainID", chainID.String()) var client evmclient.Client @@ -279,7 +279,7 @@ func (c *chain) Logger() logger.Logger { return c.logger } func (c *chain) BalanceMonitor() monitor.BalanceMonitor { return c.balanceMonitor } func (c *chain) GasEstimator() gas.EvmFeeEstimator { return c.gasEstimator } -func newEthClientFromChain(cfg evmconfig.NodePool, noNewHeadsThreshold time.Duration, lggr logger.Logger, chainID *big.Int, chainType config.ChainType, nodes []*v2.Node) (evmclient.Client, error) { +func newEthClientFromChain(cfg evmconfig.NodePool, noNewHeadsThreshold time.Duration, lggr logger.Logger, chainID *big.Int, chainType config.ChainType, nodes []*toml.Node) (evmclient.Client, error) { var primaries []evmclient.Node var sendonlys []evmclient.SendOnlyNode for i, node := range nodes { @@ -297,7 +297,7 @@ func newEthClientFromChain(cfg evmconfig.NodePool, noNewHeadsThreshold time.Dura return evmclient.NewClientWithNodes(lggr, cfg.SelectionMode(), noNewHeadsThreshold, primaries, sendonlys, chainID, chainType) } -func newPrimary(cfg evmconfig.NodePool, noNewHeadsThreshold time.Duration, lggr logger.Logger, n *v2.Node, id int32, chainID *big.Int) (evmclient.Node, error) { +func newPrimary(cfg evmconfig.NodePool, noNewHeadsThreshold time.Duration, lggr logger.Logger, n *toml.Node, id int32, chainID *big.Int) (evmclient.Node, error) { if n.SendOnly != nil && *n.SendOnly { return nil, errors.New("cannot cast send-only node to primary") } diff --git a/core/chains/evm/chain_set.go b/core/chains/evm/chain_set.go index a41b7484a83..edfc3e1aeb9 100644 --- a/core/chains/evm/chain_set.go +++ b/core/chains/evm/chain_set.go @@ -16,7 +16,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" @@ -242,7 +242,7 @@ func (cll *chainSet) SendTx(ctx context.Context, chainID, from, to string, amoun type GeneralConfig interface { config.AppConfig - v2.HasEVMConfigs + toml.HasEVMConfigs } type ChainSetOpts struct { @@ -270,7 +270,7 @@ func NewTOMLChainSet(ctx context.Context, opts ChainSetOpts) (ChainSet, error) { return nil, err } chains := opts.Config.EVMConfigs() - var enabled []*v2.EVMConfig + var enabled []*toml.EVMConfig for i := range chains { if chains[i].IsEnabled() { enabled = append(enabled, chains[i]) diff --git a/core/chains/evm/chain_set_test.go b/core/chains/evm/chain_set_test.go index 1683ce3e5c9..2c7de3c62b3 100644 --- a/core/chains/evm/chain_set_test.go +++ b/core/chains/evm/chain_set_test.go @@ -10,7 +10,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" @@ -28,7 +28,7 @@ func TestChainSet(t *testing.T) { one := uint32(1) c.EVM[0].MinIncomingConfirmations = &one t := true - c.EVM = append(c.EVM, &v2.EVMConfig{ChainID: utils.NewBig(newId), Enabled: &t, Chain: v2.Defaults(nil)}) + c.EVM = append(c.EVM, &toml.EVMConfig{ChainID: utils.NewBig(newId), Enabled: &t, Chain: toml.Defaults(nil)}) }) db := pgtest.NewSqlxDB(t) kst := cltest.NewKeyStore(t, db, cfg.Database()) diff --git a/core/chains/evm/config/v2/chain_scoped.go b/core/chains/evm/config/chain_scoped.go similarity index 87% rename from core/chains/evm/config/v2/chain_scoped.go rename to core/chains/evm/config/chain_scoped.go index db4b141c396..608e9be8e5e 100644 --- a/core/chains/evm/config/v2/chain_scoped.go +++ b/core/chains/evm/config/chain_scoped.go @@ -1,4 +1,4 @@ -package v2 +package config import ( "math/big" @@ -10,12 +10,12 @@ import ( ocrtypes "github.com/smartcontractkit/libocr/offchainreporting/types" "github.com/smartcontractkit/chainlink/v2/core/assets" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" gencfg "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" ) -func NewTOMLChainScopedConfig(genCfg gencfg.AppConfig, chain *EVMConfig, lggr logger.Logger) *ChainScoped { +func NewTOMLChainScopedConfig(genCfg gencfg.AppConfig, chain *toml.EVMConfig, lggr logger.Logger) *ChainScoped { return &ChainScoped{AppConfig: genCfg, cfg: chain, lggr: lggr} } @@ -24,7 +24,7 @@ type ChainScoped struct { gencfg.AppConfig lggr logger.Logger - cfg *EVMConfig + cfg *toml.EVMConfig } func (c *ChainScoped) Validate() (err error) { @@ -46,30 +46,30 @@ func (c *ChainScoped) Validate() (err error) { } type evmConfig struct { - c *EVMConfig + c *toml.EVMConfig } -func (e *evmConfig) BalanceMonitor() config.BalanceMonitor { +func (e *evmConfig) BalanceMonitor() BalanceMonitor { return &balanceMonitorConfig{c: e.c.BalanceMonitor} } -func (e *evmConfig) Transactions() config.Transactions { +func (e *evmConfig) Transactions() Transactions { return &transactionsConfig{c: e.c.Transactions} } -func (e *evmConfig) HeadTracker() config.HeadTracker { +func (e *evmConfig) HeadTracker() HeadTracker { return &headTrackerConfig{c: e.c.HeadTracker} } -func (e *evmConfig) OCR() config.OCR { +func (e *evmConfig) OCR() OCR { return &ocrConfig{c: e.c.OCR} } -func (e *evmConfig) OCR2() config.OCR2 { +func (e *evmConfig) OCR2() OCR2 { return &ocr2Config{c: e.c.OCR2} } -func (e *evmConfig) GasEstimator() config.GasEstimator { +func (e *evmConfig) GasEstimator() GasEstimator { return &gasEstimatorConfig{c: e.c.GasEstimator, blockDelay: e.c.RPCBlockQueryDelay, transactionsMaxInFlight: e.c.Transactions.MaxInFlight, k: e.c.KeySpecific} } @@ -128,7 +128,7 @@ func (e *evmConfig) MinIncomingConfirmations() uint32 { return *e.c.MinIncomingConfirmations } -func (e *evmConfig) NodePool() config.NodePool { +func (e *evmConfig) NodePool() NodePool { return &nodePoolConfig{c: e.c.NodePool} } @@ -136,7 +136,7 @@ func (e *evmConfig) NodeNoNewHeadsThreshold() time.Duration { return e.c.NoNewHeadsThreshold.Duration() } -func (c *ChainScoped) EVM() config.EVM { +func (c *ChainScoped) EVM() EVM { return &evmConfig{c: c.cfg} } diff --git a/core/chains/evm/config/chain_scoped_balance_monitor.go b/core/chains/evm/config/chain_scoped_balance_monitor.go new file mode 100644 index 00000000000..eef8240e635 --- /dev/null +++ b/core/chains/evm/config/chain_scoped_balance_monitor.go @@ -0,0 +1,11 @@ +package config + +import "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + +type balanceMonitorConfig struct { + c toml.BalanceMonitor +} + +func (b *balanceMonitorConfig) Enabled() bool { + return *b.c.Enabled +} diff --git a/core/chains/evm/config/v2/chain_scoped_gas_estimator.go b/core/chains/evm/config/chain_scoped_gas_estimator.go similarity index 92% rename from core/chains/evm/config/v2/chain_scoped_gas_estimator.go rename to core/chains/evm/config/chain_scoped_gas_estimator.go index dde27c664c5..ab637361e56 100644 --- a/core/chains/evm/config/v2/chain_scoped_gas_estimator.go +++ b/core/chains/evm/config/chain_scoped_gas_estimator.go @@ -1,15 +1,15 @@ -package v2 +package config import ( gethcommon "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink/v2/core/assets" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" ) type gasEstimatorConfig struct { - c GasEstimator - k KeySpecificConfig + c toml.GasEstimator + k toml.KeySpecificConfig blockDelay *uint16 transactionsMaxInFlight *uint32 } @@ -32,7 +32,7 @@ func (g *gasEstimatorConfig) PriceMaxKey(addr gethcommon.Address) *assets.Wei { return g.c.PriceMax } -func (g *gasEstimatorConfig) BlockHistory() config.BlockHistory { +func (g *gasEstimatorConfig) BlockHistory() BlockHistory { return &blockHistoryConfig{c: g.c.BlockHistory, blockDelay: g.blockDelay, bumpThreshold: g.c.BumpThreshold} } @@ -104,12 +104,12 @@ func (g *gasEstimatorConfig) Mode() string { return *g.c.Mode } -func (g *gasEstimatorConfig) LimitJobType() config.LimitJobType { +func (g *gasEstimatorConfig) LimitJobType() LimitJobType { return &limitJobTypeConfig{c: g.c.LimitJobType} } type limitJobTypeConfig struct { - c GasLimitJobType + c toml.GasLimitJobType } func (l *limitJobTypeConfig) OCR() *uint32 { @@ -137,7 +137,7 @@ func (l *limitJobTypeConfig) VRF() *uint32 { } type blockHistoryConfig struct { - c BlockHistoryEstimator + c toml.BlockHistoryEstimator blockDelay *uint16 bumpThreshold *uint32 } diff --git a/core/chains/evm/config/v2/chain_scoped_head_tracker.go b/core/chains/evm/config/chain_scoped_head_tracker.go similarity index 70% rename from core/chains/evm/config/v2/chain_scoped_head_tracker.go rename to core/chains/evm/config/chain_scoped_head_tracker.go index 031ad7ca9ed..c46f5b72e6c 100644 --- a/core/chains/evm/config/v2/chain_scoped_head_tracker.go +++ b/core/chains/evm/config/chain_scoped_head_tracker.go @@ -1,9 +1,13 @@ -package v2 +package config -import "time" +import ( + "time" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" +) type headTrackerConfig struct { - c HeadTracker + c toml.HeadTracker } func (h *headTrackerConfig) HistoryDepth() uint32 { diff --git a/core/chains/evm/config/v2/config_node_pool.go b/core/chains/evm/config/chain_scoped_node_pool.go similarity index 79% rename from core/chains/evm/config/v2/config_node_pool.go rename to core/chains/evm/config/chain_scoped_node_pool.go index 514c3d4822d..2f26aaab0c7 100644 --- a/core/chains/evm/config/v2/config_node_pool.go +++ b/core/chains/evm/config/chain_scoped_node_pool.go @@ -1,11 +1,13 @@ -package v2 +package config import ( "time" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" ) type nodePoolConfig struct { - c NodePool + c toml.NodePool } func (n *nodePoolConfig) PollFailureThreshold() uint32 { diff --git a/core/chains/evm/config/v2/chain_scoped_ocr.go b/core/chains/evm/config/chain_scoped_ocr.go similarity index 79% rename from core/chains/evm/config/v2/chain_scoped_ocr.go rename to core/chains/evm/config/chain_scoped_ocr.go index 4b95dbd35a8..0cdec34e388 100644 --- a/core/chains/evm/config/v2/chain_scoped_ocr.go +++ b/core/chains/evm/config/chain_scoped_ocr.go @@ -1,9 +1,13 @@ -package v2 +package config -import "time" +import ( + "time" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" +) type ocrConfig struct { - c OCR + c toml.OCR } func (o *ocrConfig) ContractConfirmations() uint16 { diff --git a/core/chains/evm/config/v2/chain_scoped_ocr2.go b/core/chains/evm/config/chain_scoped_ocr2.go similarity index 60% rename from core/chains/evm/config/v2/chain_scoped_ocr2.go rename to core/chains/evm/config/chain_scoped_ocr2.go index c18bc3dc7e2..4d59b58b602 100644 --- a/core/chains/evm/config/v2/chain_scoped_ocr2.go +++ b/core/chains/evm/config/chain_scoped_ocr2.go @@ -1,9 +1,11 @@ -package v2 +package config -import "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" +import ( + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" +) type ocr2Automation struct { - c Automation + c toml.Automation } func (o *ocr2Automation) GasLimit() uint32 { @@ -11,10 +13,10 @@ func (o *ocr2Automation) GasLimit() uint32 { } type ocr2Config struct { - c OCR2 + c toml.OCR2 } -func (o *ocr2Config) Automation() config.OCR2Automation { +func (o *ocr2Config) Automation() OCR2Automation { return &ocr2Automation{c: o.c.Automation} } diff --git a/core/chains/evm/config/v2/chain_scoped_ocr2_test.go b/core/chains/evm/config/chain_scoped_ocr2_test.go similarity index 94% rename from core/chains/evm/config/v2/chain_scoped_ocr2_test.go rename to core/chains/evm/config/chain_scoped_ocr2_test.go index b4a4ba525df..21863ae65ca 100644 --- a/core/chains/evm/config/v2/chain_scoped_ocr2_test.go +++ b/core/chains/evm/config/chain_scoped_ocr2_test.go @@ -1,4 +1,4 @@ -package v2_test +package config_test import ( "testing" diff --git a/core/chains/evm/config/v2/chain_scoped_ocr_test.go b/core/chains/evm/config/chain_scoped_ocr_test.go similarity index 96% rename from core/chains/evm/config/v2/chain_scoped_ocr_test.go rename to core/chains/evm/config/chain_scoped_ocr_test.go index 19b2233c407..e42de465c5c 100644 --- a/core/chains/evm/config/v2/chain_scoped_ocr_test.go +++ b/core/chains/evm/config/chain_scoped_ocr_test.go @@ -1,4 +1,4 @@ -package v2_test +package config_test import ( "testing" diff --git a/core/chains/evm/config/v2/chain_scoped_transactions.go b/core/chains/evm/config/chain_scoped_transactions.go similarity index 82% rename from core/chains/evm/config/v2/chain_scoped_transactions.go rename to core/chains/evm/config/chain_scoped_transactions.go index 869d656fade..df2343d3158 100644 --- a/core/chains/evm/config/v2/chain_scoped_transactions.go +++ b/core/chains/evm/config/chain_scoped_transactions.go @@ -1,9 +1,13 @@ -package v2 +package config -import "time" +import ( + "time" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" +) type transactionsConfig struct { - c Transactions + c toml.Transactions } func (t *transactionsConfig) ForwardersEnabled() bool { diff --git a/core/chains/evm/config/config.go b/core/chains/evm/config/config.go index 4c04d992f99..7467243d991 100644 --- a/core/chains/evm/config/config.go +++ b/core/chains/evm/config/config.go @@ -116,6 +116,13 @@ type BlockHistory interface { TransactionPercentile() uint16 } +type NodePool interface { + PollFailureThreshold() uint32 + PollInterval() time.Duration + SelectionMode() string + SyncThreshold() uint32 +} + //go:generate mockery --quiet --name ChainScopedConfig --output ./mocks/ --case=underscore type ChainScopedConfig interface { config.AppConfig diff --git a/core/chains/evm/config/config_node_pool.go b/core/chains/evm/config/config_node_pool.go deleted file mode 100644 index aebe0b268ef..00000000000 --- a/core/chains/evm/config/config_node_pool.go +++ /dev/null @@ -1,10 +0,0 @@ -package config - -import "time" - -type NodePool interface { - PollFailureThreshold() uint32 - PollInterval() time.Duration - SelectionMode() string - SyncThreshold() uint32 -} diff --git a/core/chains/evm/config/config_node_pool_test.go b/core/chains/evm/config/config_node_pool_test.go deleted file mode 100644 index c04ce83997e..00000000000 --- a/core/chains/evm/config/config_node_pool_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package config_test - -import ( - "math/big" - "math/rand" - "testing" - "time" - - "github.com/stretchr/testify/require" - - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" - configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -func TestNodePoolConfig(t *testing.T) { - gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - id := utils.NewBig(big.NewInt(rand.Int63())) - c.EVM[0] = &v2.EVMConfig{ - ChainID: id, - Chain: v2.Defaults(id, &v2.Chain{}), - } - }) - cfg := evmtest.NewChainScopedConfig(t, gcfg) - - require.Equal(t, "HighestHead", cfg.EVM().NodePool().SelectionMode()) - require.Equal(t, uint32(5), cfg.EVM().NodePool().SyncThreshold()) - require.Equal(t, time.Duration(10000000000), cfg.EVM().NodePool().PollInterval()) - require.Equal(t, uint32(5), cfg.EVM().NodePool().PollFailureThreshold()) -} diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index 9483897b952..d3240cf81f7 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/v2/core/assets" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" @@ -27,10 +27,10 @@ func TestChainScopedConfig(t *testing.T) { t.Parallel() gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { id := utils.NewBig(big.NewInt(rand.Int63())) - c.EVM[0] = &v2.EVMConfig{ + c.EVM[0] = &toml.EVMConfig{ ChainID: id, - Chain: v2.Defaults(id, &v2.Chain{ - GasEstimator: v2.GasEstimator{PriceMax: assets.NewWeiI(100000000000000)}, + Chain: toml.Defaults(id, &toml.Chain{ + GasEstimator: toml.GasEstimator{PriceMax: assets.NewWeiI(100000000000000)}, }), } }) @@ -38,10 +38,10 @@ func TestChainScopedConfig(t *testing.T) { overrides := func(c *chainlink.Config, s *chainlink.Secrets) { id := utils.NewBig(big.NewInt(rand.Int63())) - c.EVM[0] = &v2.EVMConfig{ + c.EVM[0] = &toml.EVMConfig{ ChainID: id, - Chain: v2.Defaults(id, &v2.Chain{ - GasEstimator: v2.GasEstimator{ + Chain: toml.Defaults(id, &toml.Chain{ + GasEstimator: toml.GasEstimator{ PriceMax: assets.NewWeiI(100000000000000), PriceDefault: assets.NewWeiI(42000000000), }, @@ -65,10 +65,10 @@ func TestChainScopedConfig(t *testing.T) { var override uint32 = 10 gasBumpOverrides := func(c *chainlink.Config, s *chainlink.Secrets) { id := utils.NewBig(big.NewInt(rand.Int63())) - c.EVM[0] = &v2.EVMConfig{ + c.EVM[0] = &toml.EVMConfig{ ChainID: id, - Chain: v2.Defaults(id, &v2.Chain{ - GasEstimator: v2.GasEstimator{ + Chain: toml.Defaults(id, &toml.Chain{ + GasEstimator: toml.GasEstimator{ BumpTxDepth: ptr(uint32(override)), }, }), @@ -86,9 +86,9 @@ func TestChainScopedConfig(t *testing.T) { randomOtherAddr := testutils.NewAddress() gcfg2 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { overrides(c, s) - c.EVM[0].KeySpecific = v2.KeySpecificConfig{ + c.EVM[0].KeySpecific = toml.KeySpecificConfig{ {Key: ptr(ethkey.EIP55AddressFromAddress(randomOtherAddr)), - GasEstimator: v2.KeySpecificGasEstimator{ + GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: assets.GWei(850), }, }, @@ -112,9 +112,9 @@ func TestChainScopedConfig(t *testing.T) { t.Run("uses key-specific override value when set", func(t *testing.T) { val := assets.GWei(250) gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].KeySpecific = v2.KeySpecificConfig{ + c.EVM[0].KeySpecific = toml.KeySpecificConfig{ {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), - GasEstimator: v2.KeySpecificGasEstimator{ + GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: val, }, }, @@ -129,9 +129,9 @@ func TestChainScopedConfig(t *testing.T) { chainSpecificPrice := assets.GWei(1200) gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice - c.EVM[0].KeySpecific = v2.KeySpecificConfig{ + c.EVM[0].KeySpecific = toml.KeySpecificConfig{ {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), - GasEstimator: v2.KeySpecificGasEstimator{ + GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, }, }, @@ -146,9 +146,9 @@ func TestChainScopedConfig(t *testing.T) { chainSpecificPrice := assets.GWei(1200) gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice - c.EVM[0].KeySpecific = v2.KeySpecificConfig{ + c.EVM[0].KeySpecific = toml.KeySpecificConfig{ {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), - GasEstimator: v2.KeySpecificGasEstimator{ + GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, }, }, @@ -161,9 +161,9 @@ func TestChainScopedConfig(t *testing.T) { t.Run("uses key-specific override value when set and lower than global config", func(t *testing.T) { keySpecificPrice := assets.GWei(900) gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].KeySpecific = v2.KeySpecificConfig{ + c.EVM[0].KeySpecific = toml.KeySpecificConfig{ {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), - GasEstimator: v2.KeySpecificGasEstimator{ + GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, }, }, @@ -178,9 +178,9 @@ func TestChainScopedConfig(t *testing.T) { chainSpecificPrice := assets.GWei(1200) gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice - c.EVM[0].KeySpecific = v2.KeySpecificConfig{ + c.EVM[0].KeySpecific = toml.KeySpecificConfig{ {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), - GasEstimator: v2.KeySpecificGasEstimator{ + GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, }, }, @@ -281,8 +281,8 @@ func TestChainScopedConfig_BSCDefaults(t *testing.T) { chainID := big.NewInt(56) gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, secrets *chainlink.Secrets) { id := utils.NewBig(chainID) - cfg := v2.Defaults(id) - c.EVM[0] = &v2.EVMConfig{ + cfg := toml.Defaults(id) + c.EVM[0] = &toml.EVMConfig{ ChainID: id, Enabled: ptr(true), Chain: cfg, @@ -333,8 +333,8 @@ func TestChainScopedConfig_Profiles(t *testing.T) { gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, secrets *chainlink.Secrets) { id := utils.NewBigI(tt.chainID) - cfg := v2.Defaults(id) - c.EVM[0] = &v2.EVMConfig{ + cfg := toml.Defaults(id) + c.EVM[0] = &toml.EVMConfig{ ChainID: id, Enabled: ptr(true), Chain: cfg, @@ -365,11 +365,11 @@ func TestChainScopedConfig_HeadTracker(t *testing.T) { } func Test_chainScopedConfig_Validate(t *testing.T) { - configWithChains := func(t *testing.T, id int64, chains ...*v2.Chain) config.AppConfig { + configWithChains := func(t *testing.T, id int64, chains ...*toml.Chain) config.AppConfig { return configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { chainID := utils.NewBigI(id) - c.EVM[0] = &v2.EVMConfig{ChainID: chainID, Enabled: ptr(true), Chain: v2.Defaults(chainID, chains...), - Nodes: v2.EVMNodes{{ + c.EVM[0] = &toml.EVMConfig{ChainID: chainID, Enabled: ptr(true), Chain: toml.Defaults(chainID, chains...), + Nodes: toml.EVMNodes{{ Name: ptr("fake"), WSURL: models.MustParseURL("wss://foo.test/ws"), HTTPURL: models.MustParseURL("http://foo.test"), @@ -378,7 +378,7 @@ func Test_chainScopedConfig_Validate(t *testing.T) { } // Validate built-in - for _, id := range v2.DefaultIDs { + for _, id := range toml.DefaultIDs { id := id t.Run(fmt.Sprintf("chainID-%s", id), func(t *testing.T) { cfg := configWithChains(t, id.Int64()) @@ -390,19 +390,19 @@ func Test_chainScopedConfig_Validate(t *testing.T) { t.Run("arbitrum-estimator", func(t *testing.T) { t.Run("custom", func(t *testing.T) { - cfg := configWithChains(t, 0, &v2.Chain{ + cfg := configWithChains(t, 0, &toml.Chain{ ChainType: ptr(string(config.ChainArbitrum)), - GasEstimator: v2.GasEstimator{ + GasEstimator: toml.GasEstimator{ Mode: ptr("BlockHistory"), }, }) assert.NoError(t, cfg.Validate()) }) t.Run("mainnet", func(t *testing.T) { - cfg := configWithChains(t, 42161, &v2.Chain{ - GasEstimator: v2.GasEstimator{ + cfg := configWithChains(t, 42161, &toml.Chain{ + GasEstimator: toml.GasEstimator{ Mode: ptr("BlockHistory"), - BlockHistory: v2.BlockHistoryEstimator{ + BlockHistory: toml.BlockHistoryEstimator{ BlockHistorySize: ptr[uint16](1), }, }, @@ -410,8 +410,8 @@ func Test_chainScopedConfig_Validate(t *testing.T) { assert.NoError(t, cfg.Validate()) }) t.Run("testnet", func(t *testing.T) { - cfg := configWithChains(t, 421611, &v2.Chain{ - GasEstimator: v2.GasEstimator{ + cfg := configWithChains(t, 421611, &toml.Chain{ + GasEstimator: toml.GasEstimator{ Mode: ptr("L2Suggested"), }, }) @@ -421,25 +421,25 @@ func Test_chainScopedConfig_Validate(t *testing.T) { t.Run("optimism-estimator", func(t *testing.T) { t.Run("custom", func(t *testing.T) { - cfg := configWithChains(t, 0, &v2.Chain{ + cfg := configWithChains(t, 0, &toml.Chain{ ChainType: ptr(string(config.ChainOptimismBedrock)), - GasEstimator: v2.GasEstimator{ + GasEstimator: toml.GasEstimator{ Mode: ptr("BlockHistory"), }, }) assert.NoError(t, cfg.Validate()) }) t.Run("mainnet", func(t *testing.T) { - cfg := configWithChains(t, 10, &v2.Chain{ - GasEstimator: v2.GasEstimator{ + cfg := configWithChains(t, 10, &toml.Chain{ + GasEstimator: toml.GasEstimator{ Mode: ptr("FixedPrice"), }, }) assert.NoError(t, cfg.Validate()) }) t.Run("testnet", func(t *testing.T) { - cfg := configWithChains(t, 69, &v2.Chain{ - GasEstimator: v2.GasEstimator{ + cfg := configWithChains(t, 69, &toml.Chain{ + GasEstimator: toml.GasEstimator{ Mode: ptr("FixedPrice"), }, }) @@ -448,4 +448,20 @@ func Test_chainScopedConfig_Validate(t *testing.T) { }) } +func TestNodePoolConfig(t *testing.T) { + gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { + id := utils.NewBig(big.NewInt(rand.Int63())) + c.EVM[0] = &toml.EVMConfig{ + ChainID: id, + Chain: toml.Defaults(id, &toml.Chain{}), + } + }) + cfg := evmtest.NewChainScopedConfig(t, gcfg) + + require.Equal(t, "HighestHead", cfg.EVM().NodePool().SelectionMode()) + require.Equal(t, uint32(5), cfg.EVM().NodePool().SyncThreshold()) + require.Equal(t, time.Duration(10000000000), cfg.EVM().NodePool().PollInterval()) + require.Equal(t, uint32(5), cfg.EVM().NodePool().PollFailureThreshold()) +} + func ptr[T any](t T) *T { return &t } diff --git a/core/chains/evm/config/v2/config.go b/core/chains/evm/config/toml/config.go similarity index 99% rename from core/chains/evm/config/v2/config.go rename to core/chains/evm/config/toml/config.go index 2d486c141f4..e8947d106aa 100644 --- a/core/chains/evm/config/v2/config.go +++ b/core/chains/evm/config/toml/config.go @@ -1,4 +1,4 @@ -package v2 +package toml import ( "fmt" diff --git a/core/chains/evm/config/v2/defaults.go b/core/chains/evm/config/toml/defaults.go similarity index 99% rename from core/chains/evm/config/v2/defaults.go rename to core/chains/evm/config/toml/defaults.go index c7530942516..811d49da00c 100644 --- a/core/chains/evm/config/v2/defaults.go +++ b/core/chains/evm/config/toml/defaults.go @@ -1,4 +1,4 @@ -package v2 +package toml import ( "bytes" diff --git a/core/chains/evm/config/v2/defaults/Arbitrum_Goerli.toml b/core/chains/evm/config/toml/defaults/Arbitrum_Goerli.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Arbitrum_Goerli.toml rename to core/chains/evm/config/toml/defaults/Arbitrum_Goerli.toml diff --git a/core/chains/evm/config/v2/defaults/Arbitrum_Mainnet.toml b/core/chains/evm/config/toml/defaults/Arbitrum_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Arbitrum_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Arbitrum_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Arbitrum_Rinkeby.toml b/core/chains/evm/config/toml/defaults/Arbitrum_Rinkeby.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Arbitrum_Rinkeby.toml rename to core/chains/evm/config/toml/defaults/Arbitrum_Rinkeby.toml diff --git a/core/chains/evm/config/v2/defaults/Avalanche_Fuji.toml b/core/chains/evm/config/toml/defaults/Avalanche_Fuji.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Avalanche_Fuji.toml rename to core/chains/evm/config/toml/defaults/Avalanche_Fuji.toml diff --git a/core/chains/evm/config/v2/defaults/Avalanche_Mainnet.toml b/core/chains/evm/config/toml/defaults/Avalanche_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Avalanche_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Avalanche_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/BSC_Mainnet.toml b/core/chains/evm/config/toml/defaults/BSC_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/BSC_Mainnet.toml rename to core/chains/evm/config/toml/defaults/BSC_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Celo_Mainnet.toml b/core/chains/evm/config/toml/defaults/Celo_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Celo_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Celo_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Celo_Testnet.toml b/core/chains/evm/config/toml/defaults/Celo_Testnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Celo_Testnet.toml rename to core/chains/evm/config/toml/defaults/Celo_Testnet.toml diff --git a/core/chains/evm/config/v2/defaults/Ethereum_Goerli.toml b/core/chains/evm/config/toml/defaults/Ethereum_Goerli.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Ethereum_Goerli.toml rename to core/chains/evm/config/toml/defaults/Ethereum_Goerli.toml diff --git a/core/chains/evm/config/v2/defaults/Ethereum_Kovan.toml b/core/chains/evm/config/toml/defaults/Ethereum_Kovan.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Ethereum_Kovan.toml rename to core/chains/evm/config/toml/defaults/Ethereum_Kovan.toml diff --git a/core/chains/evm/config/v2/defaults/Ethereum_Mainnet.toml b/core/chains/evm/config/toml/defaults/Ethereum_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Ethereum_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Ethereum_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Ethereum_Rinkeby.toml b/core/chains/evm/config/toml/defaults/Ethereum_Rinkeby.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Ethereum_Rinkeby.toml rename to core/chains/evm/config/toml/defaults/Ethereum_Rinkeby.toml diff --git a/core/chains/evm/config/v2/defaults/Ethereum_Ropsten.toml b/core/chains/evm/config/toml/defaults/Ethereum_Ropsten.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Ethereum_Ropsten.toml rename to core/chains/evm/config/toml/defaults/Ethereum_Ropsten.toml diff --git a/core/chains/evm/config/v2/defaults/Ethereum_Sepolia.toml b/core/chains/evm/config/toml/defaults/Ethereum_Sepolia.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Ethereum_Sepolia.toml rename to core/chains/evm/config/toml/defaults/Ethereum_Sepolia.toml diff --git a/core/chains/evm/config/v2/defaults/Fantom_Mainnet.toml b/core/chains/evm/config/toml/defaults/Fantom_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Fantom_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Fantom_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Fantom_Testnet.toml b/core/chains/evm/config/toml/defaults/Fantom_Testnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Fantom_Testnet.toml rename to core/chains/evm/config/toml/defaults/Fantom_Testnet.toml diff --git a/core/chains/evm/config/v2/defaults/Harmony_Mainnet.toml b/core/chains/evm/config/toml/defaults/Harmony_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Harmony_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Harmony_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Harmony_Testnet.toml b/core/chains/evm/config/toml/defaults/Harmony_Testnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Harmony_Testnet.toml rename to core/chains/evm/config/toml/defaults/Harmony_Testnet.toml diff --git a/core/chains/evm/config/v2/defaults/Heco_Mainnet.toml b/core/chains/evm/config/toml/defaults/Heco_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Heco_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Heco_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Klaytn_Mainnet.toml b/core/chains/evm/config/toml/defaults/Klaytn_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Klaytn_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Klaytn_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Klaytn_Testnet.toml b/core/chains/evm/config/toml/defaults/Klaytn_Testnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Klaytn_Testnet.toml rename to core/chains/evm/config/toml/defaults/Klaytn_Testnet.toml diff --git a/core/chains/evm/config/v2/defaults/Metis_Mainnet.toml b/core/chains/evm/config/toml/defaults/Metis_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Metis_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Metis_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Metis_Rinkeby.toml b/core/chains/evm/config/toml/defaults/Metis_Rinkeby.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Metis_Rinkeby.toml rename to core/chains/evm/config/toml/defaults/Metis_Rinkeby.toml diff --git a/core/chains/evm/config/v2/defaults/OKX_Mainnet.toml b/core/chains/evm/config/toml/defaults/OKX_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/OKX_Mainnet.toml rename to core/chains/evm/config/toml/defaults/OKX_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/OKX_Testnet.toml b/core/chains/evm/config/toml/defaults/OKX_Testnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/OKX_Testnet.toml rename to core/chains/evm/config/toml/defaults/OKX_Testnet.toml diff --git a/core/chains/evm/config/v2/defaults/Optimism_Goerli.toml b/core/chains/evm/config/toml/defaults/Optimism_Goerli.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Optimism_Goerli.toml rename to core/chains/evm/config/toml/defaults/Optimism_Goerli.toml diff --git a/core/chains/evm/config/v2/defaults/Optimism_Mainnet.toml b/core/chains/evm/config/toml/defaults/Optimism_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Optimism_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Optimism_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Polygon_Mainnet.toml b/core/chains/evm/config/toml/defaults/Polygon_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Polygon_Mainnet.toml rename to core/chains/evm/config/toml/defaults/Polygon_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/Polygon_Mumbai.toml b/core/chains/evm/config/toml/defaults/Polygon_Mumbai.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Polygon_Mumbai.toml rename to core/chains/evm/config/toml/defaults/Polygon_Mumbai.toml diff --git a/core/chains/evm/config/v2/defaults/README.md b/core/chains/evm/config/toml/defaults/README.md similarity index 100% rename from core/chains/evm/config/v2/defaults/README.md rename to core/chains/evm/config/toml/defaults/README.md diff --git a/core/chains/evm/config/v2/defaults/RSK_Mainnet.toml b/core/chains/evm/config/toml/defaults/RSK_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/RSK_Mainnet.toml rename to core/chains/evm/config/toml/defaults/RSK_Mainnet.toml diff --git a/core/chains/evm/config/v2/defaults/RSK_Testnet.toml b/core/chains/evm/config/toml/defaults/RSK_Testnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/RSK_Testnet.toml rename to core/chains/evm/config/toml/defaults/RSK_Testnet.toml diff --git a/core/chains/evm/config/v2/defaults/Simulated.toml b/core/chains/evm/config/toml/defaults/Simulated.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/Simulated.toml rename to core/chains/evm/config/toml/defaults/Simulated.toml diff --git a/core/chains/evm/config/v2/defaults/fallback.toml b/core/chains/evm/config/toml/defaults/fallback.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/fallback.toml rename to core/chains/evm/config/toml/defaults/fallback.toml diff --git a/core/chains/evm/config/v2/defaults/xDai_Mainnet.toml b/core/chains/evm/config/toml/defaults/xDai_Mainnet.toml similarity index 100% rename from core/chains/evm/config/v2/defaults/xDai_Mainnet.toml rename to core/chains/evm/config/toml/defaults/xDai_Mainnet.toml diff --git a/core/chains/evm/config/v2/chain_scoped_balance_monitor.go b/core/chains/evm/config/v2/chain_scoped_balance_monitor.go deleted file mode 100644 index 78426cc60a6..00000000000 --- a/core/chains/evm/config/v2/chain_scoped_balance_monitor.go +++ /dev/null @@ -1,9 +0,0 @@ -package v2 - -type balanceMonitorConfig struct { - c BalanceMonitor -} - -func (b *balanceMonitorConfig) Enabled() bool { - return *b.c.Enabled -} diff --git a/core/chains/evm/txmgr/resender_test.go b/core/chains/evm/txmgr/resender_test.go index bc090ea371a..32523ab5c26 100644 --- a/core/chains/evm/txmgr/resender_test.go +++ b/core/chains/evm/txmgr/resender_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -108,9 +108,9 @@ func Test_EthResender_alertUnconfirmed(t *testing.T) { // Set this to the smallest non-zero value possible for the attempt to be eligible for resend delay := models.MustNewDuration(1 * time.Nanosecond) cfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0] = &v2.EVMConfig{ - Chain: v2.Defaults(utils.NewBig(big.NewInt(0)), &v2.Chain{ - Transactions: v2.Transactions{ResendAfterThreshold: delay}, + c.EVM[0] = &toml.EVMConfig{ + Chain: toml.Defaults(utils.NewBig(big.NewInt(0)), &toml.Chain{ + Transactions: toml.Transactions{ResendAfterThreshold: delay}, }), } }) diff --git a/core/cmd/evm_node_commands_test.go b/core/cmd/evm_node_commands_test.go index 6081b0af6e0..3ad4103b0f1 100644 --- a/core/cmd/evm_node_commands_test.go +++ b/core/cmd/evm_node_commands_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" diff --git a/core/config/docs/docs_test.go b/core/config/docs/docs_test.go index 0c5e40d11a4..f1a3ab1906c 100644 --- a/core/config/docs/docs_test.go +++ b/core/config/docs/docs_test.go @@ -13,7 +13,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/config/docs" diff --git a/core/config/docs/extended.go b/core/config/docs/extended.go index a302648791a..288a99bf613 100644 --- a/core/config/docs/extended.go +++ b/core/config/docs/extended.go @@ -7,7 +7,7 @@ import ( "github.com/pelletier/go-toml/v2" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" ) // evmChainDefaults returns generated Markdown for the EVM per-chain defaults. See v2.Defaults. diff --git a/core/internal/testutils/configtest/v2/general_config.go b/core/internal/testutils/configtest/v2/general_config.go index ca76cb47271..168906c263e 100644 --- a/core/internal/testutils/configtest/v2/general_config.go +++ b/core/internal/testutils/configtest/v2/general_config.go @@ -9,7 +9,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/store/dialects" diff --git a/core/internal/testutils/evmtest/evmtest.go b/core/internal/testutils/evmtest/evmtest.go index 5e6d9fea744..88f0b0137f5 100644 --- a/core/internal/testutils/evmtest/evmtest.go +++ b/core/internal/testutils/evmtest/evmtest.go @@ -22,7 +22,7 @@ import ( evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmtoml "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" @@ -39,18 +39,18 @@ import ( ) func NewChainScopedConfig(t testing.TB, cfg evm.GeneralConfig) evmconfig.ChainScopedConfig { - var evmCfg *v2.EVMConfig + var evmCfg *evmtoml.EVMConfig if len(cfg.EVMConfigs()) > 0 { evmCfg = cfg.EVMConfigs()[0] } else { chainID := utils.NewBigI(0) - evmCfg = &v2.EVMConfig{ + evmCfg = &evmtoml.EVMConfig{ ChainID: chainID, - Chain: v2.Defaults(chainID), + Chain: evmtoml.Defaults(chainID), } } - return v2.NewTOMLChainScopedConfig(cfg, evmCfg, logger.TestLogger(t)) + return evmconfig.NewTOMLChainScopedConfig(cfg, evmCfg, logger.TestLogger(t)) } @@ -140,16 +140,16 @@ func MustGetDefaultChain(t testing.TB, cc evm.ChainSet) evm.Chain { type TestConfigs struct { mu sync.RWMutex - v2.EVMConfigs + evmtoml.EVMConfigs } var _ evmtypes.Configs = &TestConfigs{} -func NewTestConfigs(cs ...*v2.EVMConfig) *TestConfigs { - return &TestConfigs{EVMConfigs: v2.EVMConfigs(cs)} +func NewTestConfigs(cs ...*evmtoml.EVMConfig) *TestConfigs { + return &TestConfigs{EVMConfigs: evmtoml.EVMConfigs(cs)} } -func (mo *TestConfigs) PutChains(cs ...v2.EVMConfig) { +func (mo *TestConfigs) PutChains(cs ...evmtoml.EVMConfig) { mo.mu.Lock() defer mo.mu.Unlock() chains: @@ -258,7 +258,7 @@ func (mo *TestConfigs) NodeStatusesPaged(offset int, limit int, chainIDs ...stri return } -func legacyNode(n *v2.Node, chainID *utils.Big) (v2 evmtypes.Node) { +func legacyNode(n *evmtoml.Node, chainID *utils.Big) (v2 evmtypes.Node) { v2.Name = *n.Name v2.EVMChainID = *chainID if n.HTTPURL != nil { @@ -273,7 +273,7 @@ func legacyNode(n *v2.Node, chainID *utils.Big) (v2 evmtypes.Node) { return } -func nodeStatus(n *v2.Node, chainID string) (types.NodeStatus, error) { +func nodeStatus(n *evmtoml.Node, chainID string) (types.NodeStatus, error) { var s types.NodeStatus s.ChainID = chainID s.Name = *n.Name diff --git a/core/internal/testutils/evmtest/v2/evmtest.go b/core/internal/testutils/evmtest/v2/evmtest.go index 69c9f6a47b9..400690480d7 100644 --- a/core/internal/testutils/evmtest/v2/evmtest.go +++ b/core/internal/testutils/evmtest/v2/evmtest.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -17,6 +17,6 @@ func ChainArbitrumRinkeby(t *testing.T) config.ChainScopedConfig { return scoped func scopedConfig(t *testing.T, chainID int64) config.ChainScopedConfig { id := utils.NewBigI(chainID) - evmCfg := v2.EVMConfig{ChainID: id, Chain: v2.Defaults(id)} - return v2.NewTOMLChainScopedConfig(configtest.NewTestGeneralConfig(t), &evmCfg, logger.TestLogger(t)) + evmCfg := toml.EVMConfig{ChainID: id, Chain: toml.Defaults(id)} + return config.NewTOMLChainScopedConfig(configtest.NewTestGeneralConfig(t), &evmCfg, logger.TestLogger(t)) } diff --git a/core/services/chainlink/config.go b/core/services/chainlink/config.go index 3ab9676dd80..732d156f276 100644 --- a/core/services/chainlink/config.go +++ b/core/services/chainlink/config.go @@ -14,7 +14,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" "github.com/smartcontractkit/chainlink/v2/core/utils/config" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/config/docs" "github.com/smartcontractkit/chainlink/v2/core/config/env" diff --git a/core/services/chainlink/config_general.go b/core/services/chainlink/config_general.go index 4b2309171ee..cf924b1430a 100644 --- a/core/services/chainlink/config_general.go +++ b/core/services/chainlink/config_general.go @@ -18,7 +18,7 @@ import ( ocrnetworking "github.com/smartcontractkit/libocr/networking" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/config" diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index b30be5d3f16..577d8919de9 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -23,7 +23,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" legacy "github.com/smartcontractkit/chainlink/v2/core/config" diff --git a/core/services/chainlink/mocks/general_config.go b/core/services/chainlink/mocks/general_config.go index 8ff13ead0fc..289c23b26b2 100644 --- a/core/services/chainlink/mocks/general_config.go +++ b/core/services/chainlink/mocks/general_config.go @@ -17,9 +17,9 @@ import ( time "time" - uuid "github.com/google/uuid" + toml "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + uuid "github.com/google/uuid" zapcore "go.uber.org/zap/zapcore" ) @@ -164,15 +164,15 @@ func (_m *GeneralConfig) DefaultChainID() *big.Int { } // EVMConfigs provides a mock function with given fields: -func (_m *GeneralConfig) EVMConfigs() v2.EVMConfigs { +func (_m *GeneralConfig) EVMConfigs() toml.EVMConfigs { ret := _m.Called() - var r0 v2.EVMConfigs - if rf, ok := ret.Get(0).(func() v2.EVMConfigs); ok { + var r0 toml.EVMConfigs + if rf, ok := ret.Get(0).(func() toml.EVMConfigs); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v2.EVMConfigs) + r0 = ret.Get(0).(toml.EVMConfigs) } } diff --git a/core/services/chainlink/types.go b/core/services/chainlink/types.go index 9a476bb8eb3..a286dc3c234 100644 --- a/core/services/chainlink/types.go +++ b/core/services/chainlink/types.go @@ -2,7 +2,7 @@ package chainlink import ( "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/config" @@ -12,7 +12,7 @@ import ( type GeneralConfig interface { config.AppConfig - v2.HasEVMConfigs + toml.HasEVMConfigs CosmosConfigs() cosmos.CosmosConfigs SolanaConfigs() solana.SolanaConfigs StarknetConfigs() starknet.StarknetConfigs diff --git a/core/services/job/job_orm_test.go b/core/services/job/job_orm_test.go index f92234216dc..269fa0b8178 100644 --- a/core/services/job/job_orm_test.go +++ b/core/services/job/job_orm_test.go @@ -18,7 +18,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" diff --git a/core/services/pipeline/common_test.go b/core/services/pipeline/common_test.go index e62811e9a29..8f47063f4c5 100644 --- a/core/services/pipeline/common_test.go +++ b/core/services/pipeline/common_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" "gopkg.in/guregu/null.v4" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" configtest2 "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" @@ -324,7 +324,7 @@ func TestSelectGasLimit(t *testing.T) { gcfg := configtest2.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.LimitDefault = ptr(uint32(999)) - c.EVM[0].GasEstimator.LimitJobType = v2.GasLimitJobType{ + c.EVM[0].GasEstimator.LimitJobType = toml.GasLimitJobType{ DR: ptr(uint32(100)), VRF: ptr(uint32(101)), FM: ptr(uint32(102)), diff --git a/core/services/vrf/integration_helpers_test.go b/core/services/vrf/integration_helpers_test.go index 9a55f9e0425..6b945f5e562 100644 --- a/core/services/vrf/integration_helpers_test.go +++ b/core/services/vrf/integration_helpers_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/v2/core/assets" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_consumer_v2" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_coordinator_v2" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_external_sub_owner_example" @@ -46,14 +46,14 @@ func testSingleConsumerHappyPath( key2 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, db := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_happypath", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, - }, v2.KeySpecific{ + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + }, toml.KeySpecific{ // Gas lane. Key: ptr(key2.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) }) @@ -162,7 +162,7 @@ func testMultipleConsumersNeedBHS( // generate n BHS keys to make sure BHS job rotates sending keys var bhsKeys []ethkey.KeyV2 var bhsKeyAddresses []string - var keySpecificOverrides []v2.KeySpecific + var keySpecificOverrides []toml.KeySpecific var keys []interface{} gasLanePriceWei := assets.GWei(10) for i := 0; i < nConsumers; i++ { @@ -170,16 +170,16 @@ func testMultipleConsumersNeedBHS( bhsKeys = append(bhsKeys, bhsKey) bhsKeyAddresses = append(bhsKeyAddresses, bhsKey.Address.String()) keys = append(keys, bhsKey) - keySpecificOverrides = append(keySpecificOverrides, v2.KeySpecific{ + keySpecificOverrides = append(keySpecificOverrides, toml.KeySpecific{ Key: ptr(bhsKey.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, }) sendEth(t, ownerKey, uni.backend, bhsKey.Address, 10) } - keySpecificOverrides = append(keySpecificOverrides, v2.KeySpecific{ + keySpecificOverrides = append(keySpecificOverrides, toml.KeySpecific{ // Gas lane. Key: ptr(vrfKey.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, }) config, db := heavyweight.FullTestDBV2(t, "vrfv2_needs_blockhash_store", func(c *chainlink.Config, s *chainlink.Secrets) { @@ -315,10 +315,10 @@ func testSingleConsumerHappyPathBatchFulfillment( key1 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, db := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_batch_happypath", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].GasEstimator.LimitDefault = ptr[uint32](5_000_000) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) @@ -413,10 +413,10 @@ func testSingleConsumerNeedsTopUp( key := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(1000) config, db := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_needstopup", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(1000), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(1000), toml.KeySpecific{ // Gas lane. Key: ptr(key.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) }) @@ -512,10 +512,10 @@ func testBlockHeaderFeeder( gasLanePriceWei := assets.GWei(10) config, db := heavyweight.FullTestDBV2(t, "vrfv2_test_block_header_feeder", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, gasLanePriceWei, v2.KeySpecific{ + simulatedOverrides(t, gasLanePriceWei, toml.KeySpecific{ // Gas lane. Key: ptr(vrfKey.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) c.Feature.LogPoller = ptr(true) @@ -607,14 +607,14 @@ func testSingleConsumerForcedFulfillment( key2 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, db := heavyweight.FullTestDBV2(t, fmt.Sprintf("vrfv2_singleconsumer_forcefulfill_%v", batchEnabled), func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, - }, v2.KeySpecific{ + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + }, toml.KeySpecific{ // Gas lane. Key: ptr(key2.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) }) diff --git a/core/services/vrf/integration_v2_test.go b/core/services/vrf/integration_v2_test.go index 608cb287772..2ad08ef4ebd 100644 --- a/core/services/vrf/integration_v2_test.go +++ b/core/services/vrf/integration_v2_test.go @@ -31,7 +31,7 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" "github.com/smartcontractkit/chainlink/v2/core/assets" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" evmlogger "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" @@ -882,10 +882,10 @@ func testEoa(t *testing.T, batchingEnabled bool) { key1 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, _ := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_eoa_request", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].GasEstimator.LimitDefault = ptr(uint32(gasLimit)) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) @@ -1002,10 +1002,10 @@ func TestVRFV2Integration_SingleConsumer_EIP150_HappyPath(t *testing.T) { key1 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, _ := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_eip150_happypath", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].GasEstimator.LimitDefault = ptr(uint32(gasLimit)) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) @@ -1063,10 +1063,10 @@ func TestVRFV2Integration_SingleConsumer_EIP150_Revert(t *testing.T) { key1 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, _ := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_eip150_revert", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].GasEstimator.LimitDefault = ptr(uint32(gasLimit)) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) @@ -1144,10 +1144,10 @@ func TestVRFV2Integration_SingleConsumer_Wrapper(t *testing.T) { key1 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, db := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_wrapper", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].GasEstimator.LimitDefault = ptr[uint32](3_500_000) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) @@ -1222,10 +1222,10 @@ func TestVRFV2Integration_Wrapper_High_Gas(t *testing.T) { callBackGasLimit := int64(2_000_000) // base callback gas. gasLanePriceWei := assets.GWei(10) config, db := heavyweight.FullTestDBV2(t, "vrfv2_wrapper_high_gas_revert", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].GasEstimator.LimitDefault = ptr[uint32](3_500_000) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) @@ -1347,10 +1347,10 @@ func TestVRFV2Integration_SingleConsumer_BigGasCallback_Sandwich(t *testing.T) { key1 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(100) config, db := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_bigcallback_sandwich", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(100), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(100), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].GasEstimator.LimitDefault = ptr[uint32](5_000_000) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) @@ -1450,14 +1450,14 @@ func TestVRFV2Integration_SingleConsumer_MultipleGasLanes(t *testing.T) { cheapGasLane := assets.GWei(10) expensiveGasLane := assets.GWei(1000) config, db := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_multiplegaslanes", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Cheap gas lane. Key: ptr(cheapKey.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: cheapGasLane}, - }, v2.KeySpecific{ + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: cheapGasLane}, + }, toml.KeySpecific{ // Expensive gas lane. Key: ptr(expensiveKey.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: expensiveGasLane}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: expensiveGasLane}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) }) @@ -1550,10 +1550,10 @@ func TestVRFV2Integration_SingleConsumer_AlwaysRevertingCallback_StillFulfilled( key := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, db := heavyweight.FullTestDBV2(t, "vrfv2_singleconsumer_alwaysrevertingcallback", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) }) @@ -1610,13 +1610,13 @@ func TestVRFV2Integration_ConsumerProxy_HappyPath(t *testing.T) { key2 := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, db := heavyweight.FullTestDBV2(t, "vrfv2_consumerproxy_happypath", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, assets.GWei(10), v2.KeySpecific{ + simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. Key: ptr(key1.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, - }, v2.KeySpecific{ + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + }, toml.KeySpecific{ Key: ptr(key2.EIP55Address), - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) }) @@ -1726,7 +1726,7 @@ func TestVRFV2Integration_ConsumerProxy_CoordinatorZeroAddress(t *testing.T) { require.Error(t, err) } -func simulatedOverrides(t *testing.T, defaultGasPrice *assets.Wei, ks ...v2.KeySpecific) func(*chainlink.Config, *chainlink.Secrets) { +func simulatedOverrides(t *testing.T, defaultGasPrice *assets.Wei, ks ...toml.KeySpecific) func(*chainlink.Config, *chainlink.Secrets) { return func(c *chainlink.Config, s *chainlink.Secrets) { require.Zero(t, testutils.SimulatedChainID.Cmp(c.EVM[0].ChainID.ToInt())) c.EVM[0].GasEstimator.Mode = ptr("FixedPrice") @@ -1868,9 +1868,9 @@ func TestIntegrationVRFV2(t *testing.T) { key := cltest.MustGenerateRandomKey(t) gasLanePriceWei := assets.GWei(10) config, _ := heavyweight.FullTestDBV2(t, "vrf_v2_integration", func(c *chainlink.Config, s *chainlink.Secrets) { - simulatedOverrides(t, gasPrice, v2.KeySpecific{ + simulatedOverrides(t, gasPrice, toml.KeySpecific{ Key: &key.EIP55Address, - GasEstimator: v2.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, + GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) }) diff --git a/core/web/evm_chains_controller_test.go b/core/web/evm_chains_controller_test.go index 5696bf74c3a..553bdae937b 100644 --- a/core/web/evm_chains_controller_test.go +++ b/core/web/evm_chains_controller_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" diff --git a/core/web/evm_forwarders_controller_test.go b/core/web/evm_forwarders_controller_test.go index 373d5f73ba9..212105252c4 100644 --- a/core/web/evm_forwarders_controller_test.go +++ b/core/web/evm_forwarders_controller_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" diff --git a/core/web/loader/loader_test.go b/core/web/loader/loader_test.go index 754abc45888..0567ab5188b 100644 --- a/core/web/loader/loader_test.go +++ b/core/web/loader/loader_test.go @@ -13,7 +13,7 @@ import ( relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/chains" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" evmmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtxmgrmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr/mocks" @@ -36,9 +36,9 @@ func TestLoader_Chains(t *testing.T) { ctx := InjectDataloader(testutils.Context(t), app) one := utils.NewBigI(1) - chain := v2.EVMConfig{ChainID: one, Chain: v2.Defaults(one)} + chain := toml.EVMConfig{ChainID: one, Chain: toml.Defaults(one)} two := utils.NewBigI(2) - chain2 := v2.EVMConfig{ChainID: two, Chain: v2.Defaults(two)} + chain2 := toml.EVMConfig{ChainID: two, Chain: toml.Defaults(two)} evmORM := evmtest.NewTestConfigs(&chain, &chain2) app.On("EVMORM").Return(evmORM) diff --git a/core/web/resolver/chain_test.go b/core/web/resolver/chain_test.go index 80ea9f3921f..c3cafd329b4 100644 --- a/core/web/resolver/chain_test.go +++ b/core/web/resolver/chain_test.go @@ -8,7 +8,7 @@ import ( "github.com/pelletier/go-toml/v2" "github.com/stretchr/testify/require" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmtoml "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -58,7 +58,7 @@ ReaperThreshold = '1m0s' ResendAfterThreshold = '1h0m0s' ` ) - var chain v2.EVMConfig + var chain evmtoml.EVMConfig err := toml.Unmarshal([]byte(configTOML), &chain) require.NoError(t, err) @@ -72,7 +72,7 @@ ResendAfterThreshold = '1h0m0s' before: func(f *gqlTestFramework) { f.App.On("EVMORM").Return(f.Mocks.evmORM) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ + f.Mocks.evmORM.PutChains(evmtoml.EVMConfig{ ChainID: &chainID, Enabled: chain.Enabled, Chain: chain.Chain, @@ -145,7 +145,7 @@ ReaperThreshold = '1m0s' ResendAfterThreshold = '1h0m0s' ` ) - var chain v2.Chain + var chain evmtoml.Chain err := toml.Unmarshal([]byte(configTOML), &chain) require.NoError(t, err) @@ -158,7 +158,7 @@ ResendAfterThreshold = '1h0m0s' authenticated: true, before: func(f *gqlTestFramework) { f.App.On("EVMORM").Return(f.Mocks.evmORM) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ + f.Mocks.evmORM.PutChains(evmtoml.EVMConfig{ ChainID: &chainID, Chain: chain, }) diff --git a/core/web/resolver/eth_key_test.go b/core/web/resolver/eth_key_test.go index d437fac0958..3f49815548c 100644 --- a/core/web/resolver/eth_key_test.go +++ b/core/web/resolver/eth_key_test.go @@ -13,7 +13,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" mocks2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/mocks" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -95,7 +95,7 @@ func TestResolver_ETHKeys(t *testing.T) { f.Mocks.chain.On("BalanceMonitor").Return(f.Mocks.balM) f.Mocks.chain.On("Config").Return(f.Mocks.scfg) f.Mocks.chainSet.On("Get", states[0].EVMChainID.ToInt()).Return(f.Mocks.chain, nil) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ChainID: &chainID}) + f.Mocks.evmORM.PutChains(toml.EVMConfig{ChainID: &chainID}) f.Mocks.keystore.On("Eth").Return(f.Mocks.ethKs) f.App.On("GetKeyStore").Return(f.Mocks.keystore) f.App.On("EVMORM").Return(f.Mocks.evmORM) @@ -142,7 +142,7 @@ func TestResolver_ETHKeys(t *testing.T) { f.Mocks.ethKs.On("Get", keys[0].Address.Hex()).Return(keys[0], nil) f.Mocks.ethKs.On("GetAll").Return(keys, nil) f.Mocks.chainSet.On("Get", states[0].EVMChainID.ToInt()).Return(f.Mocks.chain, evm.ErrNoChains) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ChainID: &chainID}) + f.Mocks.evmORM.PutChains(toml.EVMConfig{ChainID: &chainID}) f.Mocks.keystore.On("Eth").Return(f.Mocks.ethKs) f.App.On("GetKeyStore").Return(f.Mocks.keystore) f.App.On("EVMORM").Return(f.Mocks.evmORM) @@ -297,7 +297,7 @@ func TestResolver_ETHKeys(t *testing.T) { f.App.On("GetKeyStore").Return(f.Mocks.keystore) f.App.On("GetChains").Return(chainlink.Chains{EVM: f.Mocks.chainSet}) f.Mocks.chain.On("Config").Return(f.Mocks.scfg) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ChainID: &chainID}) + f.Mocks.evmORM.PutChains(toml.EVMConfig{ChainID: &chainID}) f.App.On("EVMORM").Return(f.Mocks.evmORM) f.Mocks.scfg.On("EVM").Return(&evmMockConfig) }, @@ -346,7 +346,7 @@ func TestResolver_ETHKeys(t *testing.T) { f.Mocks.chain.On("BalanceMonitor").Return(nil) f.Mocks.chain.On("Config").Return(f.Mocks.scfg) f.Mocks.chainSet.On("Get", states[0].EVMChainID.ToInt()).Return(f.Mocks.chain, nil) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ChainID: &chainID}) + f.Mocks.evmORM.PutChains(toml.EVMConfig{ChainID: &chainID}) f.Mocks.keystore.On("Eth").Return(f.Mocks.ethKs) f.App.On("GetKeyStore").Return(f.Mocks.keystore) f.App.On("EVMORM").Return(f.Mocks.evmORM) diff --git a/core/web/resolver/eth_transaction_test.go b/core/web/resolver/eth_transaction_test.go index 959a4b467d8..8a1685e4f72 100644 --- a/core/web/resolver/eth_transaction_test.go +++ b/core/web/resolver/eth_transaction_test.go @@ -11,7 +11,7 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" "github.com/smartcontractkit/chainlink/v2/core/assets" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" @@ -84,7 +84,7 @@ func TestResolver_EthTransaction(t *testing.T) { }, }, nil) f.App.On("TxmStorageService").Return(f.Mocks.txmStore) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ChainID: &chainID}) + f.Mocks.evmORM.PutChains(toml.EVMConfig{ChainID: &chainID}) f.App.On("EVMORM").Return(f.Mocks.evmORM) }, query: query, @@ -141,7 +141,7 @@ func TestResolver_EthTransaction(t *testing.T) { }, }, nil) f.App.On("TxmStorageService").Return(f.Mocks.txmStore) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ChainID: &chainID}) + f.Mocks.evmORM.PutChains(toml.EVMConfig{ChainID: &chainID}) f.App.On("EVMORM").Return(f.Mocks.evmORM) }, query: query, diff --git a/core/web/resolver/node.go b/core/web/resolver/node.go index df3910f4bb2..39a85e83b13 100644 --- a/core/web/resolver/node.go +++ b/core/web/resolver/node.go @@ -9,13 +9,13 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/types" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + evmtoml "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/web/loader" ) // NodeResolver resolves the Node type. type NodeResolver struct { - node v2.Node + node evmtoml.Node status types.NodeStatus } diff --git a/core/web/resolver/node_test.go b/core/web/resolver/node_test.go index 65c57848fdc..1bb381731d6 100644 --- a/core/web/resolver/node_test.go +++ b/core/web/resolver/node_test.go @@ -9,7 +9,7 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/types" - v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/v2" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -54,7 +54,7 @@ func TestResolver_Nodes(t *testing.T) { }, }, 1, nil) f.App.On("EVMORM").Return(f.Mocks.evmORM) - f.Mocks.evmORM.PutChains(v2.EVMConfig{ChainID: &chainID}) + f.Mocks.evmORM.PutChains(toml.EVMConfig{ChainID: &chainID}) }, query: query, result: ` @@ -124,7 +124,7 @@ func Test_NodeQuery(t *testing.T) { authenticated: true, before: func(f *gqlTestFramework) { f.App.On("EVMORM").Return(f.Mocks.evmORM) - f.Mocks.evmORM.PutChains(v2.EVMConfig{Nodes: []*v2.Node{{ + f.Mocks.evmORM.PutChains(toml.EVMConfig{Nodes: []*toml.Node{{ Name: &name, WSURL: models.MustParseURL("ws://some-url"), HTTPURL: models.MustParseURL("http://some-url"),