diff --git a/go.mod b/go.mod index 104666560..062c250d4 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/santhosh-tekuri/jsonschema/v5 v5.2.0 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 - github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 + github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 go.opentelemetry.io/otel v1.28.0 diff --git a/go.sum b/go.sum index 84d8f6989..aa0c53162 100644 --- a/go.sum +++ b/go.sum @@ -223,8 +223,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= +github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/pkg/capabilities/consensus/ocr3/factory.go b/pkg/capabilities/consensus/ocr3/factory.go index 11fc18aa4..d634121b7 100644 --- a/pkg/capabilities/consensus/ocr3/factory.go +++ b/pkg/capabilities/consensus/ocr3/factory.go @@ -36,7 +36,7 @@ func newFactory(s *requests.Store, c *capability, batchSize int, outcomePruningT }, nil } -func (o *factory) NewReportingPlugin(config ocr3types.ReportingPluginConfig) (ocr3types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { +func (o *factory) NewReportingPlugin(ctx context.Context, config ocr3types.ReportingPluginConfig) (ocr3types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { rp, err := newReportingPlugin(o.store, o.capability, o.batchSize, config, o.outcomePruningThreshold, o.lggr) info := ocr3types.ReportingPluginInfo{ Name: "OCR3 Capability Plugin", diff --git a/pkg/capabilities/consensus/ocr3/reporting_plugin.go b/pkg/capabilities/consensus/ocr3/reporting_plugin.go index 015cc2964..60b900fad 100644 --- a/pkg/capabilities/consensus/ocr3/reporting_plugin.go +++ b/pkg/capabilities/consensus/ocr3/reporting_plugin.go @@ -7,6 +7,7 @@ import ( "slices" "time" + "github.com/smartcontractkit/libocr/quorumhelper" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" @@ -149,15 +150,15 @@ func (r *reportingPlugin) Observation(ctx context.Context, outctx ocr3types.Outc return proto.MarshalOptions{Deterministic: true}.Marshal(obs) } -func (r *reportingPlugin) ValidateObservation(outctx ocr3types.OutcomeContext, query types.Query, ao types.AttributedObservation) error { +func (r *reportingPlugin) ValidateObservation(ctx context.Context, outctx ocr3types.OutcomeContext, query types.Query, ao types.AttributedObservation) error { return nil } -func (r *reportingPlugin) ObservationQuorum(outctx ocr3types.OutcomeContext, query types.Query) (ocr3types.Quorum, error) { - return ocr3types.QuorumTwoFPlusOne, nil +func (r *reportingPlugin) ObservationQuorum(ctx context.Context, outctx ocr3types.OutcomeContext, query types.Query, aos []types.AttributedObservation) (bool, error) { + return quorumhelper.ObservationCountReachesObservationQuorum(quorumhelper.QuorumTwoFPlusOne, r.config.N, r.config.F, aos), nil } -func (r *reportingPlugin) Outcome(outctx ocr3types.OutcomeContext, query types.Query, attributedObservations []types.AttributedObservation) (ocr3types.Outcome, error) { +func (r *reportingPlugin) Outcome(ctx context.Context, outctx ocr3types.OutcomeContext, query types.Query, attributedObservations []types.AttributedObservation) (ocr3types.Outcome, error) { // execution ID -> oracle ID -> list of observations execIDToOracleObservations := map[string]map[ocrcommon.OracleID][]values.Value{} seenWorkflowIDs := map[string]int{} @@ -350,14 +351,14 @@ func marshalReportInfo(info *pbtypes.ReportInfo, keyID string) ([]byte, error) { return ip, nil } -func (r *reportingPlugin) Reports(seqNr uint64, outcome ocr3types.Outcome) ([]ocr3types.ReportWithInfo[[]byte], error) { +func (r *reportingPlugin) Reports(ctx context.Context, seqNr uint64, outcome ocr3types.Outcome) ([]ocr3types.ReportPlus[[]byte], error) { o := &pbtypes.Outcome{} err := proto.Unmarshal(outcome, o) if err != nil { return nil, err } - reports := []ocr3types.ReportWithInfo[[]byte]{} + reports := []ocr3types.ReportPlus[[]byte]{} for _, report := range o.CurrentReports { if report == nil { @@ -438,8 +439,12 @@ func (r *reportingPlugin) Reports(seqNr uint64, outcome ocr3types.Outcome) ([]oc continue } - rawReport, err = encoder.Encode(context.Background(), *mv) + rawReport, err = encoder.Encode(ctx, *mv) if err != nil { + if cerr := ctx.Err(); cerr != nil { + r.lggr.Errorw("report encoding cancelled", "err", cerr) + return nil, cerr + } r.lggr.Errorw("could not encode report for workflow", "error", err) continue } @@ -452,9 +457,11 @@ func (r *reportingPlugin) Reports(seqNr uint64, outcome ocr3types.Outcome) ([]oc } // Append every report, even if shouldReport = false, to let the transmitter mark the step as complete. - reports = append(reports, ocr3types.ReportWithInfo[[]byte]{ - Report: rawReport, - Info: infob, + reports = append(reports, ocr3types.ReportPlus[[]byte]{ + ReportWithInfo: ocr3types.ReportWithInfo[[]byte]{ + Report: rawReport, + Info: infob, + }, }) } diff --git a/pkg/capabilities/consensus/ocr3/reporting_plugin_test.go b/pkg/capabilities/consensus/ocr3/reporting_plugin_test.go index 61acd4011..04be58609 100644 --- a/pkg/capabilities/consensus/ocr3/reporting_plugin_test.go +++ b/pkg/capabilities/consensus/ocr3/reporting_plugin_test.go @@ -17,7 +17,6 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/requests" - pbtypes "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" @@ -300,7 +299,7 @@ func TestReportingPlugin_Outcome(t *testing.T) { }, } - outcome, err := rp.Outcome(ocr3types.OutcomeContext{}, qb, aos) + outcome, err := rp.Outcome(tests.Context(t), ocr3types.OutcomeContext{}, qb, aos) require.NoError(t, err) opb := &pbtypes.Outcome{} @@ -316,6 +315,7 @@ func TestReportingPlugin_Outcome(t *testing.T) { } func TestReportingPlugin_Outcome_NilDerefs(t *testing.T) { + ctx := tests.Context(t) lggr := logger.Test(t) s := requests.NewStore() mcap := &mockCapability{ @@ -349,7 +349,7 @@ func TestReportingPlugin_Outcome_NilDerefs(t *testing.T) { {}, } - _, err = rp.Outcome(ocr3types.OutcomeContext{}, qb, aos) + _, err = rp.Outcome(ctx, ocr3types.OutcomeContext{}, qb, aos) require.NoError(t, err) obs := &pbtypes.Observations{ @@ -368,7 +368,7 @@ func TestReportingPlugin_Outcome_NilDerefs(t *testing.T) { Observer: commontypes.OracleID(1), }, } - _, err = rp.Outcome(ocr3types.OutcomeContext{}, qb, aos) + _, err = rp.Outcome(ctx, ocr3types.OutcomeContext{}, qb, aos) require.NoError(t, err) } @@ -408,22 +408,25 @@ func TestReportingPlugin_Reports_ShouldReportFalse(t *testing.T) { } pl, err := proto.Marshal(outcome) require.NoError(t, err) - reports, err := rp.Reports(sqNr, pl) + reports, err := rp.Reports(tests.Context(t), sqNr, pl) require.NoError(t, err) assert.Len(t, reports, 1) gotRep := reports[0] - assert.Len(t, gotRep.Report, 0) + assert.Len(t, gotRep.ReportWithInfo.Report, 0) - ib := gotRep.Info + ib := gotRep.ReportWithInfo.Info info, err := extractReportInfo(ib) require.NoError(t, err) - assert.EqualExportedValues(t, info.Id, id) + assert.EqualExportedValues(t, id, info.Id) assert.False(t, info.ShouldReport) + + require.Nil(t, gotRep.TransmissionScheduleOverride) } func TestReportingPlugin_Reports_NilDerefs(t *testing.T) { + ctx := tests.Context(t) lggr := logger.Test(t) s := requests.NewStore() mcap := &mockCapability{ @@ -461,7 +464,7 @@ func TestReportingPlugin_Reports_NilDerefs(t *testing.T) { } pl, err := proto.Marshal(outcome) require.NoError(t, err) - _, err = rp.Reports(sqNr, pl) + _, err = rp.Reports(ctx, sqNr, pl) require.NoError(t, err) } @@ -511,14 +514,14 @@ func TestReportingPlugin_Reports_ShouldReportTrue(t *testing.T) { } pl, err := proto.Marshal(outcome) require.NoError(t, err) - reports, err := rp.Reports(sqNr, pl) + reports, err := rp.Reports(tests.Context(t), sqNr, pl) require.NoError(t, err) assert.Len(t, reports, 1) gotRep := reports[0] rep := &pb.Value{} - err = proto.Unmarshal(gotRep.Report, rep) + err = proto.Unmarshal(gotRep.ReportWithInfo.Report, rep) require.NoError(t, err) // The workflow ID and execution ID get added to the report. @@ -538,15 +541,18 @@ func TestReportingPlugin_Reports_ShouldReportTrue(t *testing.T) { require.NoError(t, err) require.Equal(t, nm, fp) - ib := gotRep.Info + ib := gotRep.ReportWithInfo.Info info, err := extractReportInfo(ib) require.NoError(t, err) assert.EqualExportedValues(t, info.Id, id) assert.True(t, info.ShouldReport) + + require.Nil(t, gotRep.TransmissionScheduleOverride) } func TestReportingPlugin_Outcome_ShouldPruneOldOutcomes(t *testing.T) { + ctx := tests.Context(t) lggr := logger.Test(t) s := requests.NewStore() mcap := &mockCapability{ @@ -642,13 +648,13 @@ func TestReportingPlugin_Outcome_ShouldPruneOldOutcomes(t *testing.T) { }, } - outcome1, err := rp.Outcome(ocr3types.OutcomeContext{SeqNr: 100}, qb, aos) + outcome1, err := rp.Outcome(ctx, ocr3types.OutcomeContext{SeqNr: 100}, qb, aos) require.NoError(t, err) opb1 := &pbtypes.Outcome{} err = proto.Unmarshal(outcome1, opb1) require.NoError(t, err) - outcome2, err := rp.Outcome(ocr3types.OutcomeContext{SeqNr: defaultOutcomePruningThreshold + 100, PreviousOutcome: outcome1}, qb, aos2) + outcome2, err := rp.Outcome(ctx, ocr3types.OutcomeContext{SeqNr: defaultOutcomePruningThreshold + 100, PreviousOutcome: outcome1}, qb, aos2) require.NoError(t, err) opb2 := &pbtypes.Outcome{} err = proto.Unmarshal(outcome2, opb2) @@ -663,6 +669,7 @@ func TestReportingPlugin_Outcome_ShouldPruneOldOutcomes(t *testing.T) { } func TestReportPlugin_Outcome_ShouldReturnMedianTimestamp(t *testing.T) { + ctx := tests.Context(t) lggr := logger.Test(t) s := requests.NewStore() mcap := &mockCapability{ @@ -785,7 +792,7 @@ func TestReportPlugin_Outcome_ShouldReturnMedianTimestamp(t *testing.T) { }, } - outcome, err := rp.Outcome(ocr3types.OutcomeContext{SeqNr: 100}, qb, aos) + outcome, err := rp.Outcome(ctx, ocr3types.OutcomeContext{SeqNr: 100}, qb, aos) require.NoError(t, err) opb1 := &pbtypes.Outcome{} err = proto.Unmarshal(outcome, opb1) diff --git a/pkg/capabilities/consensus/ocr3/transmitter.go b/pkg/capabilities/consensus/ocr3/transmitter.go index 1595a3955..2c8d1d6fc 100644 --- a/pkg/capabilities/consensus/ocr3/transmitter.go +++ b/pkg/capabilities/consensus/ocr3/transmitter.go @@ -131,7 +131,7 @@ func (c *ContractTransmitter) Transmit(ctx context.Context, configDigest types.C return err } -func (c *ContractTransmitter) FromAccount() (types.Account, error) { +func (c *ContractTransmitter) FromAccount(ctx context.Context) (types.Account, error) { return types.Account(c.fromAccount), nil } diff --git a/pkg/codec/modifier_codec_test.go b/pkg/codec/modifier_codec_test.go index d3ca14c00..8b6d5153e 100644 --- a/pkg/codec/modifier_codec_test.go +++ b/pkg/codec/modifier_codec_test.go @@ -13,6 +13,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/codec" "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) var anyTestBytes = []byte("any test bytes") @@ -29,7 +30,7 @@ const anyForEncoding = true func TestModifierCodec(t *testing.T) { t.Parallel() - ctx := context.Background() + ctx := tests.Context(t) mod, err := codec.NewModifierCodec(&testCodec{}, testModifier{}) require.NoError(t, err) diff --git a/pkg/loop/adapters/relay/adapter.go b/pkg/loop/adapters/relay/adapter.go deleted file mode 100644 index defcf9f29..000000000 --- a/pkg/loop/adapters/relay/adapter.go +++ /dev/null @@ -1,94 +0,0 @@ -package relay - -import ( - "context" - - looptypes "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/types" - "github.com/smartcontractkit/chainlink-common/pkg/services" - "github.com/smartcontractkit/chainlink-common/pkg/types" -) - -// RelayerExt is a subset of [loop.Relayer] for adapting [types.Relayer], typically with a Chain. See [RelayerAdapter]. -type RelayerExt interface { - types.ChainService - ID() string -} - -var _ looptypes.Relayer = (*RelayerAdapter)(nil) - -// RelayerAdapter adapts a [types.Relayer] and [RelayerExt] to implement [Relayer]. -type RelayerAdapter struct { - types.Relayer - RelayerExt -} - -func (r *RelayerAdapter) NewChainWriter(ctx context.Context, contractWriterConfig []byte) (types.ChainWriter, error) { - return r.Relayer.NewChainWriter(ctx, contractWriterConfig) -} - -func (r *RelayerAdapter) NewContractReader(_ context.Context, contractReaderConfig []byte) (types.ContractReader, error) { - return r.Relayer.NewContractReader(contractReaderConfig) -} - -func (r *RelayerAdapter) NewConfigProvider(ctx context.Context, rargs types.RelayArgs) (types.ConfigProvider, error) { - return r.Relayer.NewConfigProvider(rargs) -} - -func (r *RelayerAdapter) NewMedianProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.MedianProvider, error) { - return r.Relayer.NewMedianProvider(rargs, pargs) -} - -func (r *RelayerAdapter) NewMercuryProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.MercuryProvider, error) { - return r.Relayer.NewMercuryProvider(rargs, pargs) -} - -func (r *RelayerAdapter) NewFunctionsProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.FunctionsProvider, error) { - return r.Relayer.NewFunctionsProvider(rargs, pargs) -} - -func (r *RelayerAdapter) NewAutomationProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.AutomationProvider, error) { - return r.Relayer.NewAutomationProvider(rargs, pargs) -} - -func (r *RelayerAdapter) NewLLOProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.LLOProvider, error) { - return r.Relayer.NewLLOProvider(rargs, pargs) -} - -func (r *RelayerAdapter) NewCCIPCommitProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.CCIPCommitProvider, error) { - return r.Relayer.NewCCIPCommitProvider(rargs, pargs) -} - -func (r *RelayerAdapter) NewCCIPExecProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.CCIPExecProvider, error) { - return r.Relayer.NewCCIPExecProvider(rargs, pargs) -} - -func (r *RelayerAdapter) NewPluginProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.PluginProvider, error) { - return r.Relayer.NewPluginProvider(rargs, pargs) -} - -func (r *RelayerAdapter) NewOCR3CapabilityProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.OCR3CapabilityProvider, error) { - return r.Relayer.NewOCR3CapabilityProvider(rargs, pargs) -} - -func (r *RelayerAdapter) Start(ctx context.Context) error { - var ms services.MultiStart - return ms.Start(ctx, r.RelayerExt, r.Relayer) -} - -func (r *RelayerAdapter) Close() error { - return services.CloseAll(r.Relayer, r.RelayerExt) -} - -func (r *RelayerAdapter) Name() string { - return r.Relayer.Name() -} - -func (r *RelayerAdapter) Ready() (err error) { - return r.Relayer.Ready() -} - -func (r *RelayerAdapter) HealthReport() map[string]error { - hr := make(map[string]error) - services.CopyHealth(hr, r.Relayer.HealthReport()) - return hr -} diff --git a/pkg/loop/adapters/relay/relay.go b/pkg/loop/adapters/relay/relay.go deleted file mode 100644 index c2772f855..000000000 --- a/pkg/loop/adapters/relay/relay.go +++ /dev/null @@ -1,43 +0,0 @@ -package relay - -import ( - "context" - "fmt" - - "github.com/smartcontractkit/chainlink-common/pkg/types" -) - -// ServerAdapter extends [loop.RelayerAdapter] by overriding NewPluginProvider to dispatches calls according to `RelayArgs.ProviderType`. -// This should only be used to adapt relayers not running via GRPC in a LOOPP. -type ServerAdapter struct { - RelayerAdapter -} - -// NewServerAdapter returns a new ServerAdapter. -func NewServerAdapter(r types.Relayer, e RelayerExt) *ServerAdapter { //nolint:staticcheck - return &ServerAdapter{RelayerAdapter: RelayerAdapter{Relayer: r, RelayerExt: e}} -} - -func (r *ServerAdapter) NewPluginProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.PluginProvider, error) { - switch types.OCR2PluginType(rargs.ProviderType) { - case types.Median: - return r.NewMedianProvider(ctx, rargs, pargs) - case types.Functions: - return r.NewFunctionsProvider(ctx, rargs, pargs) - case types.Mercury: - return r.NewMercuryProvider(ctx, rargs, pargs) - case types.OCR2Keeper: - return r.NewAutomationProvider(ctx, rargs, pargs) - case types.OCR3Capability: - return r.NewOCR3CapabilityProvider(ctx, rargs, pargs) - case types.CCIPCommit: - return r.NewCCIPCommitProvider(ctx, rargs, pargs) - case types.CCIPExecution: - return r.NewCCIPExecProvider(ctx, rargs, pargs) - case types.DKG, types.OCR2VRF, types.GenericPlugin: - return r.RelayerAdapter.NewPluginProvider(ctx, rargs, pargs) - case types.LLO: - return nil, fmt.Errorf("provider type not supported: %s", rargs.ProviderType) - } - return nil, fmt.Errorf("provider type not recognized: %s", rargs.ProviderType) -} diff --git a/pkg/loop/adapters/relay/relay_test.go b/pkg/loop/adapters/relay/relay_test.go deleted file mode 100644 index 8b8420066..000000000 --- a/pkg/loop/adapters/relay/relay_test.go +++ /dev/null @@ -1,218 +0,0 @@ -package relay - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" - - "github.com/smartcontractkit/chainlink-common/pkg/types" -) - -type staticMedianProvider struct { -} - -var _ types.MedianProvider = staticMedianProvider{} - -// ContractConfigTracker implements types.MedianProvider. -func (s staticMedianProvider) ContractConfigTracker() ocr2types.ContractConfigTracker { - return nil -} - -// ContractTransmitter implements types.MedianProvider. -func (s staticMedianProvider) ContractTransmitter() ocr2types.ContractTransmitter { - return nil -} - -// MedianContract implements types.MedianProvider. -func (s staticMedianProvider) MedianContract() median.MedianContract { - return nil -} - -// OffchainConfigDigester implements types.MedianProvider. -func (s staticMedianProvider) OffchainConfigDigester() ocr2types.OffchainConfigDigester { - return nil -} - -// OnchainConfigCodec implements types.MedianProvider. -func (s staticMedianProvider) OnchainConfigCodec() median.OnchainConfigCodec { - return nil -} - -// ReportCodec implements types.MedianProvider. -func (s staticMedianProvider) ReportCodec() median.ReportCodec { - return nil -} - -// ContractReader implements types.MedianProvider. -func (s staticMedianProvider) ContractReader() types.ContractReader { - return nil -} - -// Close implements types.MedianProvider. -func (s staticMedianProvider) Close() error { - return nil -} - -// Codec implements types.MedianProvider. -func (s staticMedianProvider) Codec() types.Codec { - return nil -} - -// HealthReport implements types.MedianProvider. -func (s staticMedianProvider) HealthReport() map[string]error { - return nil -} - -// Name implements types.MedianProvider. -func (s staticMedianProvider) Name() string { - return "" -} - -// Ready implements types.MedianProvider. -func (s staticMedianProvider) Ready() error { - return nil -} - -// Start implements types.MedianProvider. -func (s staticMedianProvider) Start(context.Context) error { - return nil -} - -type staticFunctionsProvider struct { - types.FunctionsProvider -} - -type staticMercuryProvider struct { - types.MercuryProvider -} - -type staticAutomationProvider struct { - types.AutomationProvider -} - -type staticPluginProvider struct { - types.PluginProvider -} - -type staticOCR3CapabilityProvider struct { - types.OCR3CapabilityProvider -} - -type staticCCIPCommitProvider struct { - types.CCIPCommitProvider -} - -type staticCCIPExecProvider struct { - types.CCIPExecProvider -} - -type mockRelayer struct { - types.Relayer -} - -func (m *mockRelayer) NewMedianProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.MedianProvider, error) { - return staticMedianProvider{}, nil -} - -func (m *mockRelayer) NewFunctionsProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.FunctionsProvider, error) { - return staticFunctionsProvider{}, nil -} - -func (m *mockRelayer) NewMercuryProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.MercuryProvider, error) { - return staticMercuryProvider{}, nil -} - -func (m *mockRelayer) NewAutomationProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.AutomationProvider, error) { - return staticAutomationProvider{}, nil -} - -func (m *mockRelayer) NewPluginProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.PluginProvider, error) { - return staticPluginProvider{}, nil -} - -func (m *mockRelayer) NewOCR3CapabilityProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.OCR3CapabilityProvider, error) { - return staticOCR3CapabilityProvider{}, nil -} - -func (m *mockRelayer) NewCCIPCommitProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.CCIPCommitProvider, error) { - return staticCCIPCommitProvider{}, nil -} - -func (m *mockRelayer) NewCCIPExecProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.CCIPExecProvider, error) { - return staticCCIPExecProvider{}, nil -} - -type mockRelayerExt struct { - RelayerExt -} - -func isType[T any](p any) bool { - _, ok := p.(T) - return ok -} - -func TestRelayerServerAdapter(t *testing.T) { - r := &mockRelayer{} - sa := NewServerAdapter(r, mockRelayerExt{}) - - testCases := []struct { - ProviderType string - Test func(p any) bool - Error string - }{ - { - ProviderType: string(types.Median), - Test: isType[types.MedianProvider], - }, - { - ProviderType: string(types.Functions), - Test: isType[types.FunctionsProvider], - }, - { - ProviderType: string(types.Mercury), - Test: isType[types.MercuryProvider], - }, - { - ProviderType: string(types.CCIPCommit), - Test: isType[types.CCIPCommitProvider], - }, - { - ProviderType: string(types.CCIPExecution), - Test: isType[types.CCIPExecProvider], - }, - { - ProviderType: "unknown", - Error: "provider type not recognized", - }, - { - ProviderType: string(types.GenericPlugin), - Test: isType[types.PluginProvider], - }, - { - ProviderType: string(types.OCR3Capability), - Test: isType[types.OCR3CapabilityProvider], - }, - } - - ctx := tests.Context(t) - for _, tc := range testCases { - pp, err := sa.NewPluginProvider( - ctx, - types.RelayArgs{ProviderType: tc.ProviderType}, - types.PluginArgs{}, - ) - - if tc.Error != "" { - assert.ErrorContains(t, err, tc.Error) - } else { - assert.NoError(t, err) - assert.True(t, tc.Test(pp), tc.ProviderType) - } - } -} diff --git a/pkg/loop/ccip_commit.go b/pkg/loop/ccip_commit.go index b73c31921..119de6128 100644 --- a/pkg/loop/ccip_commit.go +++ b/pkg/loop/ccip_commit.go @@ -84,9 +84,9 @@ func NewCommitService(lggr logger.Logger, grpcOpts GRPCOpts, cmd func() *exec.Cm return &cfs } -func (m *CommitFactoryService) NewReportingPlugin(config ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { +func (m *CommitFactoryService) NewReportingPlugin(ctx context.Context, config ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { if err := m.Wait(); err != nil { return nil, ocrtypes.ReportingPluginInfo{}, err } - return m.Service.NewReportingPlugin(config) + return m.Service.NewReportingPlugin(ctx, config) } diff --git a/pkg/loop/ccip_commit_test.go b/pkg/loop/ccip_commit_test.go index f17f27cb1..c3956ffd8 100644 --- a/pkg/loop/ccip_commit_test.go +++ b/pkg/loop/ccip_commit_test.go @@ -1,7 +1,6 @@ package loop_test import ( - "context" "os/exec" "sync/atomic" "testing" @@ -21,6 +20,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/test" "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestCommitService(t *testing.T) { @@ -110,7 +110,7 @@ func TestCommitLOOP(t *testing.T) { } func newCommitProvider(t *testing.T, pr loop.PluginRelayer) (types.CCIPCommitProvider, error) { - ctx := context.Background() + ctx := tests.Context(t) r, err := pr.NewRelayer(ctx, test.ConfigTOML, keystoretest.Keystore, nil) require.NoError(t, err) servicetest.Run(t, r) diff --git a/pkg/loop/ccip_execution.go b/pkg/loop/ccip_execution.go index c78382bd4..099580c74 100644 --- a/pkg/loop/ccip_execution.go +++ b/pkg/loop/ccip_execution.go @@ -84,9 +84,9 @@ func NewExecutionService(lggr logger.Logger, grpcOpts GRPCOpts, cmd func() *exec return &efs } -func (m *ExecutionFactoryService) NewReportingPlugin(config ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { +func (m *ExecutionFactoryService) NewReportingPlugin(ctx context.Context, config ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { if err := m.Wait(); err != nil { return nil, ocrtypes.ReportingPluginInfo{}, err } - return m.Service.NewReportingPlugin(config) + return m.Service.NewReportingPlugin(ctx, config) } diff --git a/pkg/loop/ccip_execution_test.go b/pkg/loop/ccip_execution_test.go index 2e7fd45ce..b26f44bdf 100644 --- a/pkg/loop/ccip_execution_test.go +++ b/pkg/loop/ccip_execution_test.go @@ -1,7 +1,6 @@ package loop_test import ( - "context" "os/exec" "sync/atomic" "testing" @@ -21,6 +20,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/test" "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestExecService(t *testing.T) { @@ -111,7 +111,7 @@ func TestExecLOOP(t *testing.T) { } func newExecutionProvider(t *testing.T, pr loop.PluginRelayer) (types.CCIPExecProvider, error) { - ctx := context.Background() + ctx := tests.Context(t) r, err := pr.NewRelayer(ctx, test.ConfigTOML, keystoretest.Keystore, nil) require.NoError(t, err) servicetest.Run(t, r) diff --git a/pkg/loop/internal/core/services/keyvalue/store_test.go b/pkg/loop/internal/core/services/keyvalue/store_test.go index c9d6fd628..70dca6a58 100644 --- a/pkg/loop/internal/core/services/keyvalue/store_test.go +++ b/pkg/loop/internal/core/services/keyvalue/store_test.go @@ -9,29 +9,32 @@ import ( "google.golang.org/protobuf/types/known/emptypb" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func Test_KeyValueStoreClient(t *testing.T) { + ctx := tests.Context(t) // Setup client := Client{grpc: &testGrpcClient{store: make(map[string][]byte)}} key := "key" insertedVal := "aval" - err := client.Store(context.Background(), key, []byte(insertedVal)) + err := client.Store(ctx, key, []byte(insertedVal)) assert.NoError(t, err) - retrievedVal, err := client.Get(context.Background(), key) + retrievedVal, err := client.Get(ctx, key) assert.NoError(t, err) assert.Equal(t, insertedVal, string(retrievedVal)) } func Test_KeyValueStoreServer(t *testing.T) { + ctx := tests.Context(t) // Setup server := Server{impl: &testKeyValueStore{store: make(map[string][]byte)}} - _, err := server.StoreKeyValue(context.Background(), &pb.StoreKeyValueRequest{Key: "key", Value: []byte(`{"A":"a","B":1}`)}) + _, err := server.StoreKeyValue(ctx, &pb.StoreKeyValueRequest{Key: "key", Value: []byte(`{"A":"a","B":1}`)}) assert.NoError(t, err) - resp, err := server.GetValueForKey(context.Background(), &pb.GetValueForKeyRequest{Key: "key"}) + resp, err := server.GetValueForKey(ctx, &pb.GetValueForKeyRequest{Key: "key"}) assert.NoError(t, err) assert.Equal(t, []byte(`{"A":"a","B":1}`), resp.Value) } diff --git a/pkg/loop/internal/core/services/pipeline/pipeline_runner_test.go b/pkg/loop/internal/core/services/pipeline/pipeline_runner_test.go index d1ed65209..b404ce0a7 100644 --- a/pkg/loop/internal/core/services/pipeline/pipeline_runner_test.go +++ b/pkg/loop/internal/core/services/pipeline/pipeline_runner_test.go @@ -13,6 +13,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb" "github.com/smartcontractkit/chainlink-common/pkg/types/core" "github.com/smartcontractkit/chainlink-common/pkg/utils/jsonserializable" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) type mockPipelineRunner struct { @@ -37,6 +38,7 @@ func (c *clientAdapter) ExecuteRun(ctx context.Context, in *pb.RunRequest, opts } func TestPipelineRunnerService(t *testing.T) { + ctx := tests.Context(t) originalResults := []core.TaskResult{ { ID: "1", @@ -64,7 +66,7 @@ func TestPipelineRunnerService(t *testing.T) { client := &pipelineRunnerServiceClient{grpc: &clientAdapter{srv: srv}} trs, err := client.ExecuteRun( - context.Background(), + ctx, "my-spec", core.Vars{Vars: map[string]interface{}{"my-vars": true}}, core.Options{MaxTaskDuration: 10 * time.Second}, @@ -74,6 +76,7 @@ func TestPipelineRunnerService(t *testing.T) { } func TestPipelineRunnerService_CallArgs(t *testing.T) { + ctx := tests.Context(t) mpr := &mockPipelineRunner{} srv := &RunnerServer{impl: mpr} client := &pipelineRunnerServiceClient{grpc: &clientAdapter{srv: srv}} @@ -85,7 +88,7 @@ func TestPipelineRunnerService_CallArgs(t *testing.T) { options := core.Options{ MaxTaskDuration: 10 * time.Second, } - _, err := client.ExecuteRun(context.Background(), spec, vars, options) + _, err := client.ExecuteRun(ctx, spec, vars, options) require.NoError(t, err) assert.Equal(t, spec, mpr.spec) assert.Equal(t, vars, mpr.vars) diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr2/reporting.go b/pkg/loop/internal/core/services/reportingplugin/ocr2/reporting.go index fa95f2e80..fa4603e3b 100644 --- a/pkg/loop/internal/core/services/reportingplugin/ocr2/reporting.go +++ b/pkg/loop/internal/core/services/reportingplugin/ocr2/reporting.go @@ -29,9 +29,7 @@ func NewReportingPluginFactoryClient(b *net.BrokerExt, cc grpc.ClientConnInterfa } } -func (r *ReportingPluginFactoryClient) NewReportingPlugin(config libocr.ReportingPluginConfig) (libocr.ReportingPlugin, libocr.ReportingPluginInfo, error) { - ctx, cancel := r.StopCtx() - defer cancel() +func (r *ReportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, config libocr.ReportingPluginConfig) (libocr.ReportingPlugin, libocr.ReportingPluginInfo, error) { reply, err := r.grpc.NewReportingPlugin(ctx, &pb.NewReportingPluginRequest{ReportingPluginConfig: &pb.ReportingPluginConfig{ ConfigDigest: config.ConfigDigest[:], OracleID: uint32(config.OracleID), @@ -98,7 +96,7 @@ func (r *ReportingPluginFactoryServer) NewReportingPlugin(ctx context.Context, r } copy(cfg.ConfigDigest[:], request.ReportingPluginConfig.ConfigDigest) - rp, rpi, err := r.impl.NewReportingPlugin(cfg) + rp, rpi, err := r.impl.NewReportingPlugin(ctx, cfg) if err != nil { return nil, err } diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3/reporting.go b/pkg/loop/internal/core/services/reportingplugin/ocr3/reporting.go index 62796c6e0..e373c42c4 100644 --- a/pkg/loop/internal/core/services/reportingplugin/ocr3/reporting.go +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3/reporting.go @@ -5,11 +5,12 @@ import ( "math" "time" + "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/emptypb" + "github.com/smartcontractkit/libocr/commontypes" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "google.golang.org/grpc" - "google.golang.org/protobuf/types/known/emptypb" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/goplugin" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" @@ -27,9 +28,7 @@ func NewReportingPluginFactoryClient(b *net.BrokerExt, cc grpc.ClientConnInterfa return &reportingPluginFactoryClient{b.WithName("OCR3ReportingPluginProviderClient"), goplugin.NewServiceClient(b, cc), ocr3.NewReportingPluginFactoryClient(cc)} } -func (r *reportingPluginFactoryClient) NewReportingPlugin(config ocr3types.ReportingPluginConfig) (ocr3types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { - ctx, cancel := r.StopCtx() - defer cancel() +func (r *reportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, config ocr3types.ReportingPluginConfig) (ocr3types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { reply, err := r.grpc.NewReportingPlugin(ctx, &ocr3.NewReportingPluginRequest{ReportingPluginConfig: &ocr3.ReportingPluginConfig{ ConfigDigest: config.ConfigDigest[:], OracleID: uint32(config.OracleID), @@ -96,7 +95,7 @@ func (r *reportingPluginFactoryServer) NewReportingPlugin(ctx context.Context, r } copy(cfg.ConfigDigest[:], request.ReportingPluginConfig.ConfigDigest) - rp, rpi, err := r.impl.NewReportingPlugin(cfg) + rp, rpi, err := r.impl.NewReportingPlugin(ctx, cfg) if err != nil { return nil, err } @@ -150,9 +149,7 @@ func (o *reportingPluginClient) Observation(ctx context.Context, outctx ocr3type return reply.Observation, nil } -func (o *reportingPluginClient) ValidateObservation(outctx ocr3types.OutcomeContext, query libocr.Query, ao libocr.AttributedObservation) error { - ctx, cancel := o.StopCtx() - defer cancel() +func (o *reportingPluginClient) ValidateObservation(ctx context.Context, outctx ocr3types.OutcomeContext, query libocr.Query, ao libocr.AttributedObservation) error { _, err := o.grpc.ValidateObservation(ctx, &ocr3.ValidateObservationRequest{ OutcomeContext: pbOutcomeContext(outctx), Query: query, @@ -161,22 +158,19 @@ func (o *reportingPluginClient) ValidateObservation(outctx ocr3types.OutcomeCont return err } -func (o *reportingPluginClient) ObservationQuorum(outctx ocr3types.OutcomeContext, query libocr.Query) (ocr3types.Quorum, error) { - ctx, cancel := o.StopCtx() - defer cancel() +func (o *reportingPluginClient) ObservationQuorum(ctx context.Context, outctx ocr3types.OutcomeContext, query libocr.Query, aos []libocr.AttributedObservation) (bool, error) { reply, err := o.grpc.ObservationQuorum(ctx, &ocr3.ObservationQuorumRequest{ OutcomeContext: pbOutcomeContext(outctx), Query: query, + Ao: pbAttributedObservations(aos), }) if err != nil { - return 0, err + return false, err } - return ocr3types.Quorum(reply.Quorum), nil + return reply.QuorumReached, nil } -func (o *reportingPluginClient) Outcome(outctx ocr3types.OutcomeContext, query libocr.Query, aos []libocr.AttributedObservation) (ocr3types.Outcome, error) { - ctx, cancel := o.StopCtx() - defer cancel() +func (o *reportingPluginClient) Outcome(ctx context.Context, outctx ocr3types.OutcomeContext, query libocr.Query, aos []libocr.AttributedObservation) (ocr3types.Outcome, error) { reply, err := o.grpc.Outcome(ctx, &ocr3.OutcomeRequest{ OutcomeContext: pbOutcomeContext(outctx), Query: query, @@ -188,9 +182,7 @@ func (o *reportingPluginClient) Outcome(outctx ocr3types.OutcomeContext, query l return reply.Outcome, nil } -func (o *reportingPluginClient) Reports(seqNr uint64, outcome ocr3types.Outcome) ([]ocr3types.ReportWithInfo[[]byte], error) { - ctx, cancel := o.StopCtx() - defer cancel() +func (o *reportingPluginClient) Reports(ctx context.Context, seqNr uint64, outcome ocr3types.Outcome) ([]ocr3types.ReportPlus[[]byte], error) { reply, err := o.grpc.Reports(ctx, &ocr3.ReportsRequest{ SeqNr: seqNr, Outcome: outcome, @@ -198,7 +190,7 @@ func (o *reportingPluginClient) Reports(seqNr uint64, outcome ocr3types.Outcome) if err != nil { return nil, err } - return reportsWithInfo(reply.ReportWithInfo), nil + return reportsPlus(reply.ReportPlus), nil } func (o *reportingPluginClient) ShouldAcceptAttestedReport(ctx context.Context, u uint64, ri ocr3types.ReportWithInfo[[]byte]) (bool, error) { @@ -265,16 +257,20 @@ func (o *reportingPluginServer) ValidateObservation(ctx context.Context, request if err != nil { return nil, err } - err = o.impl.ValidateObservation(outcomeContext(request.OutcomeContext), request.Query, ao) + err = o.impl.ValidateObservation(ctx, outcomeContext(request.OutcomeContext), request.Query, ao) return new(emptypb.Empty), err } func (o *reportingPluginServer) ObservationQuorum(ctx context.Context, request *ocr3.ObservationQuorumRequest) (*ocr3.ObservationQuorumReply, error) { - oq, err := o.impl.ObservationQuorum(outcomeContext(request.OutcomeContext), request.Query) + aos, err := attributedObservations(request.Ao) + if err != nil { + return nil, err + } + oq, err := o.impl.ObservationQuorum(ctx, outcomeContext(request.OutcomeContext), request.Query, aos) if err != nil { return nil, err } - return &ocr3.ObservationQuorumReply{Quorum: int32(oq)}, nil + return &ocr3.ObservationQuorumReply{QuorumReached: oq}, nil } func (o *reportingPluginServer) Outcome(ctx context.Context, request *ocr3.OutcomeRequest) (*ocr3.OutcomeReply, error) { @@ -282,7 +278,7 @@ func (o *reportingPluginServer) Outcome(ctx context.Context, request *ocr3.Outco if err != nil { return nil, err } - out, err := o.impl.Outcome(outcomeContext(request.OutcomeContext), request.Query, aos) + out, err := o.impl.Outcome(ctx, outcomeContext(request.OutcomeContext), request.Query, aos) if err != nil { return nil, err } @@ -292,12 +288,12 @@ func (o *reportingPluginServer) Outcome(ctx context.Context, request *ocr3.Outco } func (o *reportingPluginServer) Reports(ctx context.Context, request *ocr3.ReportsRequest) (*ocr3.ReportsReply, error) { - ri, err := o.impl.Reports(request.SeqNr, request.Outcome) + rp, err := o.impl.Reports(ctx, request.SeqNr, request.Outcome) if err != nil { return nil, err } return &ocr3.ReportsReply{ - ReportWithInfo: pbReportsWithInfo(ri), + ReportPlus: pbReportsPlus(rp), }, nil } @@ -347,16 +343,33 @@ func pbAttributedObservation(ao libocr.AttributedObservation) *ocr3.AttributedOb } } -func pbReportsWithInfo(rwi []ocr3types.ReportWithInfo[[]byte]) (ri []*ocr3.ReportWithInfo) { +func pbReportsPlus(rwi []ocr3types.ReportPlus[[]byte]) (ri []*ocr3.ReportPlus) { for _, r := range rwi { - ri = append(ri, &ocr3.ReportWithInfo{ - Report: r.Report, - Info: r.Info, + ri = append(ri, &ocr3.ReportPlus{ + ReportWithInfo: &ocr3.ReportWithInfo{ + Report: r.ReportWithInfo.Report, + Info: r.ReportWithInfo.Info, + }, + TransmissionScheduleOverride: pbTransmissionSchedule(r.TransmissionScheduleOverride), }) } return } +func pbTransmissionSchedule(s *ocr3types.TransmissionSchedule) *ocr3.TransmissionSchedule { + if s == nil { + return nil + } + var pb ocr3.TransmissionSchedule + for _, t := range s.Transmitters { + pb.Transmitters = append(pb.Transmitters, uint32(t)) + } + for _, td := range s.TransmissionDelays { + pb.TransmissionDelays = append(pb.TransmissionDelays, int64(td)) + } + return &pb +} + func pbAttributedObservations(aos []libocr.AttributedObservation) (pbaos []*ocr3.AttributedObservation) { for _, ao := range aos { pbaos = append(pbaos, pbAttributedObservation(ao)) @@ -395,12 +408,29 @@ func attributedObservations(pbo []*ocr3.AttributedObservation) (o []libocr.Attri return } -func reportsWithInfo(ri []*ocr3.ReportWithInfo) (rwi []ocr3types.ReportWithInfo[[]byte]) { +func reportsPlus(ri []*ocr3.ReportPlus) (rwi []ocr3types.ReportPlus[[]byte]) { for _, r := range ri { - rwi = append(rwi, ocr3types.ReportWithInfo[[]byte]{ - Report: r.Report, - Info: r.Info, + rwi = append(rwi, ocr3types.ReportPlus[[]byte]{ + ReportWithInfo: ocr3types.ReportWithInfo[[]byte]{ + Report: r.ReportWithInfo.Report, + Info: r.ReportWithInfo.Info, + }, + TransmissionScheduleOverride: transmissionSchedule(r.TransmissionScheduleOverride), }) } return } + +func transmissionSchedule(pb *ocr3.TransmissionSchedule) *ocr3types.TransmissionSchedule { + if pb == nil { + return nil + } + var ts ocr3types.TransmissionSchedule + for _, t := range pb.Transmitters { + ts.Transmitters = append(ts.Transmitters, commontypes.OracleID(t)) + } + for _, td := range pb.TransmissionDelays { + ts.TransmissionDelays = append(ts.TransmissionDelays, time.Duration(td)) + } + return &ts +} diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3/test/factory.go b/pkg/loop/internal/core/services/reportingplugin/ocr3/test/factory.go index e36fc9227..df93d7812 100644 --- a/pkg/loop/internal/core/services/reportingplugin/ocr3/test/factory.go +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3/test/factory.go @@ -40,7 +40,7 @@ func (o ocr3staticPluginFactory) Ready() error { panic("implement me") } func (o ocr3staticPluginFactory) HealthReport() map[string]error { panic("implement me") } -func (o ocr3staticPluginFactory) NewReportingPlugin(config ocr3types.ReportingPluginConfig) (ocr3types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { +func (o ocr3staticPluginFactory) NewReportingPlugin(ctx context.Context, config ocr3types.ReportingPluginConfig) (ocr3types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { err := o.equalConfig(config) if err != nil { return nil, ocr3types.ReportingPluginInfo{}, fmt.Errorf("config mismatch: %w", err) @@ -89,7 +89,7 @@ func OCR3ReportingPluginFactory(t *testing.T, factory core.OCR3ReportingPluginFa expectedFactory := Factory t.Run("OCR3ReportingPluginFactory", func(t *testing.T) { ctx := tests.Context(t) - rp, gotRPI, err := factory.NewReportingPlugin(ocr3reportingPluginConfig) + rp, gotRPI, err := factory.NewReportingPlugin(ctx, ocr3reportingPluginConfig) require.NoError(t, err) assert.Equal(t, ocr3rpi, gotRPI) t.Cleanup(func() { assert.NoError(t, rp.Close()) }) diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3/test/reporting_plugin.go b/pkg/loop/internal/core/services/reportingplugin/ocr3/test/reporting_plugin.go index e6b42f197..d52954d64 100644 --- a/pkg/loop/internal/core/services/reportingplugin/ocr3/test/reporting_plugin.go +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3/test/reporting_plugin.go @@ -5,7 +5,9 @@ import ( "context" "fmt" "testing" + "time" + "github.com/smartcontractkit/libocr/commontypes" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/stretchr/testify/assert" @@ -33,11 +35,12 @@ var ReportingPlugin = ocr3staticReportingPlugin{ observation: libocr.Observation{1, 2, 3}, }, observationQuorumRequest: observationQuorumRequest{ - outcomeCtx: outcomeCtx, - query: query, + outcomeCtx: outcomeCtx, + query: query, + observations: []libocr.AttributedObservation{{Observer: 1, Observation: []byte{1, 2, 3}}}, }, observationQuorumResponse: observationQuorumResponse{ - quorum: 1, + quorumReached: true, }, validateObservationRequest: validateObservationRequest{ outcomeCtx: outcomeCtx, @@ -57,8 +60,14 @@ var ReportingPlugin = ocr3staticReportingPlugin{ outcome: ocr3types.Outcome{1, 2, 3}, }, reportsResponse: reportsResponse{ - reportWithInfo: []ocr3types.ReportWithInfo[[]byte]{ - {Report: []byte{1, 2, 3}, Info: []byte{1, 2, 3}}, + reportPlus: []ocr3types.ReportPlus[[]byte]{ + { + ReportWithInfo: ocr3types.ReportWithInfo[[]byte]{Report: []byte{1, 2, 3}, Info: []byte{1, 2, 3}}, + TransmissionScheduleOverride: &ocr3types.TransmissionSchedule{ + Transmitters: []commontypes.OracleID{1, 2, 3}, + TransmissionDelays: []time.Duration{time.Second, time.Millisecond}, + }, + }, }, }, shouldAcceptAttestedReportRequest: shouldAcceptAttestedReportRequest{ @@ -97,12 +106,13 @@ type observationResponse struct { } type observationQuorumRequest struct { - outcomeCtx ocr3types.OutcomeContext - query libocr.Query + outcomeCtx ocr3types.OutcomeContext + query libocr.Query + observations []libocr.AttributedObservation } type observationQuorumResponse struct { - quorum ocr3types.Quorum + quorumReached bool } type validateObservationRequest struct { @@ -127,7 +137,7 @@ type reportsRequest struct { } type reportsResponse struct { - reportWithInfo []ocr3types.ReportWithInfo[[]byte] + reportPlus []ocr3types.ReportPlus[[]byte] } type shouldAcceptAttestedReportRequest struct { @@ -200,7 +210,7 @@ func (s ocr3staticReportingPlugin) Observation(ctx context.Context, outcomeCtx o return s.observationResponse.observation, nil } -func (s ocr3staticReportingPlugin) ValidateObservation(outcomeCtx ocr3types.OutcomeContext, q libocr.Query, a libocr.AttributedObservation) error { +func (s ocr3staticReportingPlugin) ValidateObservation(ctx context.Context, outcomeCtx ocr3types.OutcomeContext, q libocr.Query, a libocr.AttributedObservation) error { err := s.checkOutCtx(outcomeCtx) if err != nil { return err @@ -220,19 +230,22 @@ func (s ocr3staticReportingPlugin) ValidateObservation(outcomeCtx ocr3types.Outc return nil } -func (s ocr3staticReportingPlugin) ObservationQuorum(outcomeCtx ocr3types.OutcomeContext, q libocr.Query) (ocr3types.Quorum, error) { +func (s ocr3staticReportingPlugin) ObservationQuorum(ctx context.Context, outcomeCtx ocr3types.OutcomeContext, q libocr.Query, aos []libocr.AttributedObservation) (bool, error) { err := s.checkOutCtx(outcomeCtx) if err != nil { - return ocr3types.Quorum(0), err + return false, err } if !bytes.Equal(q, s.observationQuorumRequest.query) { - return ocr3types.Quorum(0), fmt.Errorf("expected %x but got %x", s.observationQuorumRequest.query, q) + return false, fmt.Errorf("expected %x but got %x", s.observationQuorumRequest.query, q) + } + if !assert.ObjectsAreEqual(aos, s.observationQuorumRequest.observations) { + return false, fmt.Errorf("expected %v but got %v", s.observationQuorumRequest.observations, aos) } - return s.observationQuorumResponse.quorum, nil + return s.observationQuorumResponse.quorumReached, nil } -func (s ocr3staticReportingPlugin) Outcome(outcomeCtx ocr3types.OutcomeContext, q libocr.Query, aos []libocr.AttributedObservation) (ocr3types.Outcome, error) { +func (s ocr3staticReportingPlugin) Outcome(ctx context.Context, outcomeCtx ocr3types.OutcomeContext, q libocr.Query, aos []libocr.AttributedObservation) (ocr3types.Outcome, error) { err := s.checkOutCtx(outcomeCtx) if err != nil { return nil, err @@ -247,7 +260,7 @@ func (s ocr3staticReportingPlugin) Outcome(outcomeCtx ocr3types.OutcomeContext, return s.outcomeResponse.outcome, nil } -func (s ocr3staticReportingPlugin) Reports(seq uint64, o ocr3types.Outcome) ([]ocr3types.ReportWithInfo[[]byte], error) { +func (s ocr3staticReportingPlugin) Reports(ctx context.Context, seq uint64, o ocr3types.Outcome) ([]ocr3types.ReportPlus[[]byte], error) { if seq != s.reportsRequest.seq { return nil, fmt.Errorf("expected %x but got %x", s.reportsRequest.seq, seq) } @@ -256,7 +269,7 @@ func (s ocr3staticReportingPlugin) Reports(seq uint64, o ocr3types.Outcome) ([]o return nil, fmt.Errorf("expected %x but got %x", s.reportsRequest.outcome, o) } - return s.reportsResponse.reportWithInfo, nil + return s.reportsResponse.reportPlus, nil } func (s ocr3staticReportingPlugin) ShouldAcceptAttestedReport(ctx context.Context, u uint64, r ocr3types.ReportWithInfo[[]byte]) (bool, error) { @@ -300,20 +313,20 @@ func (s ocr3staticReportingPlugin) AssertEqual(ctx context.Context, t *testing.T require.NoError(t, err) assert.Equal(t, s.observationResponse.observation, gotObs) - err = rp.ValidateObservation(s.validateObservationRequest.outcomeCtx, s.validateObservationRequest.query, s.validateObservationRequest.attributedObservation) + err = rp.ValidateObservation(ctx, s.validateObservationRequest.outcomeCtx, s.validateObservationRequest.query, s.validateObservationRequest.attributedObservation) require.NoError(t, err) - gotQuorum, err := rp.ObservationQuorum(s.observationQuorumRequest.outcomeCtx, s.observationQuorumRequest.query) + gotQuorum, err := rp.ObservationQuorum(ctx, s.observationQuorumRequest.outcomeCtx, s.observationQuorumRequest.query, s.observationQuorumRequest.observations) require.NoError(t, err) - assert.Equal(t, s.observationQuorumResponse.quorum, gotQuorum) + assert.Equal(t, s.observationQuorumResponse.quorumReached, gotQuorum) - gotOutcome, err := rp.Outcome(s.outcomeRequest.outcomeCtx, s.outcomeRequest.query, s.outcomeRequest.observations) + gotOutcome, err := rp.Outcome(ctx, s.outcomeRequest.outcomeCtx, s.outcomeRequest.query, s.outcomeRequest.observations) require.NoError(t, err) assert.Equal(t, s.outcomeResponse.outcome, gotOutcome) - gotRI, err := rp.Reports(s.reportsRequest.seq, s.reportsRequest.outcome) + gotRI, err := rp.Reports(ctx, s.reportsRequest.seq, s.reportsRequest.outcome) require.NoError(t, err) - assert.Equal(t, s.reportsResponse.reportWithInfo, gotRI) + assert.Equal(t, s.reportsResponse.reportPlus, gotRI) gotShouldAccept, err := rp.ShouldAcceptAttestedReport(ctx, s.shouldAcceptAttestedReportRequest.seq, s.shouldAcceptAttestedReportRequest.r) require.NoError(t, err) diff --git a/pkg/loop/internal/core/services/telemetry/test/telemetry.go b/pkg/loop/internal/core/services/telemetry/test/telemetry.go index 5aa60cdba..33d30f9d7 100644 --- a/pkg/loop/internal/core/services/telemetry/test/telemetry.go +++ b/pkg/loop/internal/core/services/telemetry/test/telemetry.go @@ -12,6 +12,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/telemetry" testtypes "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/test/types" "github.com/smartcontractkit/chainlink-common/pkg/types/core" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) var Telemetry = staticTelemetry{ @@ -113,6 +114,7 @@ func (m mockClientConn) NewStream(ctx context.Context, desc *grpc.StreamDesc, me } func TestTelemetry(t *testing.T) { + ctx := tests.Context(t) tsc := telemetry.NewTelemetryServiceClient(mockClientConn{}) c := telemetry.NewTelemetryClient(tsc) @@ -184,7 +186,7 @@ func TestTelemetry(t *testing.T) { } for _, test := range sendTests { - err := c.Send(context.Background(), test.network, test.chainID, test.contractID, test.telemetryType, test.payload) + err := c.Send(ctx, test.network, test.chainID, test.contractID, test.telemetryType, test.payload) if test.shouldError { require.ErrorContains(t, err, test.error) } else { @@ -245,14 +247,14 @@ func TestTelemetry(t *testing.T) { } for _, test := range genMonitoringEndpointTests { - e, err := c.NewEndpoint(context.Background(), test.network, test.chainID, test.contractID, test.telemetryType) + e, err := c.NewEndpoint(ctx, test.network, test.chainID, test.contractID, test.telemetryType) if test.shouldError { require.Nil(t, e) require.ErrorContains(t, err, test.error) } else { require.NotNil(t, e) require.Nil(t, err) - require.Nil(t, e.SendLog(context.Background(), []byte("some-data"))) + require.Nil(t, e.SendLog(ctx, []byte("some-data"))) } } } diff --git a/pkg/loop/internal/pb/ocr3/ocr3_reporting.pb.go b/pkg/loop/internal/pb/ocr3/ocr3_reporting.pb.go index 9481f0350..cf9e80a81 100644 --- a/pkg/loop/internal/pb/ocr3/ocr3_reporting.pb.go +++ b/pkg/loop/internal/pb/ocr3/ocr3_reporting.pb.go @@ -774,8 +774,9 @@ type ObservationQuorumRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OutcomeContext *OutcomeContext `protobuf:"bytes,1,opt,name=outcomeContext,proto3" json:"outcomeContext,omitempty"` - Query []byte `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` + OutcomeContext *OutcomeContext `protobuf:"bytes,1,opt,name=outcomeContext,proto3" json:"outcomeContext,omitempty"` + Query []byte `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` + Ao []*AttributedObservation `protobuf:"bytes,3,rep,name=ao,proto3" json:"ao,omitempty"` } func (x *ObservationQuorumRequest) Reset() { @@ -824,12 +825,19 @@ func (x *ObservationQuorumRequest) GetQuery() []byte { return nil } +func (x *ObservationQuorumRequest) GetAo() []*AttributedObservation { + if x != nil { + return x.Ao + } + return nil +} + type ObservationQuorumReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Quorum int32 `protobuf:"varint,1,opt,name=quorum,proto3" json:"quorum,omitempty"` + QuorumReached bool `protobuf:"varint,1,opt,name=quorumReached,proto3" json:"quorumReached,omitempty"` } func (x *ObservationQuorumReply) Reset() { @@ -864,11 +872,11 @@ func (*ObservationQuorumReply) Descriptor() ([]byte, []int) { return file_ocr3_reporting_proto_rawDescGZIP(), []int{13} } -func (x *ObservationQuorumReply) GetQuorum() int32 { +func (x *ObservationQuorumReply) GetQuorumReached() bool { if x != nil { - return x.Quorum + return x.QuorumReached } - return 0 + return false } type OutcomeRequest struct { @@ -1041,7 +1049,7 @@ type ReportsReply struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ReportWithInfo []*ReportWithInfo `protobuf:"bytes,1,rep,name=ReportWithInfo,proto3" json:"ReportWithInfo,omitempty"` + ReportPlus []*ReportPlus `protobuf:"bytes,1,rep,name=reportPlus,proto3" json:"reportPlus,omitempty"` } func (x *ReportsReply) Reset() { @@ -1076,13 +1084,68 @@ func (*ReportsReply) Descriptor() ([]byte, []int) { return file_ocr3_reporting_proto_rawDescGZIP(), []int{17} } -func (x *ReportsReply) GetReportWithInfo() []*ReportWithInfo { +func (x *ReportsReply) GetReportPlus() []*ReportPlus { + if x != nil { + return x.ReportPlus + } + return nil +} + +type ReportPlus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ReportWithInfo *ReportWithInfo `protobuf:"bytes,1,opt,name=reportWithInfo,proto3" json:"reportWithInfo,omitempty"` + TransmissionScheduleOverride *TransmissionSchedule `protobuf:"bytes,2,opt,name=transmissionScheduleOverride,proto3" json:"transmissionScheduleOverride,omitempty"` +} + +func (x *ReportPlus) Reset() { + *x = ReportPlus{} + if protoimpl.UnsafeEnabled { + mi := &file_ocr3_reporting_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReportPlus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportPlus) ProtoMessage() {} + +func (x *ReportPlus) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_reporting_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportPlus.ProtoReflect.Descriptor instead. +func (*ReportPlus) Descriptor() ([]byte, []int) { + return file_ocr3_reporting_proto_rawDescGZIP(), []int{18} +} + +func (x *ReportPlus) GetReportWithInfo() *ReportWithInfo { if x != nil { return x.ReportWithInfo } return nil } +func (x *ReportPlus) GetTransmissionScheduleOverride() *TransmissionSchedule { + if x != nil { + return x.TransmissionScheduleOverride + } + return nil +} + type ReportWithInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1095,7 +1158,7 @@ type ReportWithInfo struct { func (x *ReportWithInfo) Reset() { *x = ReportWithInfo{} if protoimpl.UnsafeEnabled { - mi := &file_ocr3_reporting_proto_msgTypes[18] + mi := &file_ocr3_reporting_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1108,7 +1171,7 @@ func (x *ReportWithInfo) String() string { func (*ReportWithInfo) ProtoMessage() {} func (x *ReportWithInfo) ProtoReflect() protoreflect.Message { - mi := &file_ocr3_reporting_proto_msgTypes[18] + mi := &file_ocr3_reporting_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1121,7 +1184,7 @@ func (x *ReportWithInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use ReportWithInfo.ProtoReflect.Descriptor instead. func (*ReportWithInfo) Descriptor() ([]byte, []int) { - return file_ocr3_reporting_proto_rawDescGZIP(), []int{18} + return file_ocr3_reporting_proto_rawDescGZIP(), []int{19} } func (x *ReportWithInfo) GetReport() []byte { @@ -1138,6 +1201,61 @@ func (x *ReportWithInfo) GetInfo() []byte { return nil } +type TransmissionSchedule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Transmitters []uint32 `protobuf:"varint,1,rep,packed,name=transmitters,proto3" json:"transmitters,omitempty"` // OracleID + TransmissionDelays []int64 `protobuf:"varint,2,rep,packed,name=transmissionDelays,proto3" json:"transmissionDelays,omitempty"` +} + +func (x *TransmissionSchedule) Reset() { + *x = TransmissionSchedule{} + if protoimpl.UnsafeEnabled { + mi := &file_ocr3_reporting_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransmissionSchedule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransmissionSchedule) ProtoMessage() {} + +func (x *TransmissionSchedule) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_reporting_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransmissionSchedule.ProtoReflect.Descriptor instead. +func (*TransmissionSchedule) Descriptor() ([]byte, []int) { + return file_ocr3_reporting_proto_rawDescGZIP(), []int{20} +} + +func (x *TransmissionSchedule) GetTransmitters() []uint32 { + if x != nil { + return x.Transmitters + } + return nil +} + +func (x *TransmissionSchedule) GetTransmissionDelays() []int64 { + if x != nil { + return x.TransmissionDelays + } + return nil +} + type ShouldAcceptAttestedReportRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1150,7 +1268,7 @@ type ShouldAcceptAttestedReportRequest struct { func (x *ShouldAcceptAttestedReportRequest) Reset() { *x = ShouldAcceptAttestedReportRequest{} if protoimpl.UnsafeEnabled { - mi := &file_ocr3_reporting_proto_msgTypes[19] + mi := &file_ocr3_reporting_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1163,7 +1281,7 @@ func (x *ShouldAcceptAttestedReportRequest) String() string { func (*ShouldAcceptAttestedReportRequest) ProtoMessage() {} func (x *ShouldAcceptAttestedReportRequest) ProtoReflect() protoreflect.Message { - mi := &file_ocr3_reporting_proto_msgTypes[19] + mi := &file_ocr3_reporting_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1176,7 +1294,7 @@ func (x *ShouldAcceptAttestedReportRequest) ProtoReflect() protoreflect.Message // Deprecated: Use ShouldAcceptAttestedReportRequest.ProtoReflect.Descriptor instead. func (*ShouldAcceptAttestedReportRequest) Descriptor() ([]byte, []int) { - return file_ocr3_reporting_proto_rawDescGZIP(), []int{19} + return file_ocr3_reporting_proto_rawDescGZIP(), []int{21} } func (x *ShouldAcceptAttestedReportRequest) GetSegNr() uint64 { @@ -1204,7 +1322,7 @@ type ShouldAcceptAttestedReportReply struct { func (x *ShouldAcceptAttestedReportReply) Reset() { *x = ShouldAcceptAttestedReportReply{} if protoimpl.UnsafeEnabled { - mi := &file_ocr3_reporting_proto_msgTypes[20] + mi := &file_ocr3_reporting_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1217,7 +1335,7 @@ func (x *ShouldAcceptAttestedReportReply) String() string { func (*ShouldAcceptAttestedReportReply) ProtoMessage() {} func (x *ShouldAcceptAttestedReportReply) ProtoReflect() protoreflect.Message { - mi := &file_ocr3_reporting_proto_msgTypes[20] + mi := &file_ocr3_reporting_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1230,7 +1348,7 @@ func (x *ShouldAcceptAttestedReportReply) ProtoReflect() protoreflect.Message { // Deprecated: Use ShouldAcceptAttestedReportReply.ProtoReflect.Descriptor instead. func (*ShouldAcceptAttestedReportReply) Descriptor() ([]byte, []int) { - return file_ocr3_reporting_proto_rawDescGZIP(), []int{20} + return file_ocr3_reporting_proto_rawDescGZIP(), []int{22} } func (x *ShouldAcceptAttestedReportReply) GetShouldAccept() bool { @@ -1252,7 +1370,7 @@ type ShouldTransmitAcceptedReportRequest struct { func (x *ShouldTransmitAcceptedReportRequest) Reset() { *x = ShouldTransmitAcceptedReportRequest{} if protoimpl.UnsafeEnabled { - mi := &file_ocr3_reporting_proto_msgTypes[21] + mi := &file_ocr3_reporting_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1265,7 +1383,7 @@ func (x *ShouldTransmitAcceptedReportRequest) String() string { func (*ShouldTransmitAcceptedReportRequest) ProtoMessage() {} func (x *ShouldTransmitAcceptedReportRequest) ProtoReflect() protoreflect.Message { - mi := &file_ocr3_reporting_proto_msgTypes[21] + mi := &file_ocr3_reporting_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1278,7 +1396,7 @@ func (x *ShouldTransmitAcceptedReportRequest) ProtoReflect() protoreflect.Messag // Deprecated: Use ShouldTransmitAcceptedReportRequest.ProtoReflect.Descriptor instead. func (*ShouldTransmitAcceptedReportRequest) Descriptor() ([]byte, []int) { - return file_ocr3_reporting_proto_rawDescGZIP(), []int{21} + return file_ocr3_reporting_proto_rawDescGZIP(), []int{23} } func (x *ShouldTransmitAcceptedReportRequest) GetSegNr() uint64 { @@ -1306,7 +1424,7 @@ type ShouldTransmitAcceptedReportReply struct { func (x *ShouldTransmitAcceptedReportReply) Reset() { *x = ShouldTransmitAcceptedReportReply{} if protoimpl.UnsafeEnabled { - mi := &file_ocr3_reporting_proto_msgTypes[22] + mi := &file_ocr3_reporting_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1319,7 +1437,7 @@ func (x *ShouldTransmitAcceptedReportReply) String() string { func (*ShouldTransmitAcceptedReportReply) ProtoMessage() {} func (x *ShouldTransmitAcceptedReportReply) ProtoReflect() protoreflect.Message { - mi := &file_ocr3_reporting_proto_msgTypes[22] + mi := &file_ocr3_reporting_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1332,7 +1450,7 @@ func (x *ShouldTransmitAcceptedReportReply) ProtoReflect() protoreflect.Message // Deprecated: Use ShouldTransmitAcceptedReportReply.ProtoReflect.Descriptor instead. func (*ShouldTransmitAcceptedReportReply) Descriptor() ([]byte, []int) { - return file_ocr3_reporting_proto_rawDescGZIP(), []int{22} + return file_ocr3_reporting_proto_rawDescGZIP(), []int{24} } func (x *ShouldTransmitAcceptedReportReply) GetShouldTransmit() bool { @@ -1470,144 +1588,168 @@ var file_ocr3_reporting_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x22, 0x7f, 0x0a, 0x18, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x51, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4d, - 0x0a, 0x0e, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, - 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x0e, 0x6f, - 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x22, 0x30, 0x0a, 0x16, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x51, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x16, 0x0a, - 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x71, - 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x22, 0xb3, 0x01, 0x0a, 0x0e, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4d, 0x0a, 0x0e, 0x6f, 0x75, 0x74, 0x63, - 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x0e, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x3c, 0x0a, - 0x02, 0x61, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, - 0x33, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64, 0x4f, 0x62, 0x73, 0x65, - 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x61, 0x6f, 0x22, 0x28, 0x0a, 0x0c, 0x4f, - 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6f, - 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x75, - 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x22, 0x40, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x65, 0x71, 0x4e, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, 0x65, 0x71, 0x4e, 0x72, 0x12, 0x18, 0x0a, - 0x07, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x22, 0x5d, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x4d, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, - 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x57, 0x69, - 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x57, 0x69, - 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x3c, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x22, 0xbd, 0x01, 0x0a, 0x18, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x51, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x4d, 0x0a, 0x0e, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, + 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x0e, + 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x3c, 0x0a, 0x02, 0x61, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x64, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, + 0x61, 0x6f, 0x22, 0x3e, 0x0a, 0x16, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x51, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x24, 0x0a, 0x0d, + 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0d, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, 0x61, 0x63, 0x68, + 0x65, 0x64, 0x22, 0xb3, 0x01, 0x0a, 0x0e, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4d, 0x0a, 0x0e, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, + 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x78, 0x74, 0x52, 0x0e, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x3c, 0x0a, 0x02, 0x61, 0x6f, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x61, 0x6f, 0x22, 0x28, 0x0a, 0x0c, 0x4f, 0x75, 0x74, 0x63, + 0x6f, 0x6d, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x63, + 0x6f, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x63, 0x6f, + 0x6d, 0x65, 0x22, 0x40, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x65, 0x71, 0x4e, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, 0x65, 0x71, 0x4e, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x75, + 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x75, 0x74, + 0x63, 0x6f, 0x6d, 0x65, 0x22, 0x51, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x12, 0x41, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x6c, + 0x75, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x6c, 0x75, 0x73, 0x52, 0x0a, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x50, 0x6c, 0x75, 0x73, 0x22, 0xcc, 0x01, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x50, 0x6c, 0x75, 0x73, 0x12, 0x4d, 0x0a, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, + 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x57, 0x69, 0x74, + 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x57, 0x69, 0x74, + 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x6f, 0x0a, 0x1c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x4f, 0x76, 0x65, + 0x72, 0x72, 0x69, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, + 0x63, 0x72, 0x33, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x1c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x4f, 0x76, + 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x22, 0x3c, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, - 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x70, 0x0a, 0x21, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x63, - 0x63, 0x65, 0x70, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x65, 0x67, - 0x4e, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, 0x65, 0x67, 0x4e, 0x72, 0x12, - 0x35, 0x0a, 0x02, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, 0x6f, + 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x6a, 0x0a, 0x14, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0c, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, 0x73, + 0x12, 0x2e, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x44, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x12, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x73, + 0x22, 0x70, 0x0a, 0x21, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, + 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x65, 0x67, 0x4e, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, 0x65, 0x67, 0x4e, 0x72, 0x12, 0x35, 0x0a, 0x02, 0x72, + 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x02, + 0x72, 0x69, 0x22, 0x45, 0x0a, 0x1f, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, + 0x70, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x68, 0x6f, + 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x22, 0x72, 0x0a, 0x23, 0x53, 0x68, 0x6f, + 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, + 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x65, 0x67, 0x4e, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x05, 0x73, 0x65, 0x67, 0x4e, 0x72, 0x12, 0x35, 0x0a, 0x02, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x02, 0x72, 0x69, 0x22, 0x4b, 0x0a, + 0x21, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x41, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x68, 0x6f, 0x75, + 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x32, 0x92, 0x01, 0x0a, 0x16, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x46, 0x61, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x78, 0x0a, 0x12, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, - 0x63, 0x72, 0x33, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x02, 0x72, 0x69, 0x22, 0x45, 0x0a, 0x1f, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, - 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x68, 0x6f, - 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0c, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x22, 0x72, 0x0a, - 0x23, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x41, - 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x65, 0x67, 0x4e, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, 0x65, 0x67, 0x4e, 0x72, 0x12, 0x35, 0x0a, 0x02, 0x72, 0x69, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x57, 0x69, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x02, 0x72, - 0x69, 0x22, 0x4b, 0x0a, 0x21, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x6d, 0x69, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, - 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x32, 0x92, - 0x01, 0x0a, 0x16, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x78, 0x0a, 0x12, 0x4e, 0x65, 0x77, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, - 0x30, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, - 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x32, 0xbd, 0x07, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, - 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x51, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x12, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x0b, 0x4f, 0x62, - 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, - 0x33, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x62, 0x73, - 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x62, 0x0a, 0x13, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x73, 0x65, 0x72, - 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x56, + 0x63, 0x72, 0x33, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, + 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, + 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, + 0xbd, 0x07, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x12, 0x51, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x23, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, + 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x0b, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x62, + 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x62, 0x0a, 0x13, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x22, 0x00, 0x12, 0x75, 0x0a, 0x11, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x51, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x2f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, + 0x6f, 0x6e, 0x12, 0x31, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, + 0x75, 0x0a, 0x11, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, + 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x2f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x62, 0x73, + 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x62, + 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x07, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, + 0x65, 0x12, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, - 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x6f, 0x72, - 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, - 0x33, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x6f, - 0x72, 0x75, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x07, 0x4f, 0x75, - 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x12, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x75, - 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, - 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x25, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, - 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x90, 0x01, 0x0a, - 0x1a, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x41, 0x74, 0x74, - 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x38, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, - 0x63, 0x72, 0x33, 0x2e, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, - 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x53, 0x68, - 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, - 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x96, 0x01, 0x0a, 0x1c, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, - 0x69, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x12, 0x3a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, + 0x2e, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x57, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, + 0x72, 0x33, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x90, 0x01, 0x0a, 0x1a, 0x53, 0x68, 0x6f, + 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, + 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x38, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, + 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x41, 0x74, 0x74, 0x65, + 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x36, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, + 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x96, 0x01, 0x0a, 0x1c, + 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x41, 0x63, + 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x3a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, 0x2e, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x73, - 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x22, 0x00, 0x42, 0x4f, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, - 0x69, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x62, 0x2f, 0x6f, 0x63, 0x72, 0x33, 0x3b, 0x6f, 0x63, - 0x72, 0x33, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x6f, 0x63, 0x72, 0x33, + 0x2e, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x41, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, + 0x4f, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6d, + 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, 0x69, 0x74, 0x2f, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2f, 0x70, 0x62, 0x2f, 0x6f, 0x63, 0x72, 0x33, 0x3b, 0x6f, 0x63, 0x72, 0x33, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1622,7 +1764,7 @@ func file_ocr3_reporting_proto_rawDescGZIP() []byte { return file_ocr3_reporting_proto_rawDescData } -var file_ocr3_reporting_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_ocr3_reporting_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_ocr3_reporting_proto_goTypes = []interface{}{ (*NewReportingPluginRequest)(nil), // 0: loop.internal.pb.ocr3.NewReportingPluginRequest (*NewReportingPluginReply)(nil), // 1: loop.internal.pb.ocr3.NewReportingPluginReply @@ -1642,12 +1784,14 @@ var file_ocr3_reporting_proto_goTypes = []interface{}{ (*OutcomeReply)(nil), // 15: loop.internal.pb.ocr3.OutcomeReply (*ReportsRequest)(nil), // 16: loop.internal.pb.ocr3.ReportsRequest (*ReportsReply)(nil), // 17: loop.internal.pb.ocr3.ReportsReply - (*ReportWithInfo)(nil), // 18: loop.internal.pb.ocr3.ReportWithInfo - (*ShouldAcceptAttestedReportRequest)(nil), // 19: loop.internal.pb.ocr3.ShouldAcceptAttestedReportRequest - (*ShouldAcceptAttestedReportReply)(nil), // 20: loop.internal.pb.ocr3.ShouldAcceptAttestedReportReply - (*ShouldTransmitAcceptedReportRequest)(nil), // 21: loop.internal.pb.ocr3.ShouldTransmitAcceptedReportRequest - (*ShouldTransmitAcceptedReportReply)(nil), // 22: loop.internal.pb.ocr3.ShouldTransmitAcceptedReportReply - (*emptypb.Empty)(nil), // 23: google.protobuf.Empty + (*ReportPlus)(nil), // 18: loop.internal.pb.ocr3.ReportPlus + (*ReportWithInfo)(nil), // 19: loop.internal.pb.ocr3.ReportWithInfo + (*TransmissionSchedule)(nil), // 20: loop.internal.pb.ocr3.TransmissionSchedule + (*ShouldAcceptAttestedReportRequest)(nil), // 21: loop.internal.pb.ocr3.ShouldAcceptAttestedReportRequest + (*ShouldAcceptAttestedReportReply)(nil), // 22: loop.internal.pb.ocr3.ShouldAcceptAttestedReportReply + (*ShouldTransmitAcceptedReportRequest)(nil), // 23: loop.internal.pb.ocr3.ShouldTransmitAcceptedReportRequest + (*ShouldTransmitAcceptedReportReply)(nil), // 24: loop.internal.pb.ocr3.ShouldTransmitAcceptedReportReply + (*emptypb.Empty)(nil), // 25: google.protobuf.Empty } var file_ocr3_reporting_proto_depIdxs = []int32{ 2, // 0: loop.internal.pb.ocr3.NewReportingPluginRequest.reportingPluginConfig:type_name -> loop.internal.pb.ocr3.ReportingPluginConfig @@ -1658,36 +1802,39 @@ var file_ocr3_reporting_proto_depIdxs = []int32{ 6, // 5: loop.internal.pb.ocr3.ValidateObservationRequest.outcomeContext:type_name -> loop.internal.pb.ocr3.OutcomeContext 11, // 6: loop.internal.pb.ocr3.ValidateObservationRequest.ao:type_name -> loop.internal.pb.ocr3.AttributedObservation 6, // 7: loop.internal.pb.ocr3.ObservationQuorumRequest.outcomeContext:type_name -> loop.internal.pb.ocr3.OutcomeContext - 6, // 8: loop.internal.pb.ocr3.OutcomeRequest.outcomeContext:type_name -> loop.internal.pb.ocr3.OutcomeContext - 11, // 9: loop.internal.pb.ocr3.OutcomeRequest.ao:type_name -> loop.internal.pb.ocr3.AttributedObservation - 18, // 10: loop.internal.pb.ocr3.ReportsReply.ReportWithInfo:type_name -> loop.internal.pb.ocr3.ReportWithInfo - 18, // 11: loop.internal.pb.ocr3.ShouldAcceptAttestedReportRequest.ri:type_name -> loop.internal.pb.ocr3.ReportWithInfo - 18, // 12: loop.internal.pb.ocr3.ShouldTransmitAcceptedReportRequest.ri:type_name -> loop.internal.pb.ocr3.ReportWithInfo - 0, // 13: loop.internal.pb.ocr3.ReportingPluginFactory.NewReportingPlugin:input_type -> loop.internal.pb.ocr3.NewReportingPluginRequest - 5, // 14: loop.internal.pb.ocr3.ReportingPlugin.Query:input_type -> loop.internal.pb.ocr3.QueryRequest - 8, // 15: loop.internal.pb.ocr3.ReportingPlugin.Observation:input_type -> loop.internal.pb.ocr3.ObservationRequest - 10, // 16: loop.internal.pb.ocr3.ReportingPlugin.ValidateObservation:input_type -> loop.internal.pb.ocr3.ValidateObservationRequest - 12, // 17: loop.internal.pb.ocr3.ReportingPlugin.ObservationQuorum:input_type -> loop.internal.pb.ocr3.ObservationQuorumRequest - 14, // 18: loop.internal.pb.ocr3.ReportingPlugin.Outcome:input_type -> loop.internal.pb.ocr3.OutcomeRequest - 16, // 19: loop.internal.pb.ocr3.ReportingPlugin.Reports:input_type -> loop.internal.pb.ocr3.ReportsRequest - 19, // 20: loop.internal.pb.ocr3.ReportingPlugin.ShouldAcceptAttestedReport:input_type -> loop.internal.pb.ocr3.ShouldAcceptAttestedReportRequest - 21, // 21: loop.internal.pb.ocr3.ReportingPlugin.ShouldTransmitAcceptedReport:input_type -> loop.internal.pb.ocr3.ShouldTransmitAcceptedReportRequest - 23, // 22: loop.internal.pb.ocr3.ReportingPlugin.Close:input_type -> google.protobuf.Empty - 1, // 23: loop.internal.pb.ocr3.ReportingPluginFactory.NewReportingPlugin:output_type -> loop.internal.pb.ocr3.NewReportingPluginReply - 7, // 24: loop.internal.pb.ocr3.ReportingPlugin.Query:output_type -> loop.internal.pb.ocr3.QueryReply - 9, // 25: loop.internal.pb.ocr3.ReportingPlugin.Observation:output_type -> loop.internal.pb.ocr3.ObservationReply - 23, // 26: loop.internal.pb.ocr3.ReportingPlugin.ValidateObservation:output_type -> google.protobuf.Empty - 13, // 27: loop.internal.pb.ocr3.ReportingPlugin.ObservationQuorum:output_type -> loop.internal.pb.ocr3.ObservationQuorumReply - 15, // 28: loop.internal.pb.ocr3.ReportingPlugin.Outcome:output_type -> loop.internal.pb.ocr3.OutcomeReply - 17, // 29: loop.internal.pb.ocr3.ReportingPlugin.Reports:output_type -> loop.internal.pb.ocr3.ReportsReply - 20, // 30: loop.internal.pb.ocr3.ReportingPlugin.ShouldAcceptAttestedReport:output_type -> loop.internal.pb.ocr3.ShouldAcceptAttestedReportReply - 22, // 31: loop.internal.pb.ocr3.ReportingPlugin.ShouldTransmitAcceptedReport:output_type -> loop.internal.pb.ocr3.ShouldTransmitAcceptedReportReply - 23, // 32: loop.internal.pb.ocr3.ReportingPlugin.Close:output_type -> google.protobuf.Empty - 23, // [23:33] is the sub-list for method output_type - 13, // [13:23] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 11, // 8: loop.internal.pb.ocr3.ObservationQuorumRequest.ao:type_name -> loop.internal.pb.ocr3.AttributedObservation + 6, // 9: loop.internal.pb.ocr3.OutcomeRequest.outcomeContext:type_name -> loop.internal.pb.ocr3.OutcomeContext + 11, // 10: loop.internal.pb.ocr3.OutcomeRequest.ao:type_name -> loop.internal.pb.ocr3.AttributedObservation + 18, // 11: loop.internal.pb.ocr3.ReportsReply.reportPlus:type_name -> loop.internal.pb.ocr3.ReportPlus + 19, // 12: loop.internal.pb.ocr3.ReportPlus.reportWithInfo:type_name -> loop.internal.pb.ocr3.ReportWithInfo + 20, // 13: loop.internal.pb.ocr3.ReportPlus.transmissionScheduleOverride:type_name -> loop.internal.pb.ocr3.TransmissionSchedule + 19, // 14: loop.internal.pb.ocr3.ShouldAcceptAttestedReportRequest.ri:type_name -> loop.internal.pb.ocr3.ReportWithInfo + 19, // 15: loop.internal.pb.ocr3.ShouldTransmitAcceptedReportRequest.ri:type_name -> loop.internal.pb.ocr3.ReportWithInfo + 0, // 16: loop.internal.pb.ocr3.ReportingPluginFactory.NewReportingPlugin:input_type -> loop.internal.pb.ocr3.NewReportingPluginRequest + 5, // 17: loop.internal.pb.ocr3.ReportingPlugin.Query:input_type -> loop.internal.pb.ocr3.QueryRequest + 8, // 18: loop.internal.pb.ocr3.ReportingPlugin.Observation:input_type -> loop.internal.pb.ocr3.ObservationRequest + 10, // 19: loop.internal.pb.ocr3.ReportingPlugin.ValidateObservation:input_type -> loop.internal.pb.ocr3.ValidateObservationRequest + 12, // 20: loop.internal.pb.ocr3.ReportingPlugin.ObservationQuorum:input_type -> loop.internal.pb.ocr3.ObservationQuorumRequest + 14, // 21: loop.internal.pb.ocr3.ReportingPlugin.Outcome:input_type -> loop.internal.pb.ocr3.OutcomeRequest + 16, // 22: loop.internal.pb.ocr3.ReportingPlugin.Reports:input_type -> loop.internal.pb.ocr3.ReportsRequest + 21, // 23: loop.internal.pb.ocr3.ReportingPlugin.ShouldAcceptAttestedReport:input_type -> loop.internal.pb.ocr3.ShouldAcceptAttestedReportRequest + 23, // 24: loop.internal.pb.ocr3.ReportingPlugin.ShouldTransmitAcceptedReport:input_type -> loop.internal.pb.ocr3.ShouldTransmitAcceptedReportRequest + 25, // 25: loop.internal.pb.ocr3.ReportingPlugin.Close:input_type -> google.protobuf.Empty + 1, // 26: loop.internal.pb.ocr3.ReportingPluginFactory.NewReportingPlugin:output_type -> loop.internal.pb.ocr3.NewReportingPluginReply + 7, // 27: loop.internal.pb.ocr3.ReportingPlugin.Query:output_type -> loop.internal.pb.ocr3.QueryReply + 9, // 28: loop.internal.pb.ocr3.ReportingPlugin.Observation:output_type -> loop.internal.pb.ocr3.ObservationReply + 25, // 29: loop.internal.pb.ocr3.ReportingPlugin.ValidateObservation:output_type -> google.protobuf.Empty + 13, // 30: loop.internal.pb.ocr3.ReportingPlugin.ObservationQuorum:output_type -> loop.internal.pb.ocr3.ObservationQuorumReply + 15, // 31: loop.internal.pb.ocr3.ReportingPlugin.Outcome:output_type -> loop.internal.pb.ocr3.OutcomeReply + 17, // 32: loop.internal.pb.ocr3.ReportingPlugin.Reports:output_type -> loop.internal.pb.ocr3.ReportsReply + 22, // 33: loop.internal.pb.ocr3.ReportingPlugin.ShouldAcceptAttestedReport:output_type -> loop.internal.pb.ocr3.ShouldAcceptAttestedReportReply + 24, // 34: loop.internal.pb.ocr3.ReportingPlugin.ShouldTransmitAcceptedReport:output_type -> loop.internal.pb.ocr3.ShouldTransmitAcceptedReportReply + 25, // 35: loop.internal.pb.ocr3.ReportingPlugin.Close:output_type -> google.protobuf.Empty + 26, // [26:36] is the sub-list for method output_type + 16, // [16:26] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name } func init() { file_ocr3_reporting_proto_init() } @@ -1913,7 +2060,7 @@ func file_ocr3_reporting_proto_init() { } } file_ocr3_reporting_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReportWithInfo); i { + switch v := v.(*ReportPlus); i { case 0: return &v.state case 1: @@ -1925,7 +2072,7 @@ func file_ocr3_reporting_proto_init() { } } file_ocr3_reporting_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ShouldAcceptAttestedReportRequest); i { + switch v := v.(*ReportWithInfo); i { case 0: return &v.state case 1: @@ -1937,7 +2084,7 @@ func file_ocr3_reporting_proto_init() { } } file_ocr3_reporting_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ShouldAcceptAttestedReportReply); i { + switch v := v.(*TransmissionSchedule); i { case 0: return &v.state case 1: @@ -1949,7 +2096,7 @@ func file_ocr3_reporting_proto_init() { } } file_ocr3_reporting_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ShouldTransmitAcceptedReportRequest); i { + switch v := v.(*ShouldAcceptAttestedReportRequest); i { case 0: return &v.state case 1: @@ -1961,6 +2108,30 @@ func file_ocr3_reporting_proto_init() { } } file_ocr3_reporting_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShouldAcceptAttestedReportReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocr3_reporting_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShouldTransmitAcceptedReportRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocr3_reporting_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ShouldTransmitAcceptedReportReply); i { case 0: return &v.state @@ -1979,7 +2150,7 @@ func file_ocr3_reporting_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ocr3_reporting_proto_rawDesc, NumEnums: 0, - NumMessages: 23, + NumMessages: 25, NumExtensions: 0, NumServices: 2, }, diff --git a/pkg/loop/internal/pb/ocr3/ocr3_reporting.proto b/pkg/loop/internal/pb/ocr3/ocr3_reporting.proto index 444fbe050..dd2c31c5f 100644 --- a/pkg/loop/internal/pb/ocr3/ocr3_reporting.proto +++ b/pkg/loop/internal/pb/ocr3/ocr3_reporting.proto @@ -98,10 +98,11 @@ message AttributedObservation{ message ObservationQuorumRequest { OutcomeContext outcomeContext=1; bytes query=2; + repeated AttributedObservation ao=3; } message ObservationQuorumReply { - int32 quorum =1; + bool quorumReached=1; } message OutcomeRequest{ @@ -120,7 +121,12 @@ message ReportsRequest{ } message ReportsReply{ - repeated ReportWithInfo ReportWithInfo=1; + repeated ReportPlus reportPlus=1; +} + +message ReportPlus{ + ReportWithInfo reportWithInfo=1; + TransmissionSchedule transmissionScheduleOverride=2; } message ReportWithInfo{ @@ -128,6 +134,11 @@ message ReportWithInfo{ bytes info=2; } +message TransmissionSchedule{ + repeated uint32 transmitters=1; // OracleID + repeated int64 transmissionDelays=2; +} + message ShouldAcceptAttestedReportRequest{ uint64 segNr=1; ReportWithInfo ri=2; diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/commit_provider.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/commit_provider.go index 5865eaf7f..4f9cd5294 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/commit_provider.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/commit_provider.go @@ -165,12 +165,12 @@ func (e *CommitProviderServer) Close(context.Context, *emptypb.Empty) (*emptypb. // NewCommitStoreReader implements ccippb.CommitCustomHandlersServer. func (e *CommitProviderServer) NewCommitStoreReader(ctx context.Context, req *ccippb.NewCommitStoreReaderRequest) (*ccippb.NewCommitStoreReaderResponse, error) { - reader, err := e.impl.NewCommitStoreReader(context.Background(), ccip.Address(req.Address)) + reader, err := e.impl.NewCommitStoreReader(ctx, ccip.Address(req.Address)) if err != nil { return nil, err } // wrap the reader in a grpc server and serve it - commitStoreHandler, err := NewCommitStoreReaderGRPCServer(reader, e.BrokerExt) + commitStoreHandler, err := NewCommitStoreReaderGRPCServer(ctx, reader, e.BrokerExt) if err != nil { return nil, fmt.Errorf("failed to create offramp reader grpc server: %w", err) } @@ -198,7 +198,7 @@ func (e *CommitProviderServer) NewOffRampReader(ctx context.Context, req *ccippb return nil, err } // wrap the reader in a grpc server and serve it - offRampHandler, err := NewOffRampReaderGRPCServer(reader, e.BrokerExt) + offRampHandler, err := NewOffRampReaderGRPCServer(ctx, reader, e.BrokerExt) if err != nil { return nil, fmt.Errorf("failed to create offramp reader grpc server: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/commit_store.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/commit_store.go index c99d3fcca..4b821417b 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/commit_store.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/commit_store.go @@ -57,8 +57,8 @@ type CommitStoreGRPCServer struct { deps []io.Closer } -func NewCommitStoreReaderGRPCServer(impl ccip.CommitStoreReader, brokerExt *net.BrokerExt) (*CommitStoreGRPCServer, error) { - estimator, err := impl.GasPriceEstimator(context.Background()) +func NewCommitStoreReaderGRPCServer(ctx context.Context, impl ccip.CommitStoreReader, brokerExt *net.BrokerExt) (*CommitStoreGRPCServer, error) { + estimator, err := impl.GasPriceEstimator(ctx) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/execution_provider.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/execution_provider.go index a8a6db7d8..7e862c99c 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/execution_provider.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/execution_provider.go @@ -203,12 +203,12 @@ func (e *ExecProviderServer) Close(context.Context, *emptypb.Empty) (*emptypb.Em // NewCommitStoreReader implements ccippb.ExecutionCustomHandlersServer. func (e *ExecProviderServer) NewCommitStoreReader(ctx context.Context, req *ccippb.NewCommitStoreReaderRequest) (*ccippb.NewCommitStoreReaderResponse, error) { - reader, err := e.impl.NewCommitStoreReader(context.Background(), ccip.Address(req.Address)) + reader, err := e.impl.NewCommitStoreReader(ctx, ccip.Address(req.Address)) if err != nil { return nil, err } // wrap the reader in a grpc server and serve it - commitStoreHandler, err := NewCommitStoreReaderGRPCServer(reader, e.BrokerExt) + commitStoreHandler, err := NewCommitStoreReaderGRPCServer(ctx, reader, e.BrokerExt) if err != nil { return nil, fmt.Errorf("failed to create offramp reader grpc server: %w", err) } @@ -244,7 +244,7 @@ func (e *ExecProviderServer) NewOffRampReader(ctx context.Context, req *ccippb.N return nil, err } // wrap the reader in a grpc server and serve it - offRampHandler, err := NewOffRampReaderGRPCServer(reader, e.BrokerExt) + offRampHandler, err := NewOffRampReaderGRPCServer(ctx, reader, e.BrokerExt) if err != nil { return nil, fmt.Errorf("failed to create offramp reader grpc server: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/gas_estimator.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/gas_estimator.go index 5288b209a..a839525ef 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/gas_estimator.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/gas_estimator.go @@ -53,8 +53,8 @@ func (c *CommitGasEstimatorGRPCClient) Close() error { } // DenoteInUSD implements ccip.GasPriceEstimatorCommit. -func (c *CommitGasEstimatorGRPCClient) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { - resp, err := c.client.DenoteInUSD(context.Background(), &ccippb.DenoteInUSDRequest{ +func (c *CommitGasEstimatorGRPCClient) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { + resp, err := c.client.DenoteInUSD(ctx, &ccippb.DenoteInUSDRequest{ P: pb.NewBigIntFromInt(p), WrappedNativePrice: pb.NewBigIntFromInt(wrappedNativePrice), }) @@ -65,8 +65,8 @@ func (c *CommitGasEstimatorGRPCClient) DenoteInUSD(p *big.Int, wrappedNativePric } // Deviates implements ccip.GasPriceEstimatorCommit. -func (c *CommitGasEstimatorGRPCClient) Deviates(p1 *big.Int, p2 *big.Int) (bool, error) { - resp, err := c.client.Deviates(context.Background(), &ccippb.DeviatesRequest{ +func (c *CommitGasEstimatorGRPCClient) Deviates(ctx context.Context, p1 *big.Int, p2 *big.Int) (bool, error) { + resp, err := c.client.Deviates(ctx, &ccippb.DeviatesRequest{ P1: pb.NewBigIntFromInt(p1), P2: pb.NewBigIntFromInt(p2), }) @@ -86,8 +86,8 @@ func (c *CommitGasEstimatorGRPCClient) GetGasPrice(ctx context.Context) (*big.In } // Median implements ccip.GasPriceEstimatorCommit. -func (c *CommitGasEstimatorGRPCClient) Median(gasPrices []*big.Int) (*big.Int, error) { - resp, err := c.client.Median(context.Background(), &ccippb.MedianRequest{ +func (c *CommitGasEstimatorGRPCClient) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { + resp, err := c.client.Median(ctx, &ccippb.MedianRequest{ GasPrices: bigIntSlicePB(gasPrices), }) if err != nil { @@ -100,7 +100,7 @@ func (c *CommitGasEstimatorGRPCClient) Median(gasPrices []*big.Int) (*big.Int, e // DenoteInUSD implements ccippb.GasPriceEstimatorCommitServer. func (c *CommitGasEstimatorGRPCServer) DenoteInUSD(ctx context.Context, req *ccippb.DenoteInUSDRequest) (*ccippb.DenoteInUSDResponse, error) { - usd, err := c.impl.DenoteInUSD(req.P.Int(), req.WrappedNativePrice.Int()) + usd, err := c.impl.DenoteInUSD(ctx, req.P.Int(), req.WrappedNativePrice.Int()) if err != nil { return nil, err } @@ -109,7 +109,7 @@ func (c *CommitGasEstimatorGRPCServer) DenoteInUSD(ctx context.Context, req *cci // Deviates implements ccippb.GasPriceEstimatorCommitServer. func (c *CommitGasEstimatorGRPCServer) Deviates(ctx context.Context, req *ccippb.DeviatesRequest) (*ccippb.DeviatesResponse, error) { - deviates, err := c.impl.Deviates(req.P1.Int(), req.P2.Int()) + deviates, err := c.impl.Deviates(ctx, req.P1.Int(), req.P2.Int()) if err != nil { return nil, err } @@ -127,7 +127,7 @@ func (c *CommitGasEstimatorGRPCServer) GetGasPrice(ctx context.Context, req *emp // Median implements ccippb.GasPriceEstimatorCommitServer. func (c *CommitGasEstimatorGRPCServer) Median(ctx context.Context, req *ccippb.MedianRequest) (*ccippb.MedianResponse, error) { - gasPrice, err := c.impl.Median(bigIntSlice(req.GasPrices)) + gasPrice, err := c.impl.Median(ctx, bigIntSlice(req.GasPrices)) if err != nil { return nil, err } @@ -174,8 +174,8 @@ func (e *ExecGasEstimatorGRPCClient) Close() error { } // DenoteInUSD implements ccip.GasPriceEstimatorExec. -func (e *ExecGasEstimatorGRPCClient) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { - resp, err := e.client.DenoteInUSD(context.Background(), &ccippb.DenoteInUSDRequest{ +func (e *ExecGasEstimatorGRPCClient) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { + resp, err := e.client.DenoteInUSD(ctx, &ccippb.DenoteInUSDRequest{ P: pb.NewBigIntFromInt(p), WrappedNativePrice: pb.NewBigIntFromInt(wrappedNativePrice), }) @@ -186,9 +186,9 @@ func (e *ExecGasEstimatorGRPCClient) DenoteInUSD(p *big.Int, wrappedNativePrice } // EstimateMsgCostUSD implements ccip.GasPriceEstimatorExec. -func (e *ExecGasEstimatorGRPCClient) EstimateMsgCostUSD(p *big.Int, wrappedNativePrice *big.Int, msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { +func (e *ExecGasEstimatorGRPCClient) EstimateMsgCostUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { msgPB := evm2EVMOnRampCCIPSendRequestedWithMeta(&msg) - resp, err := e.client.EstimateMsgCostUSD(context.Background(), &ccippb.EstimateMsgCostUSDRequest{ + resp, err := e.client.EstimateMsgCostUSD(ctx, &ccippb.EstimateMsgCostUSDRequest{ P: pb.NewBigIntFromInt(p), WrappedNativePrice: pb.NewBigIntFromInt(wrappedNativePrice), Msg: msgPB, @@ -209,8 +209,8 @@ func (e *ExecGasEstimatorGRPCClient) GetGasPrice(ctx context.Context) (*big.Int, } // Median implements ccip.GasPriceEstimatorExec. -func (e *ExecGasEstimatorGRPCClient) Median(gasPrices []*big.Int) (*big.Int, error) { - resp, err := e.client.Median(context.Background(), &ccippb.MedianRequest{ +func (e *ExecGasEstimatorGRPCClient) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { + resp, err := e.client.Median(ctx, &ccippb.MedianRequest{ GasPrices: bigIntSlicePB(gasPrices), }) if err != nil { @@ -221,7 +221,7 @@ func (e *ExecGasEstimatorGRPCClient) Median(gasPrices []*big.Int) (*big.Int, err // DenoteInUSD implements ccippb.GasPriceEstimatorExecServer. func (e *ExecGasEstimatorGRPCServer) DenoteInUSD(ctx context.Context, req *ccippb.DenoteInUSDRequest) (*ccippb.DenoteInUSDResponse, error) { - usd, err := e.impl.DenoteInUSD(req.P.Int(), req.WrappedNativePrice.Int()) + usd, err := e.impl.DenoteInUSD(ctx, req.P.Int(), req.WrappedNativePrice.Int()) if err != nil { return nil, err } @@ -234,7 +234,7 @@ func (e *ExecGasEstimatorGRPCServer) EstimateMsgCostUSD(ctx context.Context, req if err != nil { return nil, fmt.Errorf("failed to convert evm2evm msg: %w", err) } - cost, err := e.impl.EstimateMsgCostUSD(req.P.Int(), req.WrappedNativePrice.Int(), *msg) + cost, err := e.impl.EstimateMsgCostUSD(ctx, req.P.Int(), req.WrappedNativePrice.Int(), *msg) if err != nil { return nil, err } @@ -252,7 +252,7 @@ func (e *ExecGasEstimatorGRPCServer) GetGasPrice(ctx context.Context, req *empty // Median implements ccippb.GasPriceEstimatorExecServer. func (e *ExecGasEstimatorGRPCServer) Median(ctx context.Context, req *ccippb.MedianRequest) (*ccippb.MedianResponse, error) { - median, err := e.impl.Median(bigIntSlice(req.GasPrices)) + median, err := e.impl.Median(ctx, bigIntSlice(req.GasPrices)) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/offramp.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/offramp.go index c23b39582..e6f834bef 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/offramp.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/offramp.go @@ -60,9 +60,9 @@ type OffRampReaderGRPCServer struct { // NewOffRampReaderGRPCServer creates a new OffRampReaderGRPCServer. It is used by the relayer to serve the offramp reader service. // The server is created by wrapping a [cciptypes.OffRampReader] implementation. It requires a brokerExt to allocate and serve the gas estimator server. // *must* be the same broker used by the client. BCF-3061 -func NewOffRampReaderGRPCServer(impl cciptypes.OffRampReader, brokerExt *net.BrokerExt) (*OffRampReaderGRPCServer, error) { +func NewOffRampReaderGRPCServer(ctx context.Context, impl cciptypes.OffRampReader, brokerExt *net.BrokerExt) (*OffRampReaderGRPCServer, error) { // offramp reader server needs to serve the gas estimator server - estimator, err := impl.GasPriceEstimator(context.Background()) + estimator, err := impl.GasPriceEstimator(ctx) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_factory_server.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_factory_server.go index 2c9dc0e7f..265e31627 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_factory_server.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_factory_server.go @@ -69,12 +69,13 @@ func runCommitReportingPluginFactory(t *testing.T, factory types.ReportingPlugin } t.Run("ReportingPluginFactory", func(t *testing.T) { + ctx := tests.Context(t) // we expect the static implementation to be used under the covers // we can't compare the types directly because the returned reporting plugin may be a grpc client // that wraps the static implementation var expectedReportingPlugin = reportingplugintest.ReportingPlugin - rp, gotRPI, err := factory.NewReportingPlugin(reportingplugintest.Factory.ReportingPluginConfig) + rp, gotRPI, err := factory.NewReportingPlugin(ctx, reportingplugintest.Factory.ReportingPluginConfig) require.NoError(t, err) assert.Equal(t, rpi, gotRPI) t.Cleanup(func() { assert.NoError(t, rp.Close()) }) diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_gas_estimator.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_gas_estimator.go index 49eaf30c7..a1000c57f 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_gas_estimator.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_gas_estimator.go @@ -38,7 +38,7 @@ type staticGasPriceEstimatorCommit struct { var _ GasPriceEstimatorCommitEvaluator = staticGasPriceEstimatorCommit{} // DenoteInUSD implements GasPriceEstimatorCommitEvaluator. -func (s staticGasPriceEstimatorCommit) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { +func (s staticGasPriceEstimatorCommit) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { if s.denoteInUSDRequest.p.Cmp(p) != 0 { return nil, fmt.Errorf("expected p %v, got %v", s.denoteInUSDRequest.p, p) } @@ -49,7 +49,7 @@ func (s staticGasPriceEstimatorCommit) DenoteInUSD(p *big.Int, wrappedNativePric } // Deviates implements GasPriceEstimatorCommitEvaluator. -func (s staticGasPriceEstimatorCommit) Deviates(p1 *big.Int, p2 *big.Int) (bool, error) { +func (s staticGasPriceEstimatorCommit) Deviates(ctx context.Context, p1 *big.Int, p2 *big.Int) (bool, error) { if s.deviatesRequest.p1.Cmp(p1) != 0 { return false, fmt.Errorf("expected p1 %v, got %v", s.deviatesRequest.p1, p1) } @@ -69,7 +69,7 @@ func (s staticGasPriceEstimatorCommit) Evaluate(ctx context.Context, other ccipt return fmt.Errorf("expected other.GetGasPrice %v, got %v", s.getGasPriceResponse, gotGas) } - gotMedian, err := other.Median(s.medianRequest.gasPrices) + gotMedian, err := other.Median(ctx, s.medianRequest.gasPrices) if err != nil { return fmt.Errorf("failed to other.Median: %w", err) } @@ -77,7 +77,7 @@ func (s staticGasPriceEstimatorCommit) Evaluate(ctx context.Context, other ccipt return fmt.Errorf("expected other.Median %v, got %v", s.medianResponse, gotMedian) } - gotDeviates, err := other.Deviates(s.deviatesRequest.p1, s.deviatesRequest.p2) + gotDeviates, err := other.Deviates(ctx, s.deviatesRequest.p1, s.deviatesRequest.p2) if err != nil { return fmt.Errorf("failed to other.Deviates: %w", err) } @@ -85,7 +85,7 @@ func (s staticGasPriceEstimatorCommit) Evaluate(ctx context.Context, other ccipt return fmt.Errorf("expected other.Deviates %v, got %v", s.deviatesResponse, gotDeviates) } - gotDenoteInUSD, err := other.DenoteInUSD(s.denoteInUSDRequest.p, s.denoteInUSDRequest.wrappedNativePrice) + gotDenoteInUSD, err := other.DenoteInUSD(ctx, s.denoteInUSDRequest.p, s.denoteInUSDRequest.wrappedNativePrice) if err != nil { return fmt.Errorf("failed to other.DenoteInUSD: %w", err) } @@ -102,7 +102,7 @@ func (s staticGasPriceEstimatorCommit) GetGasPrice(ctx context.Context) (*big.In } // Median implements GasPriceEstimatorCommitEvaluator. -func (s staticGasPriceEstimatorCommit) Median(gasPrices []*big.Int) (*big.Int, error) { +func (s staticGasPriceEstimatorCommit) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { if len(gasPrices) != len(s.medianRequest.gasPrices) { return nil, fmt.Errorf("expected gas prices len %d, got %d", len(s.medianRequest.gasPrices), len(gasPrices)) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_gas_estimator_test.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_gas_estimator_test.go index 606088788..c49157dd6 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_gas_estimator_test.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_gas_estimator_test.go @@ -47,25 +47,22 @@ func roundTripGasPriceEstimatorCommitTests(t *testing.T, client *ccip.CommitGasE }) t.Run("DenoteInUSD", func(t *testing.T) { - usd, err := client.DenoteInUSD( - GasPriceEstimatorCommit.denoteInUSDRequest.p, - GasPriceEstimatorCommit.denoteInUSDRequest.wrappedNativePrice, - ) + ctx := tests.Context(t) + usd, err := client.DenoteInUSD(ctx, GasPriceEstimatorCommit.denoteInUSDRequest.p, GasPriceEstimatorCommit.denoteInUSDRequest.wrappedNativePrice) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorCommit.denoteInUSDResponse.result, usd) }) t.Run("Deviates", func(t *testing.T) { - isDeviant, err := client.Deviates( - GasPriceEstimatorCommit.deviatesRequest.p1, - GasPriceEstimatorCommit.deviatesRequest.p2, - ) + ctx := tests.Context(t) + isDeviant, err := client.Deviates(ctx, GasPriceEstimatorCommit.deviatesRequest.p1, GasPriceEstimatorCommit.deviatesRequest.p2) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorCommit.deviatesResponse, isDeviant) }) t.Run("Median", func(t *testing.T) { - median, err := client.Median(GasPriceEstimatorCommit.medianRequest.gasPrices) + ctx := tests.Context(t) + median, err := client.Median(ctx, GasPriceEstimatorCommit.medianRequest.gasPrices) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorCommit.medianResponse, median) }) diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_store_test.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_store_test.go index 89bb99763..246be2d75 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_store_test.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_store_test.go @@ -84,25 +84,22 @@ func roundTripCommitStoreTests(t *testing.T, client cciptypes.CommitStoreReader) }) t.Run("DenoteInUSD", func(t *testing.T) { - usd, err := estimator.DenoteInUSD( - GasPriceEstimatorCommit.denoteInUSDRequest.p, - GasPriceEstimatorCommit.denoteInUSDRequest.wrappedNativePrice, - ) + ctx := tests.Context(t) + usd, err := estimator.DenoteInUSD(ctx, GasPriceEstimatorCommit.denoteInUSDRequest.p, GasPriceEstimatorCommit.denoteInUSDRequest.wrappedNativePrice) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorCommit.denoteInUSDResponse.result, usd) }) t.Run("Deviates", func(t *testing.T) { - deviates, err := estimator.Deviates( - GasPriceEstimatorCommit.deviatesRequest.p1, - GasPriceEstimatorCommit.deviatesRequest.p2, - ) + ctx := tests.Context(t) + deviates, err := estimator.Deviates(ctx, GasPriceEstimatorCommit.deviatesRequest.p1, GasPriceEstimatorCommit.deviatesRequest.p2) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorCommit.deviatesResponse, deviates) }) t.Run("Median", func(t *testing.T) { - median, err := estimator.Median(GasPriceEstimatorCommit.medianRequest.gasPrices) + ctx := tests.Context(t) + median, err := estimator.Median(ctx, GasPriceEstimatorCommit.medianRequest.gasPrices) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorCommit.medianResponse, median) }) @@ -179,7 +176,8 @@ func roundTripCommitStoreTests(t *testing.T, client cciptypes.CommitStoreReader) } func setupCommitStoreServer(t *testing.T, s *grpc.Server, b *loopnet.BrokerExt) *ccip.CommitStoreGRPCServer { - commitProvider, err := ccip.NewCommitStoreReaderGRPCServer(CommitStoreReader, b) + ctx := tests.Context(t) + commitProvider, err := ccip.NewCommitStoreReaderGRPCServer(ctx, CommitStoreReader, b) require.NoError(t, err) ccippb.RegisterCommitStoreReaderServer(s, commitProvider) return commitProvider diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_factory_server.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_factory_server.go index de99c07e0..4c748d82a 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_factory_server.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_factory_server.go @@ -83,7 +83,7 @@ func runExecReportingPluginFactory(t *testing.T, factory types.ReportingPluginFa // that wraps the static implementation var expectedReportingPlugin = reportingplugintest.ReportingPlugin - rp, gotRPI, err := factory.NewReportingPlugin(reportingplugintest.Factory.ReportingPluginConfig) + rp, gotRPI, err := factory.NewReportingPlugin(tests.Context(t), reportingplugintest.Factory.ReportingPluginConfig) require.NoError(t, err) assert.Equal(t, rpi, gotRPI) t.Cleanup(func() { assert.NoError(t, rp.Close()) }) diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_gas_estimator.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_gas_estimator.go index 633e18c78..453b30b31 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_gas_estimator.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_gas_estimator.go @@ -53,7 +53,7 @@ type staticGasPriceEstimatorExec struct { } // EstimateMsgCostUSD implements GasPriceEstimatorExecEvaluator. -func (s staticGasPriceEstimatorExec) EstimateMsgCostUSD(p *big.Int, wrappedNativePrice *big.Int, msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { +func (s staticGasPriceEstimatorExec) EstimateMsgCostUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { if s.estimateMsgCostUSDRequest.p.Cmp(p) != 0 { return nil, fmt.Errorf("expected p %v, got %v", s.estimateMsgCostUSDRequest.p, p) } @@ -69,7 +69,7 @@ func (s staticGasPriceEstimatorExec) EstimateMsgCostUSD(p *big.Int, wrappedNativ var _ GasPriceEstimatorExecEvaluator = staticGasPriceEstimatorExec{} // DenoteInUSD implements GasPriceEstimatorExecEvaluator. -func (s staticGasPriceEstimatorExec) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { +func (s staticGasPriceEstimatorExec) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { if s.denoteInUSDRequest.p.Cmp(p) != 0 { return nil, fmt.Errorf("expected p %v, got %v", s.denoteInUSDRequest.p, p) } @@ -91,7 +91,7 @@ func (s staticGasPriceEstimatorExec) Evaluate(ctx context.Context, other cciptyp } // Median test case - gotMedian, err := other.Median(s.medianRequest.gasPrices) + gotMedian, err := other.Median(ctx, s.medianRequest.gasPrices) if err != nil { return fmt.Errorf("failed to other.Median: %w", err) } @@ -100,7 +100,7 @@ func (s staticGasPriceEstimatorExec) Evaluate(ctx context.Context, other cciptyp } // EstimateMsgCostUSD test case - gotEstimate, err := other.EstimateMsgCostUSD(s.estimateMsgCostUSDRequest.p, s.estimateMsgCostUSDRequest.wrappedNativePrice, s.estimateMsgCostUSDRequest.msg) + gotEstimate, err := other.EstimateMsgCostUSD(ctx, s.estimateMsgCostUSDRequest.p, s.estimateMsgCostUSDRequest.wrappedNativePrice, s.estimateMsgCostUSDRequest.msg) if err != nil { return fmt.Errorf("failed to other.EstimateMsgCostUSD: %w", err) } @@ -108,7 +108,7 @@ func (s staticGasPriceEstimatorExec) Evaluate(ctx context.Context, other cciptyp return fmt.Errorf("expected other.EstimateMsgCostUSD %v, got %v", s.estimateMsgCostUSDResponse, gotEstimate) } - gotDenoteInUSD, err := other.DenoteInUSD(s.denoteInUSDRequest.p, s.denoteInUSDRequest.wrappedNativePrice) + gotDenoteInUSD, err := other.DenoteInUSD(ctx, s.denoteInUSDRequest.p, s.denoteInUSDRequest.wrappedNativePrice) if err != nil { return fmt.Errorf("failed to other.DenoteInUSD: %w", err) } @@ -125,7 +125,7 @@ func (s staticGasPriceEstimatorExec) GetGasPrice(ctx context.Context) (*big.Int, } // Median implements GasPriceEstimatorExecEvaluator. -func (s staticGasPriceEstimatorExec) Median(gasPrices []*big.Int) (*big.Int, error) { +func (s staticGasPriceEstimatorExec) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { if len(gasPrices) != len(s.medianRequest.gasPrices) { return nil, fmt.Errorf("expected gas prices len %d, got %d", len(s.medianRequest.gasPrices), len(gasPrices)) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_gas_estimator_test.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_gas_estimator_test.go index a5e1c8ec1..00de54459 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_gas_estimator_test.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_gas_estimator_test.go @@ -47,26 +47,22 @@ func roundTripGasPriceEstimatorExecTests(t *testing.T, client *ccip.ExecGasEstim }) t.Run("DenoteInUSD", func(t *testing.T) { - usd, err := client.DenoteInUSD( - GasPriceEstimatorExec.denoteInUSDRequest.p, - GasPriceEstimatorExec.denoteInUSDRequest.wrappedNativePrice, - ) + ctx := tests.Context(t) + usd, err := client.DenoteInUSD(ctx, GasPriceEstimatorExec.denoteInUSDRequest.p, GasPriceEstimatorExec.denoteInUSDRequest.wrappedNativePrice) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorExec.denoteInUSDResponse.result, usd) }) t.Run("EstimateMsgCostUSD", func(t *testing.T) { - cost, err := client.EstimateMsgCostUSD( - GasPriceEstimatorExec.estimateMsgCostUSDRequest.p, - GasPriceEstimatorExec.estimateMsgCostUSDRequest.wrappedNativePrice, - GasPriceEstimatorExec.estimateMsgCostUSDRequest.msg, - ) + ctx := tests.Context(t) + cost, err := client.EstimateMsgCostUSD(ctx, GasPriceEstimatorExec.estimateMsgCostUSDRequest.p, GasPriceEstimatorExec.estimateMsgCostUSDRequest.wrappedNativePrice, GasPriceEstimatorExec.estimateMsgCostUSDRequest.msg) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorExec.estimateMsgCostUSDResponse, cost) }) t.Run("Median", func(t *testing.T) { - median, err := client.Median(GasPriceEstimatorExec.medianRequest.gasPrices) + ctx := tests.Context(t) + median, err := client.Median(ctx, GasPriceEstimatorExec.medianRequest.gasPrices) require.NoError(t, err) assert.Equal(t, GasPriceEstimatorExec.medianResponse, median) }) diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/offramp.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/offramp.go index 580f21e8e..ff85e7af1 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/offramp.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/offramp.go @@ -375,7 +375,7 @@ func (s staticOffRamp) Evaluate(ctx context.Context, other ccip.OffRampReader) e return fmt.Errorf("expected gasPrice %v but got %v", GasPriceEstimatorExec.getGasPriceResponse, price) } // DenoteInUSD test case - gotUsd, err := gasPriceEstimator.DenoteInUSD(GasPriceEstimatorExec.denoteInUSDRequest.p, GasPriceEstimatorExec.denoteInUSDRequest.wrappedNativePrice) + gotUsd, err := gasPriceEstimator.DenoteInUSD(ctx, GasPriceEstimatorExec.denoteInUSDRequest.p, GasPriceEstimatorExec.denoteInUSDRequest.wrappedNativePrice) if err != nil { return fmt.Errorf("failed to get other usd: %w", err) } @@ -383,11 +383,7 @@ func (s staticOffRamp) Evaluate(ctx context.Context, other ccip.OffRampReader) e return fmt.Errorf("expected usd %v but got %v", GasPriceEstimatorExec.denoteInUSDResponse.result, gotUsd) } // EstimateMsgCostUSD test case - cost, err := gasPriceEstimator.EstimateMsgCostUSD( - GasPriceEstimatorExec.estimateMsgCostUSDRequest.p, - GasPriceEstimatorExec.estimateMsgCostUSDRequest.wrappedNativePrice, - GasPriceEstimatorExec.estimateMsgCostUSDRequest.msg, - ) + cost, err := gasPriceEstimator.EstimateMsgCostUSD(ctx, GasPriceEstimatorExec.estimateMsgCostUSDRequest.p, GasPriceEstimatorExec.estimateMsgCostUSDRequest.wrappedNativePrice, GasPriceEstimatorExec.estimateMsgCostUSDRequest.msg) if err != nil { return fmt.Errorf("failed to get other cost: %w", err) } @@ -395,7 +391,7 @@ func (s staticOffRamp) Evaluate(ctx context.Context, other ccip.OffRampReader) e return fmt.Errorf("expected cost %v but got %v", GasPriceEstimatorExec.estimateMsgCostUSDResponse, cost) } // Median test case - median, err := gasPriceEstimator.Median(GasPriceEstimatorExec.medianRequest.gasPrices) + median, err := gasPriceEstimator.Median(ctx, GasPriceEstimatorExec.medianRequest.gasPrices) if err != nil { return fmt.Errorf("failed to get other median: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/offramp_test.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/offramp_test.go index 2390cd619..b18041940 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/offramp_test.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/offramp_test.go @@ -153,7 +153,8 @@ func roundTripOffRampTests(t *testing.T, client cciptypes.OffRampReader) { } func setupOffRampServer(t *testing.T, s *grpc.Server, b *loopnet.BrokerExt) *ccip.OffRampReaderGRPCServer { - offRampProvider, err := ccip.NewOffRampReaderGRPCServer(OffRampReader, b) + ctx := tests.Context(t) + offRampProvider, err := ccip.NewOffRampReaderGRPCServer(ctx, OffRampReader, b) require.NoError(t, err) ccippb.RegisterOffRampReaderServer(s, offRampProvider) return offRampProvider diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/median/median.go b/pkg/loop/internal/relayer/pluginprovider/ext/median/median.go index 35f6c68d3..9282a48fd 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/median/median.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/median/median.go @@ -43,43 +43,43 @@ func NewProviderClient(b *net.BrokerExt, cc grpc.ClientConnInterface) *ProviderC m.reportCodec = &reportCodecClient{b, pb.NewReportCodecClient(cc)} m.medianContract = &medianContractClient{pb.NewMedianContractClient(cc)} m.onchainConfigCodec = &onchainConfigCodecClient{b, pb.NewOnchainConfigCodecClient(cc)} + m.contractReader = contractreader.NewClient(b, cc) + m.codec = contractreader.NewCodecClient(b, cc) + return m +} - maybeCr := contractreader.NewClient(b, cc) +// RmUnimplemented sets the ContractReader and Codec clients to nil, if they are not implemented. +func (p *ProviderClient) RmUnimplemented(ctx context.Context) { var anyRetVal int - - err := maybeCr.GetLatestValue(context.Background(), "", primitives.Unconfirmed, nil, &anyRetVal) - - if status.Convert(err).Code() != codes.Unimplemented { - m.contractReader = maybeCr + err := p.contractReader.GetLatestValue(ctx, "", primitives.Unconfirmed, nil, &anyRetVal) + if status.Convert(err).Code() == codes.Unimplemented { + p.contractReader = nil } - maybeCodec := contractreader.NewCodecClient(b, cc) - err = maybeCodec.Decode(context.Background(), []byte{}, &anyRetVal, "") - if status.Convert(err).Code() != codes.Unimplemented { - m.codec = maybeCodec + err = p.codec.Decode(ctx, []byte{}, &anyRetVal, "") + if status.Convert(err).Code() == codes.Unimplemented { + p.codec = nil } - - return m } -func (m *ProviderClient) ReportCodec() median.ReportCodec { - return m.reportCodec +func (p *ProviderClient) ReportCodec() median.ReportCodec { + return p.reportCodec } -func (m *ProviderClient) MedianContract() median.MedianContract { - return m.medianContract +func (p *ProviderClient) MedianContract() median.MedianContract { + return p.medianContract } -func (m *ProviderClient) OnchainConfigCodec() median.OnchainConfigCodec { - return m.onchainConfigCodec +func (p *ProviderClient) OnchainConfigCodec() median.OnchainConfigCodec { + return p.onchainConfigCodec } func (m *ProviderClient) ContractReader() types.ContractReader { return m.contractReader } -func (m *ProviderClient) Codec() types.Codec { - return m.codec +func (p *ProviderClient) Codec() types.Codec { + return p.codec } var _ median.ReportCodec = (*reportCodecClient)(nil) @@ -89,9 +89,7 @@ type reportCodecClient struct { grpc pb.ReportCodecClient } -func (r *reportCodecClient) BuildReport(observations []median.ParsedAttributedObservation) (report libocr.Report, err error) { - ctx, cancel := r.StopCtx() - defer cancel() +func (r *reportCodecClient) BuildReport(ctx context.Context, observations []median.ParsedAttributedObservation) (report libocr.Report, err error) { var req pb.BuildReportRequest for _, o := range observations { req.Observations = append(req.Observations, &pb.ParsedAttributedObservation{ @@ -111,9 +109,7 @@ func (r *reportCodecClient) BuildReport(observations []median.ParsedAttributedOb return } -func (r *reportCodecClient) MedianFromReport(report libocr.Report) (*big.Int, error) { - ctx, cancel := r.StopCtx() - defer cancel() +func (r *reportCodecClient) MedianFromReport(ctx context.Context, report libocr.Report) (*big.Int, error) { reply, err := r.grpc.MedianFromReport(ctx, &pb.MedianFromReportRequest{Report: report}) if err != nil { return nil, err @@ -121,9 +117,7 @@ func (r *reportCodecClient) MedianFromReport(report libocr.Report) (*big.Int, er return reply.Median.Int(), nil } -func (r *reportCodecClient) MaxReportLength(n int) (int, error) { - ctx, cancel := r.StopCtx() - defer cancel() +func (r *reportCodecClient) MaxReportLength(ctx context.Context, n int) (int, error) { reply, err := r.grpc.MaxReportLength(ctx, &pb.MaxReportLengthRequest{N: int64(n)}) if err != nil { return -1, err @@ -153,7 +147,7 @@ func (r *reportCodecServer) BuildReport(ctx context.Context, request *pb.BuildRe Observer: commontypes.OracleID(o.Observer), }) } - report, err := r.impl.BuildReport(obs) + report, err := r.impl.BuildReport(ctx, obs) if err != nil { return nil, err } @@ -161,7 +155,7 @@ func (r *reportCodecServer) BuildReport(ctx context.Context, request *pb.BuildRe } func (r *reportCodecServer) MedianFromReport(ctx context.Context, request *pb.MedianFromReportRequest) (*pb.MedianFromReportReply, error) { - m, err := r.impl.MedianFromReport(request.Report) + m, err := r.impl.MedianFromReport(ctx, request.Report) if err != nil { return nil, err } @@ -169,7 +163,7 @@ func (r *reportCodecServer) MedianFromReport(ctx context.Context, request *pb.Me } func (r *reportCodecServer) MaxReportLength(ctx context.Context, request *pb.MaxReportLengthRequest) (*pb.MaxReportLengthReply, error) { - l, err := r.impl.MaxReportLength(int(request.N)) + l, err := r.impl.MaxReportLength(ctx, int(request.N)) if err != nil { return nil, err } @@ -265,9 +259,7 @@ type onchainConfigCodecClient struct { grpc pb.OnchainConfigCodecClient } -func (o *onchainConfigCodecClient) Encode(config median.OnchainConfig) ([]byte, error) { - ctx, cancel := o.StopCtx() - defer cancel() +func (o *onchainConfigCodecClient) Encode(ctx context.Context, config median.OnchainConfig) ([]byte, error) { req := &pb.EncodeRequest{OnchainConfig: &pb.OnchainConfig{ Min: pb.NewBigIntFromInt(config.Min), Max: pb.NewBigIntFromInt(config.Max), @@ -279,9 +271,7 @@ func (o *onchainConfigCodecClient) Encode(config median.OnchainConfig) ([]byte, return reply.Encoded, nil } -func (o *onchainConfigCodecClient) Decode(bytes []byte) (oc median.OnchainConfig, err error) { - ctx, cancel := o.StopCtx() - defer cancel() +func (o *onchainConfigCodecClient) Decode(ctx context.Context, bytes []byte) (oc median.OnchainConfig, err error) { var reply *pb.DecodeReply reply, err = o.grpc.Decode(ctx, &pb.DecodeRequest{Encoded: bytes}) if err != nil { @@ -300,7 +290,7 @@ type onchainConfigCodecServer struct { func (o *onchainConfigCodecServer) Encode(ctx context.Context, request *pb.EncodeRequest) (*pb.EncodeReply, error) { min, max := request.OnchainConfig.Min.Int(), request.OnchainConfig.Max.Int() - b, err := o.impl.Encode(median.OnchainConfig{Max: max, Min: min}) + b, err := o.impl.Encode(ctx, median.OnchainConfig{Max: max, Min: min}) if err != nil { return nil, err } @@ -308,7 +298,7 @@ func (o *onchainConfigCodecServer) Encode(ctx context.Context, request *pb.Encod } func (o *onchainConfigCodecServer) Decode(ctx context.Context, request *pb.DecodeRequest) (*pb.DecodeReply, error) { - oc, err := o.impl.Decode(request.Encoded) + oc, err := o.impl.Decode(ctx, request.Encoded) if err != nil { return nil, err } @@ -322,7 +312,9 @@ type ProviderServer struct{} func (m ProviderServer) ConnToProvider(conn grpc.ClientConnInterface, broker net.Broker, brokerCfg net.BrokerConfig) types.MedianProvider { be := &net.BrokerExt{Broker: broker, BrokerConfig: brokerCfg} - return NewProviderClient(be, conn) + pc := NewProviderClient(be, conn) + pc.RmUnimplemented(context.Background()) + return pc } func RegisterProviderServices(s *grpc.Server, provider types.MedianProvider) { diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/median/test/median.go b/pkg/loop/internal/relayer/pluginprovider/ext/median/test/median.go index dd7623d2a..2c210d564 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/median/test/median.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/median/test/median.go @@ -58,7 +58,7 @@ func ReportingPluginFactory(t *testing.T, factory types.ReportingPluginFactory) // that wraps the static implementation var expectedReportingPlugin = reportingplugintest.ReportingPlugin - rp, gotRPI, err := factory.NewReportingPlugin(reportingPluginConfig) + rp, gotRPI, err := factory.NewReportingPlugin(tests.Context(t), reportingPluginConfig) require.NoError(t, err) assert.Equal(t, rpi, gotRPI) t.Cleanup(func() { assert.NoError(t, rp.Close()) }) @@ -142,7 +142,7 @@ func (s staticReportingPluginFactory) Ready() error { panic("implement me") } func (s staticReportingPluginFactory) HealthReport() map[string]error { panic("implement me") } -func (s staticReportingPluginFactory) NewReportingPlugin(config libocr.ReportingPluginConfig) (libocr.ReportingPlugin, libocr.ReportingPluginInfo, error) { +func (s staticReportingPluginFactory) NewReportingPlugin(ctx context.Context, config libocr.ReportingPluginConfig) (libocr.ReportingPlugin, libocr.ReportingPluginInfo, error) { if config.ConfigDigest != s.ConfigDigest { return nil, libocr.ReportingPluginInfo{}, fmt.Errorf("expected ConfigDigest %x but got %x", s.ConfigDigest, config.ConfigDigest) } @@ -329,21 +329,21 @@ var _ testtypes.Evaluator[median.ReportCodec] = staticReportCodec{} var _ median.ReportCodec = staticReportCodec{} // TODO BCF-3068 remove hard coded values, use the staticXXXConfig pattern elsewhere in the test framework -func (s staticReportCodec) BuildReport(os []median.ParsedAttributedObservation) (libocr.Report, error) { +func (s staticReportCodec) BuildReport(ctx context.Context, os []median.ParsedAttributedObservation) (libocr.Report, error) { if !assert.ObjectsAreEqual(pobs, os) { return nil, fmt.Errorf("expected observations %v but got %v", pobs, os) } return report, nil } -func (s staticReportCodec) MedianFromReport(r libocr.Report) (*big.Int, error) { +func (s staticReportCodec) MedianFromReport(ctx context.Context, r libocr.Report) (*big.Int, error) { if !bytes.Equal(report, r) { return nil, fmt.Errorf("expected report %x but got %x", report, r) } return medianValue, nil } -func (s staticReportCodec) MaxReportLength(n2 int) (int, error) { +func (s staticReportCodec) MaxReportLength(ctx context.Context, n2 int) (int, error) { if n != n2 { return -1, fmt.Errorf("expected n %d but got %d", n, n2) } @@ -351,21 +351,21 @@ func (s staticReportCodec) MaxReportLength(n2 int) (int, error) { } func (s staticReportCodec) Evaluate(ctx context.Context, rc median.ReportCodec) error { - gotReport, err := rc.BuildReport(pobs) + gotReport, err := rc.BuildReport(ctx, pobs) if err != nil { return fmt.Errorf("failed to BuildReport: %w", err) } if !bytes.Equal(gotReport, report) { return fmt.Errorf("expected Report %x but got %x", report, gotReport) } - gotMedianValue, err := rc.MedianFromReport(report) + gotMedianValue, err := rc.MedianFromReport(ctx, report) if err != nil { return fmt.Errorf("failed to get MedianFromReport: %w", err) } if medianValue.Cmp(gotMedianValue) != 0 { return fmt.Errorf("expected MedianValue %s but got %s", medianValue, gotMedianValue) } - gotMax, err := rc.MaxReportLength(n) + gotMax, err := rc.MaxReportLength(ctx, n) if err != nil { return fmt.Errorf("failed to get MaxReportLength: %w", err) } @@ -446,7 +446,7 @@ type staticOnchainConfigCodec struct{} var _ testtypes.Evaluator[median.OnchainConfigCodec] = staticOnchainConfigCodec{} var _ median.OnchainConfigCodec = staticOnchainConfigCodec{} -func (s staticOnchainConfigCodec) Encode(c median.OnchainConfig) ([]byte, error) { +func (s staticOnchainConfigCodec) Encode(ctx context.Context, c median.OnchainConfig) ([]byte, error) { if !assert.ObjectsAreEqual(onchainConfig.Max, c.Max) { return nil, fmt.Errorf("expected max %s but got %s", onchainConfig.Max, c.Max) } @@ -456,7 +456,7 @@ func (s staticOnchainConfigCodec) Encode(c median.OnchainConfig) ([]byte, error) return encodedOnchainConfig, nil } -func (s staticOnchainConfigCodec) Decode(b []byte) (median.OnchainConfig, error) { +func (s staticOnchainConfigCodec) Decode(ctx context.Context, b []byte) (median.OnchainConfig, error) { if !bytes.Equal(encodedOnchainConfig, b) { return median.OnchainConfig{}, fmt.Errorf("expected encoded %x but got %x", encodedOnchainConfig, b) } @@ -464,14 +464,14 @@ func (s staticOnchainConfigCodec) Decode(b []byte) (median.OnchainConfig, error) } func (s staticOnchainConfigCodec) Evaluate(ctx context.Context, occ median.OnchainConfigCodec) error { - gotEncoded, err := occ.Encode(onchainConfig) + gotEncoded, err := occ.Encode(ctx, onchainConfig) if err != nil { return fmt.Errorf("failed to Encode: %w", err) } if !bytes.Equal(gotEncoded, encodedOnchainConfig) { return fmt.Errorf("expected Encoded %s but got %s", encodedOnchainConfig, gotEncoded) } - gotDecoded, err := occ.Decode(encodedOnchainConfig) + gotDecoded, err := occ.Decode(ctx, encodedOnchainConfig) if err != nil { return fmt.Errorf("failed to Decode: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/onchainconfig.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/onchainconfig.go index ad8a70fa2..a660d1a56 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/onchainconfig.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/onchainconfig.go @@ -20,8 +20,8 @@ func newOnchainConfigCodecClient(cc grpc.ClientConnInterface) *onchainConfigCode return &onchainConfigCodecClient{grpc: mercury_pb.NewOnchainConfigCodecClient(cc)} } -func (o *onchainConfigCodecClient) Encode(config mercury_types.OnchainConfig) ([]byte, error) { - reply, err := o.grpc.Encode(context.TODO(), &mercury_pb.EncodeOnchainConfigRequest{ +func (o *onchainConfigCodecClient) Encode(ctx context.Context, config mercury_types.OnchainConfig) ([]byte, error) { + reply, err := o.grpc.Encode(ctx, &mercury_pb.EncodeOnchainConfigRequest{ OnchainConfig: pbOnchainConfig(config), }) if err != nil { @@ -30,8 +30,8 @@ func (o *onchainConfigCodecClient) Encode(config mercury_types.OnchainConfig) ([ return reply.OnchainConfig, nil } -func (o *onchainConfigCodecClient) Decode(data []byte) (mercury_types.OnchainConfig, error) { - reply, err := o.grpc.Decode(context.TODO(), &mercury_pb.DecodeOnchainConfigRequest{ +func (o *onchainConfigCodecClient) Decode(ctx context.Context, data []byte) (mercury_types.OnchainConfig, error) { + reply, err := o.grpc.Decode(ctx, &mercury_pb.DecodeOnchainConfigRequest{ OnchainConfig: data, }) if err != nil { @@ -67,7 +67,7 @@ func newOnchainConfigCodecServer(impl mercury_types.OnchainConfigCodec) *onchain } func (o *onchainConfigCodecServer) Encode(ctx context.Context, request *mercury_pb.EncodeOnchainConfigRequest) (*mercury_pb.EncodeOnchainConfigReply, error) { - val, err := o.impl.Encode(onchainConfig(request.OnchainConfig)) + val, err := o.impl.Encode(ctx, onchainConfig(request.OnchainConfig)) if err != nil { return nil, err } @@ -75,7 +75,7 @@ func (o *onchainConfigCodecServer) Encode(ctx context.Context, request *mercury_ } func (o *onchainConfigCodecServer) Decode(ctx context.Context, request *mercury_pb.DecodeOnchainConfigRequest) (*mercury_pb.DecodeOnchainConfigReply, error) { - val, err := o.impl.Decode(request.OnchainConfig) + val, err := o.impl.Decode(ctx, request.OnchainConfig) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/reportcodec.go index 77ae71c5e..f8fe12cb9 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/reportcodec.go @@ -64,16 +64,16 @@ func newReportCodecV4Client(impl *mercury_v4_internal.ReportCodecClient) mercury return &reportCodecV4Client{impl: impl} } -func (r *reportCodecV4Client) BuildReport(fields mercury_v4_types.ReportFields) (ocr2plus_types.Report, error) { - return r.impl.BuildReport(fields) +func (r *reportCodecV4Client) BuildReport(ctx context.Context, fields mercury_v4_types.ReportFields) (ocr2plus_types.Report, error) { + return r.impl.BuildReport(ctx, fields) } -func (r *reportCodecV4Client) MaxReportLength(n int) (int, error) { - return r.impl.MaxReportLength(n) +func (r *reportCodecV4Client) MaxReportLength(ctx context.Context, n int) (int, error) { + return r.impl.MaxReportLength(ctx, n) } -func (r *reportCodecV4Client) ObservationTimestampFromReport(report ocr2plus_types.Report) (uint32, error) { - return r.impl.ObservationTimestampFromReport(report) +func (r *reportCodecV4Client) ObservationTimestampFromReport(ctx context.Context, report ocr2plus_types.Report) (uint32, error) { + return r.impl.ObservationTimestampFromReport(ctx, report) } // reportCodecV3Server implements mercury_pb.ReportCodecV3Server by wrapping [mercury_v3_internal.ReportCodecServer] @@ -116,16 +116,16 @@ func newReportCodecV3Client(impl *mercury_v3_internal.ReportCodecClient) mercury return &reportCodecV3Client{impl: impl} } -func (r *reportCodecV3Client) BuildReport(fields mercury_v3_types.ReportFields) (ocr2plus_types.Report, error) { - return r.impl.BuildReport(fields) +func (r *reportCodecV3Client) BuildReport(ctx context.Context, fields mercury_v3_types.ReportFields) (ocr2plus_types.Report, error) { + return r.impl.BuildReport(ctx, fields) } -func (r *reportCodecV3Client) MaxReportLength(n int) (int, error) { - return r.impl.MaxReportLength(n) +func (r *reportCodecV3Client) MaxReportLength(ctx context.Context, n int) (int, error) { + return r.impl.MaxReportLength(ctx, n) } -func (r *reportCodecV3Client) ObservationTimestampFromReport(report ocr2plus_types.Report) (uint32, error) { - return r.impl.ObservationTimestampFromReport(report) +func (r *reportCodecV3Client) ObservationTimestampFromReport(ctx context.Context, report ocr2plus_types.Report) (uint32, error) { + return r.impl.ObservationTimestampFromReport(ctx, report) } // reportCodecV2Server implements mercury_pb.ReportCodecV2Server by wrapping [mercury_v2_internal.ReportCodecServer] @@ -166,16 +166,16 @@ func newReportCodecV2Client(impl *mercury_v2_internal.ReportCodecClient) mercury return &reportCodecV2Client{impl: impl} } -func (r *reportCodecV2Client) BuildReport(fields mercury_v2_types.ReportFields) (ocr2plus_types.Report, error) { - return r.impl.BuildReport(fields) +func (r *reportCodecV2Client) BuildReport(ctx context.Context, fields mercury_v2_types.ReportFields) (ocr2plus_types.Report, error) { + return r.impl.BuildReport(ctx, fields) } -func (r *reportCodecV2Client) MaxReportLength(n int) (int, error) { - return r.impl.MaxReportLength(n) +func (r *reportCodecV2Client) MaxReportLength(ctx context.Context, n int) (int, error) { + return r.impl.MaxReportLength(ctx, n) } -func (r *reportCodecV2Client) ObservationTimestampFromReport(report ocr2plus_types.Report) (uint32, error) { - return r.impl.ObservationTimestampFromReport(report) +func (r *reportCodecV2Client) ObservationTimestampFromReport(ctx context.Context, report ocr2plus_types.Report) (uint32, error) { + return r.impl.ObservationTimestampFromReport(ctx, report) } // reportCodecV1Server implements mercury_pb.ReportCodecV1Server by wrapping [mercury_v1_internal.ReportCodecServer] @@ -216,14 +216,14 @@ func newReportCodecV1Client(impl *mercury_v1_internal.ReportCodecClient) mercury return &reportCodecV1Client{impl: impl} } -func (r *reportCodecV1Client) BuildReport(fields mercury_v1_types.ReportFields) (ocr2plus_types.Report, error) { - return r.impl.BuildReport(fields) +func (r *reportCodecV1Client) BuildReport(ctx context.Context, fields mercury_v1_types.ReportFields) (ocr2plus_types.Report, error) { + return r.impl.BuildReport(ctx, fields) } -func (r *reportCodecV1Client) MaxReportLength(n int) (int, error) { - return r.impl.MaxReportLength(n) +func (r *reportCodecV1Client) MaxReportLength(ctx context.Context, n int) (int, error) { + return r.impl.MaxReportLength(ctx, n) } -func (r *reportCodecV1Client) CurrentBlockNumFromReport(report ocr2plus_types.Report) (int64, error) { - return r.impl.CurrentBlockNumFromReport(report) +func (r *reportCodecV1Client) CurrentBlockNumFromReport(ctx context.Context, report ocr2plus_types.Report) (int64, error) { + return r.impl.CurrentBlockNumFromReport(ctx, report) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/mercury.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/mercury.go index dd95594da..da65e12a5 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/mercury.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/mercury.go @@ -232,7 +232,7 @@ func (s staticMercuryPluginFactory) Ready() error { panic("implement me") } func (s staticMercuryPluginFactory) HealthReport() map[string]error { panic("implement me") } -func (s staticMercuryPluginFactory) NewMercuryPlugin(config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { +func (s staticMercuryPluginFactory) NewMercuryPlugin(ctx context.Context, config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { if config.ConfigDigest != mercuryPluginConfig.ConfigDigest { return nil, ocr3types.MercuryPluginInfo{}, fmt.Errorf("expected ConfigDigest %x but got %x", mercuryPluginConfig.ConfigDigest, config.ConfigDigest) } @@ -266,7 +266,7 @@ func MercuryPluginFactory(t *testing.T, factory types.MercuryPluginFactory) { expectedMercuryPlugin := OCR3Plugin t.Run("ReportingPluginFactory", func(t *testing.T) { ctx := tests.Context(t) - rp, gotRPI, err := factory.NewMercuryPlugin(mercuryPluginConfig) + rp, gotRPI, err := factory.NewMercuryPlugin(ctx, mercuryPluginConfig) require.NoError(t, err) assert.Equal(t, mercuryPluginInfo, gotRPI) t.Cleanup(func() { assert.NoError(t, rp.Close()) }) diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/ocr_plugin.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/ocr_plugin.go index 6aa7983a2..9ef835e10 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/ocr_plugin.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/ocr_plugin.go @@ -80,7 +80,7 @@ func (s staticMercuryPlugin) Observation(ctx context.Context, timestamp libocr.R return s.observationResponse.observation, nil } -func (s staticMercuryPlugin) Report(timestamp libocr.ReportTimestamp, previousReport libocr.Report, observations []libocr.AttributedObservation) (bool, libocr.Report, error) { +func (s staticMercuryPlugin) Report(ctx context.Context, timestamp libocr.ReportTimestamp, previousReport libocr.Report, observations []libocr.AttributedObservation) (bool, libocr.Report, error) { if timestamp != s.reportRequest.reportTimestamp { return false, nil, fmt.Errorf("expected report timestamp %v but got %v", s.reportRequest.reportTimestamp, timestamp) } @@ -99,7 +99,7 @@ func (s staticMercuryPlugin) AssertEqual(ctx context.Context, t *testing.T, othe gotObs, err := other.Observation(ctx, s.observationRequest.reportTimestamp, s.observationRequest.previousReport) require.NoError(t, err) assert.Equal(t, s.observationResponse.observation, gotObs) - gotOk, gotReport, err := other.Report(s.reportRequest.reportTimestamp, s.reportRequest.previousReport, s.reportRequest.observations) + gotOk, gotReport, err := other.Report(ctx, s.reportRequest.reportTimestamp, s.reportRequest.previousReport, s.reportRequest.observations) require.NoError(t, err) assert.Equal(t, s.reportResponse.shouldReport, gotOk) assert.Equal(t, s.reportResponse.report, gotReport) diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/onchainconfig.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/onchainconfig.go index 3ceba9ef7..1769d4705 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/onchainconfig.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/onchainconfig.go @@ -39,7 +39,7 @@ type staticOnchainConfigCodec struct { var _ OnchainConfigCodecEvaluator = staticOnchainConfigCodec{} -func (staticOnchainConfigCodec) Encode(c mercury_types.OnchainConfig) ([]byte, error) { +func (staticOnchainConfigCodec) Encode(ctx context.Context, c mercury_types.OnchainConfig) ([]byte, error) { if !reflect.DeepEqual(c, StaticOnChainConfigCodecFixtures.Decoded) { return nil, fmt.Errorf("expected OnchainConfig %v but got %v", StaticOnChainConfigCodecFixtures.Decoded, c) } @@ -47,12 +47,12 @@ func (staticOnchainConfigCodec) Encode(c mercury_types.OnchainConfig) ([]byte, e return StaticOnChainConfigCodecFixtures.Encoded, nil } -func (staticOnchainConfigCodec) Decode([]byte) (mercury_types.OnchainConfig, error) { +func (staticOnchainConfigCodec) Decode(context.Context, []byte) (mercury_types.OnchainConfig, error) { return StaticOnChainConfigCodecFixtures.Decoded, nil } func (staticOnchainConfigCodec) Evaluate(ctx context.Context, other mercury_types.OnchainConfigCodec) error { - encoded, err := other.Encode(StaticOnChainConfigCodecFixtures.Decoded) + encoded, err := other.Encode(ctx, StaticOnChainConfigCodecFixtures.Decoded) if err != nil { return fmt.Errorf("failed to encode: %w", err) } @@ -60,7 +60,7 @@ func (staticOnchainConfigCodec) Evaluate(ctx context.Context, other mercury_type return fmt.Errorf("expected encoded %x but got %x", StaticOnChainConfigCodecFixtures.Encoded, encoded) } - decoded, err := other.Decode(StaticOnChainConfigCodecFixtures.Encoded) + decoded, err := other.Decode(ctx, StaticOnChainConfigCodecFixtures.Encoded) if err != nil { return fmt.Errorf("failed to decode: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v1/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v1/reportcodec.go index b46220847..7fd67c37f 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v1/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v1/reportcodec.go @@ -23,8 +23,8 @@ func NewReportCodecClient(cc grpc.ClientConnInterface) *ReportCodecClient { return &ReportCodecClient{grpc: mercury_v1_pb.NewReportCodecClient(cc)} } -func (r *ReportCodecClient) BuildReport(fields mercury_v1_types.ReportFields) (ocr2plus_types.Report, error) { - reply, err := r.grpc.BuildReport(context.TODO(), &mercury_v1_pb.BuildReportRequest{ +func (r *ReportCodecClient) BuildReport(ctx context.Context, fields mercury_v1_types.ReportFields) (ocr2plus_types.Report, error) { + reply, err := r.grpc.BuildReport(ctx, &mercury_v1_pb.BuildReportRequest{ ReportFields: pbReportFields(fields), }) if err != nil { @@ -33,16 +33,16 @@ func (r *ReportCodecClient) BuildReport(fields mercury_v1_types.ReportFields) (o return reply.Report, nil } -func (r *ReportCodecClient) MaxReportLength(n int) (int, error) { - reply, err := r.grpc.MaxReportLength(context.TODO(), &mercury_v1_pb.MaxReportLengthRequest{}) +func (r *ReportCodecClient) MaxReportLength(ctx context.Context, n int) (int, error) { + reply, err := r.grpc.MaxReportLength(ctx, &mercury_v1_pb.MaxReportLengthRequest{}) if err != nil { return 0, err } return int(reply.MaxReportLength), nil } -func (r *ReportCodecClient) CurrentBlockNumFromReport(report ocr2plus_types.Report) (int64, error) { - reply, err := r.grpc.CurrentBlockNumFromReport(context.TODO(), &mercury_v1_pb.CurrentBlockNumFromReportRequest{ +func (r *ReportCodecClient) CurrentBlockNumFromReport(ctx context.Context, report ocr2plus_types.Report) (int64, error) { + reply, err := r.grpc.CurrentBlockNumFromReport(ctx, &mercury_v1_pb.CurrentBlockNumFromReportRequest{ Report: report, }) if err != nil { @@ -76,7 +76,7 @@ func NewReportCodecServer(impl mercury_v1_types.ReportCodec) *ReportCodecServer } func (r *ReportCodecServer) BuildReport(ctx context.Context, request *mercury_v1_pb.BuildReportRequest) (*mercury_v1_pb.BuildReportReply, error) { - report, err := r.impl.BuildReport(reportFields(request.ReportFields)) + report, err := r.impl.BuildReport(ctx, reportFields(request.ReportFields)) if err != nil { return nil, err } @@ -84,7 +84,7 @@ func (r *ReportCodecServer) BuildReport(ctx context.Context, request *mercury_v1 } func (r *ReportCodecServer) MaxReportLength(ctx context.Context, request *mercury_v1_pb.MaxReportLengthRequest) (*mercury_v1_pb.MaxReportLengthReply, error) { - n, err := r.impl.MaxReportLength(int(request.NumOracles)) + n, err := r.impl.MaxReportLength(ctx, int(request.NumOracles)) if err != nil { return nil, err } @@ -92,7 +92,7 @@ func (r *ReportCodecServer) MaxReportLength(ctx context.Context, request *mercur } func (r *ReportCodecServer) CurrentBlockNumFromReport(ctx context.Context, request *mercury_v1_pb.CurrentBlockNumFromReportRequest) (*mercury_v1_pb.CurrentBlockNumFromReportResponse, error) { - n, err := r.impl.CurrentBlockNumFromReport(request.Report) + n, err := r.impl.CurrentBlockNumFromReport(ctx, request.Report) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v1/test/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v1/test/reportcodec.go index 8449c4214..e95326962 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v1/test/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v1/test/reportcodec.go @@ -22,37 +22,37 @@ type staticReportCodec struct{} var _ mercury_v1_types.ReportCodec = staticReportCodec{} -func (s staticReportCodec) BuildReport(fields mercury_v1_types.ReportFields) (types.Report, error) { +func (s staticReportCodec) BuildReport(ctx context.Context, fields mercury_v1_types.ReportFields) (types.Report, error) { return Fixtures.Report, nil } // MaxReportLength Returns the maximum length of a report based on n, the number of oracles. // The output of BuildReport must respect this maximum length. -func (s staticReportCodec) MaxReportLength(n int) (int, error) { +func (s staticReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return Fixtures.MaxReportLength, nil } // CurrentBlockNumFromReport returns the median current block number from a report -func (s staticReportCodec) CurrentBlockNumFromReport(types.Report) (int64, error) { +func (s staticReportCodec) CurrentBlockNumFromReport(context.Context, types.Report) (int64, error) { return Fixtures.CurrentBlockNum, nil } func (s staticReportCodec) Evaluate(ctx context.Context, other mercury_v1_types.ReportCodec) error { - gotReport, err := other.BuildReport(Fixtures.ReportFields) + gotReport, err := other.BuildReport(ctx, Fixtures.ReportFields) if err != nil { return fmt.Errorf("failed to BuildReport: %w", err) } if !bytes.Equal(gotReport, Fixtures.Report) { return fmt.Errorf("expected Report %x but got %x", Fixtures.Report, gotReport) } - gotMax, err := other.MaxReportLength(Fixtures.MaxReportLength) + gotMax, err := other.MaxReportLength(ctx, Fixtures.MaxReportLength) if err != nil { return fmt.Errorf("failed to get MaxReportLength: %w", err) } if gotMax != Fixtures.MaxReportLength { return fmt.Errorf("expected MaxReportLength %d but got %d", Fixtures.MaxReportLength, gotMax) } - gotCurrentBlockNum, err := other.CurrentBlockNumFromReport(gotReport) + gotCurrentBlockNum, err := other.CurrentBlockNumFromReport(ctx, gotReport) if err != nil { return fmt.Errorf("failed to get ObservationTimestampFromReport: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v2/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v2/reportcodec.go index ecc004427..b407efdac 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v2/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v2/reportcodec.go @@ -23,8 +23,8 @@ func NewReportCodecClient(cc grpc.ClientConnInterface) *ReportCodecClient { return &ReportCodecClient{grpc: mercury_v2_pb.NewReportCodecClient(cc)} } -func (r *ReportCodecClient) BuildReport(fields mercury_v2_types.ReportFields) (ocr2plus_types.Report, error) { - reply, err := r.grpc.BuildReport(context.TODO(), &mercury_v2_pb.BuildReportRequest{ +func (r *ReportCodecClient) BuildReport(ctx context.Context, fields mercury_v2_types.ReportFields) (ocr2plus_types.Report, error) { + reply, err := r.grpc.BuildReport(ctx, &mercury_v2_pb.BuildReportRequest{ ReportFields: pbReportFields(fields), }) if err != nil { @@ -33,16 +33,16 @@ func (r *ReportCodecClient) BuildReport(fields mercury_v2_types.ReportFields) (o return reply.Report, nil } -func (r *ReportCodecClient) MaxReportLength(n int) (int, error) { - reply, err := r.grpc.MaxReportLength(context.TODO(), &mercury_v2_pb.MaxReportLengthRequest{}) +func (r *ReportCodecClient) MaxReportLength(ctx context.Context, n int) (int, error) { + reply, err := r.grpc.MaxReportLength(ctx, &mercury_v2_pb.MaxReportLengthRequest{}) if err != nil { return 0, err } return int(reply.MaxReportLength), nil } -func (r *ReportCodecClient) ObservationTimestampFromReport(report ocr2plus_types.Report) (uint32, error) { - reply, err := r.grpc.ObservationTimestampFromReport(context.TODO(), &mercury_v2_pb.ObservationTimestampFromReportRequest{ +func (r *ReportCodecClient) ObservationTimestampFromReport(ctx context.Context, report ocr2plus_types.Report) (uint32, error) { + reply, err := r.grpc.ObservationTimestampFromReport(ctx, &mercury_v2_pb.ObservationTimestampFromReportRequest{ Report: report, }) if err != nil { @@ -74,7 +74,7 @@ func NewReportCodecServer(impl mercury_v2_types.ReportCodec) *ReportCodecServer } func (r *ReportCodecServer) BuildReport(ctx context.Context, request *mercury_v2_pb.BuildReportRequest) (*mercury_v2_pb.BuildReportReply, error) { - report, err := r.impl.BuildReport(reportFields(request.ReportFields)) + report, err := r.impl.BuildReport(ctx, reportFields(request.ReportFields)) if err != nil { return nil, err } @@ -82,7 +82,7 @@ func (r *ReportCodecServer) BuildReport(ctx context.Context, request *mercury_v2 } func (r *ReportCodecServer) MaxReportLength(ctx context.Context, request *mercury_v2_pb.MaxReportLengthRequest) (*mercury_v2_pb.MaxReportLengthReply, error) { - n, err := r.impl.MaxReportLength(int(request.NumOracles)) + n, err := r.impl.MaxReportLength(ctx, int(request.NumOracles)) if err != nil { return nil, err } @@ -90,7 +90,7 @@ func (r *ReportCodecServer) MaxReportLength(ctx context.Context, request *mercur } func (r *ReportCodecServer) ObservationTimestampFromReport(ctx context.Context, request *mercury_v2_pb.ObservationTimestampFromReportRequest) (*mercury_v2_pb.ObservationTimestampFromReportReply, error) { - timestamp, err := r.impl.ObservationTimestampFromReport(request.Report) + timestamp, err := r.impl.ObservationTimestampFromReport(ctx, request.Report) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v2/test/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v2/test/reportcodec.go index 864022a1e..a8b125f57 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v2/test/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v2/test/reportcodec.go @@ -35,37 +35,37 @@ var StaticReportCodecFixtures = StaticReportCodecValues{ ObservationTimestamp: 23, } -func (s staticReportCodec) BuildReport(fields mercury_v2_types.ReportFields) (types.Report, error) { +func (s staticReportCodec) BuildReport(ctx context.Context, fields mercury_v2_types.ReportFields) (types.Report, error) { return StaticReportCodecFixtures.Report, nil } // MaxReportLength Returns the maximum length of a report based on n, the number of oracles. // The output of BuildReport must respect this maximum length. -func (s staticReportCodec) MaxReportLength(n int) (int, error) { +func (s staticReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return StaticReportCodecFixtures.MaxReportLength, nil } // CurrentBlockNumFromReport returns the median current block number from a report -func (s staticReportCodec) ObservationTimestampFromReport(types.Report) (uint32, error) { +func (s staticReportCodec) ObservationTimestampFromReport(context.Context, types.Report) (uint32, error) { return StaticReportCodecFixtures.ObservationTimestamp, nil } func (s staticReportCodec) Evaluate(ctx context.Context, other mercury_v2_types.ReportCodec) error { - gotReport, err := other.BuildReport(Fixtures.ReportFields) + gotReport, err := other.BuildReport(ctx, Fixtures.ReportFields) if err != nil { return fmt.Errorf("failed to BuildReport: %w", err) } if !bytes.Equal(gotReport, Fixtures.Report) { return fmt.Errorf("expected Report %x but got %x", Fixtures.Report, gotReport) } - gotMax, err := other.MaxReportLength(Fixtures.MaxReportLength) + gotMax, err := other.MaxReportLength(ctx, Fixtures.MaxReportLength) if err != nil { return fmt.Errorf("failed to get MaxReportLength: %w", err) } if gotMax != Fixtures.MaxReportLength { return fmt.Errorf("expected MaxReportLength %d but got %d", Fixtures.MaxReportLength, gotMax) } - gotObservedTimestamp, err := other.ObservationTimestampFromReport(gotReport) + gotObservedTimestamp, err := other.ObservationTimestampFromReport(ctx, gotReport) if err != nil { return fmt.Errorf("failed to get ObservationTimestampFromReport: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v3/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v3/reportcodec.go index 1d4212c09..42acce88d 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v3/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v3/reportcodec.go @@ -22,8 +22,8 @@ func NewReportCodecClient(cc grpc.ClientConnInterface) *ReportCodecClient { return &ReportCodecClient{grpc: mercury_v3_pb.NewReportCodecClient(cc)} } -func (r *ReportCodecClient) BuildReport(fields mercury_v3_types.ReportFields) (ocr2plus_types.Report, error) { - reply, err := r.grpc.BuildReport(context.TODO(), &mercury_v3_pb.BuildReportRequest{ +func (r *ReportCodecClient) BuildReport(ctx context.Context, fields mercury_v3_types.ReportFields) (ocr2plus_types.Report, error) { + reply, err := r.grpc.BuildReport(ctx, &mercury_v3_pb.BuildReportRequest{ ReportFields: pbReportFields(fields), }) if err != nil { @@ -32,16 +32,16 @@ func (r *ReportCodecClient) BuildReport(fields mercury_v3_types.ReportFields) (o return reply.Report, nil } -func (r *ReportCodecClient) MaxReportLength(n int) (int, error) { - reply, err := r.grpc.MaxReportLength(context.TODO(), &mercury_v3_pb.MaxReportLengthRequest{}) +func (r *ReportCodecClient) MaxReportLength(ctx context.Context, n int) (int, error) { + reply, err := r.grpc.MaxReportLength(ctx, &mercury_v3_pb.MaxReportLengthRequest{}) if err != nil { return 0, err } return int(reply.MaxReportLength), nil } -func (r *ReportCodecClient) ObservationTimestampFromReport(report ocr2plus_types.Report) (uint32, error) { - reply, err := r.grpc.ObservationTimestampFromReport(context.TODO(), &mercury_v3_pb.ObservationTimestampFromReportRequest{ +func (r *ReportCodecClient) ObservationTimestampFromReport(ctx context.Context, report ocr2plus_types.Report) (uint32, error) { + reply, err := r.grpc.ObservationTimestampFromReport(ctx, &mercury_v3_pb.ObservationTimestampFromReportRequest{ Report: report, }) if err != nil { @@ -75,7 +75,7 @@ func NewReportCodecServer(impl mercury_v3_types.ReportCodec) *ReportCodecServer } func (r *ReportCodecServer) BuildReport(ctx context.Context, request *mercury_v3_pb.BuildReportRequest) (*mercury_v3_pb.BuildReportReply, error) { - report, err := r.impl.BuildReport(reportFields(request.ReportFields)) + report, err := r.impl.BuildReport(ctx, reportFields(request.ReportFields)) if err != nil { return nil, err } @@ -83,7 +83,7 @@ func (r *ReportCodecServer) BuildReport(ctx context.Context, request *mercury_v3 } func (r *ReportCodecServer) MaxReportLength(ctx context.Context, request *mercury_v3_pb.MaxReportLengthRequest) (*mercury_v3_pb.MaxReportLengthReply, error) { - n, err := r.impl.MaxReportLength(int(request.NumOracles)) + n, err := r.impl.MaxReportLength(ctx, int(request.NumOracles)) if err != nil { return nil, err } @@ -91,7 +91,7 @@ func (r *ReportCodecServer) MaxReportLength(ctx context.Context, request *mercur } func (r *ReportCodecServer) ObservationTimestampFromReport(ctx context.Context, request *mercury_v3_pb.ObservationTimestampFromReportRequest) (*mercury_v3_pb.ObservationTimestampFromReportReply, error) { - timestamp, err := r.impl.ObservationTimestampFromReport(request.Report) + timestamp, err := r.impl.ObservationTimestampFromReport(ctx, request.Report) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v3/test/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v3/test/reportcodec.go index 91c413da0..7764b74bf 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v3/test/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v3/test/reportcodec.go @@ -22,34 +22,34 @@ type staticReportCodec struct{} var _ ReportCodecEvaluator = staticReportCodec{} -func (staticReportCodec) BuildReport(fields mercury_v3_types.ReportFields) (ocr2plus_types.Report, error) { +func (staticReportCodec) BuildReport(ctx context.Context, fields mercury_v3_types.ReportFields) (ocr2plus_types.Report, error) { return Fixtures.Report, nil } -func (staticReportCodec) MaxReportLength(n int) (int, error) { +func (staticReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return Fixtures.MaxReportLength, nil } -func (staticReportCodec) ObservationTimestampFromReport(report ocr2plus_types.Report) (uint32, error) { +func (staticReportCodec) ObservationTimestampFromReport(ctx context.Context, report ocr2plus_types.Report) (uint32, error) { return Fixtures.ObservationTimestamp, nil } func (staticReportCodec) Evaluate(ctx context.Context, other mercury_v3_types.ReportCodec) error { - gotReport, err := other.BuildReport(Fixtures.ReportFields) + gotReport, err := other.BuildReport(ctx, Fixtures.ReportFields) if err != nil { return fmt.Errorf("failed to BuildReport: %w", err) } if !bytes.Equal(gotReport, Fixtures.Report) { return fmt.Errorf("expected Report %x but got %x", Fixtures.Report, gotReport) } - gotMax, err := other.MaxReportLength(Fixtures.MaxReportLength) + gotMax, err := other.MaxReportLength(ctx, Fixtures.MaxReportLength) if err != nil { return fmt.Errorf("failed to get MaxReportLength: %w", err) } if gotMax != Fixtures.MaxReportLength { return fmt.Errorf("expected MaxReportLength %d but got %d", Fixtures.MaxReportLength, gotMax) } - gotObservedTimestamp, err := other.ObservationTimestampFromReport(gotReport) + gotObservedTimestamp, err := other.ObservationTimestampFromReport(ctx, gotReport) if err != nil { return fmt.Errorf("failed to get ObservationTimestampFromReport: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v4/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v4/reportcodec.go index 58c6df4ec..dc5e9cf41 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v4/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v4/reportcodec.go @@ -21,8 +21,8 @@ func NewReportCodecClient(cc grpc.ClientConnInterface) *ReportCodecClient { return &ReportCodecClient{grpc: mercury_v4_pb.NewReportCodecClient(cc)} } -func (r *ReportCodecClient) BuildReport(fields mercury_v4_types.ReportFields) (ocr2plus_types.Report, error) { - reply, err := r.grpc.BuildReport(context.TODO(), &mercury_v4_pb.BuildReportRequest{ +func (r *ReportCodecClient) BuildReport(ctx context.Context, fields mercury_v4_types.ReportFields) (ocr2plus_types.Report, error) { + reply, err := r.grpc.BuildReport(ctx, &mercury_v4_pb.BuildReportRequest{ ReportFields: pbReportFields(fields), }) if err != nil { @@ -31,16 +31,16 @@ func (r *ReportCodecClient) BuildReport(fields mercury_v4_types.ReportFields) (o return reply.Report, nil } -func (r *ReportCodecClient) MaxReportLength(n int) (int, error) { - reply, err := r.grpc.MaxReportLength(context.TODO(), &mercury_v4_pb.MaxReportLengthRequest{}) +func (r *ReportCodecClient) MaxReportLength(ctx context.Context, n int) (int, error) { + reply, err := r.grpc.MaxReportLength(ctx, &mercury_v4_pb.MaxReportLengthRequest{}) if err != nil { return 0, err } return int(reply.MaxReportLength), nil } -func (r *ReportCodecClient) ObservationTimestampFromReport(report ocr2plus_types.Report) (uint32, error) { - reply, err := r.grpc.ObservationTimestampFromReport(context.TODO(), &mercury_v4_pb.ObservationTimestampFromReportRequest{ +func (r *ReportCodecClient) ObservationTimestampFromReport(ctx context.Context, report ocr2plus_types.Report) (uint32, error) { + reply, err := r.grpc.ObservationTimestampFromReport(ctx, &mercury_v4_pb.ObservationTimestampFromReportRequest{ Report: report, }) if err != nil { @@ -73,7 +73,7 @@ func NewReportCodecServer(impl mercury_v4_types.ReportCodec) *ReportCodecServer } func (r *ReportCodecServer) BuildReport(ctx context.Context, request *mercury_v4_pb.BuildReportRequest) (*mercury_v4_pb.BuildReportReply, error) { - report, err := r.impl.BuildReport(reportFields(request.ReportFields)) + report, err := r.impl.BuildReport(ctx, reportFields(request.ReportFields)) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func (r *ReportCodecServer) BuildReport(ctx context.Context, request *mercury_v4 } func (r *ReportCodecServer) MaxReportLength(ctx context.Context, request *mercury_v4_pb.MaxReportLengthRequest) (*mercury_v4_pb.MaxReportLengthReply, error) { - n, err := r.impl.MaxReportLength(int(request.NumOracles)) + n, err := r.impl.MaxReportLength(ctx, int(request.NumOracles)) if err != nil { return nil, err } @@ -89,7 +89,7 @@ func (r *ReportCodecServer) MaxReportLength(ctx context.Context, request *mercur } func (r *ReportCodecServer) ObservationTimestampFromReport(ctx context.Context, request *mercury_v4_pb.ObservationTimestampFromReportRequest) (*mercury_v4_pb.ObservationTimestampFromReportReply, error) { - timestamp, err := r.impl.ObservationTimestampFromReport(request.Report) + timestamp, err := r.impl.ObservationTimestampFromReport(ctx, request.Report) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v4/test/reportcodec.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v4/test/reportcodec.go index 5860487c3..d7e70c23c 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v4/test/reportcodec.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/v4/test/reportcodec.go @@ -22,34 +22,34 @@ type staticReportCodec struct{} var _ ReportCodecEvaluator = staticReportCodec{} -func (staticReportCodec) BuildReport(fields mercury_v4_types.ReportFields) (ocr2plus_types.Report, error) { +func (staticReportCodec) BuildReport(ctx context.Context, fields mercury_v4_types.ReportFields) (ocr2plus_types.Report, error) { return Fixtures.Report, nil } -func (staticReportCodec) MaxReportLength(n int) (int, error) { +func (staticReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return Fixtures.MaxReportLength, nil } -func (staticReportCodec) ObservationTimestampFromReport(report ocr2plus_types.Report) (uint32, error) { +func (staticReportCodec) ObservationTimestampFromReport(ctx context.Context, report ocr2plus_types.Report) (uint32, error) { return Fixtures.ObservationTimestamp, nil } func (staticReportCodec) Evaluate(ctx context.Context, other mercury_v4_types.ReportCodec) error { - gotReport, err := other.BuildReport(Fixtures.ReportFields) + gotReport, err := other.BuildReport(ctx, Fixtures.ReportFields) if err != nil { return fmt.Errorf("failed to BuildReport: %w", err) } if !bytes.Equal(gotReport, Fixtures.Report) { return fmt.Errorf("expected Report %x but got %x", Fixtures.Report, gotReport) } - gotMax, err := other.MaxReportLength(Fixtures.MaxReportLength) + gotMax, err := other.MaxReportLength(ctx, Fixtures.MaxReportLength) if err != nil { return fmt.Errorf("failed to get MaxReportLength: %w", err) } if gotMax != Fixtures.MaxReportLength { return fmt.Errorf("expected MaxReportLength %d but got %d", Fixtures.MaxReportLength, gotMax) } - gotObservedTimestamp, err := other.ObservationTimestampFromReport(gotReport) + gotObservedTimestamp, err := other.ObservationTimestampFromReport(ctx, gotReport) if err != nil { return fmt.Errorf("failed to get ObservationTimestampFromReport: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ocr2/config.go b/pkg/loop/internal/relayer/pluginprovider/ocr2/config.go index 9ed3d7d5b..14cafd48b 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ocr2/config.go +++ b/pkg/loop/internal/relayer/pluginprovider/ocr2/config.go @@ -47,9 +47,7 @@ type offchainConfigDigesterClient struct { grpc pb.OffchainConfigDigesterClient } -func (o *offchainConfigDigesterClient) ConfigDigest(config libocr.ContractConfig) (digest libocr.ConfigDigest, err error) { - ctx, cancel := o.StopCtx() - defer cancel() +func (o *offchainConfigDigesterClient) ConfigDigest(ctx context.Context, config libocr.ContractConfig) (digest libocr.ConfigDigest, err error) { var reply *pb.ConfigDigestReply reply, err = o.grpc.ConfigDigest(ctx, &pb.ConfigDigestRequest{ ContractConfig: pbContractConfig(config), @@ -65,9 +63,7 @@ func (o *offchainConfigDigesterClient) ConfigDigest(config libocr.ContractConfig return } -func (o *offchainConfigDigesterClient) ConfigDigestPrefix() (libocr.ConfigDigestPrefix, error) { - ctx, cancel := o.StopCtx() - defer cancel() +func (o *offchainConfigDigesterClient) ConfigDigestPrefix(ctx context.Context) (libocr.ConfigDigestPrefix, error) { reply, err := o.grpc.ConfigDigestPrefix(ctx, &pb.ConfigDigestPrefixRequest{}) if err != nil { return 0, err @@ -100,7 +96,7 @@ func (o *offchainConfigDigesterServer) ConfigDigest(ctx context.Context, request for _, t := range request.ContractConfig.Transmitters { cc.Transmitters = append(cc.Transmitters, libocr.Account(t)) } - cd, err := o.impl.ConfigDigest(cc) + cd, err := o.impl.ConfigDigest(ctx, cc) if err != nil { return nil, err } @@ -108,7 +104,7 @@ func (o *offchainConfigDigesterServer) ConfigDigest(ctx context.Context, request } func (o *offchainConfigDigesterServer) ConfigDigestPrefix(ctx context.Context, request *pb.ConfigDigestPrefixRequest) (*pb.ConfigDigestPrefixReply, error) { - p, err := o.impl.ConfigDigestPrefix() + p, err := o.impl.ConfigDigestPrefix(ctx) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ocr2/contract_transmitter.go b/pkg/loop/internal/relayer/pluginprovider/ocr2/contract_transmitter.go index 7c14307d1..323f73207 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ocr2/contract_transmitter.go +++ b/pkg/loop/internal/relayer/pluginprovider/ocr2/contract_transmitter.go @@ -60,8 +60,8 @@ func (c *contractTransmitterClient) LatestConfigDigestAndEpoch(ctx context.Conte return } -func (c *contractTransmitterClient) FromAccount() (libocr.Account, error) { - reply, err := c.grpc.FromAccount(context.TODO(), &pb.FromAccountRequest{}) +func (c *contractTransmitterClient) FromAccount(ctx context.Context) (libocr.Account, error) { + reply, err := c.grpc.FromAccount(ctx, &pb.FromAccountRequest{}) if err != nil { return "", err } @@ -112,7 +112,7 @@ func (c *contractTransmitterServer) LatestConfigDigestAndEpoch(ctx context.Conte } func (c *contractTransmitterServer) FromAccount(ctx context.Context, request *pb.FromAccountRequest) (*pb.FromAccountReply, error) { - a, err := c.impl.FromAccount() + a, err := c.impl.FromAccount(ctx) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ocr2/test/contract_transmitter.go b/pkg/loop/internal/relayer/pluginprovider/ocr2/test/contract_transmitter.go index b5f139686..c5e11e3c6 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ocr2/test/contract_transmitter.go +++ b/pkg/loop/internal/relayer/pluginprovider/ocr2/test/contract_transmitter.go @@ -44,12 +44,12 @@ func (s staticContractTransmitter) LatestConfigDigestAndEpoch(ctx context.Contex return s.ConfigDigest, s.Epoch, nil } -func (s staticContractTransmitter) FromAccount() (libocr.Account, error) { +func (s staticContractTransmitter) FromAccount(ctx context.Context) (libocr.Account, error) { return s.Account, nil } func (s staticContractTransmitter) Evaluate(ctx context.Context, ct libocr.ContractTransmitter) error { - gotAccount, err := ct.FromAccount() + gotAccount, err := ct.FromAccount(ctx) if err != nil { return fmt.Errorf("failed to get FromAccount: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ocr2/test/offchain_config_digester.go b/pkg/loop/internal/relayer/pluginprovider/ocr2/test/offchain_config_digester.go index 2b8a043e2..badd71bd7 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ocr2/test/offchain_config_digester.go +++ b/pkg/loop/internal/relayer/pluginprovider/ocr2/test/offchain_config_digester.go @@ -21,26 +21,26 @@ type staticOffchainConfigDigester struct { var _ libocr.OffchainConfigDigester = staticOffchainConfigDigester{} -func (s staticOffchainConfigDigester) ConfigDigest(config libocr.ContractConfig) (libocr.ConfigDigest, error) { +func (s staticOffchainConfigDigester) ConfigDigest(ctx context.Context, config libocr.ContractConfig) (libocr.ConfigDigest, error) { if !assert.ObjectsAreEqual(s.contractConfig, config) { return libocr.ConfigDigest{}, fmt.Errorf("expected contract config %v but got %v", s.configDigest, config) } return s.configDigest, nil } -func (s staticOffchainConfigDigester) ConfigDigestPrefix() (libocr.ConfigDigestPrefix, error) { +func (s staticOffchainConfigDigester) ConfigDigestPrefix(ctx context.Context) (libocr.ConfigDigestPrefix, error) { return s.configDigestPrefix, nil } func (s staticOffchainConfigDigester) Evaluate(ctx context.Context, ocd libocr.OffchainConfigDigester) error { - gotDigestPrefix, err := ocd.ConfigDigestPrefix() + gotDigestPrefix, err := ocd.ConfigDigestPrefix(ctx) if err != nil { return fmt.Errorf("failed to get ConfigDigestPrefix: %w", err) } if gotDigestPrefix != s.configDigestPrefix { return fmt.Errorf("expected ConfigDigestPrefix %x but got %x", s.configDigestPrefix, gotDigestPrefix) } - gotDigest, err := ocd.ConfigDigest(contractConfig) + gotDigest, err := ocd.ConfigDigest(ctx, contractConfig) if err != nil { return fmt.Errorf("failed to get ConfigDigest: %w", err) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ocr3/contract_transmitter.go b/pkg/loop/internal/relayer/pluginprovider/ocr3/contract_transmitter.go index ff96ff969..e5525ac31 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ocr3/contract_transmitter.go +++ b/pkg/loop/internal/relayer/pluginprovider/ocr3/contract_transmitter.go @@ -55,8 +55,8 @@ func (c *contractTransmitterClient) Transmit(ctx context.Context, configDigest l return nil } -func (c *contractTransmitterClient) FromAccount() (libocr.Account, error) { - reply, err := c.grpc.FromAccount(context.TODO(), &emptypb.Empty{}) +func (c *contractTransmitterClient) FromAccount(ctx context.Context) (libocr.Account, error) { + reply, err := c.grpc.FromAccount(ctx, &emptypb.Empty{}) if err != nil { return "", err } @@ -97,7 +97,7 @@ func (c *contractTransmitterServer) Transmit(ctx context.Context, request *ocr3p } func (c *contractTransmitterServer) FromAccount(ctx context.Context, request *emptypb.Empty) (*ocr3pb.FromAccountReply, error) { - a, err := c.impl.FromAccount() + a, err := c.impl.FromAccount(ctx) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayer/pluginprovider/ocr3/test/contract_transmitter.go b/pkg/loop/internal/relayer/pluginprovider/ocr3/test/contract_transmitter.go index 8372d2e88..54d8b523f 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ocr3/test/contract_transmitter.go +++ b/pkg/loop/internal/relayer/pluginprovider/ocr3/test/contract_transmitter.go @@ -71,12 +71,12 @@ func (s staticOCR3ContractTransmitter) Transmit(ctx context.Context, configDiges return nil } -func (s staticOCR3ContractTransmitter) FromAccount() (libocr.Account, error) { +func (s staticOCR3ContractTransmitter) FromAccount(ctx context.Context) (libocr.Account, error) { return s.Account, nil } func (s staticOCR3ContractTransmitter) Evaluate(ctx context.Context, ct ocr3types.ContractTransmitter[[]byte]) error { - gotAccount, err := ct.FromAccount() + gotAccount, err := ct.FromAccount(ctx) if err != nil { return fmt.Errorf("failed to get FromAccount: %w", err) } diff --git a/pkg/loop/internal/relayer/relayer.go b/pkg/loop/internal/relayer/relayer.go index 0ccd85f1b..97cdc35e6 100644 --- a/pkg/loop/internal/relayer/relayer.go +++ b/pkg/loop/internal/relayer/relayer.go @@ -261,7 +261,7 @@ func (r *relayerClient) NewPluginProvider(ctx context.Context, rargs types.Relay broker := r.BrokerExt - return WrapProviderClientConnection(rargs.ProviderType, cc, broker) + return WrapProviderClientConnection(ctx, rargs.ProviderType, cc, broker) } type PluginProviderClient interface { @@ -269,13 +269,15 @@ type PluginProviderClient interface { goplugin.GRPCClientConn } -func WrapProviderClientConnection(providerType string, cc grpc.ClientConnInterface, broker *net.BrokerExt) (PluginProviderClient, error) { +func WrapProviderClientConnection(ctx context.Context, providerType string, cc grpc.ClientConnInterface, broker *net.BrokerExt) (PluginProviderClient, error) { // TODO: Remove this when we have fully transitioned all relayers to running in LOOPPs. // This allows callers to type assert a PluginProvider into a product provider type (eg. MedianProvider) // for interoperability with legacy code. switch providerType { case string(types.Median): - return median.NewProviderClient(broker, cc), nil + pc := median.NewProviderClient(broker, cc) + pc.RmUnimplemented(ctx) + return pc, nil case string(types.GenericPlugin): return ocr2.NewPluginProviderClient(broker, cc), nil case string(types.OCR3Capability): diff --git a/pkg/loop/internal/relayerset/inprocessprovider/grpc_provider_server_test.go b/pkg/loop/internal/relayerset/inprocessprovider/grpc_provider_server_test.go index 52005444a..adf3a20c4 100644 --- a/pkg/loop/internal/relayerset/inprocessprovider/grpc_provider_server_test.go +++ b/pkg/loop/internal/relayerset/inprocessprovider/grpc_provider_server_test.go @@ -10,15 +10,13 @@ import ( ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-common/pkg/logger" - "github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/relay" "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestProviderServer(t *testing.T) { r := &mockRelayer{} - sa := relay.NewServerAdapter(r, mockRelayerExt{}) - mp, _ := sa.NewPluginProvider(tests.Context(t), types.RelayArgs{ProviderType: string(types.Median)}, types.PluginArgs{}) + mp, _ := r.NewPluginProvider(tests.Context(t), types.RelayArgs{ProviderType: string(types.Median)}, types.PluginArgs{}) lggr := logger.Test(t) _, err := NewProviderServer(mp, "unsupported-type", lggr) @@ -35,30 +33,26 @@ type mockRelayer struct { types.Relayer } -func (m *mockRelayer) NewMedianProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.MedianProvider, error) { +func (m *mockRelayer) NewMedianProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.MedianProvider, error) { return staticMedianProvider{}, nil } -func (m *mockRelayer) NewFunctionsProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.FunctionsProvider, error) { +func (m *mockRelayer) NewFunctionsProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.FunctionsProvider, error) { return staticFunctionsProvider{}, nil } -func (m *mockRelayer) NewMercuryProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.MercuryProvider, error) { +func (m *mockRelayer) NewMercuryProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.MercuryProvider, error) { return staticMercuryProvider{}, nil } -func (m *mockRelayer) NewAutomationProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.AutomationProvider, error) { +func (m *mockRelayer) NewAutomationProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.AutomationProvider, error) { return staticAutomationProvider{}, nil } -func (m *mockRelayer) NewPluginProvider(rargs types.RelayArgs, pargs types.PluginArgs) (types.PluginProvider, error) { +func (m *mockRelayer) NewPluginProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.PluginProvider, error) { return staticPluginProvider{}, nil } -type mockRelayerExt struct { - relay.RelayerExt -} - type staticMedianProvider struct { } diff --git a/pkg/loop/internal/relayerset/relayer.go b/pkg/loop/internal/relayerset/relayer.go index 8a5ffc751..a85dcdbc6 100644 --- a/pkg/loop/internal/relayerset/relayer.go +++ b/pkg/loop/internal/relayerset/relayer.go @@ -33,7 +33,7 @@ func (r *relayerClient) NewPluginProvider(ctx context.Context, rargs core.RelayA return providerID, nil, nil }) - return relayer.WrapProviderClientConnection(rargs.ProviderType, cc, r.relayerSetClient.BrokerExt) + return relayer.WrapProviderClientConnection(ctx, rargs.ProviderType, cc, r.relayerSetClient.BrokerExt) } func (r *relayerClient) NewContractReader(_ context.Context, contractReaderConfig []byte) (types.ContractReader, error) { @@ -60,8 +60,8 @@ func (r *relayerClient) NewChainWriter(_ context.Context, chainWriterConfig []by return chainwriter.NewClient(r.relayerSetClient.BrokerExt.WithName("ChainWriterClient"), cwc), nil } -func (r *relayerClient) Start(context.Context) error { - return r.relayerSetClient.StartRelayer(context.Background(), r.relayerID) +func (r *relayerClient) Start(ctx context.Context) error { + return r.relayerSetClient.StartRelayer(ctx, r.relayerID) } func (r *relayerClient) Close() error { diff --git a/pkg/loop/internal/reportingplugin/median/median.go b/pkg/loop/internal/reportingplugin/median/median.go index dbba44261..a6b53fc68 100644 --- a/pkg/loop/internal/reportingplugin/median/median.go +++ b/pkg/loop/internal/reportingplugin/median/median.go @@ -149,6 +149,7 @@ func (m *pluginMedianServer) NewMedianFactory(ctx context.Context, request *pb.N } providerRes := net.Resource{Closer: providerConn, Name: "MedianProvider"} provider := medianprovider.NewProviderClient(m.BrokerExt, providerConn) + provider.RmUnimplemented(ctx) errorLogConn, err := m.Dial(request.ErrorLogID) if err != nil { diff --git a/pkg/loop/internal/reportingplugin/mercury/mercury_reporting.go b/pkg/loop/internal/reportingplugin/mercury/mercury_reporting.go index 996f502ba..e2d91d47d 100644 --- a/pkg/loop/internal/reportingplugin/mercury/mercury_reporting.go +++ b/pkg/loop/internal/reportingplugin/mercury/mercury_reporting.go @@ -26,9 +26,7 @@ func NewPluginFactoryClient(b *net.BrokerExt, cc grpc.ClientConnInterface) *Plug return &PluginFactoryClient{b.WithName("MercuryPluginProviderClient"), goplugin.NewServiceClient(b, cc), mercurypb.NewMercuryPluginFactoryClient(cc)} } -func (r *PluginFactoryClient) NewMercuryPlugin(config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { - ctx, cancel := r.StopCtx() - defer cancel() +func (r *PluginFactoryClient) NewMercuryPlugin(ctx context.Context, config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { response, err := r.client.NewMercuryPlugin(ctx, &mercurypb.NewMercuryPluginRequest{MercuryPluginConfig: &mercurypb.MercuryPluginConfig{ ConfigDigest: config.ConfigDigest[:], OracleID: uint32(config.OracleID), @@ -86,7 +84,7 @@ func (r *mercuryPluginFactoryServer) NewMercuryPlugin(ctx context.Context, reque } copy(cfg.ConfigDigest[:], request.MercuryPluginConfig.ConfigDigest) - rp, rpi, err := r.impl.NewMercuryPlugin(cfg) + rp, rpi, err := r.impl.NewMercuryPlugin(ctx, cfg) if err != nil { return nil, err } @@ -130,9 +128,7 @@ func (r *mercuryPluginClient) Observation(ctx context.Context, timestamp libocr. return response.Observation, nil } -func (r *mercuryPluginClient) Report(timestamp libocr.ReportTimestamp, previousReport libocr.Report, obs []libocr.AttributedObservation) (bool, libocr.Report, error) { - ctx, cancel := r.StopCtx() - defer cancel() +func (r *mercuryPluginClient) Report(ctx context.Context, timestamp libocr.ReportTimestamp, previousReport libocr.Report, obs []libocr.AttributedObservation) (bool, libocr.Report, error) { response, err := r.grpc.Report(ctx, &mercurypb.ReportRequest{ ReportTimestamp: pb.ReportTimestampToPb(timestamp), PreviousReport: previousReport, @@ -181,7 +177,7 @@ func (r *mercuryPluginServer) Report(ctx context.Context, request *mercurypb.Rep if err != nil { return nil, err } - should, report, err := r.impl.Report(rts, request.PreviousReport, obs) + should, report, err := r.impl.Report(ctx, rts, request.PreviousReport, obs) if err != nil { return nil, err } diff --git a/pkg/loop/internal/reportingplugin/test/factory.go b/pkg/loop/internal/reportingplugin/test/factory.go index aeb2849ff..d07e88544 100644 --- a/pkg/loop/internal/reportingplugin/test/factory.go +++ b/pkg/loop/internal/reportingplugin/test/factory.go @@ -48,7 +48,7 @@ func (s staticFactory) Ready() error { panic("implement me") } func (s staticFactory) HealthReport() map[string]error { panic("implement me") } -func (s staticFactory) NewReportingPlugin(config libocr.ReportingPluginConfig) (libocr.ReportingPlugin, libocr.ReportingPluginInfo, error) { +func (s staticFactory) NewReportingPlugin(ctx context.Context, config libocr.ReportingPluginConfig) (libocr.ReportingPlugin, libocr.ReportingPluginInfo, error) { err := s.equalConfig(config) if err != nil { return nil, libocr.ReportingPluginInfo{}, fmt.Errorf("config mismatch: %w", err) @@ -100,7 +100,7 @@ func RunFactory(t *testing.T, factory libocr.ReportingPluginFactory) { expectedFactory := Factory t.Run("ReportingPluginFactory", func(t *testing.T) { ctx := tests.Context(t) - rp, gotRPI, err := factory.NewReportingPlugin(expectedFactory.ReportingPluginConfig) + rp, gotRPI, err := factory.NewReportingPlugin(ctx, expectedFactory.ReportingPluginConfig) require.NoError(t, err) assert.Equal(t, expectedFactory.rpi, gotRPI) t.Cleanup(func() { assert.NoError(t, rp.Close()) }) diff --git a/pkg/loop/median_service.go b/pkg/loop/median_service.go index 0e4bf485f..44bf302c7 100644 --- a/pkg/loop/median_service.go +++ b/pkg/loop/median_service.go @@ -39,9 +39,9 @@ func NewMedianService(lggr logger.Logger, grpcOpts GRPCOpts, cmd func() *exec.Cm return &ms } -func (m *MedianService) NewReportingPlugin(config ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { +func (m *MedianService) NewReportingPlugin(ctx context.Context, config ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { if err := m.Wait(); err != nil { return nil, ocrtypes.ReportingPluginInfo{}, err } - return m.Service.NewReportingPlugin(config) + return m.Service.NewReportingPlugin(ctx, config) } diff --git a/pkg/loop/mercury_service.go b/pkg/loop/mercury_service.go index 38672444f..f3eca6e06 100644 --- a/pkg/loop/mercury_service.go +++ b/pkg/loop/mercury_service.go @@ -18,14 +18,14 @@ import ( var _ ocr3types.MercuryPluginFactory = (*MercuryV4Service)(nil) -// MercuryV3Service is a [types.Service] that maintains an internal [types.PluginMedian]. +// MercuryV4Service is a [types.Service] that maintains an internal [types.PluginMedian]. type MercuryV4Service struct { goplugin.PluginService[*GRPCPluginMercury, types.MercuryPluginFactory] } var _ ocr3types.MercuryPluginFactory = (*MercuryV4Service)(nil) -// NewMercuryV3Service returns a new [*MercuryV3Service]. +// NewMercuryV4Service returns a new [*MercuryV4Service]. // cmd must return a new exec.Cmd each time it is called. func NewMercuryV4Service(lggr logger.Logger, grpcOpts GRPCOpts, cmd func() *exec.Cmd, provider types.MercuryProvider, dataSource mercury_v4_types.DataSource) *MercuryV4Service { newService := func(ctx context.Context, instance any) (types.MercuryPluginFactory, error) { @@ -43,11 +43,11 @@ func NewMercuryV4Service(lggr logger.Logger, grpcOpts GRPCOpts, cmd func() *exec return &ms } -func (m *MercuryV4Service) NewMercuryPlugin(config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { +func (m *MercuryV4Service) NewMercuryPlugin(ctx context.Context, config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { if err := m.Wait(); err != nil { return nil, ocr3types.MercuryPluginInfo{}, err } - return m.Service.NewMercuryPlugin(config) + return m.Service.NewMercuryPlugin(ctx, config) } var _ ocr3types.MercuryPluginFactory = (*MercuryV3Service)(nil) @@ -77,11 +77,11 @@ func NewMercuryV3Service(lggr logger.Logger, grpcOpts GRPCOpts, cmd func() *exec return &ms } -func (m *MercuryV3Service) NewMercuryPlugin(config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { +func (m *MercuryV3Service) NewMercuryPlugin(ctx context.Context, config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { if err := m.Wait(); err != nil { return nil, ocr3types.MercuryPluginInfo{}, err } - return m.Service.NewMercuryPlugin(config) + return m.Service.NewMercuryPlugin(ctx, config) } // MercuryV1Service is a [types.Service] that maintains an internal [types.PluginMedian]. @@ -109,11 +109,11 @@ func NewMercuryV1Service(lggr logger.Logger, grpcOpts GRPCOpts, cmd func() *exec return &ms } -func (m *MercuryV1Service) NewMercuryPlugin(config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { +func (m *MercuryV1Service) NewMercuryPlugin(ctx context.Context, config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { if err := m.Wait(); err != nil { return nil, ocr3types.MercuryPluginInfo{}, err } - return m.Service.NewMercuryPlugin(config) + return m.Service.NewMercuryPlugin(ctx, config) } var _ ocr3types.MercuryPluginFactory = (*MercuryV1Service)(nil) @@ -143,11 +143,11 @@ func NewMercuryV2Service(lggr logger.Logger, grpcOpts GRPCOpts, cmd func() *exec return &ms } -func (m *MercuryV2Service) NewMercuryPlugin(config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { +func (m *MercuryV2Service) NewMercuryPlugin(ctx context.Context, config ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { if err := m.Wait(); err != nil { return nil, ocr3types.MercuryPluginInfo{}, err } - return m.Service.NewMercuryPlugin(config) + return m.Service.NewMercuryPlugin(ctx, config) } var _ ocr3types.MercuryPluginFactory = (*MercuryV2Service)(nil) diff --git a/pkg/loop/plugin_median_test.go b/pkg/loop/plugin_median_test.go index 2c31cecd8..90b617f51 100644 --- a/pkg/loop/plugin_median_test.go +++ b/pkg/loop/plugin_median_test.go @@ -1,7 +1,6 @@ package loop_test import ( - "context" "testing" "time" @@ -17,6 +16,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/types/core" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestPluginMedian(t *testing.T) { @@ -83,7 +83,7 @@ func newStopCh(t *testing.T) <-chan struct{} { } func newMedianProvider(t *testing.T, pr loop.PluginRelayer) types.MedianProvider { - ctx := context.Background() + ctx := tests.Context(t) r, err := pr.NewRelayer(ctx, test.ConfigTOML, keystoretest.Keystore, nil) require.NoError(t, err) servicetest.Run(t, r) diff --git a/pkg/loop/plugin_mercury_test.go b/pkg/loop/plugin_mercury_test.go index dba9a9da9..36af7c35f 100644 --- a/pkg/loop/plugin_mercury_test.go +++ b/pkg/loop/plugin_mercury_test.go @@ -1,7 +1,6 @@ package loop_test import ( - "context" "testing" "github.com/hashicorp/go-plugin" @@ -15,6 +14,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/test" "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestPluginMercury(t *testing.T) { @@ -66,7 +66,7 @@ func TestPluginMercuryExec(t *testing.T) { } func newMercuryProvider(t *testing.T, pr loop.PluginRelayer) types.MercuryProvider { - ctx := context.Background() + ctx := tests.Context(t) r, err := pr.NewRelayer(ctx, test.ConfigTOML, keystoretest.Keystore, nil) require.NoError(t, err) servicetest.Run(t, r) diff --git a/pkg/loop/relayer_adapter.go b/pkg/loop/relayer_adapter.go deleted file mode 100644 index 490245e6f..000000000 --- a/pkg/loop/relayer_adapter.go +++ /dev/null @@ -1,6 +0,0 @@ -package loop - -import "github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/relay" - -// TODO temporary alias to allow 2 step migration of solana and starknet repositories -type RelayerAdapter = relay.RelayerAdapter diff --git a/pkg/loop/reportingplugins/loopp_service.go b/pkg/loop/reportingplugins/loopp_service.go index 43381ecc0..92b7db4fd 100644 --- a/pkg/loop/reportingplugins/loopp_service.go +++ b/pkg/loop/reportingplugins/loopp_service.go @@ -59,11 +59,11 @@ func NewLOOPPService( return &ps } -func (g *LOOPPService) NewReportingPlugin(config ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { +func (g *LOOPPService) NewReportingPlugin(ctx context.Context, config ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { if err := g.Wait(); err != nil { return nil, ocrtypes.ReportingPluginInfo{}, err } - return g.Service.NewReportingPlugin(config) + return g.Service.NewReportingPlugin(ctx, config) } func NewLOOPPServiceValidation( diff --git a/pkg/loop/reportingplugins/ocr3/loopp_service.go b/pkg/loop/reportingplugins/ocr3/loopp_service.go index bf862e7b5..7f3a088df 100644 --- a/pkg/loop/reportingplugins/ocr3/loopp_service.go +++ b/pkg/loop/reportingplugins/ocr3/loopp_service.go @@ -51,11 +51,11 @@ func NewLOOPPService( return &ps } -func (g *LOOPPService) NewReportingPlugin(config ocr3types.ReportingPluginConfig) (ocr3types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { +func (g *LOOPPService) NewReportingPlugin(ctx context.Context, config ocr3types.ReportingPluginConfig) (ocr3types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { if err := g.Wait(); err != nil { return nil, ocr3types.ReportingPluginInfo{}, err } - return g.Service.NewReportingPlugin(config) + return g.Service.NewReportingPlugin(ctx, config) } func NewLOOPPServiceValidation( diff --git a/pkg/loop/standard_capabilities_test.go b/pkg/loop/standard_capabilities_test.go index 425722dd6..b9d63c01e 100644 --- a/pkg/loop/standard_capabilities_test.go +++ b/pkg/loop/standard_capabilities_test.go @@ -1,7 +1,6 @@ package loop_test import ( - "context" "testing" "github.com/hashicorp/go-plugin" @@ -13,6 +12,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop" sctest "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/capability/standard/test" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/test" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestPluginStandardCapabilities(t *testing.T) { @@ -29,30 +29,32 @@ func TestPluginStandardCapabilities(t *testing.T) { Logger: logger.Test(t), StopCh: stopCh}}, func(t *testing.T, s loop.StandardCapabilities) { - infos, err := s.Infos(context.Background()) + ctx := tests.Context(t) + infos, err := s.Infos(ctx) assert.NoError(t, err) assert.Equal(t, 2, len(infos)) assert.Equal(t, capabilities.CapabilityTypeAction, infos[0].CapabilityType) assert.Equal(t, capabilities.CapabilityTypeTarget, infos[1].CapabilityType) - err = s.Initialise(context.Background(), "", nil, nil, nil, nil, nil, nil, nil) + err = s.Initialise(ctx, "", nil, nil, nil, nil, nil, nil, nil) assert.NoError(t, err) }) } func TestRunningStandardCapabilitiesPluginOutOfProcess(t *testing.T) { t.Parallel() + ctx := tests.Context(t) stopCh := newStopCh(t) scs := newOutOfProcessStandardCapabilitiesService(t, true, stopCh) - infos, err := scs.Infos(context.Background()) + infos, err := scs.Infos(ctx) assert.NoError(t, err) assert.Equal(t, 2, len(infos)) assert.Equal(t, capabilities.CapabilityTypeAction, infos[0].CapabilityType) assert.Equal(t, capabilities.CapabilityTypeTarget, infos[1].CapabilityType) - err = scs.Initialise(context.Background(), "", nil, nil, nil, nil, nil, nil, nil) + err = scs.Initialise(ctx, "", nil, nil, nil, nil, nil, nil, nil) assert.NoError(t, err) } diff --git a/pkg/monitoring/testutils.go b/pkg/monitoring/testutils.go index 96ee0267e..5b8325d90 100644 --- a/pkg/monitoring/testutils.go +++ b/pkg/monitoring/testutils.go @@ -430,7 +430,7 @@ func generateContractConfig(ctx context.Context, n int) ( Min: generateBigInt(128), Max: generateBigInt(128), } - onchainConfigEncoded, err := median.StandardOnchainConfigCodec{}.Encode(onchainConfig) + onchainConfigEncoded, err := median.StandardOnchainConfigCodec{}.Encode(ctx, onchainConfig) if err != nil { return types.ContractConfig{}, median.OnchainConfig{}, nil, nil, err } diff --git a/pkg/types/ccip/gaspriceestimator.go b/pkg/types/ccip/gaspriceestimator.go index aafc46bc0..902547308 100644 --- a/pkg/types/ccip/gaspriceestimator.go +++ b/pkg/types/ccip/gaspriceestimator.go @@ -17,7 +17,7 @@ type GasPriceEstimatorCommit interface { // TODO CCIP-1882: reconcile gas price estimator to remove unnecessary interface funcs // this can be a helper function implementation detail. not needed in the interface // Deviates checks if p1 gas price diffs from p2 by deviation options. Input prices should not be nil. - Deviates(p1 *big.Int, p2 *big.Int) (bool, error) + Deviates(ctx context.Context, p1 *big.Int, p2 *big.Int) (bool, error) } // GasPriceEstimatorExec provides gasPriceEstimatorCommon + features needed in exec plugin, e.g. message cost estimation. @@ -25,7 +25,7 @@ type GasPriceEstimatorExec interface { CommonGasPriceEstimator // EstimateMsgCostUSD estimates the costs for msg execution, and converts to USD value scaled by 1e18 (e.g. 5$ = 5e18). - EstimateMsgCostUSD(p *big.Int, wrappedNativePrice *big.Int, msg EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) + EstimateMsgCostUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) } // CommonGasPriceEstimator is abstraction over multi-component gas prices. @@ -34,11 +34,11 @@ type CommonGasPriceEstimator interface { // GetGasPrice fetches the current gas price. GetGasPrice(ctx context.Context) (*big.Int, error) // DenoteInUSD converts the gas price to be in units of USD. Input prices should not be nil. - DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) + DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) // TODO CCIP-1882: reconcile gas price estimator to remove unnecessary interface funcs // this can be a helper function implementation detail. not needed in the interface // Median finds the median gas price in slice. If gas price has multiple components, median of each individual component should be taken. Input prices should not contain nil. - Median(gasPrices []*big.Int) (*big.Int, error) + Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) } // EVM2EVMOnRampCCIPSendRequestedWithMeta helper struct to hold the send request and some metadata diff --git a/pkg/types/mercury/types.go b/pkg/types/mercury/types.go index 8f0d05734..fa679d1e9 100644 --- a/pkg/types/mercury/types.go +++ b/pkg/types/mercury/types.go @@ -19,8 +19,8 @@ type OnchainConfig struct { } type OnchainConfigCodec interface { - Encode(OnchainConfig) ([]byte, error) - Decode([]byte) (OnchainConfig, error) + Encode(context.Context, OnchainConfig) ([]byte, error) + Decode(context.Context, []byte) (OnchainConfig, error) } type ServerFetcher interface { diff --git a/pkg/types/mercury/v1/types.go b/pkg/types/mercury/v1/types.go index c15efd9b5..1fc3b52ec 100644 --- a/pkg/types/mercury/v1/types.go +++ b/pkg/types/mercury/v1/types.go @@ -67,14 +67,14 @@ type ReportCodec interface { // ParsedAttributedObservation per observer, and that all observers are // valid. However, observation values, timestamps, etc... should all be // treated as untrusted. - BuildReport(fields ReportFields) (ocrtypes.Report, error) + BuildReport(ctx context.Context, fields ReportFields) (ocrtypes.Report, error) // MaxReportLength Returns the maximum length of a report based on n, the number of oracles. // The output of BuildReport must respect this maximum length. - MaxReportLength(n int) (int, error) + MaxReportLength(ctx context.Context, n int) (int, error) // CurrentBlockNumFromReport returns the median current block number from a report - CurrentBlockNumFromReport(ocrtypes.Report) (int64, error) + CurrentBlockNumFromReport(context.Context, ocrtypes.Report) (int64, error) } // DataSource implementations must be thread-safe. Observe may be called by many diff --git a/pkg/types/mercury/v2/types.go b/pkg/types/mercury/v2/types.go index 2cecacb23..e57920c90 100644 --- a/pkg/types/mercury/v2/types.go +++ b/pkg/types/mercury/v2/types.go @@ -25,13 +25,13 @@ type ReportCodec interface { // ParsedAttributedObservation per observer, and that all observers are // valid. However, observation values, timestamps, etc... should all be // treated as untrusted. - BuildReport(ReportFields) (ocrtypes.Report, error) + BuildReport(context.Context, ReportFields) (ocrtypes.Report, error) // MaxReportLength Returns the maximum length of a report based on n, the number of oracles. // The output of BuildReport must respect this maximum length. - MaxReportLength(n int) (int, error) + MaxReportLength(ctx context.Context, n int) (int, error) - ObservationTimestampFromReport(ocrtypes.Report) (uint32, error) + ObservationTimestampFromReport(context.Context, ocrtypes.Report) (uint32, error) } // DataSource implementations must be thread-safe. Observe may be called by many diff --git a/pkg/types/mercury/v3/types.go b/pkg/types/mercury/v3/types.go index 713cbda1a..0d4eefdcd 100644 --- a/pkg/types/mercury/v3/types.go +++ b/pkg/types/mercury/v3/types.go @@ -27,13 +27,13 @@ type ReportCodec interface { // ParsedAttributedObservation per observer, and that all observers are // valid. However, observation values, timestamps, etc... should all be // treated as untrusted. - BuildReport(ReportFields) (ocrtypes.Report, error) + BuildReport(context.Context, ReportFields) (ocrtypes.Report, error) // MaxReportLength Returns the maximum length of a report based on n, the number of oracles. // The output of BuildReport must respect this maximum length. - MaxReportLength(n int) (int, error) + MaxReportLength(ctx context.Context, n int) (int, error) - ObservationTimestampFromReport(ocrtypes.Report) (uint32, error) + ObservationTimestampFromReport(context.Context, ocrtypes.Report) (uint32, error) } // DataSource implementations must be thread-safe. Observe may be called by many diff --git a/pkg/types/mercury/v4/types.go b/pkg/types/mercury/v4/types.go index 5f4380b7b..d26272af5 100644 --- a/pkg/types/mercury/v4/types.go +++ b/pkg/types/mercury/v4/types.go @@ -26,13 +26,13 @@ type ReportCodec interface { // ParsedAttributedObservation per observer, and that all observers are // valid. However, observation values, timestamps, etc... should all be // treated as untrusted. - BuildReport(ReportFields) (ocrtypes.Report, error) + BuildReport(context.Context, ReportFields) (ocrtypes.Report, error) // MaxReportLength Returns the maximum length of a report based on n, the number of oracles. // The output of BuildReport must respect this maximum length. - MaxReportLength(n int) (int, error) + MaxReportLength(ctx context.Context, n int) (int, error) - ObservationTimestampFromReport(ocrtypes.Report) (uint32, error) + ObservationTimestampFromReport(context.Context, ocrtypes.Report) (uint32, error) } // DataSource implementations must be thread-safe. Observe may be called by many diff --git a/pkg/types/relayer.go b/pkg/types/relayer.go index cfcb0da09..5e43daa03 100644 --- a/pkg/types/relayer.go +++ b/pkg/types/relayer.go @@ -77,7 +77,7 @@ type NodeStatus struct { State string } -// ChainService is a sub-interface of [loop.Relayer] that encapsulates the explicit interactions with a chain +// ChainService is a sub-interface that encapsulates the explicit interactions with a chain, rather than through a provider. type ChainService interface { Service @@ -92,11 +92,9 @@ type ChainService interface { Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error } -// Relayer is the product-facing, and context-less sub-interface of [loop.Relayer]. -// -// Deprecated: use loop.Relayer, which includes context.Context. +// Relayer extends ChainService with providers for each product. type Relayer interface { - Service + ChainService // NewChainWriter returns a new ChainWriter. // The format of config depends on the implementation. @@ -104,19 +102,19 @@ type Relayer interface { // NewContractReader returns a new ContractReader. // The format of contractReaderConfig depends on the implementation. - NewContractReader(contractReaderConfig []byte) (ContractReader, error) + NewContractReader(ctx context.Context, contractReaderConfig []byte) (ContractReader, error) - NewConfigProvider(rargs RelayArgs) (ConfigProvider, error) + NewConfigProvider(ctx context.Context, rargs RelayArgs) (ConfigProvider, error) - NewMedianProvider(rargs RelayArgs, pargs PluginArgs) (MedianProvider, error) - NewMercuryProvider(rargs RelayArgs, pargs PluginArgs) (MercuryProvider, error) - NewFunctionsProvider(rargs RelayArgs, pargs PluginArgs) (FunctionsProvider, error) - NewAutomationProvider(rargs RelayArgs, pargs PluginArgs) (AutomationProvider, error) - NewLLOProvider(rargs RelayArgs, pargs PluginArgs) (LLOProvider, error) - NewCCIPCommitProvider(rargs RelayArgs, pargs PluginArgs) (CCIPCommitProvider, error) - NewCCIPExecProvider(rargs RelayArgs, pargs PluginArgs) (CCIPExecProvider, error) + NewMedianProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (MedianProvider, error) + NewMercuryProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (MercuryProvider, error) + NewFunctionsProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (FunctionsProvider, error) + NewAutomationProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (AutomationProvider, error) + NewLLOProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (LLOProvider, error) + NewCCIPCommitProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (CCIPCommitProvider, error) + NewCCIPExecProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (CCIPExecProvider, error) - NewPluginProvider(rargs RelayArgs, pargs PluginArgs) (PluginProvider, error) + NewPluginProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (PluginProvider, error) - NewOCR3CapabilityProvider(rargs RelayArgs, pargs PluginArgs) (OCR3CapabilityProvider, error) + NewOCR3CapabilityProvider(ctx context.Context, rargs RelayArgs, pargs PluginArgs) (OCR3CapabilityProvider, error) }