Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.98
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-ccip/chains/evm v0.0.0-20260506144252-c100eabfda74
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260511142328-0441b446ad75
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260511163550-f55b0441dfd3
github.com/smartcontractkit/chainlink-common/keystore v1.1.0
github.com/smartcontractkit/chainlink-data-streams v0.1.14-0.20260504075031-e5aae8c82e91
github.com/smartcontractkit/chainlink-data-streams v0.1.14-0.20260511174456-27c482950e2e
github.com/smartcontractkit/chainlink-deployments-framework v0.101.0
github.com/smartcontractkit/chainlink-evm v0.3.4-0.20260507171202-46e6a397da2d
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260421142741-9c7fbaf7c828
Expand Down
8 changes: 4 additions & 4 deletions core/scripts/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions core/services/llo/telem/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
"github.com/smartcontractkit/chainlink-data-streams/llo"
datastreamsllo "github.com/smartcontractkit/chainlink-data-streams/llo"
"github.com/smartcontractkit/chainlink-data-streams/llo/reportcodecs/evm"
mercuryutils "github.com/smartcontractkit/chainlink-data-streams/mercury/utils"

"github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon"
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
Expand Down Expand Up @@ -404,7 +404,7 @@ func (t *telemeter) prepareObservationTelemetry(p any, opts llo.DSOpts) {
}

func (t *telemeter) prepareV3PremiumLegacyTelemetry(d *TelemetryPipeline) {
eaTelemetryValues := ocrcommon.ParseMercuryEATelemetry(t.eng.SugaredLogger, d.trrs, mercuryutils.REPORT_V3)
eaTelemetryValues := ocrcommon.ParseMercuryEATelemetry(t.eng.SugaredLogger, d.trrs, mercury.REPORT_V3)
for _, eaTelem := range eaTelemetryValues {
var benchmarkPrice, bidPrice, askPrice int64
var bp, bid, ask string
Expand Down Expand Up @@ -443,7 +443,7 @@ func (t *telemeter) prepareV3PremiumLegacyTelemetry(d *TelemetryPipeline) {
IsNativeFeed: false,
ConfigDigest: d.opts.ConfigDigest().Hex(),
AssetSymbol: eaTelem.AssetSymbol,
Version: uint32(1000 + mercuryutils.REPORT_V3), // add 1000 to distinguish between legacy feeds, this can be changed if necessary
Version: uint32(1000 + mercury.REPORT_V3), // add 1000 to distinguish between legacy feeds, this can be changed if necessary
DonId: t.donID,
}
epoch, round, err := evm.SeqNrToEpochAndRound(d.opts.OutCtx().SeqNr)
Expand Down
4 changes: 2 additions & 2 deletions core/services/ocr2/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
ocr2keepers20runner "github.com/smartcontractkit/chainlink-automation/pkg/v2/runner"
ocr2keepers21config "github.com/smartcontractkit/chainlink-automation/pkg/v3/config"
ocr2keepers21 "github.com/smartcontractkit/chainlink-automation/pkg/v3/plugin"
mercurytypes "github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
evmmercury "github.com/smartcontractkit/chainlink-data-streams/mercury"
mercuryutils "github.com/smartcontractkit/chainlink-data-streams/mercury/utils"
evmconfig "github.com/smartcontractkit/chainlink-evm/pkg/config"
functionsRelay "github.com/smartcontractkit/chainlink-evm/pkg/functions"

Expand Down Expand Up @@ -1516,7 +1516,7 @@ func (d *Delegate) newServicesMercury(

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), relayConfig.EnableTriggerCapability)
mercuryServices, err2 := mercury.NewServices(jb, mercuryProvider, d.pipelineRunner, lggr, oracleArgsNoPlugin, mCfg, chEnhancedTelem, d.mercuryORM, (mercurytypes.FeedID)(*spec.FeedID), relayConfig.EnableTriggerCapability)

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"))
Expand Down
8 changes: 4 additions & 4 deletions core/services/ocr2/plugins/mercury/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

pkgerrors "github.com/pkg/errors"

mercuryutils "github.com/smartcontractkit/chainlink-data-streams/mercury/utils"
"github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
"github.com/smartcontractkit/chainlink/v2/core/null"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)
Expand All @@ -36,8 +36,8 @@ type PluginConfig struct {
// effectively sets the "first" validFromBlockNumber.
InitialBlockNumber null.Int64 `json:"initialBlockNumber" toml:"initialBlockNumber"`

LinkFeedID *mercuryutils.FeedID `json:"linkFeedID" toml:"linkFeedID"`
NativeFeedID *mercuryutils.FeedID `json:"nativeFeedID" toml:"nativeFeedID"`
LinkFeedID *mercury.FeedID `json:"linkFeedID" toml:"linkFeedID"`
NativeFeedID *mercury.FeedID `json:"nativeFeedID" toml:"nativeFeedID"`
}

func validateURL(rawServerURL string) error {
Expand Down Expand Up @@ -75,7 +75,7 @@ func (p PluginConfig) GetServers() (servers []Server) {
return
}

func ValidatePluginConfig(config PluginConfig, feedID mercuryutils.FeedID) (merr error) {
func ValidatePluginConfig(config PluginConfig, feedID mercury.FeedID) (merr error) {
if len(config.Servers) > 0 {
if config.RawServerURL != "" || len(config.ServerPubKey) != 0 {
merr = errors.Join(merr, errors.New("Mercury: Servers and RawServerURL/ServerPubKey may not be specified together"))
Expand Down
8 changes: 4 additions & 4 deletions core/services/ocr2/plugins/mercury/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ func Test_PluginConfig(t *testing.T) {
t.Run("with invalid values", func(t *testing.T) {
var mc PluginConfig

rawToml := `LinkFeedID = "test"`
rawToml := `LinkFeedID = "0y0000000000000000000000000000000000000000000000000000000000000000"`
err := toml.Unmarshal([]byte(rawToml), &mc)
assert.Contains(t, err.Error(), "toml: hex string without 0x prefix")
assert.Contains(t, err.Error(), "toml: FeedID must start with '0x' or '0X' prefix")

rawToml = `LinkFeedID = "0xtest000000000000000000000000000000000000000000000000000000000000"`
err = toml.Unmarshal([]byte(rawToml), &mc)
assert.Contains(t, err.Error(), `toml: invalid hex string`)
assert.Contains(t, err.Error(), `toml: Failed to decode hex: encoding/hex: invalid byte`)

rawToml = `LinkFeedID = "0xtest"`
err = toml.Unmarshal([]byte(rawToml), &mc)
assert.Contains(t, err.Error(), `toml: hex string has length 4, want 64 for Hash`)
assert.Contains(t, err.Error(), `toml: FeedID must be 32 bytes (64 hex chars) long`)

rawToml = `
ServerURL = "example.com:80"
Expand Down
10 changes: 5 additions & 5 deletions core/services/ocr2/plugins/mercury/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"

mercurytypes "github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
"github.com/smartcontractkit/chainlink-data-streams/mercury/types"
"github.com/smartcontractkit/chainlink-data-streams/mercury/utils"
relaymercuryv2 "github.com/smartcontractkit/chainlink-data-streams/mercury/v2"
relaymercuryv3 "github.com/smartcontractkit/chainlink-data-streams/mercury/v3"
relaymercuryv4 "github.com/smartcontractkit/chainlink-data-streams/mercury/v4"
Expand Down Expand Up @@ -71,7 +71,7 @@ func NewServices(
cfg Config,
chEnhancedTelem chan ocrcommon.EnhancedTelemetryMercuryData,
orm types.DataSourceORM,
feedID utils.FeedID,
feedID mercurytypes.FeedID,
enableTriggerCapability bool,
) ([]job.ServiceCtx, error) {
if jb.PipelineSpec == nil {
Expand Down Expand Up @@ -169,10 +169,10 @@ type factoryCfg struct {
ocr2Provider commontypes.MercuryProvider
reportingPluginConfig config.PluginConfig
cfg Config
feedID utils.FeedID
feedID mercurytypes.FeedID
}

func getPluginFeedIDs(pluginConfig config.PluginConfig) (linkFeedID utils.FeedID, nativeFeedID utils.FeedID) {
func getPluginFeedIDs(pluginConfig config.PluginConfig) (linkFeedID mercurytypes.FeedID, nativeFeedID mercurytypes.FeedID) {
if pluginConfig.LinkFeedID != nil {
linkFeedID = *pluginConfig.LinkFeedID
}
Expand Down Expand Up @@ -302,7 +302,7 @@ func newv2factory(factoryCfg factoryCfg) (ocr3types.MercuryPluginFactory, []job.
return factory, srvs, nil
}

func initLoop(cmd string, cfg Config, feedID utils.FeedID, lggr logger.Logger) (func() *exec.Cmd, *loopUnregisterCloser, loop.GRPCOpts, logger.Logger, error) {
func initLoop(cmd string, cfg Config, feedID mercurytypes.FeedID, lggr logger.Logger) (func() *exec.Cmd, *loopUnregisterCloser, loop.GRPCOpts, logger.Logger, error) {
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())
Expand Down
7 changes: 3 additions & 4 deletions core/services/ocr2/plugins/mercury/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
v3 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3"
v4 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v4"
"github.com/smartcontractkit/chainlink-data-streams/mercury/types"
"github.com/smartcontractkit/chainlink-data-streams/mercury/utils"
"github.com/smartcontractkit/chainlink/v2/core/config/env"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
Expand Down Expand Up @@ -91,7 +90,7 @@ var (
func TestNewServices(t *testing.T) {
type args struct {
pluginConfig job.JSONConfig
feedID utils.FeedID
feedID mercury.FeedID
cfg mercuryocr2.Config
}
testCases := []struct {
Expand Down Expand Up @@ -227,7 +226,7 @@ func TestNewServices(t *testing.T) {
prodCfg := mercuryocr2.NewMercuryConfig(1, 1, loopRegistrarConfig)
type args struct {
pluginConfig job.JSONConfig
feedID utils.FeedID
feedID mercury.FeedID
cfg mercuryocr2.Config
}
testCases := []struct {
Expand Down Expand Up @@ -296,7 +295,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, cfg mercuryocr2.Config) ([]job.ServiceCtx, error) {
func newServicesTestWrapper(t *testing.T, pluginConfig job.JSONConfig, feedID mercury.FeedID, cfg mercuryocr2.Config) ([]job.ServiceCtx, error) {
t.Helper()
jb := testJob
jb.OCR2OracleSpec.PluginConfig = pluginConfig
Expand Down
12 changes: 6 additions & 6 deletions core/services/ocrcommon/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
v1types "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1"
v2types "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v2"
v3types "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3"
v4types "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v4"
mercuryutils "github.com/smartcontractkit/chainlink-data-streams/mercury/utils"

"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
Expand Down Expand Up @@ -56,7 +56,7 @@ type EnhancedTelemetryMercuryData struct {
V4Observation *v4types.Observation
TaskRunResults pipeline.TaskRunResults
RepTimestamp ocrtypes.ReportTimestamp
FeedVersion mercuryutils.FeedVersion
FeedVersion mercury.FeedVersion
FetchMaxFinalizedTimestamp bool
IsLinkFeed bool
IsNativeFeed bool
Expand Down Expand Up @@ -154,7 +154,7 @@ func (e *EnhancedTelemetryService[T]) getChainID() string {
}
}

func ParseMercuryEATelemetry(lggr logger.Logger, trrs pipeline.TaskRunResults, feedVersion mercuryutils.FeedVersion) (eaTelemetryValues []EATelemetry) {
func ParseMercuryEATelemetry(lggr logger.Logger, trrs pipeline.TaskRunResults, feedVersion mercury.FeedVersion) (eaTelemetryValues []EATelemetry) {
for _, trr := range trrs {
if trr.Task.Type() != pipeline.TaskTypeBridge {
continue
Expand Down Expand Up @@ -502,7 +502,7 @@ type bridgeRequestData struct {
}

// parseRequestData parses the requestData of the bridge.
func parseBridgeRequestData(requestData string, mercuryVersion mercuryutils.FeedVersion) bridgeRequestData {
func parseBridgeRequestData(requestData string, mercuryVersion mercury.FeedVersion) bridgeRequestData {
type reqDataPayload struct {
Endpoint *string `json:"endpoint"`
To *string `json:"to"`
Expand Down Expand Up @@ -553,7 +553,7 @@ const (
exchangeRate = "exchangeRate"
)

func getPricesFromBridgeTask(lggr logger.Logger, bridgeTask pipeline.TaskRunResult, allTasks pipeline.TaskRunResults, mercuryVersion mercuryutils.FeedVersion) (float64, float64, float64) {
func getPricesFromBridgeTask(lggr logger.Logger, bridgeTask pipeline.TaskRunResult, allTasks pipeline.TaskRunResults, mercuryVersion mercury.FeedVersion) (float64, float64, float64) {
var benchmarkPrice, bidPrice, askPrice float64

// This will assume that all fields we care about are tagged with the correct priceType
Expand Down Expand Up @@ -635,7 +635,7 @@ func parsePriceFromTask(lggr logger.Logger, trr pipeline.TaskRunResult) float64

// getPricesFromResultsByOrder parses the pipeline.TaskRunResults for pipeline.TaskTypeJSONParse and gets the benchmarkPrice,
// bid and ask. This functions expects the pipeline.TaskRunResults to be correctly ordered
func getPricesFromResultsByOrder(lggr logger.Logger, startTask pipeline.TaskRunResult, allTasks pipeline.TaskRunResults, mercuryVersion mercuryutils.FeedVersion) (float64, float64, float64) {
func getPricesFromResultsByOrder(lggr logger.Logger, startTask pipeline.TaskRunResult, allTasks pipeline.TaskRunResults, mercuryVersion mercury.FeedVersion) (float64, float64, float64) {
var benchmarkPrice, askPrice, bidPrice float64

// We rely on task results to be sorted in the correct order
Expand Down
11 changes: 5 additions & 6 deletions core/services/relay/evm/mercury/v2/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
v2types "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v2"
mercurytypes "github.com/smartcontractkit/chainlink-data-streams/mercury/types"
mercuryutils "github.com/smartcontractkit/chainlink-data-streams/mercury/utils"
v2 "github.com/smartcontractkit/chainlink-data-streams/mercury/v2"
"github.com/smartcontractkit/chainlink-data-streams/mercury/v2/reportcodec"

Expand All @@ -37,15 +36,15 @@ type datasource struct {
pipelineRunner Runner
jb job.Job
spec pipeline.Spec
feedID mercuryutils.FeedID
feedID mercury.FeedID
lggr logger.Logger
saver ocrcommon.Saver
orm mercurytypes.DataSourceORM
codec reportcodec.ReportCodec

fetcher LatestReportFetcher
linkFeedID mercuryutils.FeedID
nativeFeedID mercuryutils.FeedID
linkFeedID mercury.FeedID
nativeFeedID mercury.FeedID

mu sync.RWMutex

Expand All @@ -54,7 +53,7 @@ type datasource struct {

var _ v2.DataSource = &datasource{}

func NewDataSource(orm mercurytypes.DataSourceORM, pr pipeline.Runner, jb job.Job, spec pipeline.Spec, feedID mercuryutils.FeedID, lggr logger.Logger, s ocrcommon.Saver, enhancedTelemChan chan ocrcommon.EnhancedTelemetryMercuryData, fetcher LatestReportFetcher, linkFeedID, nativeFeedID mercuryutils.FeedID) *datasource {
func NewDataSource(orm mercurytypes.DataSourceORM, pr pipeline.Runner, jb job.Job, spec pipeline.Spec, feedID mercury.FeedID, lggr logger.Logger, s ocrcommon.Saver, enhancedTelemChan chan ocrcommon.EnhancedTelemetryMercuryData, fetcher LatestReportFetcher, linkFeedID, nativeFeedID mercury.FeedID) *datasource {
return &datasource{pr, jb, spec, feedID, lggr, s, orm, reportcodec.ReportCodec{}, fetcher, linkFeedID, nativeFeedID, sync.RWMutex{}, enhancedTelemChan}
}

Expand Down Expand Up @@ -170,7 +169,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam
V2Observation: &obs,
TaskRunResults: trrs,
RepTimestamp: repts,
FeedVersion: mercuryutils.REPORT_V2,
FeedVersion: mercury.REPORT_V2,
FetchMaxFinalizedTimestamp: fetchMaxFinalizedTimestamp,
IsLinkFeed: isLink,
IsNativeFeed: isNative,
Expand Down
Loading
Loading