diff --git a/core/chains/config.go b/core/chains/config.go index e7f16317cde..3556c33a785 100644 --- a/core/chains/config.go +++ b/core/chains/config.go @@ -2,9 +2,6 @@ package chains import ( "errors" - - "github.com/smartcontractkit/chainlink-relay/pkg/logger" - "github.com/smartcontractkit/chainlink-relay/pkg/types" ) var ( @@ -13,20 +10,7 @@ var ( ErrNotFound = errors.New("not found") ) -type ChainConfig[N Node] interface { - GetChainStatus() (types.ChainStatus, error) - GetNodeStatus(name string) (types.NodeStatus, error) - NodeConfig[N] -} - -type NodeConfig[N Node] interface { - ListNodes() (nodes []N, err error) - Node(name string) (N, error) -} - // ChainOpts holds options for configuring a Chain -type ChainOpts[N Node] interface { +type ChainOpts interface { Validate() error - Logger() logger.Logger - ChainConfig() ChainConfig[N] } diff --git a/core/chains/cosmos/chain.go b/core/chains/cosmos/chain.go index 0f93df1b4ad..c2c7f25f843 100644 --- a/core/chains/cosmos/chain.go +++ b/core/chains/cosmos/chain.go @@ -25,7 +25,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos/cosmostxm" - "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos/types" "github.com/smartcontractkit/chainlink/v2/core/chains/internal" "github.com/smartcontractkit/chainlink/v2/core/services/pg" "github.com/smartcontractkit/chainlink/v2/core/services/relay" @@ -57,7 +56,6 @@ type ChainOpts struct { DB *sqlx.DB KeyStore loop.Keystore EventBroadcaster pg.EventBroadcaster - Config types.Config } func (o *ChainOpts) Validate() (err error) { @@ -79,20 +77,9 @@ func (o *ChainOpts) Validate() (err error) { if o.EventBroadcaster == nil { err = multierr.Append(err, required("EventBroadcaster")) } - if o.Config == nil { - err = multierr.Append(err, required("Configs")) - } return } -func (o *ChainOpts) GetLogger() logger.Logger { - return o.Logger -} - -func (o *ChainOpts) ChainConfig() chains.ChainConfig[db.Node] { - return o.Config -} - func NewChain(cfg *CosmosConfig, opts ChainOpts) (adapters.Chain, error) { if !cfg.IsEnabled() { return nil, fmt.Errorf("cannot create new chain with ID %s, the chain is disabled", *cfg.ChainID) @@ -188,7 +175,7 @@ func (c *chain) getClient(name string) (cosmosclient.ReaderWriter, error) { } client, err := cosmosclient.NewClient(c.id, node.TendermintURL, DefaultRequestTimeout, logger.Named(c.lggr, "Client."+name)) if err != nil { - return nil, fmt.Errorf("failed to create client: %w") + return nil, fmt.Errorf("failed to create client: %w", err) } c.lggr.Debugw("Created client", "name", node.Name, "tendermint-url", node.TendermintURL) return client, nil diff --git a/core/chains/cosmos/types/types.go b/core/chains/cosmos/types/types.go index 496a4ee6859..69b086a9706 100644 --- a/core/chains/cosmos/types/types.go +++ b/core/chains/cosmos/types/types.go @@ -1,15 +1,5 @@ package types -import ( - "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/db" - - "github.com/smartcontractkit/chainlink/v2/core/chains" -) - -type Config interface { - chains.ChainConfig[db.Node] -} - // NewNode defines a new node to create. type NewNode struct { Name string `json:"name"` diff --git a/core/chains/evm/chain.go b/core/chains/evm/chain.go index bc5de62b3eb..39c92252c7f 100644 --- a/core/chains/evm/chain.go +++ b/core/chains/evm/chain.go @@ -6,7 +6,6 @@ import ( "fmt" "math/big" "net/url" - "sync" "time" "go.uber.org/multierr" @@ -55,8 +54,6 @@ type Chain interface { BalanceMonitor() monitor.BalanceMonitor LogPoller() logpoller.LogPoller GasEstimator() gas.EvmFeeEstimator - - //GetNodeStatus(ctx context.Context, name string) (relaytypes.NodeStatus, error) } var ( @@ -70,7 +67,7 @@ type LegacyChains struct { *chains.ChainsKV[Chain] dflt Chain - cfgs toml.EVMConfigs //evmtypes.Configs + cfgs toml.EVMConfigs } // LegacyChainContainer is container for EVM chains. @@ -84,6 +81,9 @@ type LegacyChainContainer interface { List(ids ...string) ([]Chain, error) Slice() []Chain + // BCF-2516: this is only used for EVMORM. When we delete that + // we can promote/move the needed funcs from it to LegacyChainContainer + // so instead of EVMORM().XYZ() we'd have something like legacyChains.XYZ() ChainNodeConfigs() evmtypes.Configs } @@ -173,9 +173,6 @@ type RelayerConfig struct { MailMon *utils.MailboxMonitor GasEstimator gas.EvmFeeEstimator - init sync.Once - //operationalConfigs evmtypes.Configs - // TODO BCF-2513 remove test code from the API // Gen-functions are useful for dependency injection by tests GenEthClient func(*big.Int) client.Client diff --git a/core/chains/evm/chain_test.go b/core/chains/evm/chain_test.go index 7657c830325..41f498b3e76 100644 --- a/core/chains/evm/chain_test.go +++ b/core/chains/evm/chain_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/mocks" @@ -25,8 +24,4 @@ func TestLegacyChains(t *testing.T) { assert.NoError(t, err) assert.Equal(t, c, got) - require.NotPanics(t, func() { - l = evm.NewLegacyChains(m, nil) - assert.NotNil(t, l.ChainNodeConfigs()) - }) } diff --git a/core/chains/evm/config/toml/config.go b/core/chains/evm/config/toml/config.go index 5edb80e270d..732c06e787b 100644 --- a/core/chains/evm/config/toml/config.go +++ b/core/chains/evm/config/toml/config.go @@ -101,7 +101,7 @@ func (cs EVMConfigs) totalChains() int { if ch == nil { continue } - total += 1 + total++ } return total } diff --git a/core/chains/starknet/chain.go b/core/chains/starknet/chain.go index cac6baa0deb..fead94cda60 100644 --- a/core/chains/starknet/chain.go +++ b/core/chains/starknet/chain.go @@ -50,10 +50,6 @@ func (o *ChainOpts) Validate() (err error) { return } -func (o *ChainOpts) GetLogger() logger.Logger { - return o.Logger -} - var _ starkChain.Chain = (*chain)(nil) type chain struct { diff --git a/core/services/chainlink/relayer_factory.go b/core/services/chainlink/relayer_factory.go index 7943e34e239..b5e21593981 100644 --- a/core/services/chainlink/relayer_factory.go +++ b/core/services/chainlink/relayer_factory.go @@ -230,9 +230,8 @@ func (r *RelayerFactory) NewCosmos(ctx context.Context, config CosmosFactoryConf KeyStore: loopKs, EventBroadcaster: config.EventBroadcaster, } - // opts.Config = cosmos.New // cosmos.NewConfigs(cosmos.CosmosConfigs{chainCfg}) - chain, err := cosmos.NewChain(chainCfg, opts) + chain, err := cosmos.NewChain(chainCfg, opts) if err != nil { return nil, fmt.Errorf("failed to load Cosmos chain %q: %w", relayId, err) }