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