diff --git a/core/chains/evm/log/helpers_test.go b/core/chains/evm/log/helpers_test.go index 35db8f7f7bf..8a86694340f 100644 --- a/core/chains/evm/log/helpers_test.go +++ b/core/chains/evm/log/helpers_test.go @@ -97,7 +97,7 @@ func newBroadcasterHelperWithEthClient(t *testing.T, ethClient evmclient.Client, lb := log.NewTestBroadcaster(orm, ethClient, config.EVM(), lggr, highestSeenHead, mailMon) kst := cltest.NewKeyStore(t, db, globalConfig.Database()) - cc := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{ + chainsAndConfig := evmtest.NewLegacyChainsAndConfig(t, evmtest.TestChainOpts{ Client: ethClient, GeneralConfig: globalConfig, DB: db, @@ -107,10 +107,11 @@ func newBroadcasterHelperWithEthClient(t *testing.T, ethClient evmclient.Client, }) m := make(map[string]legacyevm.Chain) - for _, r := range cc.Slice() { - m[r.Chain().ID().String()] = r.Chain() + for _, r := range chainsAndConfig.Slice() { + m[r.ID().String()] = r } - legacyChains := legacyevm.NewLegacyChains(m, cc.AppConfig().EVMConfigs()) + + legacyChains := chainsAndConfig.NewLegacyChains() pipelineHelper := cltest.NewJobPipelineV2(t, config.WebServer(), config.JobPipeline(), config.Database(), legacyChains, db, kst, nil, nil) return &broadcasterHelper{ diff --git a/core/chains/legacyevm/chain.go b/core/chains/legacyevm/chain.go index 0e0e1e65aca..db6a9528dda 100644 --- a/core/chains/legacyevm/chain.go +++ b/core/chains/legacyevm/chain.go @@ -139,27 +139,12 @@ type AppConfig interface { toml.HasEVMConfigs } -type ChainRelayExtenderConfig struct { +type ChainRelayOpts struct { Logger logger.Logger KeyStore keystore.Eth ChainOpts } -func (c ChainRelayExtenderConfig) Validate() error { - err := c.ChainOpts.Validate() - if c.Logger == nil { - err = errors.Join(err, errors.New("nil Logger")) - } - if c.KeyStore == nil { - err = errors.Join(err, errors.New("nil Keystore")) - } - - if err != nil { - err = fmt.Errorf("invalid ChainRelayerExtenderConfig: %w", err) - } - return err -} - type ChainOpts struct { AppConfig AppConfig @@ -196,7 +181,7 @@ func (o ChainOpts) Validate() error { return err } -func NewTOMLChain(ctx context.Context, chain *toml.EVMConfig, opts ChainRelayExtenderConfig) (Chain, error) { +func NewTOMLChain(ctx context.Context, chain *toml.EVMConfig, opts ChainRelayOpts) (Chain, error) { err := opts.Validate() if err != nil { return nil, err @@ -211,7 +196,7 @@ func NewTOMLChain(ctx context.Context, chain *toml.EVMConfig, opts ChainRelayExt return newChain(ctx, cfg, chain.Nodes, opts) } -func newChain(ctx context.Context, cfg *evmconfig.ChainScoped, nodes []*toml.Node, opts ChainRelayExtenderConfig) (*chain, error) { +func newChain(ctx context.Context, cfg *evmconfig.ChainScoped, nodes []*toml.Node, opts ChainRelayOpts) (*chain, error) { chainID, chainType := cfg.EVM().ChainID(), cfg.EVM().ChainType() l := opts.Logger var client evmclient.Client diff --git a/core/chains/legacyevm/evm_txm.go b/core/chains/legacyevm/evm_txm.go index 1606ea1b244..8e6d8419a73 100644 --- a/core/chains/legacyevm/evm_txm.go +++ b/core/chains/legacyevm/evm_txm.go @@ -22,7 +22,7 @@ func newEvmTxm( client evmclient.Client, lggr logger.Logger, logPoller logpoller.LogPoller, - opts ChainRelayExtenderConfig, + opts ChainRelayOpts, ) (txm txmgr.TxManager, estimator gas.EvmFeeEstimator, err error, diff --git a/core/cmd/shell_local_test.go b/core/cmd/shell_local_test.go index 72c2f2b5bbd..1259add1636 100644 --- a/core/cmd/shell_local_test.go +++ b/core/cmd/shell_local_test.go @@ -41,7 +41,7 @@ import ( "github.com/urfave/cli" ) -func genTestEVMRelayers(t *testing.T, opts legacyevm.ChainRelayExtenderConfig, ks evmrelayer.CSAETHKeystore) *chainlink.CoreRelayerChainInteroperators { +func genTestEVMRelayers(t *testing.T, opts legacyevm.ChainRelayOpts, ks evmrelayer.CSAETHKeystore) *chainlink.CoreRelayerChainInteroperators { f := chainlink.RelayerFactory{ Logger: opts.Logger, LoopRegistry: plugins.NewLoopRegistry(opts.Logger, opts.AppConfig.Tracing()), @@ -85,7 +85,7 @@ func TestShell_RunNodeWithPasswords(t *testing.T) { lggr := logger.TestLogger(t) - opts := legacyevm.ChainRelayExtenderConfig{ + opts := legacyevm.ChainRelayOpts{ Logger: lggr, KeyStore: keyStore.Eth(), ChainOpts: legacyevm.ChainOpts{ @@ -189,7 +189,7 @@ func TestShell_RunNodeWithAPICredentialsFile(t *testing.T) { ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(10), nil).Maybe() lggr := logger.TestLogger(t) - opts := legacyevm.ChainRelayExtenderConfig{ + opts := legacyevm.ChainRelayOpts{ Logger: lggr, KeyStore: keyStore.Eth(), ChainOpts: legacyevm.ChainOpts{ diff --git a/core/internal/features/features_test.go b/core/internal/features/features_test.go index 1c4d097d633..697bd74e545 100644 --- a/core/internal/features/features_test.go +++ b/core/internal/features/features_test.go @@ -69,7 +69,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/webhook" "github.com/smartcontractkit/chainlink/v2/core/static" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -1262,7 +1261,7 @@ func TestIntegration_BlockHistoryEstimator(t *testing.T) { kst := cltest.NewKeyStore(t, db, cfg.Database()) require.NoError(t, kst.Unlock(cltest.Password)) - cc := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), Client: ethClient, GeneralConfig: cfg}) + chainsAndConfig := evmtest.NewLegacyChainsAndConfig(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), Client: ethClient, GeneralConfig: cfg}) b41 := evmtypes.Block{ Number: 41, @@ -1318,8 +1317,7 @@ func TestIntegration_BlockHistoryEstimator(t *testing.T) { ethClient.On("HeadByHash", mock.Anything, h41.Hash).Return(&h41, nil).Maybe() ethClient.On("HeadByHash", mock.Anything, h42.Hash).Return(&h42, nil).Maybe() - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(cc) - for _, re := range cc.Slice() { + for _, re := range chainsAndConfig.Slice() { servicetest.Run(t, re) } var newHeads evmtest.RawSub[*evmtypes.Head] @@ -1329,6 +1327,7 @@ func TestIntegration_BlockHistoryEstimator(t *testing.T) { t.Fatal("timed out waiting for app to subscribe") } + legacyChains := chainsAndConfig.NewLegacyChains() chain := evmtest.MustGetDefaultChain(t, legacyChains) estimator := chain.GasEstimator() gasPrice, gasLimit, err := estimator.GetFee(testutils.Context(t), nil, 500_000, maxGasPrice) diff --git a/core/internal/testutils/evmtest/evmtest.go b/core/internal/testutils/evmtest/evmtest.go index cc56c3c9e9b..d5d3310109b 100644 --- a/core/internal/testutils/evmtest/evmtest.go +++ b/core/internal/testutils/evmtest/evmtest.go @@ -70,19 +70,26 @@ type TestChainOpts struct { GasEstimator gas.EvmFeeEstimator } -// NewChainRelayExtenders returns a simple chain collection with one chain and +// NewLegacyChainsAndConfig returns a simple chain collection with one chain and // allows to mock client/config on that chain -func NewChainRelayExtenders(t testing.TB, testopts TestChainOpts) *evmrelay.ChainRelayerExtenders { - opts := NewChainRelayExtOpts(t, testopts) - cc, err := evmrelay.NewChainRelayerExtenders(testutils.Context(t), opts) +func NewLegacyChainsAndConfig(t testing.TB, testopts TestChainOpts) *evmrelay.LegacyChainsAndConfig { + opts := NewChainOpts(t, testopts) + cc, err := evmrelay.NewLegacyChainsAndConfig(testutils.Context(t), opts) require.NoError(t, err) return cc } -func NewChainRelayExtOpts(t testing.TB, testopts TestChainOpts) legacyevm.ChainRelayExtenderConfig { +func NewLegacyChains(t testing.TB, testopts TestChainOpts) *legacyevm.LegacyChains { + opts := NewChainOpts(t, testopts) + cc, err := evmrelay.NewLegacyChainsAndConfig(testutils.Context(t), opts) + require.NoError(t, err) + return cc.NewLegacyChains() +} + +func NewChainOpts(t testing.TB, testopts TestChainOpts) legacyevm.ChainRelayOpts { require.NotNil(t, testopts.KeyStore) lggr := logger.TestLogger(t) - opts := legacyevm.ChainRelayExtenderConfig{ + opts := legacyevm.ChainRelayOpts{ Logger: lggr, KeyStore: testopts.KeyStore, ChainOpts: legacyevm.ChainOpts{ diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 62ae3f4a3ec..b6dc2e2d2fc 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -5,6 +5,12 @@ go 1.21.3 // Make sure we're working with the latest chainlink libs replace github.com/smartcontractkit/chainlink/v2 => ../../ +replace github.com/smartcontractkit/libocr => github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0 + +replace github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin => github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2 + +replace github.com/smartcontractkit/tdh2/go/tdh2 => github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2 + require ( github.com/docker/docker v24.0.7+incompatible github.com/docker/go-connections v0.4.0 @@ -18,9 +24,9 @@ require ( github.com/olekukonko/tablewriter v0.0.5 github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 - github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b - github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 + github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7 + github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 github.com/spf13/cobra v1.6.1 @@ -242,11 +248,11 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580 // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 0da8f55aa27..2ef5a21b839 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -819,6 +819,12 @@ github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0 h1:ON2l755Emwb9RFUYhIhQZXkraFfRdFfGfAn7Ded6akQ= +github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0/go.mod h1:WcuWFMskcGK0MYZuH5hEhGJOzdJRUFeNEM4PAKlejI4= +github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2 h1:Is1Mky3KrcbhK/Y2gs/nhR6fKeuVupD6urIVQLmP7sM= +github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2/go.mod h1:6i2tn96F0C4PHiilFtWGVmZnp9m98lSLj9zaxSz0jV8= +github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2 h1:un1qd1p4obk2bTRqA0+IN+4iM3PrNhkhbAdrN/Nmv20= +github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -1162,32 +1168,26 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumvbfM1u/etVq42Afwq/jtNSBSOA8n5jntnNPo= github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= -github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= -github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b h1:PRuvHgPka1gIGPKASuJHvqUvYWhZO7z5B/kKapjkZaM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5 h1:kBnmjv3fxU7krVIqZFvo1m4F6qBc4vPURQFX/mcChhI= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5/go.mod h1:EoM7wQ81mov7wsUzG4zEnnr0EH0POEo/I0hRDg433TU= +github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416 h1:0y1ahFgoCr8XDnVtt/ggnmVGorsEAGfSZthahjHjKJ8= +github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416/go.mod h1:96/xMsCUq8jaRkv/ODnX14QaJU4kt4gy3MTfRADLLaM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7 h1:h+Z8qh53HaTqU5zV4XHAE1wTaVSfZfdyfYXPpz688zE= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7/go.mod h1:fzgN322Qq4jCFAx/nrTi+TYvUOp6SYhpPPhIKepuzac= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87 h1:3fEIxv38h/G59wIiB6NahZiDdwmhmG2VL7PA0hK3Bvo= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87/go.mod h1:zeL+MxaiSEjNdPkDsMI8zjb+l2ZTN6m8u5oklFRFZAQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d h1:w4MsbOtNk6nD/mcXLstHWk9hB6g7QLtcAfhPjhwvOaQ= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d/go.mod h1:YPAfLNowdBwiKiYOwgwtbJHi8AJWbcxkbOY0ItAvkfc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312 h1:ziqC+WW/2/UI6w3DShy7HGzJMWWLIYHT5ev2Qaa3h6I= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312/go.mod h1:vqnojBNdzHNI6asWezJlottUiVEXudMEGf2Mz5R+xps= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a h1:atCXqF8e5U2zfEaA87cKJs+K1MAbOVh3V05gEd60fR0= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a/go.mod h1:YWKpf+hO9XMlzIWQT8yGoky3aeFLzMUVsjbs80LD77M= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580 h1:HvCOqpfrG+ODx7Fp+D2CnVEvGmuLiJ6UkR8LcXFMLek= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580/go.mod h1:X1BXPBWuDCCMUm9pmKA+u4eiapxNmyY0x5uEKueNJFg= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1 h1:BztQ8QEmI1z5TGBWmx2Pi+RyNX4OpjU0qijt8IRm0is= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1/go.mod h1:/VXLub0xjd7BaKTBjXlGac1hprt7iBGlvtsLTzYxHWM= +github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e h1:kmtH8NE/ujL9pwrceL7QPMIH1Nb7s5Rtcc2xgKbwQ24= +github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e/go.mod h1:1WMis7p5HzhTMZgUBPYYsx48PkzND+GuOq2IDerRSMs= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= -github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 h1:AA7vf29c6lFsZm+MtIEtXtg6VUOQV6waJo5MUuHfRjQ= -github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7/go.mod h1:WcuWFMskcGK0MYZuH5hEhGJOzdJRUFeNEM4PAKlejI4= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:q6f4fe39oZPdsh1i57WznEZgxd8siidMaSFq3wdPmVg= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 h1:Dai1bn+Q5cpeGMQwRdjOdVjG8mmFFROVkSKuUgBErRQ= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= github.com/smartcontractkit/wsrpc v0.7.2 h1:iBXzMeg7vc5YoezIQBq896y25BARw7OKbhrb6vPbtRQ= github.com/smartcontractkit/wsrpc v0.7.2/go.mod h1:sj7QX2NQibhkhxTfs3KOhAj/5xwgqMipTvJVSssT9i0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= diff --git a/core/services/blockhashstore/bhs_test.go b/core/services/blockhashstore/bhs_test.go index 44205ec7b86..226239b9323 100644 --- a/core/services/blockhashstore/bhs_test.go +++ b/core/services/blockhashstore/bhs_test.go @@ -19,7 +19,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/blockhashstore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -29,8 +28,7 @@ func TestStoreRotatesFromAddresses(t *testing.T) { cfg := configtest.NewTestGeneralConfig(t) kst := cltest.NewKeyStore(t, db, cfg.Database()) require.NoError(t, kst.Unlock(cltest.Password)) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), GeneralConfig: cfg, Client: ethClient}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), GeneralConfig: cfg, Client: ethClient}) chain, err := legacyChains.Get(cltest.FixtureChainID.String()) require.NoError(t, err) lggr := logger.TestLogger(t) diff --git a/core/services/blockhashstore/delegate_test.go b/core/services/blockhashstore/delegate_test.go index 6fffcfdd493..c149a4a3ce9 100644 --- a/core/services/blockhashstore/delegate_test.go +++ b/core/services/blockhashstore/delegate_test.go @@ -26,7 +26,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func TestDelegate_JobType(t *testing.T) { @@ -61,7 +60,7 @@ func createTestDelegate(t *testing.T) (*blockhashstore.Delegate, *testData) { lp.On("RegisterFilter", mock.Anything).Return(nil) lp.On("LatestBlock", mock.Anything, mock.Anything).Return(logpoller.LogPollerBlock{}, nil) - relayExtenders := evmtest.NewChainRelayExtenders( + legacyChains := evmtest.NewLegacyChains( t, evmtest.TestChainOpts{ DB: db, @@ -71,7 +70,6 @@ func createTestDelegate(t *testing.T) (*blockhashstore.Delegate, *testData) { LogPoller: lp, }, ) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) return blockhashstore.NewDelegate(lggr, legacyChains, kst), &testData{ ethClient: ethClient, ethKeyStore: kst, diff --git a/core/services/chainlink/relayer_chain_interoperators.go b/core/services/chainlink/relayer_chain_interoperators.go index 673f71e3c65..19a3668a7ed 100644 --- a/core/services/chainlink/relayer_chain_interoperators.go +++ b/core/services/chainlink/relayer_chain_interoperators.go @@ -126,7 +126,6 @@ func InitCosmos(ctx context.Context, factory RelayerFactory, config CosmosFactor return fmt.Errorf("failed to setup Cosmos relayer: %w", err2) } legacyMap := make(map[string]cosmos.Chain) - for id, a := range adapters { op.srvs = append(op.srvs, a) op.loopRelayers[id] = a @@ -371,25 +370,24 @@ func NewLegacyCosmos(m map[string]adapters.Chain) *LegacyCosmos { return chains.NewChainsKV[adapters.Chain](m) } -type CosmosLoopRelayerChainer interface { +type LOOPRelayAdapter interface { loop.Relayer Chain() adapters.Chain } -type CosmosLoopRelayerChain struct { +type loopRelayAdapter struct { loop.Relayer chain adapters.Chain } -func NewCosmosLoopRelayerChain(r *cosmos.Relayer, s adapters.Chain) *CosmosLoopRelayerChain { - ra := relay.NewServerAdapter(r, s) - return &CosmosLoopRelayerChain{ - Relayer: ra, - chain: s, +func NewCosmosLOOPRelayerChain(r *cosmos.Relayer) *loopRelayAdapter { + return &loopRelayAdapter{ + Relayer: relay.NewServerAdapter(r), + chain: r.Chain(), } } -func (r *CosmosLoopRelayerChain) Chain() adapters.Chain { +func (r *loopRelayAdapter) Chain() adapters.Chain { return r.chain } -var _ CosmosLoopRelayerChainer = &CosmosLoopRelayerChain{} +var _ LOOPRelayAdapter = &loopRelayAdapter{} diff --git a/core/services/chainlink/relayer_factory.go b/core/services/chainlink/relayer_factory.go index 49582e2d52a..69192ad62f5 100644 --- a/core/services/chainlink/relayer_factory.go +++ b/core/services/chainlink/relayer_factory.go @@ -40,31 +40,27 @@ type EVMFactoryConfig struct { evmrelay.CSAETHKeystore } -func (r *RelayerFactory) NewEVM(ctx context.Context, config EVMFactoryConfig) (map[relay.ID]evmrelay.LoopRelayAdapter, error) { +func (r *RelayerFactory) NewEVM(ctx context.Context, config EVMFactoryConfig) (map[relay.ID]evmrelay.LOOPRelayAdapter, error) { // TODO impl EVM loop. For now always 'fallback' to an adapter and embedded chain - relayers := make(map[relay.ID]evmrelay.LoopRelayAdapter) + relayers := make(map[relay.ID]evmrelay.LOOPRelayAdapter) lggr := r.Logger.Named("EVM") // override some common opts with the factory values. this seems weird... maybe other signatures should change, or this should take a different type... - ccOpts := legacyevm.ChainRelayExtenderConfig{ + ccOpts := legacyevm.ChainRelayOpts{ Logger: lggr, KeyStore: config.CSAETHKeystore.Eth(), ChainOpts: config.ChainOpts, } - evmRelayExtenders, err := evmrelay.NewChainRelayerExtenders(ctx, ccOpts) + legacyChains, err := evmrelay.NewLegacyChains(ctx, ccOpts) if err != nil { return nil, err } - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(evmRelayExtenders) - for _, ext := range evmRelayExtenders.Slice() { - relayID := relay.ID{Network: relay.EVM, ChainID: ext.Chain().ID().String()} - chain, err2 := legacyChains.Get(relayID.ChainID) - if err2 != nil { - return nil, err2 - } + for _, chain := range legacyChains { + relayID := relay.ID{Network: relay.EVM, ChainID: chain.ID().String()} + chain := chain relayerOpts := evmrelay.RelayerOpts{ DB: ccOpts.DB, @@ -78,7 +74,7 @@ func (r *RelayerFactory) NewEVM(ctx context.Context, config EVMFactoryConfig) (m continue } - relayers[relayID] = evmrelay.NewLoopRelayServerAdapter(relayer, ext) + relayers[relayID] = evmrelay.NewLOOPRelayAdapter(relayer) } // always return err because it is accumulating individual errors @@ -148,7 +144,7 @@ func (r *RelayerFactory) NewSolana(ks keystore.Solana, chainCfgs solana.TOMLConf if err != nil { return nil, err } - solanaRelayers[relayID] = relay.NewServerAdapter(pkgsolana.NewRelayer(lggr, chain), chain) + solanaRelayers[relayID] = relay.NewServerAdapter(pkgsolana.NewRelayer(lggr, chain)) } } return solanaRelayers, nil @@ -218,7 +214,7 @@ func (r *RelayerFactory) NewStarkNet(ks keystore.StarkNet, chainCfgs config.TOML return nil, err } - starknetRelayers[relayID] = relay.NewServerAdapter(pkgstarknet.NewRelayer(lggr, chain), chain) + starknetRelayers[relayID] = relay.NewServerAdapter(pkgstarknet.NewRelayer(lggr, chain)) } } return starknetRelayers, nil @@ -253,12 +249,12 @@ func (c CosmosFactoryConfig) Validate() error { return err } -func (r *RelayerFactory) NewCosmos(config CosmosFactoryConfig) (map[relay.ID]CosmosLoopRelayerChainer, error) { +func (r *RelayerFactory) NewCosmos(config CosmosFactoryConfig) (map[relay.ID]LOOPRelayAdapter, error) { err := config.Validate() if err != nil { return nil, fmt.Errorf("cannot create Cosmos relayer: %w", err) } - relayers := make(map[relay.ID]CosmosLoopRelayerChainer) + relayers := make(map[relay.ID]LOOPRelayAdapter) var ( cosmosLggr = r.Logger.Named("Cosmos") @@ -282,7 +278,7 @@ func (r *RelayerFactory) NewCosmos(config CosmosFactoryConfig) (map[relay.ID]Cos return nil, fmt.Errorf("failed to load Cosmos chain %q: %w", relayID, err) } - relayers[relayID] = NewCosmosLoopRelayerChain(cosmos.NewRelayer(lggr, chain), chain) + relayers[relayID] = NewCosmosLOOPRelayerChain(cosmos.NewRelayer(lggr, chain)) } return relayers, nil diff --git a/core/services/directrequest/delegate_test.go b/core/services/directrequest/delegate_test.go index 3b80ba2f915..765cf76011d 100644 --- a/core/services/directrequest/delegate_test.go +++ b/core/services/directrequest/delegate_test.go @@ -34,7 +34,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/pg" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" pipeline_mocks "github.com/smartcontractkit/chainlink/v2/core/services/pipeline/mocks" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func TestDelegate_ServicesForSpec(t *testing.T) { @@ -46,10 +45,9 @@ func TestDelegate_ServicesForSpec(t *testing.T) { }) keyStore := cltest.NewKeyStore(t, db, cfg.Database()) mailMon := servicetest.Run(t, mailboxtest.NewMonitor(t)) - relayerExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, MailMon: mailMon, KeyStore: keyStore.Eth()}) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, MailMon: mailMon, KeyStore: keyStore.Eth()}) lggr := logger.TestLogger(t) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayerExtenders) delegate := directrequest.NewDelegate(lggr, runner, nil, legacyChains, mailMon) t.Run("Spec without DirectRequestSpec", func(t *testing.T) { @@ -86,12 +84,11 @@ func NewDirectRequestUniverseWithConfig(t *testing.T, cfg chainlink.GeneralConfi db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db, cfg.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, LogBroadcaster: broadcaster, MailMon: mailMon, KeyStore: keyStore.Eth()}) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, LogBroadcaster: broadcaster, MailMon: mailMon, KeyStore: keyStore.Eth()}) lggr := logger.TestLogger(t) orm := pipeline.NewORM(db, lggr, cfg.Database(), cfg.JobPipeline().MaxSuccessfulRuns()) btORM := bridges.NewORM(db, lggr, cfg.Database()) jobORM := job.NewORM(db, orm, btORM, keyStore, lggr, cfg.Database()) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) delegate := directrequest.NewDelegate(lggr, runner, orm, legacyChains, mailMon) jb := cltest.MakeDirectRequestJobSpec(t) diff --git a/core/services/feeds/orm_test.go b/core/services/feeds/orm_test.go index 78af9bf6912..0d75ed49a86 100644 --- a/core/services/feeds/orm_test.go +++ b/core/services/feeds/orm_test.go @@ -23,7 +23,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs" "github.com/smartcontractkit/chainlink/v2/core/utils/crypto" ) @@ -1649,12 +1648,12 @@ func createJob(t *testing.T, db *sqlx.DB, externalJobID uuid.UUID) *job.Job { t.Helper() var ( - config = configtest.NewGeneralConfig(t, nil) - keyStore = cltest.NewKeyStore(t, db, config.Database()) - lggr = logger.TestLogger(t) - pipelineORM = pipeline.NewORM(db, lggr, config.Database(), config.JobPipeline().MaxSuccessfulRuns()) - bridgeORM = bridges.NewORM(db, lggr, config.Database()) - relayExtenders = evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) + config = configtest.NewGeneralConfig(t, nil) + keyStore = cltest.NewKeyStore(t, db, config.Database()) + lggr = logger.TestLogger(t) + pipelineORM = pipeline.NewORM(db, lggr, config.Database(), config.JobPipeline().MaxSuccessfulRuns()) + bridgeORM = bridges.NewORM(db, lggr, config.Database()) + legacyChains = evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) ) orm := job.NewORM(db, pipelineORM, bridgeORM, keyStore, lggr, config.Database()) require.NoError(t, keyStore.OCR().Add(cltest.DefaultOCRKey)) @@ -1666,7 +1665,6 @@ func createJob(t *testing.T, db *sqlx.DB, externalJobID uuid.UUID) *job.Job { _, bridge2 := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) jb, err := ocr.ValidatedOracleSpecToml(legacyChains, testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ JobID: externalJobID.String(), diff --git a/core/services/feeds/service_test.go b/core/services/feeds/service_test.go index d822cd9787d..ccea240248b 100644 --- a/core/services/feeds/service_test.go +++ b/core/services/feeds/service_test.go @@ -40,7 +40,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" ksmocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/versioning" "github.com/smartcontractkit/chainlink/v2/core/utils/crypto" ) @@ -177,9 +176,8 @@ func setupTestServiceCfg(t *testing.T, overrideCfg func(c *chainlink.Config, s * keyStore := new(ksmocks.Master) scopedConfig := evmtest.NewChainScopedConfig(t, gcfg) ethKeyStore := cltest.NewKeyStore(t, db, gcfg.Database()).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: gcfg, + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: gcfg, HeadTracker: headtracker.NullTracker, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) keyStore.On("Eth").Return(ethKeyStore) keyStore.On("CSA").Return(csaKeystore) keyStore.On("P2P").Return(p2pKeystore) diff --git a/core/services/functions/listener_test.go b/core/services/functions/listener_test.go index 75161d3410b..07f914e48f4 100644 --- a/core/services/functions/listener_test.go +++ b/core/services/functions/listener_test.go @@ -37,7 +37,6 @@ import ( threshold_mocks "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/threshold/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pg" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" evmrelay_mocks "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types/mocks" s4_mocks "github.com/smartcontractkit/chainlink/v2/core/services/s4/mocks" @@ -86,8 +85,7 @@ func NewFunctionsListenerUniverse(t *testing.T, timeoutSec int, pruneFrequencySe db := pgtest.NewSqlxDB(t) kst := cltest.NewKeyStore(t, db, cfg.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, KeyStore: kst.Eth(), LogBroadcaster: broadcaster, MailMon: mailMon}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, KeyStore: kst.Eth(), LogBroadcaster: broadcaster, MailMon: mailMon}) chain := legacyChains.Slice()[0] lggr := logger.TestLogger(t) diff --git a/core/services/job/helpers_test.go b/core/services/job/helpers_test.go index a7543753d63..f1975b2741d 100644 --- a/core/services/job/helpers_test.go +++ b/core/services/job/helpers_test.go @@ -26,7 +26,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) @@ -215,8 +214,7 @@ func makeMinimalHTTPOracleSpec(t *testing.T, db *sqlx.DB, cfg chainlink.GeneralC } s := fmt.Sprintf(minimalNonBootstrapTemplate, contractAddress, transmitterAddress, keyBundle, fetchUrl, timeout) keyStore := cltest.NewKeyStore(t, db, pgtest.NewQConfig(true)) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: evmtest.NewEthClientMockWithDefaultChain(t), GeneralConfig: cfg, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: evmtest.NewEthClientMockWithDefaultChain(t), GeneralConfig: cfg, KeyStore: keyStore.Eth()}) _, err := ocr.ValidatedOracleSpecToml(legacyChains, s) require.NoError(t, err) err = toml.Unmarshal([]byte(s), &os) diff --git a/core/services/job/job_orm_test.go b/core/services/job/job_orm_test.go index 3590b526022..defa882c2c2 100644 --- a/core/services/job/job_orm_test.go +++ b/core/services/job/job_orm_test.go @@ -39,7 +39,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocrbootstrap" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/relay" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/vrf/vrfcommon" "github.com/smartcontractkit/chainlink/v2/core/services/webhook" "github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs" @@ -338,8 +337,7 @@ func TestORM_DeleteJob_DeletesAssociatedRecords(t *testing.T) { _, bridge2 := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) jb, err := ocr.ValidatedOracleSpecToml(legacyChains, testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ TransmitterAddress: address.Hex(), DS1BridgeName: bridge.Name.String(), @@ -740,8 +738,7 @@ func TestORM_CreateJob_OCR_DuplicatedContractAddress(t *testing.T) { TransmitterAddress: address.Hex(), JobID: externalJobID.UUID.String(), }) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) jb, err := ocr.ValidatedOracleSpecToml(legacyChains, spec.Toml()) require.NoError(t, err) @@ -973,8 +970,7 @@ func Test_FindJobs(t *testing.T) { _, bridge2 := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) jb1, err := ocr.ValidatedOracleSpecToml(legacyChains, testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ JobID: uuid.New().String(), @@ -1057,8 +1053,7 @@ func Test_FindJob(t *testing.T) { // Must uniquely name the OCR Specs to properly insert a new job in the job table. externalJobID := uuid.New() _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) job, err := ocr.ValidatedOracleSpecToml(legacyChains, testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ JobID: externalJobID.String(), @@ -1274,8 +1269,7 @@ func Test_FindPipelineRuns(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.Database(), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db, logger.TestLogger(t), config.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore, config.Database()) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) @@ -1335,8 +1329,7 @@ func Test_PipelineRunsByJobID(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.Database(), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db, logger.TestLogger(t), config.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore, config.Database()) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) @@ -1396,8 +1389,7 @@ func Test_FindPipelineRunIDsByJobID(t *testing.T) { lggr := logger.TestLogger(t) pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.Database(), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db, lggr, config.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore, config.Database()) _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) @@ -1504,8 +1496,7 @@ func Test_FindPipelineRunsByIDs(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.Database(), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db, logger.TestLogger(t), config.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore, config.Database()) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) @@ -1676,8 +1667,7 @@ func Test_CountPipelineRunsByJobID(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.Database(), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db, logger.TestLogger(t), config.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore, config.Database()) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) diff --git a/core/services/job/job_pipeline_orm_integration_test.go b/core/services/job/job_pipeline_orm_integration_test.go index dd3062fa14b..55f8819712c 100644 --- a/core/services/job/job_pipeline_orm_integration_test.go +++ b/core/services/job/job_pipeline_orm_integration_test.go @@ -19,7 +19,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) @@ -153,8 +152,7 @@ func TestPipelineORM_Integration(t *testing.T) { clearJobsDb(t, db) orm := pipeline.NewORM(db, logger.TestLogger(t), cfg.Database(), cfg.JobPipeline().MaxSuccessfulRuns()) btORM := bridges.NewORM(db, logger.TestLogger(t), cfg.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{Client: evmtest.NewEthClientMockWithDefaultChain(t), DB: db, GeneralConfig: config, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{Client: evmtest.NewEthClientMockWithDefaultChain(t), DB: db, GeneralConfig: config, KeyStore: ethKeyStore}) runner := pipeline.NewRunner(orm, btORM, config.JobPipeline(), cfg.WebServer(), legacyChains, nil, nil, lggr, nil, nil) jobORM := NewTestORM(t, db, orm, btORM, keyStore, cfg.Database()) diff --git a/core/services/job/runner_integration_test.go b/core/services/job/runner_integration_test.go index fb671982ec5..6ed60b41128 100644 --- a/core/services/job/runner_integration_test.go +++ b/core/services/job/runner_integration_test.go @@ -43,7 +43,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/validate" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/telemetry" "github.com/smartcontractkit/chainlink/v2/core/services/webhook" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -83,8 +82,7 @@ func TestRunner(t *testing.T) { require.NoError(t, pipelineORM.Start(ctx)) t.Cleanup(func() { assert.NoError(t, pipelineORM.Close()) }) btORM := bridges.NewORM(db, logger.TestLogger(t), config.Database()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) c := clhttptest.NewTestLocalOnlyHTTPClient() runner := pipeline.NewRunner(pipelineORM, btORM, config.JobPipeline(), config.WebServer(), legacyChains, nil, nil, logger.TestLogger(t), c, c) @@ -550,14 +548,13 @@ answer1 [type=median index=0]; c.OCR.CaptureEATelemetry = ptr(tc.specCaptureEATelemetry) }) - relayExtenders = evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) - legacyChains = evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains2 := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) kb, err := keyStore.OCR().Create() require.NoError(t, err) s := fmt.Sprintf(minimalNonBootstrapTemplate, cltest.NewEIP55Address(), transmitterAddress.Hex(), kb.ID(), "http://blah.com", "") - jb, err := ocr.ValidatedOracleSpecToml(legacyChains, s) + jb, err := ocr.ValidatedOracleSpecToml(legacyChains2, s) require.NoError(t, err) err = toml.Unmarshal([]byte(s), &jb) require.NoError(t, err) @@ -577,7 +574,7 @@ answer1 [type=median index=0]; nil, pw, monitoringEndpoint, - legacyChains, + legacyChains2, lggr, config.Database(), servicetest.Run(t, mailboxtest.NewMonitor(t)), diff --git a/core/services/job/spawner_test.go b/core/services/job/spawner_test.go index 3e8ccbab848..995f1f6dd38 100644 --- a/core/services/job/spawner_test.go +++ b/core/services/job/spawner_test.go @@ -33,7 +33,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/relay" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" evmrelayer "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/plugins" ) @@ -63,12 +62,11 @@ func clearDB(t *testing.T, db *sqlx.DB) { } type relayGetter struct { - e evmrelay.EVMChainRelayerExtender r *evmrelayer.Relayer } func (g *relayGetter) Get(id relay.ID) (loop.Relayer, error) { - return evmrelayer.NewLoopRelayServerAdapter(g.r, g.e), nil + return evmrelayer.NewLOOPRelayAdapter(g.r), nil } func TestSpawner_CreateJobDeleteJob(t *testing.T) { @@ -94,8 +92,7 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) { }). Return(nil).Maybe() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) t.Run("should respect its dependents", func(t *testing.T) { lggr := logger.TestLogger(t) orm := NewTestORM(t, db, pipeline.NewORM(db, lggr, config.Database(), config.JobPipeline().MaxSuccessfulRuns()), bridges.NewORM(db, lggr, config.Database()), keyStore, config.Database()) @@ -278,9 +275,8 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) { } lggr := logger.TestLogger(t) - relayExtenders := evmtest.NewChainRelayExtenders(t, testopts) - assert.Equal(t, relayExtenders.Len(), 1) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, testopts) + assert.Equal(t, legacyChains.Len(), 1) chain := evmtest.MustGetDefaultChain(t, legacyChains) evmRelayer, err := evmrelayer.NewRelayer(lggr, chain, evmrelayer.RelayerOpts{ @@ -291,7 +287,6 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) { assert.NoError(t, err) testRelayGetter := &relayGetter{ - e: relayExtenders.Slice()[0], r: evmRelayer, } diff --git a/core/services/keeper/registry_synchronizer_helper_test.go b/core/services/keeper/registry_synchronizer_helper_test.go index 19ba2eedbbb..f57ac436d82 100644 --- a/core/services/keeper/registry_synchronizer_helper_test.go +++ b/core/services/keeper/registry_synchronizer_helper_test.go @@ -23,7 +23,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keeper" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) const syncInterval = 1000 * time.Hour // prevents sync timer from triggering during test @@ -45,8 +44,7 @@ func setupRegistrySync(t *testing.T, version keeper.RegistryVersion) ( lbMock := logmocks.NewBroadcaster(t) lbMock.On("AddDependents", 1).Maybe() j := cltest.MustInsertKeeperJob(t, db, korm, cltest.NewEIP55Address(), cltest.NewEIP55Address()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: ethClient, LogBroadcaster: lbMock, GeneralConfig: cfg, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: ethClient, LogBroadcaster: lbMock, GeneralConfig: cfg, KeyStore: keyStore.Eth()}) ch := evmtest.MustGetDefaultChain(t, legacyChains) jpv2 := cltest.NewJobPipelineV2(t, cfg.WebServer(), cfg.JobPipeline(), cfg.Database(), legacyChains, db, keyStore, nil, nil) contractAddress := j.KeeperSpec.ContractAddress.Address() diff --git a/core/services/keeper/upkeep_executer_test.go b/core/services/keeper/upkeep_executer_test.go index 590c9720cb2..a24051fec93 100644 --- a/core/services/keeper/upkeep_executer_test.go +++ b/core/services/keeper/upkeep_executer_test.go @@ -36,7 +36,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keeper" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func newHead() evmtypes.Head { @@ -80,8 +79,7 @@ func setup(t *testing.T, estimator gas.EvmFeeEstimator, overrideFn func(c *chain ethClient.On("IsL2").Return(false).Maybe() ethClient.On("HeadByNumber", mock.Anything, mock.Anything).Maybe().Return(&evmtypes.Head{Number: 1, Hash: utils.NewHash()}, nil) txm := txmmocks.NewMockEvmTxManager(t) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{TxManager: txm, DB: db, Client: ethClient, KeyStore: keyStore.Eth(), GeneralConfig: cfg, GasEstimator: estimator}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{TxManager: txm, DB: db, Client: ethClient, KeyStore: keyStore.Eth(), GeneralConfig: cfg, GasEstimator: estimator}) jpv2 := cltest.NewJobPipelineV2(t, cfg.WebServer(), cfg.JobPipeline(), cfg.Database(), legacyChains, db, keyStore, nil, nil) ch := evmtest.MustGetDefaultChain(t, legacyChains) orm := keeper.NewORM(db, logger.TestLogger(t), ch.Config().Database()) diff --git a/core/services/ocr2/delegate_test.go b/core/services/ocr2/delegate_test.go index 3da0c9cbfd6..0d7104e1a81 100644 --- a/core/services/ocr2/delegate_test.go +++ b/core/services/ocr2/delegate_test.go @@ -22,7 +22,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" ocr2validate "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/validate" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs" ) @@ -44,9 +43,8 @@ func TestGetEVMEffectiveTransmitterID(t *testing.T) { lggr := logger.TestLogger(t) txManager := txmmocks.NewMockEvmTxManager(t) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth(), TxManager: txManager}) - require.True(t, relayExtenders.Len() > 0) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth(), TxManager: txManager}) + require.True(t, legacyChains.Len() > 0) type testCase struct { name string diff --git a/core/services/ocr2/plugins/functions/reporting.go b/core/services/ocr2/plugins/functions/reporting.go index 36e8a882734..5a3af1fb17a 100644 --- a/core/services/ocr2/plugins/functions/reporting.go +++ b/core/services/ocr2/plugins/functions/reporting.go @@ -92,7 +92,7 @@ func formatRequestId(requestId []byte) string { } // NewReportingPlugin complies with ReportingPluginFactory -func (f FunctionsReportingPluginFactory) NewReportingPlugin(rpConfig types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { +func (f FunctionsReportingPluginFactory) NewReportingPlugin(ctx context.Context, rpConfig types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { pluginConfig, err := config.DecodeReportingPluginConfig(rpConfig.OffchainConfig) if err != nil { f.Logger.Error("unable to decode reporting plugin config", commontypes.LogFields{ diff --git a/core/services/ocr2/plugins/functions/reporting_test.go b/core/services/ocr2/plugins/functions/reporting_test.go index 5b9f59ccb23..0d8767a5b3e 100644 --- a/core/services/ocr2/plugins/functions/reporting_test.go +++ b/core/services/ocr2/plugins/functions/reporting_test.go @@ -13,6 +13,7 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/types" commonlogger "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" functions_srv "github.com/smartcontractkit/chainlink/v2/core/services/functions" @@ -42,7 +43,7 @@ func preparePlugin(t *testing.T, batchSize uint32, maxTotalGasLimit uint32) (typ } pluginConfigBytes, err := config.EncodeReportingPluginConfig(&pluginConfig) require.NoError(t, err) - plugin, _, err := factory.NewReportingPlugin(types.ReportingPluginConfig{ + plugin, _, err := factory.NewReportingPlugin(tests.Context(t), types.ReportingPluginConfig{ N: 4, F: 1, OffchainConfig: pluginConfigBytes, diff --git a/core/services/ocr2/plugins/promwrapper/factory.go b/core/services/ocr2/plugins/promwrapper/factory.go index c3dffa55013..a3195ed88c9 100644 --- a/core/services/ocr2/plugins/promwrapper/factory.go +++ b/core/services/ocr2/plugins/promwrapper/factory.go @@ -1,6 +1,7 @@ package promwrapper import ( + "context" "math/big" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" @@ -15,8 +16,8 @@ type promFactory struct { chainID *big.Int } -func (p *promFactory) NewReportingPlugin(config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { - plugin, info, err := p.wrapped.NewReportingPlugin(config) +func (p *promFactory) NewReportingPlugin(ctx context.Context, config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { + plugin, info, err := p.wrapped.NewReportingPlugin(ctx, config) if err != nil { return nil, types.ReportingPluginInfo{}, err } diff --git a/core/services/ocr2/plugins/s4/factory.go b/core/services/ocr2/plugins/s4/factory.go index 54ed727ad78..3caff4e1866 100644 --- a/core/services/ocr2/plugins/s4/factory.go +++ b/core/services/ocr2/plugins/s4/factory.go @@ -1,6 +1,8 @@ package s4 import ( + "context" + s4_orm "github.com/smartcontractkit/chainlink/v2/core/services/s4" "github.com/smartcontractkit/libocr/commontypes" @@ -20,7 +22,7 @@ type S4ReportingPluginFactory struct { var _ types.ReportingPluginFactory = (*S4ReportingPluginFactory)(nil) // NewReportingPlugin complies with ReportingPluginFactory -func (f S4ReportingPluginFactory) NewReportingPlugin(rpConfig types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { +func (f S4ReportingPluginFactory) NewReportingPlugin(ctx context.Context, rpConfig types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { config, limits, err := f.ConfigDecoder(rpConfig.OffchainConfig) if err != nil { f.Logger.Error("unable to decode reporting plugin config", commontypes.LogFields{ diff --git a/core/services/ocr2/plugins/s4/factory_test.go b/core/services/ocr2/plugins/s4/factory_test.go index 13a36a53823..53129b18796 100644 --- a/core/services/ocr2/plugins/s4/factory_test.go +++ b/core/services/ocr2/plugins/s4/factory_test.go @@ -4,6 +4,7 @@ import ( "errors" "testing" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/s4" s4_mocks "github.com/smartcontractkit/chainlink/v2/core/services/s4/mocks" @@ -42,7 +43,7 @@ func TestS4ReportingPluginFactory_NewReportingPlugin(t *testing.T) { rpConfig := types.ReportingPluginConfig{ OffchainConfig: make([]byte, 100), } - plugin, pluginInfo, err := f.NewReportingPlugin(rpConfig) + plugin, pluginInfo, err := f.NewReportingPlugin(tests.Context(t), rpConfig) require.NoError(t, err) require.NotNil(t, plugin) require.Equal(t, types.ReportingPluginInfo{ @@ -67,7 +68,7 @@ func TestS4ReportingPluginFactory_NewReportingPlugin(t *testing.T) { rpConfig := types.ReportingPluginConfig{ OffchainConfig: make([]byte, 100), } - plugin, _, err := f.NewReportingPlugin(rpConfig) + plugin, _, err := f.NewReportingPlugin(tests.Context(t), rpConfig) require.ErrorContains(t, err, "some error") require.Nil(t, plugin) }) diff --git a/core/services/pipeline/runner_test.go b/core/services/pipeline/runner_test.go index 5b4aaef7e88..e238bd5eb6a 100644 --- a/core/services/pipeline/runner_test.go +++ b/core/services/pipeline/runner_test.go @@ -14,14 +14,13 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/jmoiron/sqlx" "github.com/shopspring/decimal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "gopkg.in/guregu/null.v4" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" - "github.com/smartcontractkit/chainlink/v2/core/bridges" bridgesMocks "github.com/smartcontractkit/chainlink/v2/core/bridges/mocks" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" @@ -36,15 +35,12 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline/mocks" "github.com/smartcontractkit/chainlink/v2/core/utils" - - "github.com/jmoiron/sqlx" ) func newRunner(t testing.TB, db *sqlx.DB, bridgeORM bridges.ORM, cfg chainlink.GeneralConfig) (pipeline.Runner, *mocks.ORM) { lggr := logger.TestLogger(t) ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) orm := mocks.NewORM(t) q := pg.NewQ(db, lggr, cfg.Database()) @@ -480,8 +476,7 @@ func Test_PipelineRunner_HandleFaultsPersistRun(t *testing.T) { Return(nil) cfg := configtest.NewTestGeneralConfig(t) ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) lggr := logger.TestLogger(t) r := pipeline.NewRunner(orm, btORM, cfg.JobPipeline(), cfg.WebServer(), legacyChains, ethKeyStore, nil, lggr, nil, nil) @@ -948,8 +943,7 @@ func Test_PipelineRunner_ExecuteRun(t *testing.T) { db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) lggr := logger.TestLogger(t) r := pipeline.NewRunner(nil, nil, cfg.JobPipeline(), cfg.WebServer(), legacyChains, ethKeyStore, nil, lggr, nil, nil) diff --git a/core/services/pipeline/task.eth_call_test.go b/core/services/pipeline/task.eth_call_test.go index cb58a03a9df..8657f6dc628 100644 --- a/core/services/pipeline/task.eth_call_test.go +++ b/core/services/pipeline/task.eth_call_test.go @@ -25,7 +25,6 @@ import ( keystoremocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" pipelinemocks "github.com/smartcontractkit/chainlink/v2/core/services/pipeline/mocks" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func TestETHCallTask(t *testing.T) { @@ -259,8 +258,7 @@ func TestETHCallTask(t *testing.T) { var legacyChains legacyevm.LegacyChainContainer if test.expectedErrorCause != nil || test.expectedErrorContains != "" { - exts := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, TxManager: txManager, KeyStore: keyStore}) - legacyChains = evmrelay.NewLegacyChainsFromRelayerExtenders(exts) + legacyChains = evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, TxManager: txManager, KeyStore: keyStore}) } else { legacyChains = cltest.NewLegacyChainsWithMockChain(t, ethClient, cfg) } diff --git a/core/services/pipeline/task.eth_tx_test.go b/core/services/pipeline/task.eth_tx_test.go index 5f5019d1967..1505667ace9 100644 --- a/core/services/pipeline/task.eth_tx_test.go +++ b/core/services/pipeline/task.eth_tx_test.go @@ -23,7 +23,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" keystoremocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func TestETHTxTask(t *testing.T) { @@ -581,9 +580,8 @@ func TestETHTxTask(t *testing.T) { }) lggr := logger.TestLogger(t) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, TxManager: txManager, KeyStore: keyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) test.setupClientMocks(keyStore, txManager) task.HelperSetDependencies(legacyChains, keyStore, test.specGasLimit, pipeline.DirectRequestJobType) diff --git a/core/services/relay/evm/contract_transmitter.go b/core/services/relay/evm/contract_transmitter.go index 76360e34e1a..c47050ba18a 100644 --- a/core/services/relay/evm/contract_transmitter.go +++ b/core/services/relay/evm/contract_transmitter.go @@ -194,7 +194,7 @@ func (oc *contractTransmitter) LatestConfigDigestAndEpoch(ctx context.Context) ( } // FromAccount returns the account from which the transmitter invokes the contract -func (oc *contractTransmitter) FromAccount() (ocrtypes.Account, error) { +func (oc *contractTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { return ocrtypes.Account(oc.transmitter.FromAddress().String()), nil } diff --git a/core/services/relay/evm/contract_transmitter_test.go b/core/services/relay/evm/contract_transmitter_test.go index e03c5508247..161360d1cd8 100644 --- a/core/services/relay/evm/contract_transmitter_test.go +++ b/core/services/relay/evm/contract_transmitter_test.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" lpmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" @@ -70,7 +71,7 @@ func TestContractTransmitter(t *testing.T) { require.NoError(t, err) assert.Equal(t, "000130da6b9315bd59af6b0a3f5463c0d0a39e92eaa34cbcbdbace7b3bfcc777", hex.EncodeToString(digest[:])) assert.Equal(t, uint32(2), epoch) - from, err := ot.FromAccount() + from, err := ot.FromAccount(tests.Context(t)) require.NoError(t, err) assert.Equal(t, sampleAddress.String(), string(from)) } diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index d6a8c584fab..71bd0443f45 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "math/big" "strings" "sync" @@ -104,13 +105,12 @@ func (r *Relayer) Name() string { return r.lggr.Name() } -// Start does noop: no subservices started on relay start, but when the first job is started -func (r *Relayer) Start(context.Context) error { - return nil +func (r *Relayer) Start(ctx context.Context) error { + return r.chain.Start(ctx) } func (r *Relayer) Close() error { - return nil + return r.chain.Close() } // Ready does noop: always ready @@ -119,12 +119,32 @@ func (r *Relayer) Ready() error { } func (r *Relayer) HealthReport() (report map[string]error) { - report = make(map[string]error) + report = map[string]error{r.Name(): r.Ready()} maps.Copy(report, r.chain.HealthReport()) return } -func (r *Relayer) NewMercuryProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.MercuryProvider, error) { +func (r *Relayer) GetChainStatus(ctx context.Context) (commontypes.ChainStatus, error) { + return r.chain.GetChainStatus(ctx) +} + +func (r *Relayer) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []commontypes.NodeStatus, nextPageToken string, total int, err error) { + return r.chain.ListNodeStatuses(ctx, pageSize, pageToken) +} + +func (r *Relayer) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { + return r.chain.Transact(ctx, from, to, amount, balanceCheck) +} + +func (r *Relayer) ID() string { + return r.chain.ID().String() +} + +func (r *Relayer) Chain() legacyevm.Chain { + return r.chain +} + +func (r *Relayer) NewMercuryProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.MercuryProvider, error) { lggr := r.lggr.Named("MercuryProvider").Named(rargs.ExternalJobID.String()) relayOpts := types.NewRelayOpts(rargs) relayConfig, err := relayOpts.RelayConfig() @@ -186,13 +206,13 @@ func (r *Relayer) NewMercuryProvider(rargs commontypes.RelayArgs, pargs commonty return NewMercuryProvider(cw, r.chainReader, NewMercuryChainReader(r.chain.HeadTracker()), transmitter, reportCodecV1, reportCodecV2, reportCodecV3, lggr), nil } -func (r *Relayer) NewFunctionsProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.FunctionsProvider, error) { +func (r *Relayer) NewFunctionsProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.FunctionsProvider, error) { lggr := r.lggr.Named("FunctionsProvider").Named(rargs.ExternalJobID.String()) // TODO(FUN-668): Not ready yet (doesn't implement FunctionsEvents() properly) return NewFunctionsProvider(r.chain, rargs, pargs, lggr, r.ks.Eth(), functions.FunctionsPlugin) } -func (r *Relayer) NewConfigProvider(args commontypes.RelayArgs) (commontypes.ConfigProvider, error) { +func (r *Relayer) NewConfigProvider(ctx context.Context, args commontypes.RelayArgs) (commontypes.ConfigProvider, error) { lggr := r.lggr.Named("ConfigProvider").Named(args.ExternalJobID.String()) relayOpts := types.NewRelayOpts(args) relayConfig, err := relayOpts.RelayConfig() @@ -442,7 +462,7 @@ func newContractTransmitter(lggr logger.Logger, rargs commontypes.RelayArgs, tra ) } -func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.MedianProvider, error) { +func (r *Relayer) NewMedianProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.MedianProvider, error) { lggr := r.lggr.Named("MedianProvider").Named(rargs.ExternalJobID.String()) relayOpts := types.NewRelayOpts(rargs) relayConfig, err := relayOpts.RelayConfig() @@ -496,7 +516,7 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp return &medianProvider, nil } -func (r *Relayer) NewAutomationProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.AutomationProvider, error) { +func (r *Relayer) NewAutomationProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.AutomationProvider, error) { lggr := r.lggr.Named("AutomationProvider").Named(rargs.ExternalJobID.String()) ocr2keeperRelayer := NewOCR2KeeperRelayer(r.db, r.chain, lggr.Named("OCR2KeeperRelayer"), r.ks.Eth()) diff --git a/core/services/relay/evm/functions/contract_transmitter.go b/core/services/relay/evm/functions/contract_transmitter.go index 2a62db31a8c..63477e0a025 100644 --- a/core/services/relay/evm/functions/contract_transmitter.go +++ b/core/services/relay/evm/functions/contract_transmitter.go @@ -240,7 +240,7 @@ func (oc *contractTransmitter) LatestConfigDigestAndEpoch(ctx context.Context) ( } // FromAccount returns the account from which the transmitter invokes the contract -func (oc *contractTransmitter) FromAccount() (ocrtypes.Account, error) { +func (oc *contractTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { return ocrtypes.Account(oc.transmitter.FromAddress().String()), nil } diff --git a/core/services/relay/evm/functions/offchain_config_digester.go b/core/services/relay/evm/functions/offchain_config_digester.go index 29547e794ce..685bd6d4984 100644 --- a/core/services/relay/evm/functions/offchain_config_digester.go +++ b/core/services/relay/evm/functions/offchain_config_digester.go @@ -1,6 +1,7 @@ package functions import ( + "context" "encoding/binary" "errors" "fmt" @@ -36,7 +37,7 @@ func NewFunctionsOffchainConfigDigester(pluginType FunctionsPluginType, chainID } } -func (d *functionsOffchainConfigDigester) ConfigDigest(cc types.ContractConfig) (types.ConfigDigest, error) { +func (d *functionsOffchainConfigDigester) ConfigDigest(ctx context.Context, cc types.ContractConfig) (types.ConfigDigest, error) { contractAddress := d.contractAddress.Load() if contractAddress == nil { return types.ConfigDigest{}, errors.New("contract address not set") @@ -46,7 +47,7 @@ func (d *functionsOffchainConfigDigester) ConfigDigest(cc types.ContractConfig) ContractAddress: *contractAddress, } - configDigest, err := baseDigester.ConfigDigest(cc) + configDigest, err := baseDigester.ConfigDigest(ctx, cc) if err != nil { return types.ConfigDigest{}, err } @@ -68,7 +69,7 @@ func (d *functionsOffchainConfigDigester) ConfigDigest(cc types.ContractConfig) return configDigest, nil } -func (d *functionsOffchainConfigDigester) ConfigDigestPrefix() (types.ConfigDigestPrefix, error) { +func (d *functionsOffchainConfigDigester) ConfigDigestPrefix(ctx context.Context) (types.ConfigDigestPrefix, error) { switch d.pluginType { case FunctionsPlugin: return FunctionsDigestPrefix, nil diff --git a/core/services/relay/evm/loop_impl.go b/core/services/relay/evm/loop_impl.go index 57a09dd49ae..3fd1de910b3 100644 --- a/core/services/relay/evm/loop_impl.go +++ b/core/services/relay/evm/loop_impl.go @@ -7,26 +7,24 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/relay" ) -//go:generate mockery --quiet --name LoopRelayAdapter --output ./mocks/ --case=underscore -type LoopRelayAdapter interface { +type LOOPRelayAdapter interface { loop.Relayer Chain() legacyevm.Chain } -type LoopRelayer struct { +type loopRelayAdapter struct { loop.Relayer - ext EVMChainRelayerExtender + chain legacyevm.Chain } -var _ loop.Relayer = &LoopRelayer{} +var _ LOOPRelayAdapter = &loopRelayAdapter{} -func NewLoopRelayServerAdapter(r *Relayer, cs EVMChainRelayerExtender) *LoopRelayer { - ra := relay.NewServerAdapter(r, cs) - return &LoopRelayer{ - Relayer: ra, - ext: cs, +func NewLOOPRelayAdapter(r *Relayer) *loopRelayAdapter { + return &loopRelayAdapter{ + Relayer: relay.NewServerAdapter(r), + chain: r.chain, } } -func (la *LoopRelayer) Chain() legacyevm.Chain { - return la.ext.Chain() +func (la *loopRelayAdapter) Chain() legacyevm.Chain { + return la.chain } diff --git a/core/services/relay/evm/median_test.go b/core/services/relay/evm/median_test.go index 9c474006aa7..8d60d9e46a2 100644 --- a/core/services/relay/evm/median_test.go +++ b/core/services/relay/evm/median_test.go @@ -32,7 +32,7 @@ func TestNewMedianProvider(t *testing.T) { rc, err2 := json.Marshal(&relayConfigBadChainID) rargs2 := commontypes.RelayArgs{ContractID: contractID.String(), RelayConfig: rc} require.NoError(t, err2) - _, err2 = relayer.NewMedianProvider(rargs2, pargs) + _, err2 = relayer.NewMedianProvider(testutils.Context(t), rargs2, pargs) assert.ErrorContains(t, err2, "chain id in spec does not match") }) @@ -41,7 +41,7 @@ func TestNewMedianProvider(t *testing.T) { rc, err2 := json.Marshal(&relayConfig) require.NoError(t, err2) rargsBadContractID := commontypes.RelayArgs{ContractID: "NotAContractID", RelayConfig: rc} - _, err2 = relayer.NewMedianProvider(rargsBadContractID, pargs) + _, err2 = relayer.NewMedianProvider(testutils.Context(t), rargsBadContractID, pargs) assert.ErrorContains(t, err2, "invalid contractID") }) } diff --git a/core/services/relay/evm/mercury/offchain_config_digester.go b/core/services/relay/evm/mercury/offchain_config_digester.go index a12198738a9..42ebba268d7 100644 --- a/core/services/relay/evm/mercury/offchain_config_digester.go +++ b/core/services/relay/evm/mercury/offchain_config_digester.go @@ -1,6 +1,7 @@ package mercury import ( + "context" "crypto/ed25519" "encoding/hex" "math/big" @@ -27,7 +28,7 @@ type OffchainConfigDigester struct { ContractAddress common.Address } -func (d OffchainConfigDigester) ConfigDigest(cc ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { +func (d OffchainConfigDigester) ConfigDigest(ctx context.Context, cc ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { signers := []common.Address{} for i, signer := range cc.Signers { if len(signer) != 20 { @@ -65,6 +66,6 @@ func (d OffchainConfigDigester) ConfigDigest(cc ocrtypes.ContractConfig) (ocrtyp ), nil } -func (d OffchainConfigDigester) ConfigDigestPrefix() (ocrtypes.ConfigDigestPrefix, error) { +func (d OffchainConfigDigester) ConfigDigestPrefix(ctx context.Context) (ocrtypes.ConfigDigestPrefix, error) { return ocrtypes.ConfigDigestPrefixMercuryV02, nil } diff --git a/core/services/relay/evm/mercury/offchain_config_digester_test.go b/core/services/relay/evm/mercury/offchain_config_digester_test.go index c5d39926576..62869cf6f3d 100644 --- a/core/services/relay/evm/mercury/offchain_config_digester_test.go +++ b/core/services/relay/evm/mercury/offchain_config_digester_test.go @@ -7,17 +7,20 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func Test_OffchainConfigDigester_ConfigDigest(t *testing.T) { + ctx := tests.Context(t) // ChainID and ContractAddress are taken into account for computation - cd1, err := OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(types.ContractConfig{}) + cd1, err := OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(ctx, types.ContractConfig{}) require.NoError(t, err) - cd2, err := OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(types.ContractConfig{}) + cd2, err := OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(ctx, types.ContractConfig{}) require.NoError(t, err) - cd3, err := OffchainConfigDigester{ChainID: big.NewInt(1)}.ConfigDigest(types.ContractConfig{}) + cd3, err := OffchainConfigDigester{ChainID: big.NewInt(1)}.ConfigDigest(ctx, types.ContractConfig{}) require.NoError(t, err) - cd4, err := OffchainConfigDigester{ChainID: big.NewInt(1), ContractAddress: common.Address{1}}.ConfigDigest(types.ContractConfig{}) + cd4, err := OffchainConfigDigester{ChainID: big.NewInt(1), ContractAddress: common.Address{1}}.ConfigDigest(ctx, types.ContractConfig{}) require.NoError(t, err) require.Equal(t, cd1, cd2) @@ -26,29 +29,29 @@ func Test_OffchainConfigDigester_ConfigDigest(t *testing.T) { require.NotEqual(t, cd3, cd4) // malformed signers - _, err = OffchainConfigDigester{}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{}.ConfigDigest(ctx, types.ContractConfig{ Signers: []types.OnchainPublicKey{{1, 2}}, }) require.Error(t, err) // malformed transmitters - _, err = OffchainConfigDigester{}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{}.ConfigDigest(ctx, types.ContractConfig{ Transmitters: []types.Account{"0x"}, }) require.Error(t, err) - _, err = OffchainConfigDigester{}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{}.ConfigDigest(ctx, types.ContractConfig{ Transmitters: []types.Account{"7343581f55146951b0f678dc6cfa8fd360e2f353"}, }) require.Error(t, err) - _, err = OffchainConfigDigester{}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{}.ConfigDigest(ctx, types.ContractConfig{ Transmitters: []types.Account{"7343581f55146951b0f678dc6cfa8fd360e2f353aabbccddeeffaaccddeeffaz"}, }) require.Error(t, err) // well-formed transmitters - _, err = OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(ctx, types.ContractConfig{ Transmitters: []types.Account{"7343581f55146951b0f678dc6cfa8fd360e2f353aabbccddeeffaaccddeeffaa"}, }) require.NoError(t, err) diff --git a/core/services/relay/evm/mercury/transmitter.go b/core/services/relay/evm/mercury/transmitter.go index 40a51b9d92d..1f6f26e97a2 100644 --- a/core/services/relay/evm/mercury/transmitter.go +++ b/core/services/relay/evm/mercury/transmitter.go @@ -371,7 +371,7 @@ func (mt *mercuryTransmitter) Transmit(ctx context.Context, reportCtx ocrtypes.R } // FromAccount returns the stringified (hex) CSA public key -func (mt *mercuryTransmitter) FromAccount() (ocrtypes.Account, error) { +func (mt *mercuryTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { return ocrtypes.Account(mt.fromAccount), nil } diff --git a/core/services/relay/evm/mocks/loop_relay_adapter.go b/core/services/relay/evm/mocks/loop_relay_adapter.go deleted file mode 100644 index 5b927f1b8ac..00000000000 --- a/core/services/relay/evm/mocks/loop_relay_adapter.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by mockery v2.38.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - big "math/big" - - legacyevm "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" - - mock "github.com/stretchr/testify/mock" - - types "github.com/smartcontractkit/chainlink-common/pkg/types" -) - -// LoopRelayAdapter is an autogenerated mock type for the LoopRelayAdapter type -type LoopRelayAdapter struct { - mock.Mock -} - -// Chain provides a mock function with given fields: -func (_m *LoopRelayAdapter) Chain() legacyevm.Chain { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Chain") - } - - var r0 legacyevm.Chain - if rf, ok := ret.Get(0).(func() legacyevm.Chain); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(legacyevm.Chain) - } - } - - return r0 -} - -// Close provides a mock function with given fields: -func (_m *LoopRelayAdapter) Close() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Close") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// GetChainStatus provides a mock function with given fields: ctx -func (_m *LoopRelayAdapter) GetChainStatus(ctx context.Context) (types.ChainStatus, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetChainStatus") - } - - var r0 types.ChainStatus - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (types.ChainStatus, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) types.ChainStatus); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(types.ChainStatus) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// HealthReport provides a mock function with given fields: -func (_m *LoopRelayAdapter) HealthReport() map[string]error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for HealthReport") - } - - var r0 map[string]error - if rf, ok := ret.Get(0).(func() map[string]error); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]error) - } - } - - return r0 -} - -// ListNodeStatuses provides a mock function with given fields: ctx, pageSize, pageToken -func (_m *LoopRelayAdapter) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) ([]types.NodeStatus, string, int, error) { - ret := _m.Called(ctx, pageSize, pageToken) - - if len(ret) == 0 { - panic("no return value specified for ListNodeStatuses") - } - - var r0 []types.NodeStatus - var r1 string - var r2 int - var r3 error - if rf, ok := ret.Get(0).(func(context.Context, int32, string) ([]types.NodeStatus, string, int, error)); ok { - return rf(ctx, pageSize, pageToken) - } - if rf, ok := ret.Get(0).(func(context.Context, int32, string) []types.NodeStatus); ok { - r0 = rf(ctx, pageSize, pageToken) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]types.NodeStatus) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, int32, string) string); ok { - r1 = rf(ctx, pageSize, pageToken) - } else { - r1 = ret.Get(1).(string) - } - - if rf, ok := ret.Get(2).(func(context.Context, int32, string) int); ok { - r2 = rf(ctx, pageSize, pageToken) - } else { - r2 = ret.Get(2).(int) - } - - if rf, ok := ret.Get(3).(func(context.Context, int32, string) error); ok { - r3 = rf(ctx, pageSize, pageToken) - } else { - r3 = ret.Error(3) - } - - return r0, r1, r2, r3 -} - -// Name provides a mock function with given fields: -func (_m *LoopRelayAdapter) Name() string { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Name") - } - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// NewConfigProvider provides a mock function with given fields: _a0, _a1 -func (_m *LoopRelayAdapter) NewConfigProvider(_a0 context.Context, _a1 types.RelayArgs) (types.ConfigProvider, error) { - ret := _m.Called(_a0, _a1) - - if len(ret) == 0 { - panic("no return value specified for NewConfigProvider") - } - - var r0 types.ConfigProvider - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs) (types.ConfigProvider, error)); ok { - return rf(_a0, _a1) - } - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs) types.ConfigProvider); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.ConfigProvider) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.RelayArgs) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewPluginProvider provides a mock function with given fields: _a0, _a1, _a2 -func (_m *LoopRelayAdapter) NewPluginProvider(_a0 context.Context, _a1 types.RelayArgs, _a2 types.PluginArgs) (types.PluginProvider, error) { - ret := _m.Called(_a0, _a1, _a2) - - if len(ret) == 0 { - panic("no return value specified for NewPluginProvider") - } - - var r0 types.PluginProvider - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs, types.PluginArgs) (types.PluginProvider, error)); ok { - return rf(_a0, _a1, _a2) - } - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs, types.PluginArgs) types.PluginProvider); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.PluginProvider) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.RelayArgs, types.PluginArgs) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Ready provides a mock function with given fields: -func (_m *LoopRelayAdapter) Ready() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Ready") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Start provides a mock function with given fields: _a0 -func (_m *LoopRelayAdapter) Start(_a0 context.Context) error { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for Start") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Transact provides a mock function with given fields: ctx, from, to, amount, balanceCheck -func (_m *LoopRelayAdapter) Transact(ctx context.Context, from string, to string, amount *big.Int, balanceCheck bool) error { - ret := _m.Called(ctx, from, to, amount, balanceCheck) - - if len(ret) == 0 { - panic("no return value specified for Transact") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, string, *big.Int, bool) error); ok { - r0 = rf(ctx, from, to, amount, balanceCheck) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewLoopRelayAdapter creates a new instance of LoopRelayAdapter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewLoopRelayAdapter(t interface { - mock.TestingT - Cleanup(func()) -}) *LoopRelayAdapter { - mock := &LoopRelayAdapter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/services/relay/evm/ocr2keeper.go b/core/services/relay/evm/ocr2keeper.go index 55c4d78e7b4..570affb1aa5 100644 --- a/core/services/relay/evm/ocr2keeper.go +++ b/core/services/relay/evm/ocr2keeper.go @@ -115,7 +115,7 @@ func (t *ocr3keeperProviderContractTransmitter) Transmit( } func (t *ocr3keeperProviderContractTransmitter) FromAccount() (ocrtypes.Account, error) { - return t.contractTransmitter.FromAccount() + return t.contractTransmitter.FromAccount(context.Background()) } type ocr2keeperProvider struct { diff --git a/core/services/relay/evm/relayer_extender.go b/core/services/relay/evm/relayer_extender.go index 83f03b47f9e..884597df718 100644 --- a/core/services/relay/evm/relayer_extender.go +++ b/core/services/relay/evm/relayer_extender.go @@ -2,15 +2,11 @@ package evm import ( "context" + "errors" "fmt" - "math/big" - "github.com/pkg/errors" "go.uber.org/multierr" - "github.com/smartcontractkit/chainlink-common/pkg/loop" - commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" ) @@ -18,107 +14,30 @@ import ( // ErrNoChains indicates that no EVM chains have been started var ErrNoChains = errors.New("no EVM chains loaded") -type EVMChainRelayerExtender interface { - loop.RelayerExt - Chain() legacyevm.Chain -} - -type EVMChainRelayerExtenderSlicer interface { - Slice() []EVMChainRelayerExtender - Len() int - AppConfig() legacyevm.AppConfig -} - -type ChainRelayerExtenders struct { - exts []EVMChainRelayerExtender - cfg legacyevm.AppConfig +type LegacyChainsAndConfig struct { + rs []legacyevm.Chain + cfg toml.EVMConfigs } -var _ EVMChainRelayerExtenderSlicer = &ChainRelayerExtenders{} - -func NewLegacyChainsFromRelayerExtenders(exts EVMChainRelayerExtenderSlicer) *legacyevm.LegacyChains { +func (r *LegacyChainsAndConfig) NewLegacyChains() *legacyevm.LegacyChains { m := make(map[string]legacyevm.Chain) - for _, r := range exts.Slice() { - m[r.Chain().ID().String()] = r.Chain() - } - return legacyevm.NewLegacyChains(m, exts.AppConfig().EVMConfigs()) -} - -func newChainRelayerExtsFromSlice(exts []*ChainRelayerExt, appConfig legacyevm.AppConfig) *ChainRelayerExtenders { - temp := make([]EVMChainRelayerExtender, len(exts)) - for i := range exts { - temp[i] = exts[i] - } - return &ChainRelayerExtenders{ - exts: temp, - cfg: appConfig, + for _, r := range r.Slice() { + m[r.ID().String()] = r } + return legacyevm.NewLegacyChains(m, r.cfg) } -func (c *ChainRelayerExtenders) AppConfig() legacyevm.AppConfig { - return c.cfg +func (r *LegacyChainsAndConfig) Slice() []legacyevm.Chain { + return r.rs } -func (c *ChainRelayerExtenders) Slice() []EVMChainRelayerExtender { - return c.exts +func (r *LegacyChainsAndConfig) Len() int { + return len(r.rs) } -func (c *ChainRelayerExtenders) Len() int { - return len(c.exts) -} - -// implements OneChain -type ChainRelayerExt struct { - chain legacyevm.Chain -} - -var _ EVMChainRelayerExtender = &ChainRelayerExt{} - -func (s *ChainRelayerExt) GetChainStatus(ctx context.Context) (commontypes.ChainStatus, error) { - return s.chain.GetChainStatus(ctx) -} - -func (s *ChainRelayerExt) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []commontypes.NodeStatus, nextPageToken string, total int, err error) { - return s.chain.ListNodeStatuses(ctx, pageSize, pageToken) -} - -func (s *ChainRelayerExt) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { - return s.chain.Transact(ctx, from, to, amount, balanceCheck) -} - -func (s *ChainRelayerExt) ID() string { - return s.chain.ID().String() -} - -func (s *ChainRelayerExt) Chain() legacyevm.Chain { - return s.chain -} - -var ErrCorruptEVMChain = errors.New("corrupt evm chain") - -func (s *ChainRelayerExt) Start(ctx context.Context) error { - return s.chain.Start(ctx) -} - -func (s *ChainRelayerExt) Close() (err error) { - return s.chain.Close() -} - -func (s *ChainRelayerExt) Name() string { - return s.chain.Name() -} - -func (s *ChainRelayerExt) HealthReport() map[string]error { - return s.chain.HealthReport() -} - -func (s *ChainRelayerExt) Ready() (err error) { - return s.chain.Ready() -} - -func NewChainRelayerExtenders(ctx context.Context, opts legacyevm.ChainRelayExtenderConfig) (*ChainRelayerExtenders, error) { - if err := opts.Validate(); err != nil { - return nil, err +func NewLegacyChains(ctx context.Context, opts legacyevm.ChainRelayOpts) (result []legacyevm.Chain, err error) { + if err = opts.Validate(); err != nil { + return } unique := make(map[string]struct{}) @@ -136,12 +55,9 @@ func NewChainRelayerExtenders(ctx context.Context, opts legacyevm.ChainRelayExte } } - var result []*ChainRelayerExt - var err error for i := range enabled { - cid := enabled[i].ChainID.String() - privOpts := legacyevm.ChainRelayExtenderConfig{ + privOpts := legacyevm.ChainRelayOpts{ Logger: opts.Logger.Named(cid), ChainOpts: opts.ChainOpts, KeyStore: opts.KeyStore, @@ -154,11 +70,12 @@ func NewChainRelayerExtenders(ctx context.Context, opts legacyevm.ChainRelayExte continue } - s := &ChainRelayerExt{ - chain: chain, - } - result = append(result, s) + result = append(result, chain) } + return +} +func NewLegacyChainsAndConfig(ctx context.Context, opts legacyevm.ChainRelayOpts) (*LegacyChainsAndConfig, error) { + result, err := NewLegacyChains(ctx, opts) // always return because it's accumulating errors - return newChainRelayerExtsFromSlice(result, opts.AppConfig), err + return &LegacyChainsAndConfig{result, opts.AppConfig.EVMConfigs()}, err } diff --git a/core/services/relay/evm/relayer_extender_test.go b/core/services/relay/evm/relayer_extender_test.go index af15461aee9..fc108a1043b 100644 --- a/core/services/relay/evm/relayer_extender_test.go +++ b/core/services/relay/evm/relayer_extender_test.go @@ -34,31 +34,31 @@ func TestChainRelayExtenders(t *testing.T) { kst := cltest.NewKeyStore(t, db, cfg.Database()) require.NoError(t, kst.Unlock(cltest.Password)) - opts := evmtest.NewChainRelayExtOpts(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), GeneralConfig: cfg}) + opts := evmtest.NewChainOpts(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), GeneralConfig: cfg}) opts.GenEthClient = func(*big.Int) evmclient.Client { return cltest.NewEthMocksWithStartupAssertions(t) } - relayExtenders, err := evmrelay.NewChainRelayerExtenders(testutils.Context(t), opts) + relayExtenders, err := evmrelay.NewLegacyChains(testutils.Context(t), opts) require.NoError(t, err) - require.Equal(t, relayExtenders.Len(), 2) - relayExtendersInstances := relayExtenders.Slice() + require.Equal(t, len(relayExtenders), 2) + relayExtendersInstances := relayExtenders for _, c := range relayExtendersInstances { require.NoError(t, c.Start(testutils.Context(t))) require.NoError(t, c.Ready()) } - require.NotEqual(t, relayExtendersInstances[0].Chain().ID().String(), relayExtendersInstances[1].Chain().ID().String()) + require.NotEqual(t, relayExtendersInstances[0].ID().String(), relayExtendersInstances[1].ID().String()) for _, c := range relayExtendersInstances { require.NoError(t, c.Close()) } - relayExtendersInstances[0].Chain().Client().(*evmclimocks.Client).AssertCalled(t, "Close") - relayExtendersInstances[1].Chain().Client().(*evmclimocks.Client).AssertCalled(t, "Close") + relayExtendersInstances[0].Client().(*evmclimocks.Client).AssertCalled(t, "Close") + relayExtendersInstances[1].Client().(*evmclimocks.Client).AssertCalled(t, "Close") - assert.Error(t, relayExtendersInstances[0].Chain().Ready()) - assert.Error(t, relayExtendersInstances[1].Chain().Ready()) + assert.Error(t, relayExtendersInstances[0].Ready()) + assert.Error(t, relayExtendersInstances[1].Ready()) // test extender methods on single instance relayExt := relayExtendersInstances[0] diff --git a/core/services/relay/grpc_provider_server_test.go b/core/services/relay/grpc_provider_server_test.go index 72bbbca0f44..15f5879fac9 100644 --- a/core/services/relay/grpc_provider_server_test.go +++ b/core/services/relay/grpc_provider_server_test.go @@ -13,7 +13,7 @@ import ( func TestProviderServer(t *testing.T) { r := &mockRelayer{} - sa := NewServerAdapter(r, mockRelayerExt{}) + sa := NewServerAdapter(r) mp, _ := sa.NewPluginProvider(testutils.Context(t), types.RelayArgs{ProviderType: string(types.Median)}, types.PluginArgs{}) lggr := logger.TestLogger(t) diff --git a/core/services/relay/relay.go b/core/services/relay/relay.go index 826c3d17a44..7b7015b6b93 100644 --- a/core/services/relay/relay.go +++ b/core/services/relay/relay.go @@ -70,15 +70,17 @@ func (i *ID) UnmarshalString(s string) error { return nil } -// ServerAdapter extends [loop.RelayerAdapter] by overriding NewPluginProvider to dispatches calls according to `RelayArgs.ProviderType`. +var _ loop.Relayer = (*ServerAdapter)(nil) + +// ServerAdapter extends [types.Relayer] to implement [loop.Relayer] with NewPluginProvider to dispatches calls according to `RelayArgs.ProviderType`. // This should only be used to adapt relayers not running via GRPC in a LOOPP. type ServerAdapter struct { - loop.RelayerAdapter + types.Relayer } // NewServerAdapter returns a new ServerAdapter. -func NewServerAdapter(r types.Relayer, e loop.RelayerExt) *ServerAdapter { //nolint:staticcheck - return &ServerAdapter{RelayerAdapter: loop.RelayerAdapter{Relayer: r, RelayerExt: e}} +func NewServerAdapter(r types.Relayer) *ServerAdapter { //nolint:staticcheck + return &ServerAdapter{Relayer: r} } func (r *ServerAdapter) NewPluginProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.PluginProvider, error) { @@ -91,9 +93,7 @@ func (r *ServerAdapter) NewPluginProvider(ctx context.Context, rargs types.Relay return r.NewMercuryProvider(ctx, rargs, pargs) case types.OCR2Keeper: return r.NewAutomationProvider(ctx, rargs, pargs) - case types.DKG, types.OCR2VRF, types.GenericPlugin: - return r.RelayerAdapter.NewPluginProvider(ctx, rargs, pargs) - case types.CCIPCommit, types.CCIPExecution: + case types.CCIPCommit, types.CCIPExecution, types.DKG, types.OCR2VRF, types.GenericPlugin: return nil, fmt.Errorf("provider type not supported: %s", rargs.ProviderType) } return nil, fmt.Errorf("provider type not recognized: %s", rargs.ProviderType) diff --git a/core/services/relay/relay_test.go b/core/services/relay/relay_test.go index 40a11518edd..cd46a2acc27 100644 --- a/core/services/relay/relay_test.go +++ b/core/services/relay/relay_test.go @@ -1,6 +1,7 @@ package relay import ( + "context" "testing" "github.com/stretchr/testify/assert" @@ -8,7 +9,6 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -105,26 +105,22 @@ type mockRelayer struct { types.Relayer } -func (m *mockRelayer) NewMedianProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.MedianProvider, error) { +func (m *mockRelayer) NewMedianProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.MedianProvider, error) { return staticMedianProvider{}, nil } -func (m *mockRelayer) NewFunctionsProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.FunctionsProvider, error) { +func (m *mockRelayer) NewFunctionsProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.FunctionsProvider, error) { return staticFunctionsProvider{}, nil } -func (m *mockRelayer) NewMercuryProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.MercuryProvider, error) { +func (m *mockRelayer) NewMercuryProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.MercuryProvider, error) { return staticMercuryProvider{}, nil } -func (m *mockRelayer) NewAutomationProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.AutomationProvider, error) { +func (m *mockRelayer) NewAutomationProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.AutomationProvider, error) { return staticAutomationProvider{}, nil } -type mockRelayerExt struct { - loop.RelayerExt -} - func isType[T any](p any) bool { _, ok := p.(T) return ok @@ -132,7 +128,7 @@ func isType[T any](p any) bool { func TestRelayerServerAdapter(t *testing.T) { r := &mockRelayer{} - sa := NewServerAdapter(r, mockRelayerExt{}) + sa := NewServerAdapter(r) testCases := []struct { ProviderType string @@ -165,23 +161,25 @@ func TestRelayerServerAdapter(t *testing.T) { }, { ProviderType: string(types.GenericPlugin), - Error: "unexpected call to NewPluginProvider", + Error: "provider type not supported", }, } ctx := testutils.Context(t) for _, tc := range testCases { - pp, err := sa.NewPluginProvider( - ctx, - types.RelayArgs{ProviderType: tc.ProviderType}, - types.PluginArgs{}, - ) - - if tc.Error != "" { - assert.ErrorContains(t, err, tc.Error) - } else { - assert.NoError(t, err) - assert.True(t, tc.Test(pp)) - } + t.Run(tc.ProviderType, func(t *testing.T) { + pp, err := sa.NewPluginProvider( + ctx, + types.RelayArgs{ProviderType: tc.ProviderType}, + types.PluginArgs{}, + ) + + if tc.Error != "" { + assert.ErrorContains(t, err, tc.Error) + } else { + assert.NoError(t, err) + assert.True(t, tc.Test(pp)) + } + }) } } diff --git a/core/services/vrf/delegate_test.go b/core/services/vrf/delegate_test.go index 8ad88d7b73b..c28ad2e51d7 100644 --- a/core/services/vrf/delegate_test.go +++ b/core/services/vrf/delegate_test.go @@ -40,7 +40,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" "github.com/smartcontractkit/chainlink/v2/core/services/vrf" vrf_mocks "github.com/smartcontractkit/chainlink/v2/core/services/vrf/mocks" @@ -87,8 +86,7 @@ func buildVrfUni(t *testing.T, db *sqlx.DB, cfg chainlink.GeneralConfig) vrfUniv require.NoError(t, orm.IdempotentInsertHead(testutils.Context(t), cltest.Head(51))) jrm := job.NewORM(db, prm, btORM, ks, lggr, cfg.Database()) t.Cleanup(func() { assert.NoError(t, jrm.Close()) }) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{LogBroadcaster: lb, KeyStore: ks.Eth(), Client: ec, DB: db, GeneralConfig: cfg, TxManager: txm}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{LogBroadcaster: lb, KeyStore: ks.Eth(), Client: ec, DB: db, GeneralConfig: cfg, TxManager: txm}) pr := pipeline.NewRunner(prm, btORM, cfg.JobPipeline(), cfg.WebServer(), legacyChains, ks.Eth(), ks.VRF(), lggr, nil, nil) require.NoError(t, ks.Unlock(testutils.Password)) k, err2 := ks.Eth().Create(testutils.FixtureChainID) diff --git a/core/services/vrf/v2/integration_v2_test.go b/core/services/vrf/v2/integration_v2_test.go index d415793ede4..c91f8a54385 100644 --- a/core/services/vrf/v2/integration_v2_test.go +++ b/core/services/vrf/v2/integration_v2_test.go @@ -76,7 +76,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey" "github.com/smartcontractkit/chainlink/v2/core/services/pg" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" "github.com/smartcontractkit/chainlink/v2/core/services/vrf/proof" v1 "github.com/smartcontractkit/chainlink/v2/core/services/vrf/v1" @@ -2019,8 +2018,7 @@ func TestStartingCountsV1(t *testing.T) { ec.On("ConfiguredChainID").Return(testutils.SimulatedChainID) ec.On("LatestBlockHeight", mock.Anything).Return(big.NewInt(2), nil).Maybe() txm := makeTestTxm(t, txStore, ks, ec) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{KeyStore: ks.Eth(), Client: ec, DB: db, GeneralConfig: cfg, TxManager: txm}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{KeyStore: ks.Eth(), Client: ec, DB: db, GeneralConfig: cfg, TxManager: txm}) chain, err := legacyChains.Get(testutils.SimulatedChainID.String()) require.NoError(t, err) listenerV1 := &v1.Listener{ diff --git a/core/web/testdata/body/health.html b/core/web/testdata/body/health.html index d1b208f4a0d..5d330b4d72a 100644 --- a/core/web/testdata/body/health.html +++ b/core/web/testdata/body/health.html @@ -52,6 +52,9 @@
LogBroadcaster
+
+ Relayer +
Txm
diff --git a/core/web/testdata/body/health.json b/core/web/testdata/body/health.json index 3c0117de7ec..ab3249b49b4 100644 --- a/core/web/testdata/body/health.json +++ b/core/web/testdata/body/health.json @@ -54,6 +54,15 @@ "output": "" } }, + { + "type": "checks", + "id": "EVM.0.Relayer", + "attributes": { + "name": "EVM.0.Relayer", + "status": "passing", + "output": "" + } + }, { "type": "checks", "id": "EVM.0.Txm", diff --git a/core/web/testdata/body/health.txt b/core/web/testdata/body/health.txt index 59f63c26413..9de8b309f6a 100644 --- a/core/web/testdata/body/health.txt +++ b/core/web/testdata/body/health.txt @@ -5,6 +5,7 @@ !EVM.0.HeadTracker.HeadListener Listener is not connected -EVM.0.LogBroadcaster +-EVM.0.Relayer -EVM.0.Txm -EVM.0.Txm.BlockHistoryEstimator -EVM.0.Txm.Broadcaster diff --git a/go.mod b/go.mod index 3f834e2d848..906ac835729 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,12 @@ module github.com/smartcontractkit/chainlink/v2 go 1.21.3 +replace github.com/smartcontractkit/libocr => github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0 + +replace github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin => github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2 + +replace github.com/smartcontractkit/tdh2/go/tdh2 => github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2 + require ( github.com/Depado/ginprom v1.8.0 github.com/Masterminds/semver/v3 v3.2.1 @@ -64,14 +70,14 @@ require ( github.com/shirou/gopsutil/v3 v3.23.11 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 - github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5 + github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7 + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312 - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a - github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580 + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1 + github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 diff --git a/go.sum b/go.sum index 014ed5ba627..fba99da0199 100644 --- a/go.sum +++ b/go.sum @@ -807,6 +807,12 @@ github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0 h1:ON2l755Emwb9RFUYhIhQZXkraFfRdFfGfAn7Ded6akQ= +github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0/go.mod h1:WcuWFMskcGK0MYZuH5hEhGJOzdJRUFeNEM4PAKlejI4= +github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2 h1:Is1Mky3KrcbhK/Y2gs/nhR6fKeuVupD6urIVQLmP7sM= +github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2/go.mod h1:6i2tn96F0C4PHiilFtWGVmZnp9m98lSLj9zaxSz0jV8= +github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2 h1:un1qd1p4obk2bTRqA0+IN+4iM3PrNhkhbAdrN/Nmv20= +github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -1148,32 +1154,26 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumvbfM1u/etVq42Afwq/jtNSBSOA8n5jntnNPo= github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= -github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= -github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b h1:PRuvHgPka1gIGPKASuJHvqUvYWhZO7z5B/kKapjkZaM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5 h1:kBnmjv3fxU7krVIqZFvo1m4F6qBc4vPURQFX/mcChhI= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5/go.mod h1:EoM7wQ81mov7wsUzG4zEnnr0EH0POEo/I0hRDg433TU= +github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416 h1:0y1ahFgoCr8XDnVtt/ggnmVGorsEAGfSZthahjHjKJ8= +github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416/go.mod h1:96/xMsCUq8jaRkv/ODnX14QaJU4kt4gy3MTfRADLLaM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7 h1:h+Z8qh53HaTqU5zV4XHAE1wTaVSfZfdyfYXPpz688zE= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7/go.mod h1:fzgN322Qq4jCFAx/nrTi+TYvUOp6SYhpPPhIKepuzac= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87 h1:3fEIxv38h/G59wIiB6NahZiDdwmhmG2VL7PA0hK3Bvo= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87/go.mod h1:zeL+MxaiSEjNdPkDsMI8zjb+l2ZTN6m8u5oklFRFZAQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d h1:w4MsbOtNk6nD/mcXLstHWk9hB6g7QLtcAfhPjhwvOaQ= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d/go.mod h1:YPAfLNowdBwiKiYOwgwtbJHi8AJWbcxkbOY0ItAvkfc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312 h1:ziqC+WW/2/UI6w3DShy7HGzJMWWLIYHT5ev2Qaa3h6I= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312/go.mod h1:vqnojBNdzHNI6asWezJlottUiVEXudMEGf2Mz5R+xps= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a h1:atCXqF8e5U2zfEaA87cKJs+K1MAbOVh3V05gEd60fR0= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a/go.mod h1:YWKpf+hO9XMlzIWQT8yGoky3aeFLzMUVsjbs80LD77M= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580 h1:HvCOqpfrG+ODx7Fp+D2CnVEvGmuLiJ6UkR8LcXFMLek= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580/go.mod h1:X1BXPBWuDCCMUm9pmKA+u4eiapxNmyY0x5uEKueNJFg= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1 h1:BztQ8QEmI1z5TGBWmx2Pi+RyNX4OpjU0qijt8IRm0is= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1/go.mod h1:/VXLub0xjd7BaKTBjXlGac1hprt7iBGlvtsLTzYxHWM= +github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e h1:kmtH8NE/ujL9pwrceL7QPMIH1Nb7s5Rtcc2xgKbwQ24= +github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e/go.mod h1:1WMis7p5HzhTMZgUBPYYsx48PkzND+GuOq2IDerRSMs= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= -github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 h1:AA7vf29c6lFsZm+MtIEtXtg6VUOQV6waJo5MUuHfRjQ= -github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7/go.mod h1:WcuWFMskcGK0MYZuH5hEhGJOzdJRUFeNEM4PAKlejI4= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:q6f4fe39oZPdsh1i57WznEZgxd8siidMaSFq3wdPmVg= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 h1:Dai1bn+Q5cpeGMQwRdjOdVjG8mmFFROVkSKuUgBErRQ= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= github.com/smartcontractkit/wsrpc v0.7.2 h1:iBXzMeg7vc5YoezIQBq896y25BARw7OKbhrb6vPbtRQ= github.com/smartcontractkit/wsrpc v0.7.2/go.mod h1:sj7QX2NQibhkhxTfs3KOhAj/5xwgqMipTvJVSssT9i0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 17a98e450a8..d53862787f5 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -5,6 +5,12 @@ go 1.21.4 // Make sure we're working with the latest chainlink libs replace github.com/smartcontractkit/chainlink/v2 => ../ +replace github.com/smartcontractkit/libocr => github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0 + +replace github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin => github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2 + +replace github.com/smartcontractkit/tdh2/go/tdh2 => github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2 + require ( cosmossdk.io/errors v1.0.0 github.com/K-Phoen/grabana v0.21.17 @@ -24,10 +30,10 @@ require ( github.com/scylladb/go-reflectx v1.0.1 github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/chainlink-automation v1.0.1 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b + github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7 github.com/smartcontractkit/chainlink-testing-framework v1.22.0 - github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 + github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 @@ -361,11 +367,11 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580 // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/wsrpc v0.7.2 // indirect github.com/soheilhy/cmux v0.1.5 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 916145aca49..7bf603df668 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1037,6 +1037,12 @@ github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0 h1:ON2l755Emwb9RFUYhIhQZXkraFfRdFfGfAn7Ded6akQ= +github.com/jmank88/libocr v0.0.0-20240112230745-2fac9a2947d0/go.mod h1:WcuWFMskcGK0MYZuH5hEhGJOzdJRUFeNEM4PAKlejI4= +github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2 h1:Is1Mky3KrcbhK/Y2gs/nhR6fKeuVupD6urIVQLmP7sM= +github.com/jmank88/tdh2/go/ocr2/decryptionplugin v0.0.0-20240112231155-782e854d3ca2/go.mod h1:6i2tn96F0C4PHiilFtWGVmZnp9m98lSLj9zaxSz0jV8= +github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2 h1:un1qd1p4obk2bTRqA0+IN+4iM3PrNhkhbAdrN/Nmv20= +github.com/jmank88/tdh2/go/tdh2 v0.0.0-20240112231155-782e854d3ca2/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -1479,34 +1485,28 @@ github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumvbfM1u/etVq42Afwq/jtNSBSOA8n5jntnNPo= github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= -github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk= -github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b h1:PRuvHgPka1gIGPKASuJHvqUvYWhZO7z5B/kKapjkZaM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240108182329-237f56daad6b/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5 h1:kBnmjv3fxU7krVIqZFvo1m4F6qBc4vPURQFX/mcChhI= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231218175426-6e0427c661e5/go.mod h1:EoM7wQ81mov7wsUzG4zEnnr0EH0POEo/I0hRDg433TU= +github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416 h1:0y1ahFgoCr8XDnVtt/ggnmVGorsEAGfSZthahjHjKJ8= +github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240112232334-de053be2a416/go.mod h1:96/xMsCUq8jaRkv/ODnX14QaJU4kt4gy3MTfRADLLaM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7 h1:h+Z8qh53HaTqU5zV4XHAE1wTaVSfZfdyfYXPpz688zE= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240113213851-efffc3787cc7/go.mod h1:fzgN322Qq4jCFAx/nrTi+TYvUOp6SYhpPPhIKepuzac= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87 h1:3fEIxv38h/G59wIiB6NahZiDdwmhmG2VL7PA0hK3Bvo= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240113193536-8f6a12bf1f87/go.mod h1:zeL+MxaiSEjNdPkDsMI8zjb+l2ZTN6m8u5oklFRFZAQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d h1:w4MsbOtNk6nD/mcXLstHWk9hB6g7QLtcAfhPjhwvOaQ= github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d/go.mod h1:YPAfLNowdBwiKiYOwgwtbJHi8AJWbcxkbOY0ItAvkfc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312 h1:ziqC+WW/2/UI6w3DShy7HGzJMWWLIYHT5ev2Qaa3h6I= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231219140448-151a4725f312/go.mod h1:vqnojBNdzHNI6asWezJlottUiVEXudMEGf2Mz5R+xps= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a h1:atCXqF8e5U2zfEaA87cKJs+K1MAbOVh3V05gEd60fR0= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231219014050-0c4a7831293a/go.mod h1:YWKpf+hO9XMlzIWQT8yGoky3aeFLzMUVsjbs80LD77M= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580 h1:HvCOqpfrG+ODx7Fp+D2CnVEvGmuLiJ6UkR8LcXFMLek= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240113214139-fc2300ce4580/go.mod h1:X1BXPBWuDCCMUm9pmKA+u4eiapxNmyY0x5uEKueNJFg= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1 h1:BztQ8QEmI1z5TGBWmx2Pi+RyNX4OpjU0qijt8IRm0is= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240113213933-2b680ac849b1/go.mod h1:/VXLub0xjd7BaKTBjXlGac1hprt7iBGlvtsLTzYxHWM= github.com/smartcontractkit/chainlink-testing-framework v1.22.0 h1:Lur628wkrceWgcLmxGZe7Mauwxht4YO71hX9Jj5YslE= github.com/smartcontractkit/chainlink-testing-framework v1.22.0/go.mod h1:yu6qqrppNJfutQV37fiSs4eS0uQP5QT0ebi3tlIgWN0= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= -github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs= +github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e h1:kmtH8NE/ujL9pwrceL7QPMIH1Nb7s5Rtcc2xgKbwQ24= +github.com/smartcontractkit/chainlink-vrf v0.0.0-20240112231546-45f885b4077e/go.mod h1:1WMis7p5HzhTMZgUBPYYsx48PkzND+GuOq2IDerRSMs= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= -github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7 h1:AA7vf29c6lFsZm+MtIEtXtg6VUOQV6waJo5MUuHfRjQ= -github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7/go.mod h1:WcuWFMskcGK0MYZuH5hEhGJOzdJRUFeNEM4PAKlejI4= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:q6f4fe39oZPdsh1i57WznEZgxd8siidMaSFq3wdPmVg= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 h1:Dai1bn+Q5cpeGMQwRdjOdVjG8mmFFROVkSKuUgBErRQ= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= github.com/smartcontractkit/wasp v0.4.0 h1:N8yPxlBvoJiyE6HaDkTkwRbuOHkGgQFGEHbw36oh4jA= github.com/smartcontractkit/wasp v0.4.0/go.mod h1:3qiofyI3pkbrc48a3CVshbMfgl74SiuPL/tm30d9Wb4= github.com/smartcontractkit/wsrpc v0.7.2 h1:iBXzMeg7vc5YoezIQBq896y25BARw7OKbhrb6vPbtRQ= diff --git a/testdata/scripts/health/default.txtar b/testdata/scripts/health/default.txtar index 15be9da1fe6..730f3afd8ea 100644 --- a/testdata/scripts/health/default.txtar +++ b/testdata/scripts/health/default.txtar @@ -29,6 +29,8 @@ fj293fbBnlQ!f9vNs -- config.toml.tmpl -- [Webserver] HTTPPort = $PORT +[WebServer.TLS] +HTTPSPort = 0 -- out.txt -- -JobSpawner diff --git a/testdata/scripts/health/multi-chain.txtar b/testdata/scripts/health/multi-chain.txtar index 6a6adb895cb..fbc5ade977f 100644 --- a/testdata/scripts/health/multi-chain.txtar +++ b/testdata/scripts/health/multi-chain.txtar @@ -29,6 +29,8 @@ fj293fbBnlQ!f9vNs -- config.toml.tmpl -- [Webserver] HTTPPort = $PORT +[WebServer.TLS] +HTTPSPort = 0 [[Cosmos]] ChainID = 'Foo' @@ -69,6 +71,7 @@ URL = 'http://stark.node' !EVM.1.HeadTracker.HeadListener Listener is not connected -EVM.1.LogBroadcaster +-EVM.1.Relayer -EVM.1.Txm -EVM.1.Txm.BlockHistoryEstimator -EVM.1.Txm.Broadcaster @@ -81,8 +84,10 @@ URL = 'http://stark.node' -PipelineORM -PipelineRunner -PromReporter --Solana.Bar --StarkNet.Baz +-Solana.Bar.Chain +-Solana.Bar.Relayer +-Solana.Bar.Txm +-StarkNet.Baz.Relayer -TelemetryManager -- out.json -- @@ -160,6 +165,15 @@ URL = 'http://stark.node' "output": "" } }, + { + "type": "checks", + "id": "EVM.1.Relayer", + "attributes": { + "name": "EVM.1.Relayer", + "status": "passing", + "output": "" + } + }, { "type": "checks", "id": "EVM.1.Txm", @@ -270,18 +284,36 @@ URL = 'http://stark.node' }, { "type": "checks", - "id": "Solana.Bar", + "id": "Solana.Bar.Chain", + "attributes": { + "name": "Solana.Bar.Chain", + "status": "passing", + "output": "" + } + }, + { + "type": "checks", + "id": "Solana.Bar.Relayer", + "attributes": { + "name": "Solana.Bar.Relayer", + "status": "passing", + "output": "" + } + }, + { + "type": "checks", + "id": "Solana.Bar.Txm", "attributes": { - "name": "Solana.Bar", + "name": "Solana.Bar.Txm", "status": "passing", "output": "" } }, { "type": "checks", - "id": "StarkNet.Baz", + "id": "StarkNet.Baz.Relayer", "attributes": { - "name": "StarkNet.Baz", + "name": "StarkNet.Baz.Relayer", "status": "passing", "output": "" }