From 5080c48eae730b2b6c689785913e1702247ff7ff Mon Sep 17 00:00:00 2001 From: krehermann Date: Mon, 5 Feb 2024 07:54:52 -0700 Subject: [PATCH 01/12] support mercury loopp --- cmd/datastreams/main.go | 39 +++++ cmd/datastreams/plugin.go | 88 ++++++++++++ core/config/env/env.go | 1 + core/services/ocr2/delegate.go | 4 +- core/services/ocr2/plugins/mercury/plugin.go | 141 ++++++++++++++++--- 5 files changed, 252 insertions(+), 21 deletions(-) create mode 100644 cmd/datastreams/main.go create mode 100644 cmd/datastreams/plugin.go diff --git a/cmd/datastreams/main.go b/cmd/datastreams/main.go new file mode 100644 index 00000000000..d80aa8ef41c --- /dev/null +++ b/cmd/datastreams/main.go @@ -0,0 +1,39 @@ +package main + +import ( + "github.com/hashicorp/go-plugin" + + "github.com/smartcontractkit/chainlink-common/pkg/loop" +) + +const ( + loggerName = "PluginMercury" +) + +func main() { + s := loop.MustNewStartedServer(loggerName) + defer s.Stop() + + p := NewPlugin(s.Logger) + defer s.Logger.ErrorIfFn(p.Close, "Failed to close") + + s.MustRegister(p) + + stop := make(chan struct{}) + defer close(stop) + + plugin.Serve(&plugin.ServeConfig{ + HandshakeConfig: loop.PluginMercuryHandshakeConfig(), + Plugins: map[string]plugin.Plugin{ + loop.PluginMercuryName: &loop.GRPCPluginMercury{ + PluginServer: p, + BrokerConfig: loop.BrokerConfig{ + StopCh: stop, + Logger: s.Logger, + GRPCOpts: s.GRPCOpts, + }, + }, + }, + GRPCServer: s.GRPCOpts.NewServer, + }) +} diff --git a/cmd/datastreams/plugin.go b/cmd/datastreams/plugin.go new file mode 100644 index 00000000000..6e40882a847 --- /dev/null +++ b/cmd/datastreams/plugin.go @@ -0,0 +1,88 @@ +package main + +import ( + "context" + + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/loop" + "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink-common/pkg/types" + v1 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1" + v2 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v2" + v3 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3" + ds_v1 "github.com/smartcontractkit/chainlink-data-streams/mercury/v1" + ds_v2 "github.com/smartcontractkit/chainlink-data-streams/mercury/v2" + ds_v3 "github.com/smartcontractkit/chainlink-data-streams/mercury/v3" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" +) + +type Plugin struct { + loop.Plugin + stop services.StopChan +} + +func NewPlugin(lggr logger.Logger) *Plugin { + return &Plugin{Plugin: loop.Plugin{Logger: lggr}, stop: make(services.StopChan)} +} + +func (p *Plugin) NewMercuryV1Factory(ctx context.Context, provider types.MercuryProvider, dataSource v1.DataSource) (types.MercuryPluginFactory, error) { + var ctxVals loop.ContextValues + ctxVals.SetValues(ctx) + lggr := logger.With(p.Logger, ctxVals.Args()...) + + factory := ds_v1.NewFactory(dataSource, lggr, provider.OnchainConfigCodec(), provider.ReportCodecV1()) + + s := &mercuryPluginFactoryService{lggr: logger.Named(lggr, "MercuryV1PluginFactory"), MercuryPluginFactory: factory} + + p.SubService(s) + + return s, nil +} + +func (p *Plugin) NewMercuryV2Factory(ctx context.Context, provider types.MercuryProvider, dataSource v2.DataSource) (types.MercuryPluginFactory, error) { + var ctxVals loop.ContextValues + ctxVals.SetValues(ctx) + lggr := logger.With(p.Logger, ctxVals.Args()...) + + factory := ds_v2.NewFactory(dataSource, lggr, provider.OnchainConfigCodec(), provider.ReportCodecV2()) + + s := &mercuryPluginFactoryService{lggr: logger.Named(lggr, "MercuryV2PluginFactory"), MercuryPluginFactory: factory} + + p.SubService(s) + + return s, nil +} + +func (p *Plugin) NewMercuryV3Factory(ctx context.Context, provider types.MercuryProvider, dataSource v3.DataSource) (types.MercuryPluginFactory, error) { + var ctxVals loop.ContextValues + ctxVals.SetValues(ctx) + lggr := logger.With(p.Logger, ctxVals.Args()...) + + factory := ds_v3.NewFactory(dataSource, lggr, provider.OnchainConfigCodec(), provider.ReportCodecV3()) + + s := &mercuryPluginFactoryService{lggr: logger.Named(lggr, "MercuryV3PluginFactory"), MercuryPluginFactory: factory} + + p.SubService(s) + + return s, nil +} + +type mercuryPluginFactoryService struct { + services.StateMachine + lggr logger.Logger + ocr3types.MercuryPluginFactory +} + +func (r *mercuryPluginFactoryService) Name() string { return r.lggr.Name() } + +func (r *mercuryPluginFactoryService) Start(ctx context.Context) error { + return r.StartOnce("ReportingPluginFactory", func() error { return nil }) +} + +func (r *mercuryPluginFactoryService) Close() error { + return r.StopOnce("ReportingPluginFactory", func() error { return nil }) +} + +func (r *mercuryPluginFactoryService) HealthReport() map[string]error { + return map[string]error{r.Name(): r.Healthy()} +} diff --git a/core/config/env/env.go b/core/config/env/env.go index f22310a6cf8..0ebfc357bf3 100644 --- a/core/config/env/env.go +++ b/core/config/env/env.go @@ -25,6 +25,7 @@ var ( // LOOPP commands and vars var ( MedianPlugin = NewPlugin("median") + MercuryPlugin = NewPlugin("mercury") SolanaPlugin = NewPlugin("solana") StarknetPlugin = NewPlugin("starknet") // PrometheusDiscoveryHostName is the externally accessible hostname diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index c838316b1cc..b20f95d129f 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -727,7 +727,9 @@ func (d *Delegate) newServicesMercury( chEnhancedTelem := make(chan ocrcommon.EnhancedTelemetryMercuryData, 100) - mercuryServices, err2 := mercury.NewServices(jb, mercuryProvider, d.pipelineRunner, lggr, oracleArgsNoPlugin, d.cfg.JobPipeline(), chEnhancedTelem, d.mercuryORM, (mercuryutils.FeedID)(*spec.FeedID)) + mCfg := mercury.NewMercuryConfig(d.cfg.JobPipeline().MaxSuccessfulRuns(), d.cfg.JobPipeline().ResultWriteQueueDepth(), d.cfg) + + mercuryServices, err2 := mercury.NewServices(jb, mercuryProvider, d.pipelineRunner, lggr, oracleArgsNoPlugin, mCfg, chEnhancedTelem, d.mercuryORM, (mercuryutils.FeedID)(*spec.FeedID)) if ocrcommon.ShouldCollectEnhancedTelemetryMercury(jb) { enhancedTelemService := ocrcommon.NewEnhancedTelemetryService(&jb, chEnhancedTelem, make(chan struct{}), d.monitoringEndpointGen.GenMonitoringEndpoint(rid.Network, rid.ChainID, spec.FeedID.String(), synchronization.EnhancedEAMercury), lggr.Named("EnhancedTelemetryMercury")) diff --git a/core/services/ocr2/plugins/mercury/plugin.go b/core/services/ocr2/plugins/mercury/plugin.go index b2767d6bcf5..09337da6ca2 100644 --- a/core/services/ocr2/plugins/mercury/plugin.go +++ b/core/services/ocr2/plugins/mercury/plugin.go @@ -2,17 +2,22 @@ package mercury import ( "encoding/json" + "fmt" "github.com/pkg/errors" libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" + "github.com/smartcontractkit/chainlink-common/pkg/loop" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" relaymercuryv1 "github.com/smartcontractkit/chainlink-data-streams/mercury/v1" relaymercuryv2 "github.com/smartcontractkit/chainlink-data-streams/mercury/v2" relaymercuryv3 "github.com/smartcontractkit/chainlink-data-streams/mercury/v3" + "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/logger" + "github.com/smartcontractkit/chainlink/v2/core/services" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury/config" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" @@ -22,11 +27,36 @@ import ( mercuryv1 "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v1" mercuryv2 "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v2" mercuryv3 "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v3" + "github.com/smartcontractkit/chainlink/v2/plugins" ) type Config interface { MaxSuccessfulRuns() uint64 ResultWriteQueueDepth() uint64 + plugins.RegistrarConfig +} + +// concrete implementation of MercuryConfig +type mercuryConfig struct { + jobPipelineMaxSuccessfulRuns uint64 + jobPipelineResultWriteQueueDepth uint64 + plugins.RegistrarConfig +} + +func NewMercuryConfig(jobPipelineMaxSuccessfulRuns uint64, jobPipelineResultWriteQueueDepth uint64, pluginProcessCfg plugins.RegistrarConfig) Config { + return &mercuryConfig{ + jobPipelineMaxSuccessfulRuns: jobPipelineMaxSuccessfulRuns, + jobPipelineResultWriteQueueDepth: jobPipelineResultWriteQueueDepth, + RegistrarConfig: pluginProcessCfg, + } +} + +func (m *mercuryConfig) MaxSuccessfulRuns() uint64 { + return m.jobPipelineMaxSuccessfulRuns +} + +func (m *mercuryConfig) ResultWriteQueueDepth() uint64 { + return m.jobPipelineResultWriteQueueDepth } func NewServices( @@ -55,8 +85,19 @@ func NewServices( } lggr = lggr.Named("MercuryPlugin").With("jobID", jb.ID, "jobName", jb.Name.ValueOrZero()) + // encapsulate all the subservices and ensure we close them all if any fail to start + srvs := []job.ServiceCtx{ocr2Provider} + abort := func() { + if cerr := services.MultiCloser(srvs).Close(); err != nil { + lggr.Errorw("Error closing unused services", "err", cerr) + } + } saver := ocrcommon.NewResultRunSaver(pipelineRunner, lggr, cfg.MaxSuccessfulRuns(), cfg.ResultWriteQueueDepth()) + srvs = append(srvs, saver) + loopEnabled, loopCmd := env.MercuryPlugin.Cmd.Get() != "", env.MercuryPlugin.Env.Get() + // this is the factory that will be used to create the mercury plugin + var factory ocr3types.MercuryPluginFactory switch feedID.Version() { case 1: ds := mercuryv1.NewDataSource( @@ -72,12 +113,31 @@ func NewServices( pluginConfig.InitialBlockNumber.Ptr(), feedID, ) - argsNoPlugin.MercuryPluginFactory = relaymercuryv1.NewFactory( - ds, - lggr, - ocr2Provider.OnchainConfigCodec(), - ocr2Provider.ReportCodecV1(), - ) + + if loopEnabled { + mercuryLggr := lggr.Named("MercuryV1").Named(feedID.String()) + envVars, err2 := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) + if err2 != nil { + abort() + return nil, fmt.Errorf("failed to parse mercury env file: %w", err2) + } + cmdFn, opts, err2 := cfg.RegisterLOOP(plugins.CmdConfig{ + ID: mercuryLggr.Name(), + Cmd: loopCmd, + Env: envVars, + }) + if err2 != nil { + abort() + return nil, fmt.Errorf("failed to register loop: %w", err2) + } + // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle + factoryServer := loop.NewMercuryV1Service(lggr, opts, cmdFn, ocr2Provider, ds) + srvs = append(srvs, factoryServer) + // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle + factory = factoryServer + } else { + factory = relaymercuryv1.NewFactory(ds, lggr, ocr2Provider.OnchainConfigCodec(), ocr2Provider.ReportCodecV1()) + } case 2: ds := mercuryv2.NewDataSource( orm, @@ -92,12 +152,31 @@ func NewServices( *pluginConfig.LinkFeedID, *pluginConfig.NativeFeedID, ) - argsNoPlugin.MercuryPluginFactory = relaymercuryv2.NewFactory( - ds, - lggr, - ocr2Provider.OnchainConfigCodec(), - ocr2Provider.ReportCodecV2(), - ) + + if loopEnabled { + mercuryLggr := lggr.Named("MercuryV2").Named(feedID.String()) + envVars, err2 := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) + if err2 != nil { + abort() + return nil, fmt.Errorf("failed to parse mercury env file: %w", err2) + } + cmdFn, opts, err2 := cfg.RegisterLOOP(plugins.CmdConfig{ + ID: mercuryLggr.Name(), + Cmd: loopCmd, + Env: envVars, + }) + if err2 != nil { + abort() + return nil, fmt.Errorf("failed to register loop: %w", err2) + } + // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle + factoryServer := loop.NewMercuryV2Service(lggr, opts, cmdFn, ocr2Provider, ds) + srvs = append(srvs, factoryServer) + // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle + factory = factoryServer + } else { + factory = relaymercuryv2.NewFactory(ds, lggr, ocr2Provider.OnchainConfigCodec(), ocr2Provider.ReportCodecV2()) + } case 3: ds := mercuryv3.NewDataSource( orm, @@ -112,19 +191,41 @@ func NewServices( *pluginConfig.LinkFeedID, *pluginConfig.NativeFeedID, ) - argsNoPlugin.MercuryPluginFactory = relaymercuryv3.NewFactory( - ds, - lggr, - ocr2Provider.OnchainConfigCodec(), - ocr2Provider.ReportCodecV3(), - ) + + if loopEnabled { + mercuryLggr := lggr.Named("MercuryV3").Named(feedID.String()) + envVars, err2 := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) + if err2 != nil { + abort() + return nil, fmt.Errorf("failed to parse mercury env file: %w", err2) + } + cmdFn, opts, err2 := cfg.RegisterLOOP(plugins.CmdConfig{ + ID: mercuryLggr.Name(), + Cmd: loopCmd, + Env: envVars, + }) + if err2 != nil { + abort() + return nil, fmt.Errorf("failed to register loop: %w", err2) + } + // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle + factoryServer := loop.NewMercuryV3Service(lggr, opts, cmdFn, ocr2Provider, ds) + srvs = append(srvs, factoryServer) + // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle + factory = factoryServer + } else { + factory = relaymercuryv3.NewFactory(ds, lggr, ocr2Provider.OnchainConfigCodec(), ocr2Provider.ReportCodecV3()) + } + default: return nil, errors.Errorf("unknown Mercury report schema version: %d", feedID.Version()) } - + argsNoPlugin.MercuryPluginFactory = factory oracle, err := libocr2.NewOracle(argsNoPlugin) if err != nil { + abort() return nil, errors.WithStack(err) } - return []job.ServiceCtx{ocr2Provider, saver, job.NewServiceAdapter(oracle)}, nil + srvs = append(srvs, job.NewServiceAdapter(oracle)) + return srvs, nil } From 73f47708b1eb9d99aff77017c5c3b74eeefff4c4 Mon Sep 17 00:00:00 2001 From: krehermann Date: Mon, 5 Feb 2024 08:59:11 -0700 Subject: [PATCH 02/12] update common --- core/scripts/go.mod | 12 ++++++------ core/scripts/go.sum | 23 ++++++++++++----------- go.mod | 12 ++++++------ go.sum | 23 ++++++++++++----------- integration-tests/go.mod | 12 ++++++------ integration-tests/go.sum | 23 ++++++++++++----------- 6 files changed, 54 insertions(+), 51 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 32dfd6a5818..a7e26307f4f 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 @@ -298,13 +298,13 @@ require ( go.uber.org/ratelimit v0.2.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/arch v0.6.0 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/term v0.15.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.16.0 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 86c6bc84e53..4a81dfda1c2 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1169,8 +1169,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa h1:9g7e1C3295ALDK8Gs42fIKSSJfI+H1RoBmivGWTvIZo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9 h1:y9EqWa7hY1Q1gmSqfyzHGcf0wXp0Ygg/+f1ZNAU1Kcc= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= @@ -1446,8 +1446,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1546,8 +1546,8 @@ golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1573,8 +1573,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1661,8 +1661,9 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1670,8 +1671,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/go.mod b/go.mod index cbcad20919f..8a67f8a89e4 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 @@ -91,10 +91,10 @@ require ( go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.46.1 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.26.0 - golang.org/x/crypto v0.17.0 + golang.org/x/crypto v0.18.0 golang.org/x/exp v0.0.0-20231127185646-65229373498e - golang.org/x/sync v0.5.0 - golang.org/x/term v0.15.0 + golang.org/x/sync v0.6.0 + golang.org/x/term v0.16.0 golang.org/x/text v0.14.0 golang.org/x/time v0.5.0 golang.org/x/tools v0.16.0 @@ -313,8 +313,8 @@ require ( go.uber.org/ratelimit v0.2.0 // indirect golang.org/x/arch v0.6.0 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect diff --git a/go.sum b/go.sum index c8f6620af85..9333c39eb41 100644 --- a/go.sum +++ b/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa h1:9g7e1C3295ALDK8Gs42fIKSSJfI+H1RoBmivGWTvIZo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9 h1:y9EqWa7hY1Q1gmSqfyzHGcf0wXp0Ygg/+f1ZNAU1Kcc= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= @@ -1441,8 +1441,8 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1540,8 +1540,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1567,8 +1567,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1654,8 +1654,9 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1664,8 +1665,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 36ce802621d..7fe234e2770 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9 github.com/smartcontractkit/chainlink-testing-framework v1.23.2 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 @@ -39,7 +39,7 @@ require ( go.dedis.ch/kyber/v3 v3.1.0 go.uber.org/ratelimit v0.2.0 go.uber.org/zap v1.26.0 - golang.org/x/sync v0.5.0 + golang.org/x/sync v0.6.0 golang.org/x/text v0.14.0 gopkg.in/guregu/null.v4 v4.0.0 ) @@ -433,13 +433,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect golang.org/x/arch v0.6.0 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/net v0.20.0 // indirect golang.org/x/oauth2 v0.15.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/term v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.16.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 3a7652dc967..94338d55831 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1502,8 +1502,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa h1:9g7e1C3295ALDK8Gs42fIKSSJfI+H1RoBmivGWTvIZo= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240124161023-948579cbaffa/go.mod h1:05rRF84QKlIOF5LfTBPkHdw4UpBI2G3zxRcuZ65bPjk= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9 h1:y9EqWa7hY1Q1gmSqfyzHGcf0wXp0Ygg/+f1ZNAU1Kcc= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240126232017-20bf421fc2a9/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= @@ -1824,8 +1824,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1932,8 +1932,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1961,8 +1961,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2064,8 +2064,9 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2075,8 +2076,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From c3038c39feb6029e687931942fcb11bdffc1cdd9 Mon Sep 17 00:00:00 2001 From: krehermann Date: Mon, 5 Feb 2024 20:41:33 -0700 Subject: [PATCH 03/12] add tests for refactored NewServices func --- core/services/ocr2/plugins/mercury/plugin.go | 67 ++--- .../ocr2/plugins/mercury/plugin_test.go | 280 ++++++++++++++++++ 2 files changed, 308 insertions(+), 39 deletions(-) create mode 100644 core/services/ocr2/plugins/mercury/plugin_test.go diff --git a/core/services/ocr2/plugins/mercury/plugin.go b/core/services/ocr2/plugins/mercury/plugin.go index 09337da6ca2..431450670b1 100644 --- a/core/services/ocr2/plugins/mercury/plugin.go +++ b/core/services/ocr2/plugins/mercury/plugin.go @@ -3,6 +3,7 @@ package mercury import ( "encoding/json" "fmt" + "os/exec" "github.com/pkg/errors" @@ -96,6 +97,7 @@ func NewServices( srvs = append(srvs, saver) loopEnabled, loopCmd := env.MercuryPlugin.Cmd.Get() != "", env.MercuryPlugin.Env.Get() + // this is the factory that will be used to create the mercury plugin var factory ocr3types.MercuryPluginFactory switch feedID.Version() { @@ -115,23 +117,13 @@ func NewServices( ) if loopEnabled { - mercuryLggr := lggr.Named("MercuryV1").Named(feedID.String()) - envVars, err2 := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) - if err2 != nil { - abort() - return nil, fmt.Errorf("failed to parse mercury env file: %w", err2) - } - cmdFn, opts, err2 := cfg.RegisterLOOP(plugins.CmdConfig{ - ID: mercuryLggr.Name(), - Cmd: loopCmd, - Env: envVars, - }) + cmdFn, opts, mercuryLggr, err2 := initLoop(loopCmd, cfg, feedID, lggr) if err2 != nil { abort() - return nil, fmt.Errorf("failed to register loop: %w", err2) + return nil, fmt.Errorf("failed to init loop for feed %s: %w", feedID, err2) } // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle - factoryServer := loop.NewMercuryV1Service(lggr, opts, cmdFn, ocr2Provider, ds) + factoryServer := loop.NewMercuryV1Service(mercuryLggr, opts, cmdFn, ocr2Provider, ds) srvs = append(srvs, factoryServer) // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle factory = factoryServer @@ -154,23 +146,13 @@ func NewServices( ) if loopEnabled { - mercuryLggr := lggr.Named("MercuryV2").Named(feedID.String()) - envVars, err2 := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) + cmdFn, opts, mercuryLggr, err2 := initLoop(loopCmd, cfg, feedID, lggr) if err2 != nil { abort() - return nil, fmt.Errorf("failed to parse mercury env file: %w", err2) - } - cmdFn, opts, err2 := cfg.RegisterLOOP(plugins.CmdConfig{ - ID: mercuryLggr.Name(), - Cmd: loopCmd, - Env: envVars, - }) - if err2 != nil { - abort() - return nil, fmt.Errorf("failed to register loop: %w", err2) + return nil, fmt.Errorf("failed to init loop for feed %s: %w", feedID, err2) } // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle - factoryServer := loop.NewMercuryV2Service(lggr, opts, cmdFn, ocr2Provider, ds) + factoryServer := loop.NewMercuryV2Service(mercuryLggr, opts, cmdFn, ocr2Provider, ds) srvs = append(srvs, factoryServer) // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle factory = factoryServer @@ -193,23 +175,13 @@ func NewServices( ) if loopEnabled { - mercuryLggr := lggr.Named("MercuryV3").Named(feedID.String()) - envVars, err2 := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) - if err2 != nil { - abort() - return nil, fmt.Errorf("failed to parse mercury env file: %w", err2) - } - cmdFn, opts, err2 := cfg.RegisterLOOP(plugins.CmdConfig{ - ID: mercuryLggr.Name(), - Cmd: loopCmd, - Env: envVars, - }) + cmdFn, opts, mercuryLggr, err2 := initLoop(loopCmd, cfg, feedID, lggr) if err2 != nil { abort() - return nil, fmt.Errorf("failed to register loop: %w", err2) + return nil, fmt.Errorf("failed to init loop for feed %s: %w", feedID, err2) } // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle - factoryServer := loop.NewMercuryV3Service(lggr, opts, cmdFn, ocr2Provider, ds) + factoryServer := loop.NewMercuryV3Service(mercuryLggr, opts, cmdFn, ocr2Provider, ds) srvs = append(srvs, factoryServer) // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle factory = factoryServer @@ -229,3 +201,20 @@ func NewServices( srvs = append(srvs, job.NewServiceAdapter(oracle)) return srvs, nil } + +func initLoop(cmd string, cfg Config, feedID utils.FeedID, lggr logger.Logger) (func() *exec.Cmd, loop.GRPCOpts, logger.Logger, error) { + mercuryLggr := lggr.Named(fmt.Sprintf("MercuryV%d", feedID.Version())).Named(feedID.String()) + envVars, err := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) + if err != nil { + return nil, loop.GRPCOpts{}, nil, fmt.Errorf("failed to parse mercury env file: %w", err) + } + cmdFn, opts, err := cfg.RegisterLOOP(plugins.CmdConfig{ + ID: mercuryLggr.Name(), + Cmd: cmd, + Env: envVars, + }) + if err != nil { + return nil, loop.GRPCOpts{}, nil, fmt.Errorf("failed to register loop: %w", err) + } + return cmdFn, opts, mercuryLggr, nil +} diff --git a/core/services/ocr2/plugins/mercury/plugin_test.go b/core/services/ocr2/plugins/mercury/plugin_test.go new file mode 100644 index 00000000000..40dba608138 --- /dev/null +++ b/core/services/ocr2/plugins/mercury/plugin_test.go @@ -0,0 +1,280 @@ +package mercury_test + +import ( + "context" + "os/exec" + "reflect" + "testing" + + "github.com/ethereum/go-ethereum/common" + "github.com/google/uuid" + "github.com/smartcontractkit/chainlink-common/pkg/loop" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/types/mercury" + v1 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1" + v2 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v2" + v3 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3" + "github.com/smartcontractkit/chainlink/v2/core/config/env" + "github.com/smartcontractkit/chainlink/v2/core/logger" + "github.com/smartcontractkit/chainlink/v2/core/services/job" + "github.com/stretchr/testify/assert" + + mercuryocr2 "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury" + + "github.com/smartcontractkit/chainlink/v2/core/services/pg" + "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" + "github.com/smartcontractkit/chainlink/v2/core/services/relay" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/types" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/utils" + "github.com/smartcontractkit/chainlink/v2/plugins" + libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus" + libocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" +) + +var ( + v1FeedId = [32]uint8{00, 01, 107, 74, 167, 229, 124, 167, 182, 138, 225, 191, 69, 101, 63, 86, 182, 86, 253, 58, 163, 53, 239, 127, 174, 105, 107, 102, 63, 27, 132, 114} + v2FeedId = [32]uint8{00, 02, 107, 74, 167, 229, 124, 167, 182, 138, 225, 191, 69, 101, 63, 86, 182, 86, 253, 58, 163, 53, 239, 127, 174, 105, 107, 102, 63, 27, 132, 114} + v3FeedId = [32]uint8{00, 03, 107, 74, 167, 229, 124, 167, 182, 138, 225, 191, 69, 101, 63, 86, 182, 86, 253, 58, 163, 53, 239, 127, 174, 105, 107, 102, 63, 27, 132, 114} + + testArgsNoPlugin = libocr2.MercuryOracleArgs{ + LocalConfig: libocr2types.LocalConfig{ + DevelopmentMode: libocr2types.EnableDangerousDevelopmentMode, + }, + } + + testCfg = mercuryocr2.NewMercuryConfig(1, 1, &testRegistrarConfig{}) + + v1jsonCfg = job.JSONConfig{ + "serverURL": "example.com:80", + "serverPubKey": "724ff6eae9e900270edfff233e16322a70ec06e1a6e62a81ef13921f398f6c93", + "initialBlockNumber": 1234, + } + + v2jsonCfg = job.JSONConfig{ + "serverURL": "example.com:80", + "serverPubKey": "724ff6eae9e900270edfff233e16322a70ec06e1a6e62a81ef13921f398f6c93", + "linkFeedID": "0x00026b4aa7e57ca7b68ae1bf45653f56b656fd3aa335ef7fae696b663f1b8472", + "nativeFeedID": "0x00036b4aa7e57ca7b68ae1bf45653f56b656fd3aa335ef7fae696b663f1b8472", + } + + v3jsonCfg = job.JSONConfig{ + "serverURL": "example.com:80", + "serverPubKey": "724ff6eae9e900270edfff233e16322a70ec06e1a6e62a81ef13921f398f6c93", + "linkFeedID": "0x00026b4aa7e57ca7b68ae1bf45653f56b656fd3aa335ef7fae696b663f1b8472", + "nativeFeedID": "0x00036b4aa7e57ca7b68ae1bf45653f56b656fd3aa335ef7fae696b663f1b8472", + } + + testJob = job.Job{ + ID: 1, + ExternalJobID: uuid.Must(uuid.NewRandom()), + OCR2OracleSpecID: ptr(int32(7)), + OCR2OracleSpec: &job.OCR2OracleSpec{ + ID: 7, + ContractID: "phony", + FeedID: ptr(common.BytesToHash([]byte{1, 2, 3})), + Relay: relay.EVM, + ChainID: "1", + }, + PipelineSpec: &pipeline.Spec{}, + PipelineSpecID: int32(1), + } + + // this is kind of gross, but it's the best way to test return values of the services + expectedEmbeddedServiceCnt = 3 + expectedLoopServiceCnt = expectedEmbeddedServiceCnt + 1 +) + +func TestNewServices(t *testing.T) { + type args struct { + pluginConfig job.JSONConfig + feedID utils.FeedID + } + tests := []struct { + name string + args args + loopMode bool + wantLoopFactory any + wantServiceCnt int + wantErr bool + }{ + { + name: "no plugin config error ", + args: args{ + feedID: v1FeedId, + }, + wantServiceCnt: 0, + wantErr: true, + }, + + { + name: "v1 legacy", + args: args{ + pluginConfig: v1jsonCfg, + feedID: v1FeedId, + }, + wantServiceCnt: expectedEmbeddedServiceCnt, + wantErr: false, + }, + { + name: "v2 legacy", + args: args{ + pluginConfig: v2jsonCfg, + feedID: v2FeedId, + }, + wantServiceCnt: expectedEmbeddedServiceCnt, + wantErr: false, + }, + { + name: "v3 legacy", + args: args{ + pluginConfig: v3jsonCfg, + feedID: v3FeedId, + }, + wantServiceCnt: expectedEmbeddedServiceCnt, + wantErr: false, + }, + { + name: "v1 loop", + loopMode: true, + args: args{ + pluginConfig: v1jsonCfg, + feedID: v1FeedId, + }, + wantServiceCnt: expectedLoopServiceCnt, + wantErr: false, + wantLoopFactory: &loop.MercuryV1Service{}, + }, + { + name: "v2 loop", + loopMode: true, + args: args{ + pluginConfig: v2jsonCfg, + feedID: v2FeedId, + }, + wantServiceCnt: expectedLoopServiceCnt, + wantErr: false, + wantLoopFactory: &loop.MercuryV2Service{}, + }, + { + name: "v3 loop", + loopMode: true, + args: args{ + pluginConfig: v3jsonCfg, + feedID: v3FeedId, + }, + wantServiceCnt: expectedLoopServiceCnt, + wantErr: false, + wantLoopFactory: &loop.MercuryV3Service{}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.loopMode { + t.Setenv(string(env.MercuryPlugin.Cmd), "fake_cmd") + assert.NotEmpty(t, env.MercuryPlugin.Cmd.Get()) + } + got, err := newServicesTestWrapper(t, tt.args.pluginConfig, tt.args.feedID) + if (err != nil) != tt.wantErr { + t.Errorf("NewServices() error = %v, wantErr %v", err, tt.wantErr) + return + } + assert.Len(t, got, tt.wantServiceCnt) + if tt.loopMode { + foundLoopFactory := false + for i := 0; i < len(got); i++ { + if reflect.TypeOf(got[i]) == reflect.TypeOf(tt.wantLoopFactory) { + foundLoopFactory = true + break + } + } + assert.True(t, foundLoopFactory) + } + }) + } +} + +// we are only varying the version via feedID (and the plugin config) +// this wrapper supplies dummy values for the rest of the arguments +func newServicesTestWrapper(t *testing.T, pluginConfig job.JSONConfig, feedID utils.FeedID) ([]job.ServiceCtx, error) { + jb := testJob + jb.OCR2OracleSpec.PluginConfig = pluginConfig + return mercuryocr2.NewServices(jb, &testProvider{}, nil, logger.TestLogger(t), testArgsNoPlugin, testCfg, nil, &testDataSourceORM{}, feedID) +} + +type testProvider struct{} + +// ChainReader implements types.MercuryProvider. +func (*testProvider) ChainReader() commontypes.ChainReader { panic("unimplemented") } + +// Close implements types.MercuryProvider. +func (*testProvider) Close() error { return nil } + +// Codec implements types.MercuryProvider. +func (*testProvider) Codec() commontypes.Codec { panic("unimplemented") } + +// ContractConfigTracker implements types.MercuryProvider. +func (*testProvider) ContractConfigTracker() libocr2types.ContractConfigTracker { + panic("unimplemented") +} + +// ContractTransmitter implements types.MercuryProvider. +func (*testProvider) ContractTransmitter() libocr2types.ContractTransmitter { + panic("unimplemented") +} + +// HealthReport implements types.MercuryProvider. +func (*testProvider) HealthReport() map[string]error { panic("unimplemented") } + +// MercuryChainReader implements types.MercuryProvider. +func (*testProvider) MercuryChainReader() mercury.ChainReader { return nil } + +// MercuryServerFetcher implements types.MercuryProvider. +func (*testProvider) MercuryServerFetcher() mercury.ServerFetcher { return nil } + +// Name implements types.MercuryProvider. +func (*testProvider) Name() string { panic("unimplemented") } + +// OffchainConfigDigester implements types.MercuryProvider. +func (*testProvider) OffchainConfigDigester() libocr2types.OffchainConfigDigester { + panic("unimplemented") +} + +// OnchainConfigCodec implements types.MercuryProvider. +func (*testProvider) OnchainConfigCodec() mercury.OnchainConfigCodec { + return nil +} + +// Ready implements types.MercuryProvider. +func (*testProvider) Ready() error { panic("unimplemented") } + +// ReportCodecV1 implements types.MercuryProvider. +func (*testProvider) ReportCodecV1() v1.ReportCodec { return nil } + +// ReportCodecV2 implements types.MercuryProvider. +func (*testProvider) ReportCodecV2() v2.ReportCodec { return nil } + +// ReportCodecV3 implements types.MercuryProvider. +func (*testProvider) ReportCodecV3() v3.ReportCodec { return nil } + +// Start implements types.MercuryProvider. +func (*testProvider) Start(context.Context) error { panic("unimplemented") } + +var _ commontypes.MercuryProvider = (*testProvider)(nil) + +type testRegistrarConfig struct{} + +// RegisterLOOP implements plugins.RegistrarConfig. +func (*testRegistrarConfig) RegisterLOOP(config plugins.CmdConfig) (func() *exec.Cmd, loop.GRPCOpts, error) { + return nil, loop.GRPCOpts{}, nil +} + +var _ plugins.RegistrarConfig = (*testRegistrarConfig)(nil) + +type testDataSourceORM struct{} + +// LatestReport implements types.DataSourceORM. +func (*testDataSourceORM) LatestReport(ctx context.Context, feedID [32]byte, qopts ...pg.QOpt) (report []byte, err error) { + return []byte{1, 2, 3}, nil +} + +var _ types.DataSourceORM = (*testDataSourceORM)(nil) From b732394074278ea896e9309fcdbd3403b6c796c0 Mon Sep 17 00:00:00 2001 From: krehermann Date: Tue, 6 Feb 2024 15:52:58 -0700 Subject: [PATCH 04/12] add make and docker support --- GNUmakefile | 5 +++++ core/services/ocr2/plugins/mercury/plugin.go | 3 ++- plugins/chainlink.Dockerfile | 3 +++ plugins/cmd/chainlink-mercury/README.md | 19 +++++++++++++++++++ .../cmd/chainlink-mercury}/main.go | 0 .../cmd/chainlink-mercury}/plugin.go | 0 6 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 plugins/cmd/chainlink-mercury/README.md rename {cmd/datastreams => plugins/cmd/chainlink-mercury}/main.go (100%) rename {cmd/datastreams => plugins/cmd/chainlink-mercury}/plugin.go (100%) diff --git a/GNUmakefile b/GNUmakefile index 549a7222a82..1a5fe5f24aa 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -62,6 +62,11 @@ chainlink-local-start: install-medianpoc: ## Build & install the chainlink-medianpoc binary. go install $(GOFLAGS) ./plugins/cmd/chainlink-medianpoc +.PHONY: install-mercury-loop +install-mercury-loop: ## Build & install the chainlink-medianpoc binary. + go install $(GOFLAGS) ./plugins/cmd/chainlink-mercury + + .PHONY: docker ## Build the chainlink docker image docker: docker buildx build \ diff --git a/core/services/ocr2/plugins/mercury/plugin.go b/core/services/ocr2/plugins/mercury/plugin.go index 431450670b1..cb07dfe3492 100644 --- a/core/services/ocr2/plugins/mercury/plugin.go +++ b/core/services/ocr2/plugins/mercury/plugin.go @@ -96,7 +96,7 @@ func NewServices( saver := ocrcommon.NewResultRunSaver(pipelineRunner, lggr, cfg.MaxSuccessfulRuns(), cfg.ResultWriteQueueDepth()) srvs = append(srvs, saver) - loopEnabled, loopCmd := env.MercuryPlugin.Cmd.Get() != "", env.MercuryPlugin.Env.Get() + loopEnabled, loopCmd := env.MercuryPlugin.Cmd.Get() != "", env.MercuryPlugin.Cmd.Get() // this is the factory that will be used to create the mercury plugin var factory ocr3types.MercuryPluginFactory @@ -203,6 +203,7 @@ func NewServices( } func initLoop(cmd string, cfg Config, feedID utils.FeedID, lggr logger.Logger) (func() *exec.Cmd, loop.GRPCOpts, logger.Logger, error) { + lggr.Debug("Initializing loop for Mercury with command", cmd) mercuryLggr := lggr.Named(fmt.Sprintf("MercuryV%d", feedID.Version())).Named(feedID.String()) envVars, err := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) if err != nil { diff --git a/plugins/chainlink.Dockerfile b/plugins/chainlink.Dockerfile index 2f3e46e9ce1..cdaa2876d79 100644 --- a/plugins/chainlink.Dockerfile +++ b/plugins/chainlink.Dockerfile @@ -20,6 +20,9 @@ RUN make install-chainlink # Install medianpoc binary RUN make install-medianpoc +# Install the mercury binary +RUN make install-mercury-loop + # Link LOOP Plugin source dirs with simple names RUN go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-feeds | xargs -I % ln -s % /chainlink-feeds RUN go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-solana | xargs -I % ln -s % /chainlink-solana diff --git a/plugins/cmd/chainlink-mercury/README.md b/plugins/cmd/chainlink-mercury/README.md new file mode 100644 index 00000000000..8cf382fa6a8 --- /dev/null +++ b/plugins/cmd/chainlink-mercury/README.md @@ -0,0 +1,19 @@ +This directory house the Mercury LOOPP + +# Running Integration Tests Locally + +Running the tests is as simple as +- building this binary +- setting the CL_MERCURY_CMD env var to the *fully resolved* binary path +- running the test(s) + + +The interesting tests are `TestIntegration_MercuryV*` in ` github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury` + +In detail: +``` +sh + +make install-mercury-loop # builds `mercury` binary in this dir +CL_MERCURY_CMD=/plugins/cmd/mercury/mercury go test -v -timeout 120s -run ^TestIntegration_MercuryV github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury 2>&1 | tee /tmp/mercury_loop.log +``` \ No newline at end of file diff --git a/cmd/datastreams/main.go b/plugins/cmd/chainlink-mercury/main.go similarity index 100% rename from cmd/datastreams/main.go rename to plugins/cmd/chainlink-mercury/main.go diff --git a/cmd/datastreams/plugin.go b/plugins/cmd/chainlink-mercury/plugin.go similarity index 100% rename from cmd/datastreams/plugin.go rename to plugins/cmd/chainlink-mercury/plugin.go From 5c98a84714f70a67a35e2edbd12ce07e0918bdde Mon Sep 17 00:00:00 2001 From: krehermann Date: Tue, 6 Feb 2024 16:49:42 -0700 Subject: [PATCH 05/12] bump common --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 0e4e183f49f..eb4cc43b5b7 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 8e4c9d995af..bb06fdb1d8b 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1169,8 +1169,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1 h1:XHWDHwJq7Qw4uvpnmWrfKjclZUrxyPeAJHwK9C4JAWg= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 h1:VasSxwm+G061WqCE1lxyuqIhbDwsXiVzx7e/wTor1pI= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index 1980d176627..fe59ba41f4c 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 diff --git a/go.sum b/go.sum index 419d7739e76..a11149e458c 100644 --- a/go.sum +++ b/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1 h1:XHWDHwJq7Qw4uvpnmWrfKjclZUrxyPeAJHwK9C4JAWg= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 h1:VasSxwm+G061WqCE1lxyuqIhbDwsXiVzx7e/wTor1pI= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 431a95ed1c4..d03c7b3f635 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 github.com/smartcontractkit/chainlink-testing-framework v1.23.2 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 5a286681b9c..8a7a221fbb0 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1502,8 +1502,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1 h1:XHWDHwJq7Qw4uvpnmWrfKjclZUrxyPeAJHwK9C4JAWg= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205225013-a5ddacf349b1/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 h1:VasSxwm+G061WqCE1lxyuqIhbDwsXiVzx7e/wTor1pI= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 03f61d8c5515102a60cddded6cda1a15916c9c97 Mon Sep 17 00:00:00 2001 From: krehermann Date: Tue, 6 Feb 2024 17:20:50 -0700 Subject: [PATCH 06/12] bump common --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index eb4cc43b5b7..7fefeb7b28e 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index bb06fdb1d8b..eefbbe10286 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1169,8 +1169,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 h1:VasSxwm+G061WqCE1lxyuqIhbDwsXiVzx7e/wTor1pI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 h1:4fhFn9nbAHyKnJ0UC0R3XgEpSa405GUcxcKZzJhcNRM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index fe59ba41f4c..c3ac0625ec6 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 diff --git a/go.sum b/go.sum index a11149e458c..859ae28481a 100644 --- a/go.sum +++ b/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 h1:VasSxwm+G061WqCE1lxyuqIhbDwsXiVzx7e/wTor1pI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 h1:4fhFn9nbAHyKnJ0UC0R3XgEpSa405GUcxcKZzJhcNRM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index d03c7b3f635..a4c70d49bf1 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 github.com/smartcontractkit/chainlink-testing-framework v1.23.2 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 8a7a221fbb0..c7d0e2da3ff 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1502,8 +1502,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676 h1:VasSxwm+G061WqCE1lxyuqIhbDwsXiVzx7e/wTor1pI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240206180015-d3b350e00676/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 h1:4fhFn9nbAHyKnJ0UC0R3XgEpSa405GUcxcKZzJhcNRM= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From c1f9a1509c1aed8ac1c074651e90a97f42b7967e Mon Sep 17 00:00:00 2001 From: krehermann Date: Wed, 7 Feb 2024 16:37:27 -0700 Subject: [PATCH 07/12] bump common --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 7fefeb7b28e..e8cb887134b 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index eefbbe10286..269e327d822 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1169,8 +1169,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 h1:4fhFn9nbAHyKnJ0UC0R3XgEpSa405GUcxcKZzJhcNRM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a h1:iiyMy4EgcKk8JWHh48Qx+EJ1XOjfqFnMDveXNCj309A= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index c3ac0625ec6..8ad4acb3dbd 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 diff --git a/go.sum b/go.sum index 859ae28481a..4de18e2b8a2 100644 --- a/go.sum +++ b/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 h1:4fhFn9nbAHyKnJ0UC0R3XgEpSa405GUcxcKZzJhcNRM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a h1:iiyMy4EgcKk8JWHh48Qx+EJ1XOjfqFnMDveXNCj309A= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index a4c70d49bf1..82005122054 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a github.com/smartcontractkit/chainlink-testing-framework v1.23.2 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index c7d0e2da3ff..f1b067bc5f0 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1502,8 +1502,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012 h1:4fhFn9nbAHyKnJ0UC0R3XgEpSa405GUcxcKZzJhcNRM= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207001935-936236447012/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a h1:iiyMy4EgcKk8JWHh48Qx+EJ1XOjfqFnMDveXNCj309A= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0 h1:NALwENz6vQ972DuD9AZjqRjyNSxH9ptNapizQGLI+2s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240120192246-4bb04c997ca0/go.mod h1:NcVAT/GETDBvIoAej5K6OYqAtDOkF6vO5pYw/hLuYVU= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 88ef4e0c380824c80d6a6d1a66457eb9606e851a Mon Sep 17 00:00:00 2001 From: krehermann Date: Wed, 7 Feb 2024 16:49:48 -0700 Subject: [PATCH 08/12] linter imports --- core/services/ocr2/plugins/mercury/plugin_test.go | 8 +++++--- plugins/cmd/chainlink-mercury/plugin.go | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/services/ocr2/plugins/mercury/plugin_test.go b/core/services/ocr2/plugins/mercury/plugin_test.go index 40dba608138..45cdef51fa5 100644 --- a/core/services/ocr2/plugins/mercury/plugin_test.go +++ b/core/services/ocr2/plugins/mercury/plugin_test.go @@ -8,6 +8,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/google/uuid" + "github.com/stretchr/testify/assert" + "github.com/smartcontractkit/chainlink-common/pkg/loop" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/types/mercury" @@ -17,18 +19,18 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/stretchr/testify/assert" mercuryocr2 "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury" + libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus" + libocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "github.com/smartcontractkit/chainlink/v2/core/services/pg" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/types" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/utils" "github.com/smartcontractkit/chainlink/v2/plugins" - libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus" - libocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) var ( diff --git a/plugins/cmd/chainlink-mercury/plugin.go b/plugins/cmd/chainlink-mercury/plugin.go index 6e40882a847..07531662ba9 100644 --- a/plugins/cmd/chainlink-mercury/plugin.go +++ b/plugins/cmd/chainlink-mercury/plugin.go @@ -3,6 +3,8 @@ package main import ( "context" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" + "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/services" @@ -13,7 +15,6 @@ import ( ds_v1 "github.com/smartcontractkit/chainlink-data-streams/mercury/v1" ds_v2 "github.com/smartcontractkit/chainlink-data-streams/mercury/v2" ds_v3 "github.com/smartcontractkit/chainlink-data-streams/mercury/v3" - "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" ) type Plugin struct { From d7bcf302809c2e957501aa77b72eb773d0e940f4 Mon Sep 17 00:00:00 2001 From: krehermann Date: Thu, 8 Feb 2024 10:27:25 -0700 Subject: [PATCH 09/12] address comments --- core/services/ocr2/plugins/mercury/plugin.go | 247 +++++++++++------- .../ocr2/plugins/mercury/plugin_test.go | 8 +- plugins/cmd/chainlink-mercury/README.md | 2 +- 3 files changed, 165 insertions(+), 92 deletions(-) diff --git a/core/services/ocr2/plugins/mercury/plugin.go b/core/services/ocr2/plugins/mercury/plugin.go index cb07dfe3492..c5eba78b0d8 100644 --- a/core/services/ocr2/plugins/mercury/plugin.go +++ b/core/services/ocr2/plugins/mercury/plugin.go @@ -10,12 +10,13 @@ import ( libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" - "github.com/smartcontractkit/chainlink-common/pkg/loop" - commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" relaymercuryv1 "github.com/smartcontractkit/chainlink-data-streams/mercury/v1" relaymercuryv2 "github.com/smartcontractkit/chainlink-data-streams/mercury/v2" relaymercuryv3 "github.com/smartcontractkit/chainlink-data-streams/mercury/v3" + "github.com/smartcontractkit/chainlink-common/pkg/loop" + commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services" @@ -96,99 +97,45 @@ func NewServices( saver := ocrcommon.NewResultRunSaver(pipelineRunner, lggr, cfg.MaxSuccessfulRuns(), cfg.ResultWriteQueueDepth()) srvs = append(srvs, saver) - loopEnabled, loopCmd := env.MercuryPlugin.Cmd.Get() != "", env.MercuryPlugin.Cmd.Get() - // this is the factory that will be used to create the mercury plugin - var factory ocr3types.MercuryPluginFactory + var ( + factory ocr3types.MercuryPluginFactory + factoryServices []job.ServiceCtx + ) + fCfg := factoryCfg{ + orm: orm, + pipelineRunner: pipelineRunner, + jb: jb, + lggr: lggr, + saver: saver, + chEnhancedTelem: chEnhancedTelem, + ocr2Provider: ocr2Provider, + reportingPluginConfig: pluginConfig, + cfg: cfg, + feedID: feedID, + } switch feedID.Version() { case 1: - ds := mercuryv1.NewDataSource( - orm, - pipelineRunner, - jb, - *jb.PipelineSpec, - lggr, - saver, - chEnhancedTelem, - ocr2Provider.MercuryChainReader(), - ocr2Provider.MercuryServerFetcher(), - pluginConfig.InitialBlockNumber.Ptr(), - feedID, - ) - - if loopEnabled { - cmdFn, opts, mercuryLggr, err2 := initLoop(loopCmd, cfg, feedID, lggr) - if err2 != nil { - abort() - return nil, fmt.Errorf("failed to init loop for feed %s: %w", feedID, err2) - } - // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle - factoryServer := loop.NewMercuryV1Service(mercuryLggr, opts, cmdFn, ocr2Provider, ds) - srvs = append(srvs, factoryServer) - // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle - factory = factoryServer - } else { - factory = relaymercuryv1.NewFactory(ds, lggr, ocr2Provider.OnchainConfigCodec(), ocr2Provider.ReportCodecV1()) + factory, factoryServices, err = newv1factory(fCfg) + if err != nil { + abort() + return nil, fmt.Errorf("failed to create mercury v1 factory: %w", err) } + srvs = append(srvs, factoryServices...) case 2: - ds := mercuryv2.NewDataSource( - orm, - pipelineRunner, - jb, - *jb.PipelineSpec, - feedID, - lggr, - saver, - chEnhancedTelem, - ocr2Provider.MercuryServerFetcher(), - *pluginConfig.LinkFeedID, - *pluginConfig.NativeFeedID, - ) - - if loopEnabled { - cmdFn, opts, mercuryLggr, err2 := initLoop(loopCmd, cfg, feedID, lggr) - if err2 != nil { - abort() - return nil, fmt.Errorf("failed to init loop for feed %s: %w", feedID, err2) - } - // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle - factoryServer := loop.NewMercuryV2Service(mercuryLggr, opts, cmdFn, ocr2Provider, ds) - srvs = append(srvs, factoryServer) - // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle - factory = factoryServer - } else { - factory = relaymercuryv2.NewFactory(ds, lggr, ocr2Provider.OnchainConfigCodec(), ocr2Provider.ReportCodecV2()) + factory, factoryServices, err = newv2factory(fCfg) + if err != nil { + abort() + return nil, fmt.Errorf("failed to create mercury v2 factory: %w", err) } + srvs = append(srvs, factoryServices...) case 3: - ds := mercuryv3.NewDataSource( - orm, - pipelineRunner, - jb, - *jb.PipelineSpec, - feedID, - lggr, - saver, - chEnhancedTelem, - ocr2Provider.MercuryServerFetcher(), - *pluginConfig.LinkFeedID, - *pluginConfig.NativeFeedID, - ) - - if loopEnabled { - cmdFn, opts, mercuryLggr, err2 := initLoop(loopCmd, cfg, feedID, lggr) - if err2 != nil { - abort() - return nil, fmt.Errorf("failed to init loop for feed %s: %w", feedID, err2) - } - // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle - factoryServer := loop.NewMercuryV3Service(mercuryLggr, opts, cmdFn, ocr2Provider, ds) - srvs = append(srvs, factoryServer) - // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle - factory = factoryServer - } else { - factory = relaymercuryv3.NewFactory(ds, lggr, ocr2Provider.OnchainConfigCodec(), ocr2Provider.ReportCodecV3()) + factory, factoryServices, err = newv3factory(fCfg) + if err != nil { + abort() + return nil, fmt.Errorf("failed to create mercury v3 factory: %w", err) } - + srvs = append(srvs, factoryServices...) default: return nil, errors.Errorf("unknown Mercury report schema version: %d", feedID.Version()) } @@ -202,8 +149,132 @@ func NewServices( return srvs, nil } +type factoryCfg struct { + orm types.DataSourceORM + pipelineRunner pipeline.Runner + jb job.Job + lggr logger.Logger + saver *ocrcommon.RunResultSaver + chEnhancedTelem chan ocrcommon.EnhancedTelemetryMercuryData + ocr2Provider commontypes.MercuryProvider + reportingPluginConfig config.PluginConfig + cfg Config + feedID utils.FeedID +} + +func newv3factory(factoryCfg factoryCfg) (ocr3types.MercuryPluginFactory, []job.ServiceCtx, error) { + var factory ocr3types.MercuryPluginFactory + srvs := make([]job.ServiceCtx, 0) + + ds := mercuryv3.NewDataSource( + factoryCfg.orm, + factoryCfg.pipelineRunner, + factoryCfg.jb, + *factoryCfg.jb.PipelineSpec, + factoryCfg.feedID, + factoryCfg.lggr, + factoryCfg.saver, + factoryCfg.chEnhancedTelem, + factoryCfg.ocr2Provider.MercuryServerFetcher(), + *factoryCfg.reportingPluginConfig.LinkFeedID, + *factoryCfg.reportingPluginConfig.NativeFeedID, + ) + + loopCmd := env.MercuryPlugin.Cmd.Get() + loopEnabled := loopCmd != "" + + if loopEnabled { + cmdFn, opts, mercuryLggr, err := initLoop(loopCmd, factoryCfg.cfg, factoryCfg.feedID, factoryCfg.lggr) + if err != nil { + return nil, nil, fmt.Errorf("failed to init loop for feed %s: %w", factoryCfg.feedID, err) + } + // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle + factoryServer := loop.NewMercuryV3Service(mercuryLggr, opts, cmdFn, factoryCfg.ocr2Provider, ds) + srvs = append(srvs, factoryServer) + // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle + factory = factoryServer + } else { + factory = relaymercuryv3.NewFactory(ds, factoryCfg.lggr, factoryCfg.ocr2Provider.OnchainConfigCodec(), factoryCfg.ocr2Provider.ReportCodecV3()) + } + return factory, srvs, nil +} + +func newv2factory(factoryCfg factoryCfg) (ocr3types.MercuryPluginFactory, []job.ServiceCtx, error) { + var factory ocr3types.MercuryPluginFactory + srvs := make([]job.ServiceCtx, 0) + + ds := mercuryv2.NewDataSource( + factoryCfg.orm, + factoryCfg.pipelineRunner, + factoryCfg.jb, + *factoryCfg.jb.PipelineSpec, + factoryCfg.feedID, + factoryCfg.lggr, + factoryCfg.saver, + factoryCfg.chEnhancedTelem, + factoryCfg.ocr2Provider.MercuryServerFetcher(), + *factoryCfg.reportingPluginConfig.LinkFeedID, + *factoryCfg.reportingPluginConfig.NativeFeedID, + ) + + loopCmd := env.MercuryPlugin.Cmd.Get() + loopEnabled := loopCmd != "" + + if loopEnabled { + cmdFn, opts, mercuryLggr, err := initLoop(loopCmd, factoryCfg.cfg, factoryCfg.feedID, factoryCfg.lggr) + if err != nil { + return nil, nil, fmt.Errorf("failed to init loop for feed %s: %w", factoryCfg.feedID, err) + } + // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle + factoryServer := loop.NewMercuryV2Service(mercuryLggr, opts, cmdFn, factoryCfg.ocr2Provider, ds) + srvs = append(srvs, factoryServer) + // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle + factory = factoryServer + } else { + factory = relaymercuryv2.NewFactory(ds, factoryCfg.lggr, factoryCfg.ocr2Provider.OnchainConfigCodec(), factoryCfg.ocr2Provider.ReportCodecV2()) + } + return factory, srvs, nil +} + +func newv1factory(factoryCfg factoryCfg) (ocr3types.MercuryPluginFactory, []job.ServiceCtx, error) { + var factory ocr3types.MercuryPluginFactory + srvs := make([]job.ServiceCtx, 0) + + ds := mercuryv1.NewDataSource( + factoryCfg.orm, + factoryCfg.pipelineRunner, + factoryCfg.jb, + *factoryCfg.jb.PipelineSpec, + factoryCfg.lggr, + factoryCfg.saver, + factoryCfg.chEnhancedTelem, + factoryCfg.ocr2Provider.MercuryChainReader(), + factoryCfg.ocr2Provider.MercuryServerFetcher(), + factoryCfg.reportingPluginConfig.InitialBlockNumber.Ptr(), + factoryCfg.feedID, + ) + + loopCmd := env.MercuryPlugin.Cmd.Get() + loopEnabled := loopCmd != "" + + if loopEnabled { + cmdFn, opts, mercuryLggr, err := initLoop(loopCmd, factoryCfg.cfg, factoryCfg.feedID, factoryCfg.lggr) + if err != nil { + return nil, nil, fmt.Errorf("failed to init loop for feed %s: %w", factoryCfg.feedID, err) + } + // in loopp mode, the factory is grpc server, and we need to handle the server lifecycle + factoryServer := loop.NewMercuryV1Service(mercuryLggr, opts, cmdFn, factoryCfg.ocr2Provider, ds) + srvs = append(srvs, factoryServer) + // adapt the grpc server to the vanilla mercury plugin factory interface used by the oracle + factory = factoryServer + } else { + factory = relaymercuryv1.NewFactory(ds, factoryCfg.lggr, factoryCfg.ocr2Provider.OnchainConfigCodec(), factoryCfg.ocr2Provider.ReportCodecV1()) + } + return factory, srvs, nil +} + func initLoop(cmd string, cfg Config, feedID utils.FeedID, lggr logger.Logger) (func() *exec.Cmd, loop.GRPCOpts, logger.Logger, error) { - lggr.Debug("Initializing loop for Mercury with command", cmd) + lggr.Debugw("Initializing Mercury loop", "command", cmd) mercuryLggr := lggr.Named(fmt.Sprintf("MercuryV%d", feedID.Version())).Named(feedID.String()) envVars, err := plugins.ParseEnvFile(env.MercuryPlugin.Env.Get()) if err != nil { diff --git a/core/services/ocr2/plugins/mercury/plugin_test.go b/core/services/ocr2/plugins/mercury/plugin_test.go index 45cdef51fa5..4e6d4d82a7e 100644 --- a/core/services/ocr2/plugins/mercury/plugin_test.go +++ b/core/services/ocr2/plugins/mercury/plugin_test.go @@ -10,15 +10,16 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/assert" + "github.com/smartcontractkit/chainlink/v2/core/config/env" + "github.com/smartcontractkit/chainlink/v2/core/logger" + "github.com/smartcontractkit/chainlink/v2/core/services/job" + "github.com/smartcontractkit/chainlink-common/pkg/loop" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/types/mercury" v1 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1" v2 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v2" v3 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3" - "github.com/smartcontractkit/chainlink/v2/core/config/env" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/job" mercuryocr2 "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury" @@ -198,6 +199,7 @@ func TestNewServices(t *testing.T) { // we are only varying the version via feedID (and the plugin config) // this wrapper supplies dummy values for the rest of the arguments func newServicesTestWrapper(t *testing.T, pluginConfig job.JSONConfig, feedID utils.FeedID) ([]job.ServiceCtx, error) { + t.Helper() jb := testJob jb.OCR2OracleSpec.PluginConfig = pluginConfig return mercuryocr2.NewServices(jb, &testProvider{}, nil, logger.TestLogger(t), testArgsNoPlugin, testCfg, nil, &testDataSourceORM{}, feedID) diff --git a/plugins/cmd/chainlink-mercury/README.md b/plugins/cmd/chainlink-mercury/README.md index 8cf382fa6a8..89775cfe911 100644 --- a/plugins/cmd/chainlink-mercury/README.md +++ b/plugins/cmd/chainlink-mercury/README.md @@ -1,4 +1,4 @@ -This directory house the Mercury LOOPP +This directory houses the Mercury LOOPP # Running Integration Tests Locally From 485adc5bacc35fa301badbf7232d00b72f807806 Mon Sep 17 00:00:00 2001 From: krehermann Date: Thu, 8 Feb 2024 20:25:44 -0700 Subject: [PATCH 10/12] bump common to merged version --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 750feb36c2a..9c73a9fd6f1 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -19,7 +19,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240112202000-6359502d2ff1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index a4f546a38a3..1154282ce2e 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1169,8 +1169,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a h1:iiyMy4EgcKk8JWHh48Qx+EJ1XOjfqFnMDveXNCj309A= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca h1:Vtu+x4788S9stmuioWtfyxCKro7dwnqJFy96IuMRB7k= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca/go.mod h1:pRlQrvcizMmuHAUV4N96oO2e3XbA99JCQELLc6ES160= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240206150430-fbccaa95af62 h1:DuSQLuq+Ilm3Q+2zn5agLrAi9UvFQmOUdKwZQKX0AFA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240206150430-fbccaa95af62/go.mod h1:Ny6kBD8Houh5yZRmGiB0ovsLHdb4qOHHwBno9JZUT+Y= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/go.mod b/go.mod index 657ccbfac03..251444bb858 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240206150430-fbccaa95af62 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240119021347-3c541a78cdb8 diff --git a/go.sum b/go.sum index 3aedc14ff52..8738e752d52 100644 --- a/go.sum +++ b/go.sum @@ -1164,8 +1164,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a h1:iiyMy4EgcKk8JWHh48Qx+EJ1XOjfqFnMDveXNCj309A= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca h1:Vtu+x4788S9stmuioWtfyxCKro7dwnqJFy96IuMRB7k= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca/go.mod h1:pRlQrvcizMmuHAUV4N96oO2e3XbA99JCQELLc6ES160= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240206150430-fbccaa95af62 h1:DuSQLuq+Ilm3Q+2zn5agLrAi9UvFQmOUdKwZQKX0AFA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240206150430-fbccaa95af62/go.mod h1:Ny6kBD8Houh5yZRmGiB0ovsLHdb4qOHHwBno9JZUT+Y= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 91956ba3ae6..7737d6c6ab1 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca github.com/smartcontractkit/chainlink-testing-framework v1.23.2 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 5a45bb5d3b7..e2895d181c9 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1502,8 +1502,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429 h1:xkejUBZhcBpBrTSfxc91Iwzadrb6SXw8ks69bHIQ9Ww= github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429/go.mod h1:wJmVvDf4XSjsahWtfUq3wvIAYEAuhr7oxmxYnEL/LGQ= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a h1:iiyMy4EgcKk8JWHh48Qx+EJ1XOjfqFnMDveXNCj309A= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240207233051-d71a85a9198a/go.mod h1:c10zGEjrXCUOKVRu5g/nWmGonAjOTqXK6dFl/LXLGiw= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca h1:Vtu+x4788S9stmuioWtfyxCKro7dwnqJFy96IuMRB7k= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240209032254-f9b58810d8ca/go.mod h1:pRlQrvcizMmuHAUV4N96oO2e3XbA99JCQELLc6ES160= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240206150430-fbccaa95af62 h1:DuSQLuq+Ilm3Q+2zn5agLrAi9UvFQmOUdKwZQKX0AFA= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240206150430-fbccaa95af62/go.mod h1:Ny6kBD8Houh5yZRmGiB0ovsLHdb4qOHHwBno9JZUT+Y= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ= From 51948696ba566f76572d80f0ca1375e2513dce4a Mon Sep 17 00:00:00 2001 From: krehermann Date: Fri, 9 Feb 2024 09:09:14 -0700 Subject: [PATCH 11/12] exlcude mercury/plugin.go from sonar duplicate requirements because the underlying API is inherently duplicated --- sonar-project.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index db2a6be1f3b..e4c866966be 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,8 +6,8 @@ sonar.python.version=3.8 sonar.exclusions=**/node_modules/**/*,**/mocks/**/*, **/testdata/**/*, **/contracts/typechain/**/*, **/contracts/artifacts/**/*, **/contracts/cache/**/*, **/contracts/scripts/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.pb.go, **/*report.xml, **/*.config.ts, **/*.txt, **/*.abi, **/*.bin, **/*_codecgen.go, core/services/relay/evm/types/*_gen.go, core/services/relay/evm/types/gen/main.go, core/services/relay/evm/testfiles/*, **/core/web/assets**, core/scripts/chaincli/handler/debug.go # Coverage exclusions sonar.coverage.exclusions=**/*.test.ts, **/*_test.go, **/contracts/test/**/*, **/contracts/**/tests/**/*, **/core/**/testutils/**/*, **/core/**/mocks/**/*, **/core/**/cltest/**/*, **/integration-tests/**/*, **/generated/**/*, **/core/scripts**/* , **/*.pb.go, ./plugins/**/*, **/main.go, **/0195_add_not_null_to_evm_chain_id_in_job_specs.go, **/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/streams/streams.go -# Duplication exclusions -sonar.cpd.exclusions=**/contracts/**/*.sol, **/config.go, /core/services/ocr2/plugins/ocr2keeper/evm*/*,**/integration-tests/testconfig/**/* +# Duplication exclusions: mercury excluded because current MercuryProvider and Factory APIs are inherently duplicated due to embedded versioning +sonar.cpd.exclusions=**/contracts/**/*.sol, **/config.go, /core/services/ocr2/plugins/ocr2keeper/evm*/*, **/integration-tests/testconfig/**/*, chainlink/core/services/ocr2/plugins/mercury/plugin.go # Tests' root folder, inclusions (tests to check and count) and exclusions sonar.tests=. From 2084f8908c5af18a0cc81d0a86409d8656b06232 Mon Sep 17 00:00:00 2001 From: krehermann Date: Fri, 9 Feb 2024 10:16:36 -0700 Subject: [PATCH 12/12] sonar exception --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index e4c866966be..546f68abb32 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -7,7 +7,7 @@ sonar.exclusions=**/node_modules/**/*,**/mocks/**/*, **/testdata/**/*, **/contra # Coverage exclusions sonar.coverage.exclusions=**/*.test.ts, **/*_test.go, **/contracts/test/**/*, **/contracts/**/tests/**/*, **/core/**/testutils/**/*, **/core/**/mocks/**/*, **/core/**/cltest/**/*, **/integration-tests/**/*, **/generated/**/*, **/core/scripts**/* , **/*.pb.go, ./plugins/**/*, **/main.go, **/0195_add_not_null_to_evm_chain_id_in_job_specs.go, **/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/streams/streams.go # Duplication exclusions: mercury excluded because current MercuryProvider and Factory APIs are inherently duplicated due to embedded versioning -sonar.cpd.exclusions=**/contracts/**/*.sol, **/config.go, /core/services/ocr2/plugins/ocr2keeper/evm*/*, **/integration-tests/testconfig/**/*, chainlink/core/services/ocr2/plugins/mercury/plugin.go +sonar.cpd.exclusions=**/contracts/**/*.sol, **/config.go, /core/services/ocr2/plugins/ocr2keeper/evm*/*, **/integration-tests/testconfig/**/*, /core/services/ocr2/plugins/mercury/plugin.go # Tests' root folder, inclusions (tests to check and count) and exclusions sonar.tests=.