Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/services/relay/evm/mercury: use chainlink-data-streams #11293

Merged
merged 1 commit into from
Dec 4, 2023
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
3 changes: 2 additions & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,9 @@ require (
github.com/shirou/gopsutil/v3 v3.23.10 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231201152724-d550085eb3c4 // indirect
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231204152334-1f32103bbb4c // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d // indirect
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231129183458-faee879168b3 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231117204155-b253a2f56664 // indirect
Expand Down
6 changes: 4 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1502,10 +1502,12 @@ 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.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk=
github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231201152724-d550085eb3c4 h1:qau0/AHvPwMR3p6gWsFWC4qVfEtSEALtBetTOpHA2IU=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231201152724-d550085eb3c4/go.mod h1:Hrru9i7n+WEYyW2aIt3/YGPhxLX+HEGWnhk3yVXeDF8=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231204152334-1f32103bbb4c h1:YFyo0pCmKkpB4EOSykCZFueRXNxQ7OhKiCnhoVIzydo=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231204152334-1f32103bbb4c/go.mod h1:Hrru9i7n+WEYyW2aIt3/YGPhxLX+HEGWnhk3yVXeDF8=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542 h1:oewYJtdRkJKUHCNDCj5C2LQe6Oq6qy975g931nfG0cc=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231117191236-12eab01a4542/go.mod h1:EpvRoycRD+kniYlz+pCpRT5e+fmPm0mSD/vmND+0oMg=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1/go.mod h1:GuPvyXryvbiUZIHmPeLBz4L+yJKeyGUjrDfd1KNne+o=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d h1:w4MsbOtNk6nD/mcXLstHWk9hB6g7QLtcAfhPjhwvOaQ=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20231127231053-2232d3a6766d/go.mod h1:YPAfLNowdBwiKiYOwgwtbJHi8AJWbcxkbOY0ItAvkfc=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231129183458-faee879168b3 h1:DudPr8ZNMEVgDwHBvnrpvK96JrGcGCG+LLBnlqaPGnE=
Expand Down
17 changes: 9 additions & 8 deletions core/services/ocr2/plugins/mercury/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ import (
ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
"github.com/smartcontractkit/wsrpc/credentials"

relaymercury "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury"
relaycodecv1 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v1"
relaycodecv2 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v2"
relaycodecv3 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v3"
mercurytypes "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"
relaymercury "github.com/smartcontractkit/chainlink-data-streams/mercury"

"github.com/smartcontractkit/chainlink/v2/core/bridges"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"
Expand All @@ -62,7 +63,7 @@ var (
f = uint8(1)
n = 4 // number of nodes
multiplier int64 = 100000000
rawOnchainConfig = relaymercury.OnchainConfig{
rawOnchainConfig = mercurytypes.OnchainConfig{
Min: big.NewInt(0),
Max: big.NewInt(math.MaxInt64),
}
Expand Down Expand Up @@ -154,7 +155,7 @@ func TestIntegration_MercuryV1(t *testing.T) {
serverKey := csakey.MustNewV2XXXTestingOnly(big.NewInt(-1))
serverPubKey := serverKey.PublicKey
srv := NewMercuryServer(t, ed25519.PrivateKey(serverKey.Raw()), reqs, func() []byte {
report, err := (&reportcodecv1.ReportCodec{}).BuildReport(relaycodecv1.ReportFields{BenchmarkPrice: big.NewInt(234567), Bid: big.NewInt(1), Ask: big.NewInt(1), CurrentBlockHash: make([]byte, 32)})
report, err := (&reportcodecv1.ReportCodec{}).BuildReport(v1.ReportFields{BenchmarkPrice: big.NewInt(234567), Bid: big.NewInt(1), Ask: big.NewInt(1), CurrentBlockHash: make([]byte, 32)})
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -503,7 +504,7 @@ func TestIntegration_MercuryV2(t *testing.T) {
serverKey := csakey.MustNewV2XXXTestingOnly(big.NewInt(-1))
serverPubKey := serverKey.PublicKey
srv := NewMercuryServer(t, ed25519.PrivateKey(serverKey.Raw()), reqs, func() []byte {
report, err := (&reportcodecv2.ReportCodec{}).BuildReport(relaycodecv2.ReportFields{BenchmarkPrice: big.NewInt(234567), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1)})
report, err := (&reportcodecv2.ReportCodec{}).BuildReport(v2.ReportFields{BenchmarkPrice: big.NewInt(234567), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1)})
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -779,7 +780,7 @@ func TestIntegration_MercuryV3(t *testing.T) {
serverKey := csakey.MustNewV2XXXTestingOnly(big.NewInt(-1))
serverPubKey := serverKey.PublicKey
srv := NewMercuryServer(t, ed25519.PrivateKey(serverKey.Raw()), reqs, func() []byte {
report, err := (&reportcodecv3.ReportCodec{}).BuildReport(relaycodecv3.ReportFields{BenchmarkPrice: big.NewInt(234567), Bid: big.NewInt(1), Ask: big.NewInt(1), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1)})
report, err := (&reportcodecv3.ReportCodec{}).BuildReport(v3.ReportFields{BenchmarkPrice: big.NewInt(234567), Bid: big.NewInt(1), Ask: big.NewInt(1), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1)})
if err != nil {
panic(err)
}
Expand Down
6 changes: 3 additions & 3 deletions core/services/ocr2/plugins/mercury/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus"

relaymercuryv1 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v1"
relaymercuryv2 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v2"
relaymercuryv3 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v3"
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/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
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 @@ -21,9 +21,9 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/synchronization/telem"
"github.com/smartcontractkit/chainlink/v2/core/utils"

relaymercuryv1 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v1"
relaymercuryv2 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v2"
relaymercuryv3 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v3"
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"
)

type eaTelemetry struct {
Expand All @@ -41,9 +41,9 @@ type EnhancedTelemetryData struct {
}

type EnhancedTelemetryMercuryData struct {
V1Observation *relaymercuryv1.Observation
V2Observation *relaymercuryv2.Observation
V3Observation *relaymercuryv3.Observation
V1Observation *v1types.Observation
V2Observation *v2types.Observation
V3Observation *v3types.Observation
TaskRunResults pipeline.TaskRunResults
RepTimestamp ocrtypes.ReportTimestamp
FeedVersion mercuryutils.FeedVersion
Expand Down
12 changes: 6 additions & 6 deletions core/services/ocrcommon/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (

"github.com/smartcontractkit/libocr/offchainreporting2plus/types"

"github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury"
mercuryv1 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v1"
mercury_v2 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v2"
"github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
mercuryv1 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1"
mercuryv2 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v2"

"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/logger"
Expand Down Expand Up @@ -696,7 +696,7 @@ func TestCollectMercuryEnhancedTelemetryV2(t *testing.T) {

chTelem <- EnhancedTelemetryMercuryData{
TaskRunResults: trrsMercuryV2,
V2Observation: &mercury_v2.Observation{
V2Observation: &mercuryv2.Observation{
BenchmarkPrice: mercury.ObsResult[*big.Int]{Val: big.NewInt(111111)},
MaxFinalizedTimestamp: mercury.ObsResult[int64]{Val: 321},
LinkPrice: mercury.ObsResult[*big.Int]{Val: big.NewInt(4321)},
Expand Down Expand Up @@ -749,7 +749,7 @@ func TestCollectMercuryEnhancedTelemetryV2(t *testing.T) {
Value: nil,
}},
},
V2Observation: &mercury_v2.Observation{},
V2Observation: &mercuryv2.Observation{},
RepTimestamp: types.ReportTimestamp{
ConfigDigest: types.ConfigDigest{2},
Epoch: 11,
Expand All @@ -760,7 +760,7 @@ func TestCollectMercuryEnhancedTelemetryV2(t *testing.T) {
trrsMercuryV2[0].Result.Value = ""
chTelem <- EnhancedTelemetryMercuryData{
TaskRunResults: trrsMercuryV2,
V2Observation: &mercury_v2.Observation{},
V2Observation: &mercuryv2.Observation{},
RepTimestamp: types.ReportTimestamp{
ConfigDigest: types.ConfigDigest{2},
Epoch: 11,
Expand Down
4 changes: 2 additions & 2 deletions core/services/relay/evm/mercury/transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/smartcontractkit/libocr/offchainreporting2plus/chains/evmutil"
ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"

relaymercury "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/types/mercury"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
Expand Down Expand Up @@ -89,7 +89,7 @@ var (
)

type Transmitter interface {
relaymercury.Transmitter
mercury.Transmitter
services.Service
}

Expand Down
27 changes: 14 additions & 13 deletions core/services/relay/evm/mercury/v1/data_source.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mercury_v1
package v1

import (
"context"
Expand All @@ -13,8 +13,9 @@ import (

ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"

relaymercury "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury"
relaymercuryv1 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v1"
"github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
v1types "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1"
v1 "github.com/smartcontractkit/chainlink-data-streams/mercury/v1"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
Expand All @@ -41,7 +42,7 @@ var (
)
)

const nBlocksObservation int = relaymercuryv1.MaxAllowedBlocks
const nBlocksObservation int = v1.MaxAllowedBlocks

type Runner interface {
ExecuteRun(ctx context.Context, spec pipeline.Spec, vars pipeline.Vars, l logger.Logger) (run *pipeline.Run, trrs pipeline.TaskRunResults, err error)
Expand All @@ -66,17 +67,17 @@ type datasource struct {
mu sync.RWMutex

chEnhancedTelem chan<- ocrcommon.EnhancedTelemetryMercuryData
chainReader relaymercury.ChainReader
chainReader mercury.ChainReader
fetcher Fetcher
initialBlockNumber *int64

insufficientBlocksCounter prometheus.Counter
zeroBlocksCounter prometheus.Counter
}

var _ relaymercuryv1.DataSource = &datasource{}
var _ v1.DataSource = &datasource{}

func NewDataSource(orm types.DataSourceORM, pr pipeline.Runner, jb job.Job, spec pipeline.Spec, lggr logger.Logger, s ocrcommon.Saver, enhancedTelemChan chan ocrcommon.EnhancedTelemetryMercuryData, chainReader relaymercury.ChainReader, fetcher Fetcher, initialBlockNumber *int64, feedID mercuryutils.FeedID) *datasource {
func NewDataSource(orm types.DataSourceORM, pr pipeline.Runner, jb job.Job, spec pipeline.Spec, lggr logger.Logger, s ocrcommon.Saver, enhancedTelemChan chan ocrcommon.EnhancedTelemetryMercuryData, chainReader mercury.ChainReader, fetcher Fetcher, initialBlockNumber *int64, feedID mercuryutils.FeedID) *datasource {
return &datasource{pr, jb, spec, lggr, s, orm, reportcodec.ReportCodec{}, feedID, sync.RWMutex{}, enhancedTelemChan, chainReader, fetcher, initialBlockNumber, insufficientBlocksCount.WithLabelValues(feedID.String()), zeroBlocksCount.WithLabelValues(feedID.String())}
}

Expand All @@ -90,7 +91,7 @@ func (e ErrEmptyLatestReport) Error() string {
return fmt.Sprintf("FetchInitialMaxFinalizedBlockNumber returned empty LatestReport; this is a new feed. No initialBlockNumber was set, tried to use current block number to determine maxFinalizedBlockNumber but got error: %v", e.Err)
}

func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestamp, fetchMaxFinalizedBlockNum bool) (obs relaymercuryv1.Observation, pipelineExecutionErr error) {
func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestamp, fetchMaxFinalizedBlockNum bool) (obs v1types.Observation, pipelineExecutionErr error) {
// setLatestBlocks must come chronologically before observations, along
// with observationTimestamp, to avoid front-running

Expand Down Expand Up @@ -204,9 +205,9 @@ func toBigInt(val interface{}) (*big.Int, error) {
}

type parseOutput struct {
benchmarkPrice relaymercury.ObsResult[*big.Int]
bid relaymercury.ObsResult[*big.Int]
ask relaymercury.ObsResult[*big.Int]
benchmarkPrice mercury.ObsResult[*big.Int]
bid mercury.ObsResult[*big.Int]
ask mercury.ObsResult[*big.Int]
}

// parse expects the output of observe to be three values, in the following order:
Expand Down Expand Up @@ -290,7 +291,7 @@ func (ds *datasource) executeRun(ctx context.Context) (*pipeline.Run, pipeline.T
return run, trrs, err
}

func (ds *datasource) setLatestBlocks(ctx context.Context, obs *relaymercuryv1.Observation) error {
func (ds *datasource) setLatestBlocks(ctx context.Context, obs *v1types.Observation) error {
latestBlocks, err := ds.chainReader.LatestHeads(ctx, nBlocksObservation)
if err != nil {
ds.lggr.Errorw("failed to read latest blocks", "error", err)
Expand Down Expand Up @@ -318,7 +319,7 @@ func (ds *datasource) setLatestBlocks(ctx context.Context, obs *relaymercuryv1.O
for _, block := range latestBlocks {
obs.LatestBlocks = append(
obs.LatestBlocks,
relaymercuryv1.NewBlock(int64(block.Number), block.Hash, block.Timestamp))
v1types.NewBlock(int64(block.Number), block.Hash, block.Timestamp))
}

return nil
Expand Down
20 changes: 10 additions & 10 deletions core/services/relay/evm/mercury/v1/data_source_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mercury_v1
package v1

import (
"context"
Expand All @@ -15,8 +15,9 @@ import (

ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"

relaymercury "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury"
relaymercuryv1 "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v1"
"github.com/smartcontractkit/chainlink-common/pkg/types/mercury"
v1 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1"

commonmocks "github.com/smartcontractkit/chainlink/v2/common/mocks"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
Expand All @@ -25,15 +26,14 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"

"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm"
mercurymocks "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/mocks"
mercuryutils "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/utils"
reportcodecv1 "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v1/reportcodec"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

var _ relaymercury.MercuryServerFetcher = &mockFetcher{}
var _ mercury.ServerFetcher = &mockFetcher{}

type mockFetcher struct {
num *int64
Expand Down Expand Up @@ -71,10 +71,10 @@ func (m *mockORM) LatestReport(ctx context.Context, feedID [32]byte, qopts ...pg

type mockChainReader struct {
err error
obs []relaymercury.Head
obs []mercury.Head
}

func (m *mockChainReader) LatestHeads(context.Context, int) ([]relaymercury.Head, error) {
func (m *mockChainReader) LatestHeads(context.Context, int) ([]mercury.Head, error) {
return m.obs, m.err
}

Expand Down Expand Up @@ -391,7 +391,7 @@ func TestMercury_Observe(t *testing.T) {

obs, err := ds.Observe(ctx, repts, true)
assert.Error(t, err)
assert.Equal(t, obs, relaymercuryv1.Observation{})
assert.Equal(t, obs, v1.Observation{})
})
})
}
Expand All @@ -416,7 +416,7 @@ func TestMercury_SetLatestBlocks(t *testing.T) {
headTracker.On("LatestChain").Return(&h, nil)
ds.chainReader = evm.NewChainReader(headTracker)

obs := relaymercuryv1.Observation{}
obs := v1.Observation{}
err := ds.setLatestBlocks(testutils.Context(t), &obs)

assert.NoError(t, err)
Expand All @@ -434,7 +434,7 @@ func TestMercury_SetLatestBlocks(t *testing.T) {
headTracker.On("LatestChain").Return((*evmtypes.Head)(nil))

ds.chainReader = evm.NewChainReader(headTracker)
obs := relaymercuryv1.Observation{}
obs := v1.Observation{}
err := ds.setLatestBlocks(testutils.Context(t), &obs)

assert.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (

ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"

reportcodec "github.com/smartcontractkit/chainlink-common/pkg/reportingplugins/mercury/v1"

v1 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/utils"
reporttypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v1/types"
Expand All @@ -25,7 +24,7 @@ import (
var ReportTypes = reporttypes.GetSchema()
var maxReportLength = 32 * len(ReportTypes) // each arg is 256 bit EVM word

var _ reportcodec.ReportCodec = &ReportCodec{}
var _ v1.ReportCodec = &ReportCodec{}

type ReportCodec struct {
logger logger.Logger
Expand All @@ -36,7 +35,7 @@ func NewReportCodec(feedID [32]byte, lggr logger.Logger) *ReportCodec {
return &ReportCodec{lggr, feedID}
}

func (r *ReportCodec) BuildReport(rf reportcodec.ReportFields) (ocrtypes.Report, error) {
func (r *ReportCodec) BuildReport(rf v1.ReportFields) (ocrtypes.Report, error) {
var merr error
if rf.BenchmarkPrice == nil {
merr = errors.Join(merr, errors.New("benchmarkPrice may not be nil"))
Expand Down
Loading
Loading