From 51ef3ef0fbf55b034a1748d8a84f44c5ac58cf1e Mon Sep 17 00:00:00 2001 From: Matthew Pendrey Date: Tue, 13 Jan 2026 17:00:28 +0000 Subject: [PATCH 1/4] wip --- .../core/services/oraclefactory3_1/client.go | 107 + .../core/services/oraclefactory3_1/server.go | 114 + .../reportingplugin/ocr3_1/reporting.go | 516 ++++ .../ocr3_1/reporting_plugin_service.go | 262 ++ .../reportingplugin/ocr3_1/test/factory.go | 128 + .../ocr3_1/test/factory_generators.go | 134 ++ .../ocr3_1/test/reporting_plugin.go | 338 +++ pkg/loop/internal/pb/ocr3_1/generate.go | 2 + .../pb/ocr3_1/make_blob_handle_test.go | 17 + .../internal/pb/ocr3_1/ocr3_1_reporting.pb.go | 2119 +++++++++++++++++ .../internal/pb/ocr3_1/ocr3_1_reporting.proto | 213 ++ .../pb/ocr3_1/ocr3_1_reporting_grpc.pb.go | 757 ++++++ pkg/types/core/oracle_factory_3_1.go | 19 + 13 files changed, 4726 insertions(+) create mode 100644 pkg/loop/internal/core/services/oraclefactory3_1/client.go create mode 100644 pkg/loop/internal/core/services/oraclefactory3_1/server.go create mode 100644 pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go create mode 100644 pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting_plugin_service.go create mode 100644 pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/factory.go create mode 100644 pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/factory_generators.go create mode 100644 pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/reporting_plugin.go create mode 100644 pkg/loop/internal/pb/ocr3_1/generate.go create mode 100644 pkg/loop/internal/pb/ocr3_1/make_blob_handle_test.go create mode 100644 pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.pb.go create mode 100644 pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.proto create mode 100644 pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting_grpc.pb.go create mode 100644 pkg/types/core/oracle_factory_3_1.go diff --git a/pkg/loop/internal/core/services/oraclefactory3_1/client.go b/pkg/loop/internal/core/services/oraclefactory3_1/client.go new file mode 100644 index 0000000000..e07f6a7afa --- /dev/null +++ b/pkg/loop/internal/core/services/oraclefactory3_1/client.go @@ -0,0 +1,107 @@ +package oraclefactory3_1 + +import ( + "context" + "fmt" + + "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/durationpb" + + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/oracle" + reportingplugin "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/reportingplugin/ocr3_1" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/goplugin" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + ocr3pb "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/ocr3" + ocr3_1pb "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/ocr3_1" + oraclefactorypb "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/oraclefactory" + ocr3relayer "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/relayer/pluginprovider/ocr3" + "github.com/smartcontractkit/chainlink-common/pkg/types/core" +) + +var _ core.OracleFactory = (*client)(nil) + +type client struct { + broker *net.BrokerExt + grpc oraclefactorypb.OracleFactoryClient + log logger.Logger + resources []net.Resource + serviceClient *goplugin.ServiceClient +} + +func NewClient(log logger.Logger, b *net.BrokerExt, conn grpc.ClientConnInterface) *client { + b = b.WithName("OracleFactoryClient") + return &client{ + log: log, + broker: b, + serviceClient: goplugin.NewServiceClient(b, conn), + grpc: oraclefactorypb.NewOracleFactoryClient(conn)} +} + +func (c *client) NewOracle(ctx context.Context, oracleArgs core.OracleArgs) (core.Oracle, error) { + var resources []net.Resource + + serviceName := "ReportingPluginFactoryServer" + reportingPluginFactoryServerID, reportingPluginFactoryServerRes, err := c.broker.ServeNew( + serviceName, func(gs *grpc.Server) { + ocr3_1pb.RegisterReportingPluginFactoryServer(gs, reportingplugin.NewReportingPluginFactoryServer( + oracleArgs.ReportingPluginFactoryService, + c.broker, + )) + }, + ) + if err != nil { + return nil, fmt.Errorf("failed to serve new %s: %w", serviceName, err) + } + resources = append(resources, reportingPluginFactoryServerRes) + + serviceName = "ContractTransmitterServer" + contractTransmitterServerID, contractTransmitterServerRes, err := c.broker.ServeNew( + serviceName, func(gs *grpc.Server) { + ocr3pb.RegisterContractTransmitterServer(gs, ocr3relayer.NewContractTransmitterServer( + oracleArgs.ContractTransmitter, + )) + }, + ) + if err != nil { + c.broker.CloseAll(resources...) + return nil, fmt.Errorf("failed to serve new %s: %w", serviceName, err) + } + resources = append(resources, contractTransmitterServerRes) + + newOracleRequest := oraclefactorypb.NewOracleRequest{ + LocalConfig: &oraclefactorypb.LocalConfig{ + BlockchainTimeout: durationpb.New(oracleArgs.LocalConfig.BlockchainTimeout), + ContractConfigConfirmations: uint32(oracleArgs.LocalConfig.ContractConfigConfirmations), + SkipContractConfigConfirmations: oracleArgs.LocalConfig.SkipContractConfigConfirmations, + ContractConfigTrackerPollInterval: durationpb.New(oracleArgs.LocalConfig.ContractConfigTrackerPollInterval), + ContractTransmitterTransmitTimeout: durationpb.New(oracleArgs.LocalConfig.ContractTransmitterTransmitTimeout), + DatabaseTimeout: durationpb.New(oracleArgs.LocalConfig.DatabaseTimeout), + MinOcr2MaxDurationQuery: durationpb.New(oracleArgs.LocalConfig.MinOCR2MaxDurationQuery), + ContractConfigLoadTimeout: durationpb.New(oracleArgs.LocalConfig.ContractConfigLoadTimeout), + DefaultMaxDurationInitialization: durationpb.New(oracleArgs.LocalConfig.DefaultMaxDurationInitialization), + DevelopmentMode: oracleArgs.LocalConfig.DevelopmentMode, + }, + ReportingPluginFactoryServiceId: reportingPluginFactoryServerID, + ContractTransmitterId: contractTransmitterServerID, + } + + newOracleReply, err := c.grpc.NewOracle(ctx, &newOracleRequest) + if err != nil { + c.broker.CloseAll(resources...) + return nil, fmt.Errorf("error getting new oracle: %w", err) + } + + oracleClientConn, err := c.broker.Dial(newOracleReply.OracleId) + if err != nil { + c.broker.CloseAll(resources...) + return nil, fmt.Errorf("error dialing reporting plugin factory service: %w", err) + } + resources = append(resources, net.Resource{ + Closer: oracleClientConn, + Name: "OracleClientConn", + }) + + c.resources = append(c.resources, resources...) + return oracle.NewClient(oracleClientConn), nil +} diff --git a/pkg/loop/internal/core/services/oraclefactory3_1/server.go b/pkg/loop/internal/core/services/oraclefactory3_1/server.go new file mode 100644 index 0000000000..36e91d67ce --- /dev/null +++ b/pkg/loop/internal/core/services/oraclefactory3_1/server.go @@ -0,0 +1,114 @@ +package oraclefactory3_1 + +import ( + "context" + "fmt" + + "google.golang.org/grpc" + + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + + "github.com/smartcontractkit/chainlink-common/pkg/logger" + oraclesrv "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/oracle" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/reportingplugin/ocr3" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + oraclepb "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/oracle" + oraclefactorypb "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/oraclefactory" + ocr3relayer "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/relayer/pluginprovider/ocr3" + "github.com/smartcontractkit/chainlink-common/pkg/types/core" +) + +var _ oraclefactorypb.OracleFactoryServer = (*server)(nil) + +type server struct { + oraclefactorypb.UnimplementedOracleFactoryServer + + broker *net.BrokerExt + impl core.OracleFactory + log logger.Logger + resources net.Resources + + Name string +} + +func NewServer(log logger.Logger, impl core.OracleFactory, broker *net.BrokerExt) (*server, net.Resource) { + name := "OracleFactoryServer3_1" + newServer := &server{ + log: log, + impl: impl, + broker: broker.WithName(name), + resources: make(net.Resources, 0), + } + + return newServer, net.Resource{ + Name: name, + Closer: newServer, + } +} + +func (s *server) Close() error { + s.broker.CloseAll(s.resources...) + return nil +} + +func (s *server) NewOracle(ctx context.Context, req *oraclefactorypb.NewOracleRequest) (*oraclefactorypb.NewOracleReply, error) { + var resources []net.Resource + + serviceName := "ReportingPluginFactory3_1" + reportingPluginFactoryServiceConn, err := s.broker.Dial(req.ReportingPluginFactoryServiceId) + if err != nil { + return nil, fmt.Errorf("error dialing %s service: %w", serviceName, err) + } + resources = append(resources, net.Resource{ + Closer: reportingPluginFactoryServiceConn, + Name: serviceName, + }) + + serviceName = "ContractTransmitter" + contractTransmitterConn, err := s.broker.Dial(req.ContractTransmitterId) + if err != nil { + return nil, fmt.Errorf("error dialing %s service: %w", serviceName, err) + } + resources = append(resources, net.Resource{ + Closer: contractTransmitterConn, + Name: serviceName, + }) + + args := core.OracleArgs{ + LocalConfig: types.LocalConfig{ + BlockchainTimeout: req.LocalConfig.BlockchainTimeout.AsDuration(), + ContractConfigConfirmations: uint16(req.LocalConfig.ContractConfigConfirmations), // #nosec G115 + SkipContractConfigConfirmations: req.LocalConfig.SkipContractConfigConfirmations, + ContractConfigTrackerPollInterval: req.LocalConfig.ContractConfigTrackerPollInterval.AsDuration(), + ContractTransmitterTransmitTimeout: req.LocalConfig.ContractTransmitterTransmitTimeout.AsDuration(), + DatabaseTimeout: req.LocalConfig.DatabaseTimeout.AsDuration(), + ContractConfigLoadTimeout: req.LocalConfig.ContractConfigLoadTimeout.AsDuration(), + DefaultMaxDurationInitialization: req.LocalConfig.DefaultMaxDurationInitialization.AsDuration(), + MinOCR2MaxDurationQuery: req.LocalConfig.MinOcr2MaxDurationQuery.AsDuration(), + DevelopmentMode: req.LocalConfig.DevelopmentMode, + }, + ReportingPluginFactoryService: ocr3.NewReportingPluginFactoryClient( + s.broker, + reportingPluginFactoryServiceConn, + ), + ContractTransmitter: ocr3relayer.NewContractTransmitterClient(s.broker, contractTransmitterConn), + } + + oracle, err := s.impl.NewOracle(ctx, args) + if err != nil { + return nil, fmt.Errorf("NewOracle call failed: %w", err) + } + + oracleServer, oracleServerRes := oraclesrv.NewServer(s.log, oracle, s.broker) + resources = append(resources, oracleServerRes) + oracleID, oracleRes, err := s.broker.ServeNew("Oracle", func(gs *grpc.Server) { + oraclepb.RegisterOracleServer(gs, oracleServer) + }) + if err != nil { + s.broker.CloseAll(resources...) + return nil, fmt.Errorf("failed to serve new oracle: %w", err) + } + resources = append(resources, oracleRes) + s.resources = append(s.resources, resources...) + return &oraclefactorypb.NewOracleReply{OracleId: oracleID}, nil +} diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go new file mode 100644 index 0000000000..e9c51f27e0 --- /dev/null +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go @@ -0,0 +1,516 @@ +package ocr3_1 + +import ( + "context" + "math" + "sync" + "time" + + "github.com/google/uuid" + "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/emptypb" + + "github.com/smartcontractkit/libocr/commontypes" + "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3_1types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/goplugin" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb" + ocr3 "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/ocr3_1" + ocr3_1 "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/ocr3_1" +) + +type reportingPluginFactoryClient struct { + *net.BrokerExt + *goplugin.ServiceClient + grpc ocr3.ReportingPluginFactoryClient +} + +func NewReportingPluginFactoryClient(b *net.BrokerExt, cc grpc.ClientConnInterface) *reportingPluginFactoryClient { + b = b.WithName("OCR3_1ReportingPluginProviderClient") + return &reportingPluginFactoryClient{b, goplugin.NewServiceClient(b, cc), ocr3.NewReportingPluginFactoryClient(cc)} +} + +func (r *reportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, config ocr3types.ReportingPluginConfig) (ocr3_1types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { + reply, err := r.grpc.NewReportingPlugin(ctx, &ocr3.NewReportingPluginRequest{ReportingPluginConfig: &ocr3.ReportingPluginConfig{ + ConfigDigest: config.ConfigDigest[:], + OracleID: uint32(config.OracleID), + N: uint32(config.N), + F: uint32(config.F), + OnchainConfig: config.OnchainConfig, + OffchainConfig: config.OffchainConfig, + EstimatedRoundInterval: int64(config.EstimatedRoundInterval), + MaxDurationQuery: int64(config.MaxDurationQuery), + MaxDurationObservation: int64(config.MaxDurationObservation), + MaxDurationShouldTransmitAcceptedReport: int64(config.MaxDurationShouldTransmitAcceptedReport), + MaxDurationShouldAcceptAttestedReport: int64(config.MaxDurationShouldAcceptAttestedReport), + }}) + if err != nil { + return nil, ocr3types.ReportingPluginInfo{}, err + } + rpi := ocr3_1types.ReportingPluginInfo{ + Name: reply.ReportingPluginInfo.Name, + Limits: ocr3_1types.ReportingPluginLimits{ + MaxQueryLength: int(reply.ReportingPluginInfo.ReportingPluginLimits.MaxQueryLength), + MaxObservationLength: int(reply.ReportingPluginInfo.ReportingPluginLimits.MaxObservationLength), + MaxReportLength: int(reply.ReportingPluginInfo.ReportingPluginLimits.MaxReportLength), + MaxReportCount: int(reply.ReportingPluginInfo.ReportingPluginLimits.MaxReportCount), + }, + } + cc, err := r.BrokerExt.Dial(reply.ReportingPluginID) + if err != nil { + return nil, ocr3types.ReportingPluginInfo{}, err + } + return newReportingPluginClient(r.BrokerExt, cc), rpi, nil +} + +var _ ocr3_1.ReportingPluginFactoryServer = (*reportingPluginFactoryServer)(nil) + +type reportingPluginFactoryServer struct { + ocr3_1.UnimplementedReportingPluginFactoryServer + + *net.BrokerExt + + impl ocr3_1types.ReportingPluginFactory[[]byte] +} + +func NewReportingPluginFactoryServer(impl ocr3_1types.ReportingPluginFactory[[]byte], b *net.BrokerExt) *reportingPluginFactoryServer { + return &reportingPluginFactoryServer{impl: impl, BrokerExt: b.WithName("OCR3ReportingPluginFactoryServer")} +} + +func (r *reportingPluginFactoryServer) NewReportingPlugin(ctx context.Context, request *ocr3_1.NewReportingPluginRequest) (*ocr3_1.NewReportingPluginReply, error) { + cfg := ocr3types.ReportingPluginConfig{ + ConfigDigest: libocr.ConfigDigest{}, + OracleID: commontypes.OracleID(request.ReportingPluginConfig.OracleID), + N: int(request.ReportingPluginConfig.N), + F: int(request.ReportingPluginConfig.F), + OnchainConfig: request.ReportingPluginConfig.OnchainConfig, + OffchainConfig: request.ReportingPluginConfig.OffchainConfig, + EstimatedRoundInterval: time.Duration(request.ReportingPluginConfig.EstimatedRoundInterval), + MaxDurationQuery: time.Duration(request.ReportingPluginConfig.MaxDurationQuery), + MaxDurationObservation: time.Duration(request.ReportingPluginConfig.MaxDurationObservation), + MaxDurationShouldTransmitAcceptedReport: time.Duration(request.ReportingPluginConfig.MaxDurationShouldTransmitAcceptedReport), + MaxDurationShouldAcceptAttestedReport: time.Duration(request.ReportingPluginConfig.MaxDurationShouldAcceptAttestedReport), + } + if l := len(request.ReportingPluginConfig.ConfigDigest); l != 32 { + return nil, pb.ErrConfigDigestLen(l) + } + copy(cfg.ConfigDigest[:], request.ReportingPluginConfig.ConfigDigest) + + rp, rpi, err := r.impl.NewReportingPlugin(ctx, cfg, nil) + if err != nil { + return nil, err + } + + const name = "OCR3_1ReportingPlugin" + id, _, err := r.ServeNew(name, func(s *grpc.Server) { + ocr3.RegisterReportingPluginServer(s, &reportingPluginServer{impl: rp}) + }, net.Resource{Closer: rp, Name: name}) + if err != nil { + return nil, err + } + + return &ocr3_1.NewReportingPluginReply{ReportingPluginID: id, ReportingPluginInfo: &ocr3_1.ReportingPluginInfo{ + Name: rpi.Name, + ReportingPluginLimits: &ocr3_1.ReportingPluginLimits{ + MaxQueryLength: uint64(rpi.Limits.MaxQueryLength), + MaxObservationLength: uint64(rpi.Limits.MaxObservationLength), + MaxReportLength: uint64(rpi.Limits.MaxReportLength), + MaxReportCount: uint64(rpi.Limits.MaxReportCount), + }, + }, + }, nil +} + +var _ ocr3_1types.ReportingPlugin[[]byte] = (*reportingPluginClient)(nil) + +type keyValueReaders struct { + keyValueReaders sync.Map +} + +func newKeyValueReaders() *keyValueReaders { + return &keyValueReaders{keyValueReaders: sync.Map{}} +} + +func (kvr *keyValueReaders) Get(id string) ocr3_1types.KeyValueReader { + v, ok := kvr.keyValueReaders.Load(id) + if !ok { + return nil + } + return v.(ocr3_1types.KeyValueReader) +} + +func (kvr *keyValueReaders) Put(kvr2 ocr3_1types.KeyValueReader) string { + id := uuid.NewString() + kvr.keyValueReaders.Store(id, kvr2) + + return id +} + +func (kvr *keyValueReaders) Delete(id string) { + kvr.keyValueReaders.Delete(id) +} + +type reportingPluginClient struct { + *net.BrokerExt + grpc ocr3.ReportingPluginClient + keyValueReaders *keyValueReaders +} + +func (o *reportingPluginClient) StateTransition(ctx context.Context, seqNr uint64, aq libocr.AttributedQuery, aos []libocr.AttributedObservation, keyValueReadWriter ocr3_1types.KeyValueReadWriter, blobFetcher ocr3_1types.BlobFetcher) (ocr3_1types.ReportsPlusPrecursor, error) { + //TODO implement me + panic("implement me") +} + +func (o *reportingPluginClient) Committed(ctx context.Context, seqNr uint64, keyValueReader ocr3_1types.KeyValueReader) error { + //TODO implement me + panic("implement me") +} + +func (o *reportingPluginClient) Query(ctx context.Context, seqNr uint64, keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobBroadcastFetcher) (libocr.Query, error) { + kvrID := o.keyValueReaders.Put(keyValueReader) + defer o.keyValueReaders.Delete(kvrID) + reply, err := o.grpc.Query(ctx, &ocr3_1.QueryRequest{ + KeyValueStateReaderID: kvrID, + SeqNr: seqNr, + }) + if err != nil { + return nil, err + } + return reply.Query, nil +} + +func (o *reportingPluginClient) Observation(ctx context.Context, seqNr uint64, aq libocr.AttributedQuery, keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobBroadcastFetcher) (libocr.Observation, error) { + kvrID := o.keyValueReaders.Put(keyValueReader) + defer o.keyValueReaders.Delete(kvrID) + reply, err := o.grpc.Observation(ctx, &ocr3_1.ObservationRequest{ + KeyValueStateReaderID: kvrID, + SeqNr: seqNr, + Query: &ocr3_1.AttributedQuery{ + Query: aq.Query, + OracleID: uint32(aq.Proposer), + }, + }) + if err != nil { + return nil, err + } + return reply.Observation, nil +} + +func (o *reportingPluginClient) ValidateObservation(ctx context.Context, seqNr uint64, + aq libocr.AttributedQuery, + ao libocr.AttributedObservation, + keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobBroadcastFetcher) error { + kvrID := o.keyValueReaders.Put(keyValueReader) + defer o.keyValueReaders.Delete(kvrID) + _, err := o.grpc.ValidateObservation(ctx, &ocr3.ValidateObservationRequest{ + KeyValueStateReaderID: kvrID, + SeqNr: seqNr, + Query: &ocr3_1.AttributedQuery{ + Query: aq.Query, + OracleID: uint32(aq.Proposer), + }, + Observation: &ocr3_1.AttributedObservation{ + Observation: ao.Observation, + OracleID: uint32(ao.Observer), + }, + }) + return err +} + +func (o *reportingPluginClient) ObservationQuorum(ctx context.Context, seqNr uint64, + aq libocr.AttributedQuery, + aos []types.AttributedObservation, + keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobBroadcastFetcher) (bool, error) { + kvrID := o.keyValueReaders.Put(keyValueReader) + defer o.keyValueReaders.Delete(kvrID) + + observations := []types.AttributedObservation, + + reply, err := o.grpc.ObservationQuorum(ctx, &ocr3.ObservationQuorumRequest{ + KeyValueStateReaderID: kvrID, + SeqNr: seqNr, + Query: &ocr3_1.AttributedQuery{ + Query: aq.Query, + OracleID: uint32(aq.Proposer), + }, + Observation: &ocr3_1.AttributedObservation{ + Observation: ao.Observation, + OracleID: uint32(ao.Observer), + }, + + }) + if err != nil { + return false, err + } + return reply.QuorumReached, nil +} + +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, + Ao: pbAttributedObservations(aos), + }) + if err != nil { + return nil, err + } + return reply.Outcome, nil +} + +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, + }) + if err != nil { + return nil, err + } + return reportsPlus(reply.ReportPlus), nil +} + +func (o *reportingPluginClient) ShouldAcceptAttestedReport(ctx context.Context, u uint64, ri ocr3types.ReportWithInfo[[]byte]) (bool, error) { + reply, err := o.grpc.ShouldAcceptAttestedReport(ctx, &ocr3.ShouldAcceptAttestedReportRequest{ + SegNr: u, + Ri: &ocr3.ReportWithInfo{Report: ri.Report, Info: ri.Info}, + }) + if err != nil { + return false, err + } + return reply.ShouldAccept, nil +} + +func (o *reportingPluginClient) ShouldTransmitAcceptedReport(ctx context.Context, u uint64, ri ocr3types.ReportWithInfo[[]byte]) (bool, error) { + reply, err := o.grpc.ShouldTransmitAcceptedReport(ctx, &ocr3.ShouldTransmitAcceptedReportRequest{ + SegNr: u, + Ri: &ocr3.ReportWithInfo{Report: ri.Report, Info: ri.Info}, + }) + if err != nil { + return false, err + } + return reply.ShouldTransmit, nil +} + +func (o *reportingPluginClient) Close() error { + ctx, cancel := o.StopCtx() + defer cancel() + + _, err := o.grpc.Close(ctx, &emptypb.Empty{}) + return err +} + +func newReportingPluginClient(b *net.BrokerExt, cc grpc.ClientConnInterface) *reportingPluginClient { + return &reportingPluginClient{b.WithName("OCR3ReportingPluginClient"), ocr3.NewReportingPluginClient(cc), + keyValueReaders: *newKeyValueReaders()} +} + +var _ ocr3.ReportingPluginServer = (*reportingPluginServer)(nil) + +type reportingPluginServer struct { + ocr3.UnimplementedReportingPluginServer + + impl ocr3types.ReportingPlugin[[]byte] +} + +func (o *reportingPluginServer) Query(ctx context.Context, request *ocr3.QueryRequest) (*ocr3.QueryReply, error) { + oc := outcomeContext(request.OutcomeContext) + q, err := o.impl.Query(ctx, oc) + if err != nil { + return nil, err + } + return &ocr3.QueryReply{Query: q}, nil +} + +func (o *reportingPluginServer) Observation(ctx context.Context, request *ocr3.ObservationRequest) (*ocr3.ObservationReply, error) { + obs, err := o.impl.Observation(ctx, outcomeContext(request.OutcomeContext), request.Query) + if err != nil { + return nil, err + } + return &ocr3.ObservationReply{Observation: obs}, nil +} + +func (o *reportingPluginServer) ValidateObservation(ctx context.Context, request *ocr3.ValidateObservationRequest) (*emptypb.Empty, error) { + ao, err := attributedObservation(request.Ao) + if err != nil { + return nil, err + } + 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) { + 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{QuorumReached: oq}, nil +} + +func (o *reportingPluginServer) Outcome(ctx context.Context, request *ocr3.OutcomeRequest) (*ocr3.OutcomeReply, error) { + aos, err := attributedObservations(request.Ao) + if err != nil { + return nil, err + } + out, err := o.impl.Outcome(ctx, outcomeContext(request.OutcomeContext), request.Query, aos) + if err != nil { + return nil, err + } + return &ocr3.OutcomeReply{ + Outcome: out, + }, nil +} + +func (o *reportingPluginServer) Reports(ctx context.Context, request *ocr3.ReportsRequest) (*ocr3.ReportsReply, error) { + rp, err := o.impl.Reports(ctx, request.SeqNr, request.Outcome) + if err != nil { + return nil, err + } + return &ocr3.ReportsReply{ + ReportPlus: pbReportsPlus(rp), + }, nil +} + +func (o *reportingPluginServer) ShouldAcceptAttestedReport(ctx context.Context, request *ocr3.ShouldAcceptAttestedReportRequest) (*ocr3.ShouldAcceptAttestedReportReply, error) { + sa, err := o.impl.ShouldAcceptAttestedReport(ctx, request.SegNr, ocr3types.ReportWithInfo[[]byte]{ + Report: request.Ri.Report, + Info: request.Ri.Info, + }) + if err != nil { + return nil, err + } + return &ocr3.ShouldAcceptAttestedReportReply{ + ShouldAccept: sa, + }, nil +} + +func (o *reportingPluginServer) ShouldTransmitAcceptedReport(ctx context.Context, request *ocr3.ShouldTransmitAcceptedReportRequest) (*ocr3.ShouldTransmitAcceptedReportReply, error) { + st, err := o.impl.ShouldTransmitAcceptedReport(ctx, request.SegNr, ocr3types.ReportWithInfo[[]byte]{ + Report: request.Ri.Report, + Info: request.Ri.Info, + }) + if err != nil { + return nil, err + } + return &ocr3.ShouldTransmitAcceptedReportReply{ + ShouldTransmit: st, + }, nil +} + +func (o *reportingPluginServer) Close(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) { + return &emptypb.Empty{}, o.impl.Close() +} + +func pbOutcomeContext(oc ocr3types.OutcomeContext) *ocr3.OutcomeContext { + return &ocr3.OutcomeContext{ + SeqNr: oc.SeqNr, + PreviousOutcome: oc.PreviousOutcome, + Epoch: oc.Epoch, //nolint:all + Round: oc.Round, //nolint:all + } +} + +func pbAttributedObservation(ao libocr.AttributedObservation) *ocr3.AttributedObservation { + return &ocr3.AttributedObservation{ + Observation: ao.Observation, + Observer: uint32(ao.Observer), + } +} + +func pbReportsPlus(rwi []ocr3types.ReportPlus[[]byte]) (ri []*ocr3.ReportPlus) { + for _, r := range rwi { + 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)) + } + + return pbaos +} + +func outcomeContext(oc *ocr3.OutcomeContext) ocr3types.OutcomeContext { + return ocr3types.OutcomeContext{ + SeqNr: oc.SeqNr, + PreviousOutcome: oc.PreviousOutcome, + Epoch: oc.Epoch, //nolint:all + Round: oc.Round, //nolint:all + } +} + +func attributedObservation(pbo *ocr3.AttributedObservation) (o libocr.AttributedObservation, err error) { + o.Observation = pbo.Observation + if pbo.Observer > math.MaxUint8 { + err = pb.ErrUint8Bounds{Name: "Observer", U: pbo.Observer} + return + } + o.Observer = commontypes.OracleID(pbo.Observer) + return +} + +func attributedObservations(pbo []*ocr3.AttributedObservation) (o []libocr.AttributedObservation, err error) { + for _, ao := range pbo { + a, err := attributedObservation(ao) + if err != nil { + return nil, err + } + o = append(o, a) + } + return +} + +func reportsPlus(ri []*ocr3.ReportPlus) (rwi []ocr3types.ReportPlus[[]byte]) { + for _, r := range ri { + 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_1/reporting_plugin_service.go b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting_plugin_service.go new file mode 100644 index 0000000000..fa33357551 --- /dev/null +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting_plugin_service.go @@ -0,0 +1,262 @@ +package ocr3_1 + +import ( + "context" + "fmt" + + "google.golang.org/grpc" + + "github.com/smartcontractkit/grpc-proxy/proxy" + + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/keyvalue" + relayersetpb "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/relayerset" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/relayerset" + + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/capability" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/errorlog" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/pipeline" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/telemetry" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/validation" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/goplugin" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb" + ocr3pb "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/ocr3" + "github.com/smartcontractkit/chainlink-common/pkg/types/core" +) + +type ReportingPluginServiceClient struct { + *goplugin.PluginClient + *goplugin.ServiceClient + + reportingPluginService pb.ReportingPluginServiceClient +} + +func NewReportingPluginServiceClient(brokerCfg net.BrokerConfig) *ReportingPluginServiceClient { + brokerCfg.Logger = logger.Named(brokerCfg.Logger, "ReportingPluginServiceClient") + pc := goplugin.NewPluginClient(brokerCfg) + return &ReportingPluginServiceClient{PluginClient: pc, reportingPluginService: pb.NewReportingPluginServiceClient(pc), ServiceClient: goplugin.NewServiceClient(pc.BrokerExt, pc)} +} + +func (o *ReportingPluginServiceClient) NewReportingPluginFactory( + ctx context.Context, + config core.ReportingPluginServiceConfig, + grpcProvider grpc.ClientConnInterface, + pipelineRunner core.PipelineRunnerService, + telemetryService core.TelemetryService, + errorLog core.ErrorLog, + capRegistry core.CapabilitiesRegistry, + keyValueStore core.KeyValueStore, + relayerSet core.RelayerSet, +) (core.OCR3ReportingPluginFactory, error) { + cc := o.NewClientConn("ReportingPluginServiceFactory", func(ctx context.Context) (id uint32, deps net.Resources, err error) { + providerID, providerRes, err := o.Serve("PluginProvider", proxy.NewProxy(grpcProvider)) + if err != nil { + return 0, nil, err + } + deps.Add(providerRes) + + pipelineRunnerID, pipelineRunnerRes, err := o.ServeNew("PipelineRunner", func(s *grpc.Server) { + pb.RegisterPipelineRunnerServiceServer(s, pipeline.NewRunnerServer(pipelineRunner)) + }) + if err != nil { + return 0, nil, err + } + deps.Add(pipelineRunnerRes) + + telemetryID, telemetryRes, err := o.ServeNew("Telemetry", func(s *grpc.Server) { + pb.RegisterTelemetryServer(s, telemetry.NewTelemetryServer(telemetryService)) + }) + if err != nil { + return 0, nil, err + } + deps.Add(telemetryRes) + + errorLogID, errorLogRes, err := o.ServeNew("ErrorLog", func(s *grpc.Server) { + pb.RegisterErrorLogServer(s, errorlog.NewServer(errorLog)) + }) + if err != nil { + return 0, nil, err + } + deps.Add(errorLogRes) + + capRegistryID, capRegistryRes, err := o.ServeNew("CapRegistry", func(s *grpc.Server) { + pb.RegisterCapabilitiesRegistryServer(s, capability.NewCapabilitiesRegistryServer(o.BrokerExt, capRegistry)) + }) + if err != nil { + return 0, nil, err + } + deps.Add(capRegistryRes) + + keyValueStoreID, keyValueStoreRes, err := o.ServeNew("KeyValueStore", func(s *grpc.Server) { + pb.RegisterKeyValueStoreServer(s, keyvalue.NewServer(keyValueStore)) + }) + if err != nil { + return 0, nil, fmt.Errorf("failed to serve KeyValueStore: %w", err) + } + deps.Add(keyValueStoreRes) + + relayerSetServer, relayerSetServerRes := relayerset.NewRelayerSetServer(o.Logger, relayerSet, o.BrokerExt) + + relayerSetID, relayerSetRes, err := o.ServeNew("RelayerSet", func(s *grpc.Server) { + relayersetpb.RegisterRelayerSetServerWithDependants(s, relayerSetServer) + }) + + if err != nil { + return 0, nil, fmt.Errorf("failed to serve new relayer set: %w", err) + } + + deps.Add(relayerSetRes) + deps.Add(relayerSetServerRes) + + reply, err := o.reportingPluginService.NewReportingPluginFactory(ctx, &pb.NewReportingPluginFactoryRequest{ + ReportingPluginServiceConfig: &pb.ReportingPluginServiceConfig{ + ProviderType: config.ProviderType, + Command: config.Command, + PluginName: config.PluginName, + TelemetryType: config.TelemetryType, + PluginConfig: config.PluginConfig, + }, + ProviderID: providerID, + ErrorLogID: errorLogID, + PipelineRunnerID: pipelineRunnerID, + TelemetryID: telemetryID, + CapRegistryID: capRegistryID, + KeyValueStoreID: keyValueStoreID, + RelayerSetID: relayerSetID, + }) + if err != nil { + return 0, nil, err + } + return reply.ID, nil, nil + }) + return NewReportingPluginFactoryClient(o.PluginClient.BrokerExt, cc), nil +} + +func (o *ReportingPluginServiceClient) NewValidationService(ctx context.Context) (core.ValidationService, error) { + cc := o.NewClientConn("ValidationService", func(ctx context.Context) (id uint32, deps net.Resources, err error) { + reply, err := o.reportingPluginService.NewValidationService(ctx, &pb.ValidationServiceRequest{}) + if err != nil { + return 0, nil, err + } + return reply.ID, nil, nil + }) + return validation.NewValidationServiceClient(o.PluginClient.BrokerExt, cc), nil +} + +var _ pb.ReportingPluginServiceServer = (*reportingPluginServiceServer)(nil) + +type reportingPluginServiceServer struct { + pb.UnimplementedReportingPluginServiceServer + + *net.BrokerExt + impl core.OCR3ReportingPluginClient +} + +func (m reportingPluginServiceServer) NewValidationService(ctx context.Context, request *pb.ValidationServiceRequest) (*pb.ValidationServiceResponse, error) { + service, err := m.impl.NewValidationService(ctx) + if err != nil { + return nil, err + } + + id, _, err := m.ServeNew("ValidationService", func(s *grpc.Server) { + pb.RegisterServiceServer(s, &goplugin.ServiceServer{Srv: service}) + pb.RegisterValidationServiceServer(s, validation.NewValidationServiceServer(service, m.BrokerExt)) + }) + if err != nil { + return nil, err + } + + return &pb.ValidationServiceResponse{ID: id}, nil +} + +func (m reportingPluginServiceServer) NewReportingPluginFactory(ctx context.Context, request *pb.NewReportingPluginFactoryRequest) (*pb.NewReportingPluginFactoryReply, error) { + errorLogConn, err := m.Dial(request.ErrorLogID) + if err != nil { + return nil, net.ErrConnDial{Name: "ErrorLog", ID: request.ErrorLogID, Err: err} + } + errorLogRes := net.Resource{Closer: errorLogConn, Name: "ErrorLog"} + errorLog := errorlog.NewClient(errorLogConn) + + providerConn, err := m.Dial(request.ProviderID) + if err != nil { + m.CloseAll(errorLogRes) + return nil, net.ErrConnDial{Name: "PluginProvider", ID: request.ProviderID, Err: err} + } + providerRes := net.Resource{Closer: providerConn, Name: "PluginProvider"} + + pipelineRunnerConn, err := m.Dial(request.PipelineRunnerID) + if err != nil { + m.CloseAll(errorLogRes, providerRes) + return nil, net.ErrConnDial{Name: "PipelineRunner", ID: request.PipelineRunnerID, Err: err} + } + pipelineRunnerRes := net.Resource{Closer: pipelineRunnerConn, Name: "PipelineRunner"} + pipelineRunner := pipeline.NewRunnerClient(pipelineRunnerConn) + + telemetryConn, err := m.Dial(request.TelemetryID) + if err != nil { + m.CloseAll(errorLogRes, providerRes, pipelineRunnerRes) + return nil, net.ErrConnDial{Name: "Telemetry", ID: request.TelemetryID, Err: err} + } + telemetryRes := net.Resource{Closer: telemetryConn, Name: "Telemetry"} + telemetry := telemetry.NewTelemetryServiceClient(telemetryConn) + + capRegistryConn, err := m.Dial(request.CapRegistryID) + if err != nil { + m.CloseAll(errorLogRes, providerRes, pipelineRunnerRes, telemetryRes) + return nil, net.ErrConnDial{Name: "CapabilitiesRegistry", ID: request.CapRegistryID, Err: err} + } + capRegistryRes := net.Resource{Closer: capRegistryConn, Name: "CapabilitiesRegistry"} + capRegistry := capability.NewCapabilitiesRegistryClient(capRegistryConn, m.BrokerExt) + + keyValueStoreConn, err := m.Dial(request.KeyValueStoreID) + if err != nil { + m.CloseAll(errorLogRes, providerRes, pipelineRunnerRes, telemetryRes, capRegistryRes) + return nil, net.ErrConnDial{Name: "KeyValueStore", ID: request.KeyValueStoreID, Err: err} + } + keyValueStoreRes := net.Resource{Closer: keyValueStoreConn, Name: "KeyValueStore"} + keyValueStore := keyvalue.NewClient(keyValueStoreConn) + + config := core.ReportingPluginServiceConfig{ + ProviderType: request.ReportingPluginServiceConfig.ProviderType, + PluginConfig: request.ReportingPluginServiceConfig.PluginConfig, + PluginName: request.ReportingPluginServiceConfig.PluginName, + Command: request.ReportingPluginServiceConfig.Command, + TelemetryType: request.ReportingPluginServiceConfig.TelemetryType, + } + + relayersetConn, err := m.Dial(request.RelayerSetID) + if err != nil { + m.CloseAll(errorLogRes, providerRes, pipelineRunnerRes, telemetryRes, keyValueStoreRes) + return nil, net.ErrConnDial{Name: "RelayerSet", ID: request.RelayerSetID, Err: err} + } + relayerSetRes := net.Resource{Closer: relayersetConn, Name: "RelayerSet"} + relayerSet := relayerset.NewRelayerSetClient(m.Logger, m.BrokerExt, relayersetConn) + + factory, err := m.impl.NewReportingPluginFactory(ctx, config, providerConn, pipelineRunner, telemetry, errorLog, capRegistry, keyValueStore, + relayerSet) + if err != nil { + m.CloseAll(providerRes, errorLogRes, pipelineRunnerRes, telemetryRes, capRegistryRes, relayerSetRes) + return nil, err + } + + id, _, err := m.ServeNew("ReportingPluginProvider", func(s *grpc.Server) { + pb.RegisterServiceServer(s, &goplugin.ServiceServer{Srv: factory}) + ocr3pb.RegisterReportingPluginFactoryServer(s, NewReportingPluginFactoryServer(factory, m.BrokerExt)) + }, providerRes, errorLogRes, pipelineRunnerRes, telemetryRes, capRegistryRes, keyValueStoreRes, relayerSetRes) + if err != nil { + return nil, err + } + + return &pb.NewReportingPluginFactoryReply{ID: id}, nil +} + +func RegisterReportingPluginServiceServer(server *grpc.Server, broker net.Broker, brokerCfg net.BrokerConfig, impl core.OCR3ReportingPluginClient) error { + pb.RegisterServiceServer(server, &goplugin.ServiceServer{Srv: impl}) + pb.RegisterReportingPluginServiceServer(server, newReportingPluginServiceServer(&net.BrokerExt{Broker: broker, BrokerConfig: brokerCfg}, impl)) + return nil +} + +func newReportingPluginServiceServer(b *net.BrokerExt, gp core.OCR3ReportingPluginClient) *reportingPluginServiceServer { + return &reportingPluginServiceServer{BrokerExt: b.WithName("OCR3ReportingPluginService"), impl: gp} +} diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/factory.go b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/factory.go new file mode 100644 index 0000000000..75802e8a6d --- /dev/null +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/factory.go @@ -0,0 +1,128 @@ +package ocr3_1_test + +import ( + "bytes" + "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" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/test" + "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink-common/pkg/types/core" +) + +func Factory(lggr logger.Logger) ocr3StaticPluginFactory { + return newOCR3StaticPluginFactory(lggr, ocr3reportingPluginConfig, ReportingPlugin) +} + +// OCR3 +type ocr3StaticPluginFactory struct { + services.Service + ocr3types.ReportingPluginConfig + reportingPlugin ocr3staticReportingPlugin +} + +var _ core.OCR3ReportingPluginFactory = (*ocr3StaticPluginFactory)(nil) + +func newOCR3StaticPluginFactory(lggr logger.Logger, cfg ocr3types.ReportingPluginConfig, rp ocr3staticReportingPlugin) ocr3StaticPluginFactory { + lggr = logger.Named(lggr, "ocr3StaticPluginFactory") + return ocr3StaticPluginFactory{ + Service: test.NewStaticService(lggr), + ReportingPluginConfig: cfg, + reportingPlugin: rp, + } +} + +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) + } + return o.reportingPlugin, ocr3rpi, nil +} + +func (o ocr3StaticPluginFactory) equalConfig(other ocr3types.ReportingPluginConfig) error { + if other.ConfigDigest != o.ConfigDigest { + return fmt.Errorf("expected ConfigDigest %x but got %x", o.ConfigDigest, other.ConfigDigest) + } + if other.OracleID != o.OracleID { + return fmt.Errorf("expected OracleID %d but got %d", o.OracleID, other.OracleID) + } + if other.F != o.F { + return fmt.Errorf("expected F %d but got %d", o.F, other.F) + } + if other.N != o.N { + return fmt.Errorf("expected N %d but got %d", o.N, other.N) + } + if !bytes.Equal(other.OnchainConfig, o.OnchainConfig) { + return fmt.Errorf("expected OnchainConfig %x but got %x", o.OnchainConfig, other.OnchainConfig) + } + if !bytes.Equal(other.OffchainConfig, o.OffchainConfig) { + return fmt.Errorf("expected OffchainConfig %x but got %x", o.OffchainConfig, other.OffchainConfig) + } + if other.EstimatedRoundInterval != o.EstimatedRoundInterval { + return fmt.Errorf("expected EstimatedRoundInterval %d but got %d", o.EstimatedRoundInterval, other.EstimatedRoundInterval) + } + if other.MaxDurationQuery != o.MaxDurationQuery { + return fmt.Errorf("expected MaxDurationQuery %d but got %d", o.MaxDurationQuery, other.MaxDurationQuery) + } + if other.MaxDurationObservation != o.MaxDurationObservation { + return fmt.Errorf("expected MaxDurationObservation %d but got %d", o.MaxDurationObservation, other.MaxDurationObservation) + } + if other.MaxDurationShouldAcceptAttestedReport != o.MaxDurationShouldAcceptAttestedReport { + return fmt.Errorf("expected MaxDurationShouldAcceptAttestedReport %d but got %d", o.MaxDurationShouldAcceptAttestedReport, other.MaxDurationShouldAcceptAttestedReport) + } + if other.MaxDurationShouldTransmitAcceptedReport != o.MaxDurationShouldTransmitAcceptedReport { + return fmt.Errorf("expected MaxDurationShouldTransmitAcceptedReport %d but got %d", o.MaxDurationShouldTransmitAcceptedReport, other.MaxDurationShouldTransmitAcceptedReport) + } + return nil +} + +func OCR3ReportingPluginFactory(t *testing.T, factory core.OCR3ReportingPluginFactory) { + expectedFactory := Factory(logger.Test(t)) + t.Run("OCR3ReportingPluginFactory", func(t *testing.T) { + rp, gotRPI, err := factory.NewReportingPlugin(t.Context(), ocr3reportingPluginConfig) + require.NoError(t, err) + assert.Equal(t, ocr3rpi, gotRPI) + t.Cleanup(func() { assert.NoError(t, rp.Close()) }) + t.Run("OCR3ReportingPlugin", func(t *testing.T) { + expectedFactory.reportingPlugin.AssertEqual(t.Context(), t, rp) + }) + }) +} + +var ( + //OCR3 + ocr3reportingPluginConfig = ocr3types.ReportingPluginConfig{ + ConfigDigest: libocr.ConfigDigest([32]byte{1: 1, 3: 3, 5: 5}), + OracleID: commontypes.OracleID(10), + N: 12, + F: 42, + OnchainConfig: []byte{17: 11}, + OffchainConfig: []byte{32: 64}, + EstimatedRoundInterval: time.Second, + MaxDurationQuery: time.Hour, + MaxDurationObservation: time.Millisecond, + MaxDurationShouldAcceptAttestedReport: 10 * time.Second, + MaxDurationShouldTransmitAcceptedReport: time.Minute, + } + + ocr3rpi = ocr3types.ReportingPluginInfo{ + Name: "test", + Limits: ocr3types.ReportingPluginLimits{ + MaxQueryLength: 42, + MaxObservationLength: 13, + MaxOutcomeLength: 33, + MaxReportLength: 17, + MaxReportCount: 41, + }, + } +) diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/factory_generators.go b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/factory_generators.go new file mode 100644 index 0000000000..f5a234a075 --- /dev/null +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/factory_generators.go @@ -0,0 +1,134 @@ +package ocr3_1_test + +import ( + "context" + "fmt" + + "google.golang.org/grpc" + + "github.com/smartcontractkit/chainlink-common/pkg/logger" + pipelinetest "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/pipeline/test" + telemetrytest "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/telemetry/test" + validationtest "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/validation/test" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + mediantest "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/relayer/pluginprovider/ext/median/test" + ocr2test "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/relayer/pluginprovider/ocr2/test" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/test" + testtypes "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/test/types" + "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/types/core" +) + +func MedianServer(lggr logger.Logger) medianServer { + return newMedianServer(lggr, medianGeneratorConfig{ + medianProvider: mediantest.MedianProvider(lggr), + pipeline: pipelinetest.PipelineRunner, + telemetry: telemetrytest.Telemetry, + validationService: validationtest.ValidationService, + }) +} + +const OCR3ReportingPluginWithMedianProviderName = "ocr3-reporting-plugin-with-median-provider" + +type medianGeneratorConfig struct { + medianProvider testtypes.MedianProviderTester + pipeline testtypes.Evaluator[core.PipelineRunnerService] + telemetry testtypes.Evaluator[core.TelemetryClient] + validationService testtypes.ValidationEvaluator +} + +type medianServer struct { + services.Service + medianGeneratorConfig + factory ocr3StaticPluginFactory +} + +func newMedianServer(lggr logger.Logger, cfg medianGeneratorConfig) medianServer { + lggr = logger.Named(lggr, "medianServer") + return medianServer{ + Service: test.NewStaticService(lggr), + medianGeneratorConfig: cfg, + factory: Factory(lggr), + } +} + +func (s medianServer) NewValidationService(ctx context.Context) (core.ValidationService, error) { + return s.validationService, nil +} +func (s medianServer) ConnToProvider(conn grpc.ClientConnInterface, broker net.Broker, brokerConfig net.BrokerConfig) types.MedianProvider { + return s.medianProvider +} + +func (s medianServer) NewReportingPluginFactory(ctx context.Context, config core.ReportingPluginServiceConfig, + provider types.MedianProvider, pipelineRunner core.PipelineRunnerService, telemetry core.TelemetryClient, + errorLog core.ErrorLog, capRegistry core.CapabilitiesRegistry, + keyValueStore core.KeyValueStore, relayerSet core.RelayerSet) (core.OCR3ReportingPluginFactory, error) { + err := s.medianProvider.Evaluate(ctx, provider) + if err != nil { + return nil, fmt.Errorf("failed to evaluate median provider: %w", err) + } + + err = s.pipeline.Evaluate(ctx, pipelineRunner) + if err != nil { + return nil, fmt.Errorf("failed to evaluate pipeline runner: %w", err) + } + + err = s.telemetry.Evaluate(ctx, telemetry) + if err != nil { + return nil, fmt.Errorf("failed to evaluate telemetry: %w", err) + } + + return s.factory, nil +} + +func AgnosticPluginServer(lggr logger.Logger) agnosticPluginServer { + lggr = logger.Named(lggr, "agnosticPluginServer") + return agnosticPluginServer{ + Service: test.NewStaticService(lggr), + provider: ocr2test.AgnosticPluginProvider(lggr), + pipelineRunner: pipelinetest.PipelineRunner, + telemetry: telemetrytest.Telemetry, + validationService: validationtest.ValidationService, + factory: Factory(lggr), + } +} + +type agnosticPluginServer struct { + services.Service + provider testtypes.PluginProviderTester + pipelineRunner testtypes.PipelineEvaluator + telemetry testtypes.TelemetryEvaluator + validationService testtypes.ValidationEvaluator + factory ocr3StaticPluginFactory +} + +func (s agnosticPluginServer) NewValidationService(ctx context.Context) (core.ValidationService, error) { + return s.validationService, nil +} + +func (s agnosticPluginServer) ConnToProvider(conn grpc.ClientConnInterface, broker net.Broker, brokerConfig net.BrokerConfig) types.PluginProvider { + return s.provider +} + +func (s agnosticPluginServer) NewReportingPluginFactory(ctx context.Context, config core.ReportingPluginServiceConfig, + provider types.PluginProvider, pipelineRunner core.PipelineRunnerService, telemetry core.TelemetryClient, + errorLog core.ErrorLog, capRegistry core.CapabilitiesRegistry, + keyValueStore core.KeyValueStore, relayerSet core.RelayerSet) (core.OCR3ReportingPluginFactory, error) { + err := s.provider.Evaluate(ctx, provider) + if err != nil { + return nil, fmt.Errorf("failed to evaluate agnostic provider: %w", err) + } + + err = s.pipelineRunner.Evaluate(ctx, pipelineRunner) + if err != nil { + return nil, fmt.Errorf("failed to evaluate pipeline runner: %w", err) + } + + err = s.telemetry.Evaluate(ctx, telemetry) + if err != nil { + return nil, fmt.Errorf("failed to evaluate telemetry: %w", err) + } + + return s.factory, nil +} diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/reporting_plugin.go b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/reporting_plugin.go new file mode 100644 index 0000000000..a3b9c6cc58 --- /dev/null +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/test/reporting_plugin.go @@ -0,0 +1,338 @@ +package ocr3_1_test + +import ( + "bytes" + "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" + "github.com/stretchr/testify/require" +) + +var ( + outcomeCtx = ocr3types.OutcomeContext{ + SeqNr: 1, + PreviousOutcome: ocr3types.Outcome([]byte{1, 2, 3}), + } + + query = libocr.Query{1, 2, 3} +) +var ReportingPlugin = ocr3staticReportingPlugin{ + ocr3staticReportingPluginConfig: ocr3staticReportingPluginConfig{ + expectedOutcomeContext: outcomeCtx, + queryRequest: queryRequest{outcomeCtx: outcomeCtx}, + queryResponse: queryResponse{query: query}, + observationRequest: observationRequest{ + outcomeCtx: outcomeCtx, + query: query, + }, + observationResponse: observationResponse{ + observation: libocr.Observation{1, 2, 3}, + }, + observationQuorumRequest: observationQuorumRequest{ + outcomeCtx: outcomeCtx, + query: query, + observations: []libocr.AttributedObservation{{Observer: 1, Observation: []byte{1, 2, 3}}}, + }, + observationQuorumResponse: observationQuorumResponse{ + quorumReached: true, + }, + validateObservationRequest: validateObservationRequest{ + outcomeCtx: outcomeCtx, + query: query, + attributedObservation: libocr.AttributedObservation{Observer: 1, Observation: []byte{1, 2, 3}}, + }, + outcomeRequest: outcomeRequest{ + outcomeCtx: outcomeCtx, + query: query, + observations: []libocr.AttributedObservation{{Observer: 1, Observation: []byte{1, 2, 3}}}, + }, + outcomeResponse: outcomeResponse{ + outcome: ocr3types.Outcome{1, 2, 3}, + }, + reportsRequest: reportsRequest{ + seq: 1, + outcome: ocr3types.Outcome{1, 2, 3}, + }, + reportsResponse: reportsResponse{ + 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{ + seq: 1, + r: ocr3types.ReportWithInfo[[]byte]{Report: []byte{1, 2, 3}, Info: []byte{1, 2, 3}}, + }, + shouldAcceptAttestedReportResponse: shouldAcceptAttestedReportResponse{ + shouldAccept: true, + }, + shouldTransmitAcceptedReportRequest: shouldTransmitAcceptedReportRequest{ + seq: 1, + + r: ocr3types.ReportWithInfo[[]byte]{Report: []byte{1, 2, 3}, Info: []byte{1, 2, 3}}, + }, + shouldTransmitAcceptedReportResponse: shouldTransmitAcceptedReportResponse{ + shouldTransmit: true, + }, + }, +} + +type queryRequest struct { + outcomeCtx ocr3types.OutcomeContext +} + +type queryResponse struct { + query libocr.Query +} + +type observationRequest struct { + outcomeCtx ocr3types.OutcomeContext + query libocr.Query +} + +type observationResponse struct { + observation libocr.Observation +} + +type observationQuorumRequest struct { + outcomeCtx ocr3types.OutcomeContext + query libocr.Query + observations []libocr.AttributedObservation +} + +type observationQuorumResponse struct { + quorumReached bool +} + +type validateObservationRequest struct { + outcomeCtx ocr3types.OutcomeContext + query libocr.Query + attributedObservation libocr.AttributedObservation +} + +type outcomeRequest struct { + outcomeCtx ocr3types.OutcomeContext + query libocr.Query + observations []libocr.AttributedObservation +} + +type outcomeResponse struct { + outcome ocr3types.Outcome +} + +type reportsRequest struct { + seq uint64 + outcome ocr3types.Outcome +} + +type reportsResponse struct { + reportPlus []ocr3types.ReportPlus[[]byte] +} + +type shouldAcceptAttestedReportRequest struct { + seq uint64 + r ocr3types.ReportWithInfo[[]byte] +} + +type shouldAcceptAttestedReportResponse struct { + shouldAccept bool +} + +type shouldTransmitAcceptedReportRequest struct { + seq uint64 + r ocr3types.ReportWithInfo[[]byte] +} + +type shouldTransmitAcceptedReportResponse struct { + shouldTransmit bool +} + +type ocr3staticReportingPluginConfig struct { + expectedOutcomeContext ocr3types.OutcomeContext + // Query method + queryRequest queryRequest + queryResponse queryResponse + // Observation method + observationRequest observationRequest + observationResponse observationResponse + // ObservationQuorum method + observationQuorumRequest observationQuorumRequest + observationQuorumResponse observationQuorumResponse + // ValidateObservation method + validateObservationRequest validateObservationRequest + // Outcome method + outcomeRequest outcomeRequest + outcomeResponse outcomeResponse + // Reports method + reportsRequest reportsRequest + reportsResponse reportsResponse + // ShouldAcceptAttestedReport method + shouldAcceptAttestedReportRequest shouldAcceptAttestedReportRequest + shouldAcceptAttestedReportResponse shouldAcceptAttestedReportResponse + // ShouldTransmitAcceptedReport method + shouldTransmitAcceptedReportRequest shouldTransmitAcceptedReportRequest + shouldTransmitAcceptedReportResponse shouldTransmitAcceptedReportResponse +} + +type ocr3staticReportingPlugin struct { + ocr3staticReportingPluginConfig +} + +func (s ocr3staticReportingPlugin) Query(ctx context.Context, outcomeCtx ocr3types.OutcomeContext) (libocr.Query, error) { + err := s.checkOutCtx(outcomeCtx) + if err != nil { + return nil, err + } + return s.queryResponse.query, nil +} + +func (s ocr3staticReportingPlugin) Observation(ctx context.Context, outcomeCtx ocr3types.OutcomeContext, q libocr.Query) (libocr.Observation, error) { + err := s.checkOutCtx(outcomeCtx) + if err != nil { + return nil, err + } + + if !bytes.Equal(s.observationRequest.query, q) { + return nil, fmt.Errorf("expected %x but got %x", s.observationRequest.query, q) + } + + return s.observationResponse.observation, nil +} + +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 + } + if !bytes.Equal(s.validateObservationRequest.query, q) { + return fmt.Errorf("expected %x but got %x", s.validateObservationRequest.query, q) + } + + if a.Observer != s.validateObservationRequest.attributedObservation.Observer { + return fmt.Errorf("expected %x but got %x", s.validateObservationRequest.attributedObservation.Observer, a.Observer) + } + + if !bytes.Equal(a.Observation, s.validateObservationRequest.attributedObservation.Observation) { + return fmt.Errorf("expected %x but got %x", s.validateObservationRequest.attributedObservation.Observation, a.Observation) + } + + return nil +} + +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 false, err + } + if !bytes.Equal(q, s.observationQuorumRequest.query) { + 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.quorumReached, nil +} + +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 + } + if !bytes.Equal(q, s.outcomeRequest.query) { + return nil, fmt.Errorf("expected %x but got %x", s.outcomeRequest.query, q) + } + + if !assert.ObjectsAreEqual(aos, s.outcomeRequest.observations) { + return nil, fmt.Errorf("expected %v but got %v", s.outcomeRequest.observations, aos) + } + return s.outcomeResponse.outcome, nil +} + +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) + } + + if !bytes.Equal(o, s.reportsRequest.outcome) { + return nil, fmt.Errorf("expected %x but got %x", s.reportsRequest.outcome, o) + } + + return s.reportsResponse.reportPlus, nil +} + +func (s ocr3staticReportingPlugin) ShouldAcceptAttestedReport(ctx context.Context, u uint64, r ocr3types.ReportWithInfo[[]byte]) (bool, error) { + if u != s.shouldAcceptAttestedReportRequest.seq { + return false, fmt.Errorf("expected %x but got %x", s.shouldAcceptAttestedReportRequest.seq, u) + } + if !assert.ObjectsAreEqual(r, s.shouldAcceptAttestedReportRequest.r) { + return false, fmt.Errorf("expected %x but got %x", s.shouldAcceptAttestedReportRequest.r, r) + } + return s.shouldAcceptAttestedReportResponse.shouldAccept, nil +} + +func (s ocr3staticReportingPlugin) ShouldTransmitAcceptedReport(ctx context.Context, u uint64, r ocr3types.ReportWithInfo[[]byte]) (bool, error) { + if u != s.shouldTransmitAcceptedReportRequest.seq { + return false, fmt.Errorf("expected %x but got %x", s.shouldTransmitAcceptedReportRequest.seq, u) + } + if !assert.ObjectsAreEqual(r, s.shouldTransmitAcceptedReportRequest.r) { + return false, fmt.Errorf("expected %x but got %x", s.shouldTransmitAcceptedReportRequest.r, r) + } + return s.shouldTransmitAcceptedReportResponse.shouldTransmit, nil +} + +func (s ocr3staticReportingPlugin) Close() error { return nil } + +func (s ocr3staticReportingPlugin) checkOutCtx(outcomeCtx ocr3types.OutcomeContext) error { + if outcomeCtx.SeqNr != s.expectedOutcomeContext.SeqNr { + return fmt.Errorf("expected %v but got %v", s.expectedOutcomeContext.SeqNr, outcomeCtx.SeqNr) + } + if !bytes.Equal(outcomeCtx.PreviousOutcome, s.expectedOutcomeContext.PreviousOutcome) { + return fmt.Errorf("expected %x but got %x", outcomeCtx.PreviousOutcome, s.expectedOutcomeContext.PreviousOutcome) + } + return nil +} + +func (s ocr3staticReportingPlugin) AssertEqual(ctx context.Context, t *testing.T, rp ocr3types.ReportingPlugin[[]byte]) { + gotQuery, err := rp.Query(ctx, s.queryRequest.outcomeCtx) + require.NoError(t, err) + assert.Equal(t, s.queryResponse.query, gotQuery) + + gotObs, err := rp.Observation(ctx, s.observationRequest.outcomeCtx, s.observationRequest.query) + require.NoError(t, err) + assert.Equal(t, s.observationResponse.observation, gotObs) + + err = rp.ValidateObservation(ctx, s.validateObservationRequest.outcomeCtx, s.validateObservationRequest.query, s.validateObservationRequest.attributedObservation) + require.NoError(t, err) + + gotQuorum, err := rp.ObservationQuorum(ctx, s.observationQuorumRequest.outcomeCtx, s.observationQuorumRequest.query, s.observationQuorumRequest.observations) + require.NoError(t, err) + assert.Equal(t, s.observationQuorumResponse.quorumReached, gotQuorum) + + 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(ctx, s.reportsRequest.seq, s.reportsRequest.outcome) + require.NoError(t, err) + assert.Equal(t, s.reportsResponse.reportPlus, gotRI) + + gotShouldAccept, err := rp.ShouldAcceptAttestedReport(ctx, s.shouldAcceptAttestedReportRequest.seq, s.shouldAcceptAttestedReportRequest.r) + require.NoError(t, err) + assert.Equal(t, s.shouldAcceptAttestedReportResponse.shouldAccept, gotShouldAccept) + + gotShouldTransmit, err := rp.ShouldTransmitAcceptedReport(ctx, s.shouldTransmitAcceptedReportRequest.seq, s.shouldTransmitAcceptedReportRequest.r) + require.NoError(t, err) + assert.Equal(t, s.shouldTransmitAcceptedReportResponse.shouldTransmit, gotShouldTransmit) +} diff --git a/pkg/loop/internal/pb/ocr3_1/generate.go b/pkg/loop/internal/pb/ocr3_1/generate.go new file mode 100644 index 0000000000..711274f402 --- /dev/null +++ b/pkg/loop/internal/pb/ocr3_1/generate.go @@ -0,0 +1,2 @@ +//go:generate protoc --proto_path=.:..:. --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative ocr3_1_reporting.proto +package ocr3_1pb diff --git a/pkg/loop/internal/pb/ocr3_1/make_blob_handle_test.go b/pkg/loop/internal/pb/ocr3_1/make_blob_handle_test.go new file mode 100644 index 0000000000..c865e4d655 --- /dev/null +++ b/pkg/loop/internal/pb/ocr3_1/make_blob_handle_test.go @@ -0,0 +1,17 @@ +package ocr3_1pb + +import ( + "fmt" + + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3_1types" +) + +func MakeBlobHandleTest() { + + MakeBlobHandleTest() + + bh := ocr3_1types.BlobHandle{} + + fmt.Printf("BlobHandle: %+v\n", bh) + +} diff --git a/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.pb.go b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.pb.go new file mode 100644 index 0000000000..0466a094d1 --- /dev/null +++ b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.pb.go @@ -0,0 +1,2119 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v5.29.3 +// source: ocr3_1_reporting.proto + +package ocr3_1pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type NewReportingPluginRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ReportingPluginConfig *ReportingPluginConfig `protobuf:"bytes,1,opt,name=reportingPluginConfig,proto3" json:"reportingPluginConfig,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NewReportingPluginRequest) Reset() { + *x = NewReportingPluginRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NewReportingPluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewReportingPluginRequest) ProtoMessage() {} + +func (x *NewReportingPluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewReportingPluginRequest.ProtoReflect.Descriptor instead. +func (*NewReportingPluginRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{0} +} + +func (x *NewReportingPluginRequest) GetReportingPluginConfig() *ReportingPluginConfig { + if x != nil { + return x.ReportingPluginConfig + } + return nil +} + +type NewReportingPluginReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + ReportingPluginID uint32 `protobuf:"varint,1,opt,name=reportingPluginID,proto3" json:"reportingPluginID,omitempty"` + ReportingPluginInfo *ReportingPluginInfo `protobuf:"bytes,2,opt,name=reportingPluginInfo,proto3" json:"reportingPluginInfo,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NewReportingPluginReply) Reset() { + *x = NewReportingPluginReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NewReportingPluginReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewReportingPluginReply) ProtoMessage() {} + +func (x *NewReportingPluginReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewReportingPluginReply.ProtoReflect.Descriptor instead. +func (*NewReportingPluginReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{1} +} + +func (x *NewReportingPluginReply) GetReportingPluginID() uint32 { + if x != nil { + return x.ReportingPluginID + } + return 0 +} + +func (x *NewReportingPluginReply) GetReportingPluginInfo() *ReportingPluginInfo { + if x != nil { + return x.ReportingPluginInfo + } + return nil +} + +type ReportingPluginConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + ConfigDigest []byte `protobuf:"bytes,1,opt,name=configDigest,proto3" json:"configDigest,omitempty"` + OracleID uint32 `protobuf:"varint,2,opt,name=oracleID,proto3" json:"oracleID,omitempty"` + N uint32 `protobuf:"varint,3,opt,name=n,proto3" json:"n,omitempty"` + F uint32 `protobuf:"varint,4,opt,name=f,proto3" json:"f,omitempty"` + OnchainConfig []byte `protobuf:"bytes,5,opt,name=onchainConfig,proto3" json:"onchainConfig,omitempty"` + OffchainConfig []byte `protobuf:"bytes,6,opt,name=offchainConfig,proto3" json:"offchainConfig,omitempty"` + EstimatedRoundInterval int64 `protobuf:"varint,7,opt,name=estimatedRoundInterval,proto3" json:"estimatedRoundInterval,omitempty"` + MaxDurationQuery int64 `protobuf:"varint,8,opt,name=maxDurationQuery,proto3" json:"maxDurationQuery,omitempty"` + MaxDurationObservation int64 `protobuf:"varint,9,opt,name=maxDurationObservation,proto3" json:"maxDurationObservation,omitempty"` + MaxDurationShouldAcceptAttestedReport int64 `protobuf:"varint,10,opt,name=MaxDurationShouldAcceptAttestedReport,proto3" json:"MaxDurationShouldAcceptAttestedReport,omitempty"` + MaxDurationShouldTransmitAcceptedReport int64 `protobuf:"varint,11,opt,name=MaxDurationShouldTransmitAcceptedReport,proto3" json:"MaxDurationShouldTransmitAcceptedReport,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportingPluginConfig) Reset() { + *x = ReportingPluginConfig{} + mi := &file_ocr3_1_reporting_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReportingPluginConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportingPluginConfig) ProtoMessage() {} + +func (x *ReportingPluginConfig) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportingPluginConfig.ProtoReflect.Descriptor instead. +func (*ReportingPluginConfig) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{2} +} + +func (x *ReportingPluginConfig) GetConfigDigest() []byte { + if x != nil { + return x.ConfigDigest + } + return nil +} + +func (x *ReportingPluginConfig) GetOracleID() uint32 { + if x != nil { + return x.OracleID + } + return 0 +} + +func (x *ReportingPluginConfig) GetN() uint32 { + if x != nil { + return x.N + } + return 0 +} + +func (x *ReportingPluginConfig) GetF() uint32 { + if x != nil { + return x.F + } + return 0 +} + +func (x *ReportingPluginConfig) GetOnchainConfig() []byte { + if x != nil { + return x.OnchainConfig + } + return nil +} + +func (x *ReportingPluginConfig) GetOffchainConfig() []byte { + if x != nil { + return x.OffchainConfig + } + return nil +} + +func (x *ReportingPluginConfig) GetEstimatedRoundInterval() int64 { + if x != nil { + return x.EstimatedRoundInterval + } + return 0 +} + +func (x *ReportingPluginConfig) GetMaxDurationQuery() int64 { + if x != nil { + return x.MaxDurationQuery + } + return 0 +} + +func (x *ReportingPluginConfig) GetMaxDurationObservation() int64 { + if x != nil { + return x.MaxDurationObservation + } + return 0 +} + +func (x *ReportingPluginConfig) GetMaxDurationShouldAcceptAttestedReport() int64 { + if x != nil { + return x.MaxDurationShouldAcceptAttestedReport + } + return 0 +} + +func (x *ReportingPluginConfig) GetMaxDurationShouldTransmitAcceptedReport() int64 { + if x != nil { + return x.MaxDurationShouldTransmitAcceptedReport + } + return 0 +} + +type ReportingPluginLimits struct { + state protoimpl.MessageState `protogen:"open.v1"` + MaxQueryLength uint64 `protobuf:"varint,1,opt,name=maxQueryLength,proto3" json:"maxQueryLength,omitempty"` + MaxObservationLength uint64 `protobuf:"varint,2,opt,name=maxObservationLength,proto3" json:"maxObservationLength,omitempty"` + MaxReportLength uint64 `protobuf:"varint,3,opt,name=MaxReportLength,proto3" json:"MaxReportLength,omitempty"` + MaxReportCount uint64 `protobuf:"varint,4,opt,name=MaxReportCount,proto3" json:"MaxReportCount,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportingPluginLimits) Reset() { + *x = ReportingPluginLimits{} + mi := &file_ocr3_1_reporting_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReportingPluginLimits) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportingPluginLimits) ProtoMessage() {} + +func (x *ReportingPluginLimits) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportingPluginLimits.ProtoReflect.Descriptor instead. +func (*ReportingPluginLimits) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{3} +} + +func (x *ReportingPluginLimits) GetMaxQueryLength() uint64 { + if x != nil { + return x.MaxQueryLength + } + return 0 +} + +func (x *ReportingPluginLimits) GetMaxObservationLength() uint64 { + if x != nil { + return x.MaxObservationLength + } + return 0 +} + +func (x *ReportingPluginLimits) GetMaxReportLength() uint64 { + if x != nil { + return x.MaxReportLength + } + return 0 +} + +func (x *ReportingPluginLimits) GetMaxReportCount() uint64 { + if x != nil { + return x.MaxReportCount + } + return 0 +} + +type ReportingPluginInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ReportingPluginLimits *ReportingPluginLimits `protobuf:"bytes,2,opt,name=reportingPluginLimits,proto3" json:"reportingPluginLimits,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportingPluginInfo) Reset() { + *x = ReportingPluginInfo{} + mi := &file_ocr3_1_reporting_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReportingPluginInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportingPluginInfo) ProtoMessage() {} + +func (x *ReportingPluginInfo) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportingPluginInfo.ProtoReflect.Descriptor instead. +func (*ReportingPluginInfo) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{4} +} + +func (x *ReportingPluginInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ReportingPluginInfo) GetReportingPluginLimits() *ReportingPluginLimits { + if x != nil { + return x.ReportingPluginLimits + } + return nil +} + +// TODO the blob cannot be constructed outside of libocr right now, need to modify libocr to allow to support cross process blob-handles +type FetchBlobRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + BlobHandle []byte `protobuf:"bytes,1,opt,name=blobHandle,proto3" json:"blobHandle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FetchBlobRequest) Reset() { + *x = FetchBlobRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FetchBlobRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchBlobRequest) ProtoMessage() {} + +func (x *FetchBlobRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FetchBlobRequest.ProtoReflect.Descriptor instead. +func (*FetchBlobRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{5} +} + +func (x *FetchBlobRequest) GetBlobHandle() []byte { + if x != nil { + return x.BlobHandle + } + return nil +} + +type FetchBlobReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FetchBlobReply) Reset() { + *x = FetchBlobReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FetchBlobReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchBlobReply) ProtoMessage() {} + +func (x *FetchBlobReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FetchBlobReply.ProtoReflect.Descriptor instead. +func (*FetchBlobReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{6} +} + +func (x *FetchBlobReply) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type BroadcastBlobRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + BlobExpirationHint uint64 `protobuf:"varint,2,opt,name=blobExpirationHint,proto3" json:"blobExpirationHint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BroadcastBlobRequest) Reset() { + *x = BroadcastBlobRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BroadcastBlobRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BroadcastBlobRequest) ProtoMessage() {} + +func (x *BroadcastBlobRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BroadcastBlobRequest.ProtoReflect.Descriptor instead. +func (*BroadcastBlobRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{7} +} + +func (x *BroadcastBlobRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *BroadcastBlobRequest) GetBlobExpirationHint() uint64 { + if x != nil { + return x.BlobExpirationHint + } + return 0 +} + +type BroadcastBlobReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + BlobHandle []byte `protobuf:"bytes,1,opt,name=blobHandle,proto3" json:"blobHandle,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BroadcastBlobReply) Reset() { + *x = BroadcastBlobReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BroadcastBlobReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BroadcastBlobReply) ProtoMessage() {} + +func (x *BroadcastBlobReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BroadcastBlobReply.ProtoReflect.Descriptor instead. +func (*BroadcastBlobReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{8} +} + +func (x *BroadcastBlobReply) GetBlobHandle() []byte { + if x != nil { + return x.BlobHandle + } + return nil +} + +type KeyValueStateReadRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyValueStateReadRequest) Reset() { + *x = KeyValueStateReadRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyValueStateReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueStateReadRequest) ProtoMessage() {} + +func (x *KeyValueStateReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyValueStateReadRequest.ProtoReflect.Descriptor instead. +func (*KeyValueStateReadRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{9} +} + +func (x *KeyValueStateReadRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *KeyValueStateReadRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type KeyValueStateWriteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyValueStateWriteRequest) Reset() { + *x = KeyValueStateWriteRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyValueStateWriteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueStateWriteRequest) ProtoMessage() {} + +func (x *KeyValueStateWriteRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyValueStateWriteRequest.ProtoReflect.Descriptor instead. +func (*KeyValueStateWriteRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{10} +} + +func (x *KeyValueStateWriteRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *KeyValueStateWriteRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *KeyValueStateWriteRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type KeyValueStateDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyValueStateDeleteRequest) Reset() { + *x = KeyValueStateDeleteRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyValueStateDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueStateDeleteRequest) ProtoMessage() {} + +func (x *KeyValueStateDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyValueStateDeleteRequest.ProtoReflect.Descriptor instead. +func (*KeyValueStateDeleteRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{11} +} + +func (x *KeyValueStateDeleteRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *KeyValueStateDeleteRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type KeyValueStateReadReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyValueStateReadReply) Reset() { + *x = KeyValueStateReadReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyValueStateReadReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueStateReadReply) ProtoMessage() {} + +func (x *KeyValueStateReadReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyValueStateReadReply.ProtoReflect.Descriptor instead. +func (*KeyValueStateReadReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{12} +} + +func (x *KeyValueStateReadReply) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type QueryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + SeqNr uint64 `protobuf:"varint,2,opt,name=seqNr,proto3" json:"seqNr,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueryRequest) Reset() { + *x = QueryRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryRequest) ProtoMessage() {} + +func (x *QueryRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead. +func (*QueryRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{13} +} + +func (x *QueryRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *QueryRequest) GetSeqNr() uint64 { + if x != nil { + return x.SeqNr + } + return 0 +} + +type AttributedQuery struct { + state protoimpl.MessageState `protogen:"open.v1"` + Query []byte `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + OracleID uint32 `protobuf:"varint,2,opt,name=oracleID,proto3" json:"oracleID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttributedQuery) Reset() { + *x = AttributedQuery{} + mi := &file_ocr3_1_reporting_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttributedQuery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttributedQuery) ProtoMessage() {} + +func (x *AttributedQuery) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttributedQuery.ProtoReflect.Descriptor instead. +func (*AttributedQuery) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{14} +} + +func (x *AttributedQuery) GetQuery() []byte { + if x != nil { + return x.Query + } + return nil +} + +func (x *AttributedQuery) GetOracleID() uint32 { + if x != nil { + return x.OracleID + } + return 0 +} + +type AttributedObservation struct { + state protoimpl.MessageState `protogen:"open.v1"` + Observation []byte `protobuf:"bytes,1,opt,name=observation,proto3" json:"observation,omitempty"` + OracleID uint32 `protobuf:"varint,2,opt,name=oracleID,proto3" json:"oracleID,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttributedObservation) Reset() { + *x = AttributedObservation{} + mi := &file_ocr3_1_reporting_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttributedObservation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttributedObservation) ProtoMessage() {} + +func (x *AttributedObservation) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttributedObservation.ProtoReflect.Descriptor instead. +func (*AttributedObservation) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{15} +} + +func (x *AttributedObservation) GetObservation() []byte { + if x != nil { + return x.Observation + } + return nil +} + +func (x *AttributedObservation) GetOracleID() uint32 { + if x != nil { + return x.OracleID + } + return 0 +} + +type QueryReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Query []byte `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueryReply) Reset() { + *x = QueryReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueryReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryReply) ProtoMessage() {} + +func (x *QueryReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryReply.ProtoReflect.Descriptor instead. +func (*QueryReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{16} +} + +func (x *QueryReply) GetQuery() []byte { + if x != nil { + return x.Query + } + return nil +} + +type ObservationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + SeqNr uint64 `protobuf:"varint,2,opt,name=seqNr,proto3" json:"seqNr,omitempty"` + Query *AttributedQuery `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObservationRequest) Reset() { + *x = ObservationRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObservationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObservationRequest) ProtoMessage() {} + +func (x *ObservationRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObservationRequest.ProtoReflect.Descriptor instead. +func (*ObservationRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{17} +} + +func (x *ObservationRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *ObservationRequest) GetSeqNr() uint64 { + if x != nil { + return x.SeqNr + } + return 0 +} + +func (x *ObservationRequest) GetQuery() *AttributedQuery { + if x != nil { + return x.Query + } + return nil +} + +type ObservationReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Observation []byte `protobuf:"bytes,1,opt,name=observation,proto3" json:"observation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObservationReply) Reset() { + *x = ObservationReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObservationReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObservationReply) ProtoMessage() {} + +func (x *ObservationReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObservationReply.ProtoReflect.Descriptor instead. +func (*ObservationReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{18} +} + +func (x *ObservationReply) GetObservation() []byte { + if x != nil { + return x.Observation + } + return nil +} + +type ValidateObservationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + SeqNr uint64 `protobuf:"varint,2,opt,name=seqNr,proto3" json:"seqNr,omitempty"` + Query *AttributedQuery `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` + Observation *AttributedObservation `protobuf:"bytes,4,opt,name=observation,proto3" json:"observation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ValidateObservationRequest) Reset() { + *x = ValidateObservationRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValidateObservationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidateObservationRequest) ProtoMessage() {} + +func (x *ValidateObservationRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValidateObservationRequest.ProtoReflect.Descriptor instead. +func (*ValidateObservationRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{19} +} + +func (x *ValidateObservationRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *ValidateObservationRequest) GetSeqNr() uint64 { + if x != nil { + return x.SeqNr + } + return 0 +} + +func (x *ValidateObservationRequest) GetQuery() *AttributedQuery { + if x != nil { + return x.Query + } + return nil +} + +func (x *ValidateObservationRequest) GetObservation() *AttributedObservation { + if x != nil { + return x.Observation + } + return nil +} + +type ObservationQuorumRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + SeqNr uint64 `protobuf:"varint,2,opt,name=seqNr,proto3" json:"seqNr,omitempty"` + Query *AttributedQuery `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` + Observations []*AttributedObservation `protobuf:"bytes,4,rep,name=observations,proto3" json:"observations,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObservationQuorumRequest) Reset() { + *x = ObservationQuorumRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObservationQuorumRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObservationQuorumRequest) ProtoMessage() {} + +func (x *ObservationQuorumRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObservationQuorumRequest.ProtoReflect.Descriptor instead. +func (*ObservationQuorumRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{20} +} + +func (x *ObservationQuorumRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *ObservationQuorumRequest) GetSeqNr() uint64 { + if x != nil { + return x.SeqNr + } + return 0 +} + +func (x *ObservationQuorumRequest) GetQuery() *AttributedQuery { + if x != nil { + return x.Query + } + return nil +} + +func (x *ObservationQuorumRequest) GetObservations() []*AttributedObservation { + if x != nil { + return x.Observations + } + return nil +} + +type ObservationQuorumReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + QuorumReached bool `protobuf:"varint,1,opt,name=quorumReached,proto3" json:"quorumReached,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObservationQuorumReply) Reset() { + *x = ObservationQuorumReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObservationQuorumReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObservationQuorumReply) ProtoMessage() {} + +func (x *ObservationQuorumReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObservationQuorumReply.ProtoReflect.Descriptor instead. +func (*ObservationQuorumReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{21} +} + +func (x *ObservationQuorumReply) GetQuorumReached() bool { + if x != nil { + return x.QuorumReached + } + return false +} + +type StateTransitionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + SeqNr uint64 `protobuf:"varint,2,opt,name=seqNr,proto3" json:"seqNr,omitempty"` + Query *AttributedQuery `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` + Observation []*AttributedObservation `protobuf:"bytes,4,rep,name=observation,proto3" json:"observation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StateTransitionRequest) Reset() { + *x = StateTransitionRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StateTransitionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StateTransitionRequest) ProtoMessage() {} + +func (x *StateTransitionRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StateTransitionRequest.ProtoReflect.Descriptor instead. +func (*StateTransitionRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{22} +} + +func (x *StateTransitionRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *StateTransitionRequest) GetSeqNr() uint64 { + if x != nil { + return x.SeqNr + } + return 0 +} + +func (x *StateTransitionRequest) GetQuery() *AttributedQuery { + if x != nil { + return x.Query + } + return nil +} + +func (x *StateTransitionRequest) GetObservation() []*AttributedObservation { + if x != nil { + return x.Observation + } + return nil +} + +type StateTransitionReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Outcome []byte `protobuf:"bytes,1,opt,name=outcome,proto3" json:"outcome,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StateTransitionReply) Reset() { + *x = StateTransitionReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StateTransitionReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StateTransitionReply) ProtoMessage() {} + +func (x *StateTransitionReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StateTransitionReply.ProtoReflect.Descriptor instead. +func (*StateTransitionReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{23} +} + +func (x *StateTransitionReply) GetOutcome() []byte { + if x != nil { + return x.Outcome + } + return nil +} + +type CommittedRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` + SeqNr uint64 `protobuf:"varint,2,opt,name=seqNr,proto3" json:"seqNr,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommittedRequest) Reset() { + *x = CommittedRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommittedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommittedRequest) ProtoMessage() {} + +func (x *CommittedRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommittedRequest.ProtoReflect.Descriptor instead. +func (*CommittedRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{24} +} + +func (x *CommittedRequest) GetKeyValueStateReaderID() string { + if x != nil { + return x.KeyValueStateReaderID + } + return "" +} + +func (x *CommittedRequest) GetSeqNr() uint64 { + if x != nil { + return x.SeqNr + } + return 0 +} + +type ReportsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SeqNr uint64 `protobuf:"varint,1,opt,name=seqNr,proto3" json:"seqNr,omitempty"` + Outcome []byte `protobuf:"bytes,2,opt,name=outcome,proto3" json:"outcome,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportsRequest) Reset() { + *x = ReportsRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReportsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportsRequest) ProtoMessage() {} + +func (x *ReportsRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportsRequest.ProtoReflect.Descriptor instead. +func (*ReportsRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{25} +} + +func (x *ReportsRequest) GetSeqNr() uint64 { + if x != nil { + return x.SeqNr + } + return 0 +} + +func (x *ReportsRequest) GetOutcome() []byte { + if x != nil { + return x.Outcome + } + return nil +} + +type ReportsReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + ReportPlus []*ReportPlus `protobuf:"bytes,1,rep,name=reportPlus,proto3" json:"reportPlus,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportsReply) Reset() { + *x = ReportsReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReportsReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportsReply) ProtoMessage() {} + +func (x *ReportsReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportsReply.ProtoReflect.Descriptor instead. +func (*ReportsReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{26} +} + +func (x *ReportsReply) GetReportPlus() []*ReportPlus { + if x != nil { + return x.ReportPlus + } + return nil +} + +type ReportPlus struct { + state protoimpl.MessageState `protogen:"open.v1"` + ReportWithInfo *ReportWithInfo `protobuf:"bytes,1,opt,name=reportWithInfo,proto3" json:"reportWithInfo,omitempty"` + TransmissionScheduleOverride *TransmissionSchedule `protobuf:"bytes,2,opt,name=transmissionScheduleOverride,proto3" json:"transmissionScheduleOverride,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportPlus) Reset() { + *x = ReportPlus{} + mi := &file_ocr3_1_reporting_proto_msgTypes[27] + 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_1_reporting_proto_msgTypes[27] + if 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_1_reporting_proto_rawDescGZIP(), []int{27} +} + +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 `protogen:"open.v1"` + Report []byte `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` + Info []byte `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReportWithInfo) Reset() { + *x = ReportWithInfo{} + mi := &file_ocr3_1_reporting_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReportWithInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReportWithInfo) ProtoMessage() {} + +func (x *ReportWithInfo) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReportWithInfo.ProtoReflect.Descriptor instead. +func (*ReportWithInfo) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{28} +} + +func (x *ReportWithInfo) GetReport() []byte { + if x != nil { + return x.Report + } + return nil +} + +func (x *ReportWithInfo) GetInfo() []byte { + if x != nil { + return x.Info + } + return nil +} + +type TransmissionSchedule struct { + state protoimpl.MessageState `protogen:"open.v1"` + 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"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TransmissionSchedule) Reset() { + *x = TransmissionSchedule{} + mi := &file_ocr3_1_reporting_proto_msgTypes[29] + 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_1_reporting_proto_msgTypes[29] + if 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_1_reporting_proto_rawDescGZIP(), []int{29} +} + +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 `protogen:"open.v1"` + SegNr uint64 `protobuf:"varint,1,opt,name=segNr,proto3" json:"segNr,omitempty"` + Ri *ReportWithInfo `protobuf:"bytes,2,opt,name=ri,proto3" json:"ri,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ShouldAcceptAttestedReportRequest) Reset() { + *x = ShouldAcceptAttestedReportRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ShouldAcceptAttestedReportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShouldAcceptAttestedReportRequest) ProtoMessage() {} + +func (x *ShouldAcceptAttestedReportRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShouldAcceptAttestedReportRequest.ProtoReflect.Descriptor instead. +func (*ShouldAcceptAttestedReportRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{30} +} + +func (x *ShouldAcceptAttestedReportRequest) GetSegNr() uint64 { + if x != nil { + return x.SegNr + } + return 0 +} + +func (x *ShouldAcceptAttestedReportRequest) GetRi() *ReportWithInfo { + if x != nil { + return x.Ri + } + return nil +} + +type ShouldAcceptAttestedReportReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + ShouldAccept bool `protobuf:"varint,1,opt,name=shouldAccept,proto3" json:"shouldAccept,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ShouldAcceptAttestedReportReply) Reset() { + *x = ShouldAcceptAttestedReportReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ShouldAcceptAttestedReportReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShouldAcceptAttestedReportReply) ProtoMessage() {} + +func (x *ShouldAcceptAttestedReportReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShouldAcceptAttestedReportReply.ProtoReflect.Descriptor instead. +func (*ShouldAcceptAttestedReportReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{31} +} + +func (x *ShouldAcceptAttestedReportReply) GetShouldAccept() bool { + if x != nil { + return x.ShouldAccept + } + return false +} + +type ShouldTransmitAcceptedReportRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SegNr uint64 `protobuf:"varint,1,opt,name=segNr,proto3" json:"segNr,omitempty"` + Ri *ReportWithInfo `protobuf:"bytes,2,opt,name=ri,proto3" json:"ri,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ShouldTransmitAcceptedReportRequest) Reset() { + *x = ShouldTransmitAcceptedReportRequest{} + mi := &file_ocr3_1_reporting_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ShouldTransmitAcceptedReportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShouldTransmitAcceptedReportRequest) ProtoMessage() {} + +func (x *ShouldTransmitAcceptedReportRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShouldTransmitAcceptedReportRequest.ProtoReflect.Descriptor instead. +func (*ShouldTransmitAcceptedReportRequest) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{32} +} + +func (x *ShouldTransmitAcceptedReportRequest) GetSegNr() uint64 { + if x != nil { + return x.SegNr + } + return 0 +} + +func (x *ShouldTransmitAcceptedReportRequest) GetRi() *ReportWithInfo { + if x != nil { + return x.Ri + } + return nil +} + +type ShouldTransmitAcceptedReportReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + ShouldTransmit bool `protobuf:"varint,1,opt,name=shouldTransmit,proto3" json:"shouldTransmit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ShouldTransmitAcceptedReportReply) Reset() { + *x = ShouldTransmitAcceptedReportReply{} + mi := &file_ocr3_1_reporting_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ShouldTransmitAcceptedReportReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShouldTransmitAcceptedReportReply) ProtoMessage() {} + +func (x *ShouldTransmitAcceptedReportReply) ProtoReflect() protoreflect.Message { + mi := &file_ocr3_1_reporting_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShouldTransmitAcceptedReportReply.ProtoReflect.Descriptor instead. +func (*ShouldTransmitAcceptedReportReply) Descriptor() ([]byte, []int) { + return file_ocr3_1_reporting_proto_rawDescGZIP(), []int{33} +} + +func (x *ShouldTransmitAcceptedReportReply) GetShouldTransmit() bool { + if x != nil { + return x.ShouldTransmit + } + return false +} + +var File_ocr3_1_reporting_proto protoreflect.FileDescriptor + +const file_ocr3_1_reporting_proto_rawDesc = "" + + "\n" + + "\x16ocr3_1_reporting.proto\x12\x17loop.internal.pb.ocr3_1\x1a\x1bgoogle/protobuf/empty.proto\"\x81\x01\n" + + "\x19NewReportingPluginRequest\x12d\n" + + "\x15reportingPluginConfig\x18\x01 \x01(\v2..loop.internal.pb.ocr3_1.ReportingPluginConfigR\x15reportingPluginConfig\"\xa7\x01\n" + + "\x17NewReportingPluginReply\x12,\n" + + "\x11reportingPluginID\x18\x01 \x01(\rR\x11reportingPluginID\x12^\n" + + "\x13reportingPluginInfo\x18\x02 \x01(\v2,.loop.internal.pb.ocr3_1.ReportingPluginInfoR\x13reportingPluginInfo\"\x8d\x04\n" + + "\x15ReportingPluginConfig\x12\"\n" + + "\fconfigDigest\x18\x01 \x01(\fR\fconfigDigest\x12\x1a\n" + + "\boracleID\x18\x02 \x01(\rR\boracleID\x12\f\n" + + "\x01n\x18\x03 \x01(\rR\x01n\x12\f\n" + + "\x01f\x18\x04 \x01(\rR\x01f\x12$\n" + + "\ronchainConfig\x18\x05 \x01(\fR\ronchainConfig\x12&\n" + + "\x0eoffchainConfig\x18\x06 \x01(\fR\x0eoffchainConfig\x126\n" + + "\x16estimatedRoundInterval\x18\a \x01(\x03R\x16estimatedRoundInterval\x12*\n" + + "\x10maxDurationQuery\x18\b \x01(\x03R\x10maxDurationQuery\x126\n" + + "\x16maxDurationObservation\x18\t \x01(\x03R\x16maxDurationObservation\x12T\n" + + "%MaxDurationShouldAcceptAttestedReport\x18\n" + + " \x01(\x03R%MaxDurationShouldAcceptAttestedReport\x12X\n" + + "'MaxDurationShouldTransmitAcceptedReport\x18\v \x01(\x03R'MaxDurationShouldTransmitAcceptedReport\"\xc5\x01\n" + + "\x15ReportingPluginLimits\x12&\n" + + "\x0emaxQueryLength\x18\x01 \x01(\x04R\x0emaxQueryLength\x122\n" + + "\x14maxObservationLength\x18\x02 \x01(\x04R\x14maxObservationLength\x12(\n" + + "\x0fMaxReportLength\x18\x03 \x01(\x04R\x0fMaxReportLength\x12&\n" + + "\x0eMaxReportCount\x18\x04 \x01(\x04R\x0eMaxReportCount\"\x8f\x01\n" + + "\x13ReportingPluginInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12d\n" + + "\x15reportingPluginLimits\x18\x02 \x01(\v2..loop.internal.pb.ocr3_1.ReportingPluginLimitsR\x15reportingPluginLimits\"2\n" + + "\x10FetchBlobRequest\x12\x1e\n" + + "\n" + + "blobHandle\x18\x01 \x01(\fR\n" + + "blobHandle\"*\n" + + "\x0eFetchBlobReply\x12\x18\n" + + "\apayload\x18\x01 \x01(\fR\apayload\"`\n" + + "\x14BroadcastBlobRequest\x12\x18\n" + + "\apayload\x18\x01 \x01(\fR\apayload\x12.\n" + + "\x12blobExpirationHint\x18\x02 \x01(\x04R\x12blobExpirationHint\"4\n" + + "\x12BroadcastBlobReply\x12\x1e\n" + + "\n" + + "blobHandle\x18\x01 \x01(\fR\n" + + "blobHandle\"b\n" + + "\x18KeyValueStateReadRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\"y\n" + + "\x19KeyValueStateWriteRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\"d\n" + + "\x1aKeyValueStateDeleteRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\".\n" + + "\x16KeyValueStateReadReply\x12\x14\n" + + "\x05value\x18\x01 \x01(\fR\x05value\"Z\n" + + "\fQueryRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x14\n" + + "\x05seqNr\x18\x02 \x01(\x04R\x05seqNr\"C\n" + + "\x0fAttributedQuery\x12\x14\n" + + "\x05query\x18\x01 \x01(\fR\x05query\x12\x1a\n" + + "\boracleID\x18\x02 \x01(\rR\boracleID\"U\n" + + "\x15AttributedObservation\x12 \n" + + "\vobservation\x18\x01 \x01(\fR\vobservation\x12\x1a\n" + + "\boracleID\x18\x02 \x01(\rR\boracleID\"\"\n" + + "\n" + + "QueryReply\x12\x14\n" + + "\x05query\x18\x01 \x01(\fR\x05query\"\xa0\x01\n" + + "\x12ObservationRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x14\n" + + "\x05seqNr\x18\x02 \x01(\x04R\x05seqNr\x12>\n" + + "\x05query\x18\x03 \x01(\v2(.loop.internal.pb.ocr3_1.AttributedQueryR\x05query\"4\n" + + "\x10ObservationReply\x12 \n" + + "\vobservation\x18\x01 \x01(\fR\vobservation\"\xfa\x01\n" + + "\x1aValidateObservationRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x14\n" + + "\x05seqNr\x18\x02 \x01(\x04R\x05seqNr\x12>\n" + + "\x05query\x18\x03 \x01(\v2(.loop.internal.pb.ocr3_1.AttributedQueryR\x05query\x12P\n" + + "\vobservation\x18\x04 \x01(\v2..loop.internal.pb.ocr3_1.AttributedObservationR\vobservation\"\xfa\x01\n" + + "\x18ObservationQuorumRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x14\n" + + "\x05seqNr\x18\x02 \x01(\x04R\x05seqNr\x12>\n" + + "\x05query\x18\x03 \x01(\v2(.loop.internal.pb.ocr3_1.AttributedQueryR\x05query\x12R\n" + + "\fobservations\x18\x04 \x03(\v2..loop.internal.pb.ocr3_1.AttributedObservationR\fobservations\">\n" + + "\x16ObservationQuorumReply\x12$\n" + + "\rquorumReached\x18\x01 \x01(\bR\rquorumReached\"\xf6\x01\n" + + "\x16StateTransitionRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x14\n" + + "\x05seqNr\x18\x02 \x01(\x04R\x05seqNr\x12>\n" + + "\x05query\x18\x03 \x01(\v2(.loop.internal.pb.ocr3_1.AttributedQueryR\x05query\x12P\n" + + "\vobservation\x18\x04 \x03(\v2..loop.internal.pb.ocr3_1.AttributedObservationR\vobservation\"0\n" + + "\x14StateTransitionReply\x12\x18\n" + + "\aoutcome\x18\x01 \x01(\fR\aoutcome\"^\n" + + "\x10CommittedRequest\x124\n" + + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x14\n" + + "\x05seqNr\x18\x02 \x01(\x04R\x05seqNr\"@\n" + + "\x0eReportsRequest\x12\x14\n" + + "\x05seqNr\x18\x01 \x01(\x04R\x05seqNr\x12\x18\n" + + "\aoutcome\x18\x02 \x01(\fR\aoutcome\"S\n" + + "\fReportsReply\x12C\n" + + "\n" + + "reportPlus\x18\x01 \x03(\v2#.loop.internal.pb.ocr3_1.ReportPlusR\n" + + "reportPlus\"\xd0\x01\n" + + "\n" + + "ReportPlus\x12O\n" + + "\x0ereportWithInfo\x18\x01 \x01(\v2'.loop.internal.pb.ocr3_1.ReportWithInfoR\x0ereportWithInfo\x12q\n" + + "\x1ctransmissionScheduleOverride\x18\x02 \x01(\v2-.loop.internal.pb.ocr3_1.TransmissionScheduleR\x1ctransmissionScheduleOverride\"<\n" + + "\x0eReportWithInfo\x12\x16\n" + + "\x06report\x18\x01 \x01(\fR\x06report\x12\x12\n" + + "\x04info\x18\x02 \x01(\fR\x04info\"j\n" + + "\x14TransmissionSchedule\x12\"\n" + + "\ftransmitters\x18\x01 \x03(\rR\ftransmitters\x12.\n" + + "\x12transmissionDelays\x18\x02 \x03(\x03R\x12transmissionDelays\"r\n" + + "!ShouldAcceptAttestedReportRequest\x12\x14\n" + + "\x05segNr\x18\x01 \x01(\x04R\x05segNr\x127\n" + + "\x02ri\x18\x02 \x01(\v2'.loop.internal.pb.ocr3_1.ReportWithInfoR\x02ri\"E\n" + + "\x1fShouldAcceptAttestedReportReply\x12\"\n" + + "\fshouldAccept\x18\x01 \x01(\bR\fshouldAccept\"t\n" + + "#ShouldTransmitAcceptedReportRequest\x12\x14\n" + + "\x05segNr\x18\x01 \x01(\x04R\x05segNr\x127\n" + + "\x02ri\x18\x02 \x01(\v2'.loop.internal.pb.ocr3_1.ReportWithInfoR\x02ri\"K\n" + + "!ShouldTransmitAcceptedReportReply\x12&\n" + + "\x0eshouldTransmit\x18\x01 \x01(\bR\x0eshouldTransmit2\x96\x01\n" + + "\x16ReportingPluginFactory\x12|\n" + + "\x12NewReportingPlugin\x122.loop.internal.pb.ocr3_1.NewReportingPluginRequest\x1a0.loop.internal.pb.ocr3_1.NewReportingPluginReply\"\x002\xdc\f\n" + + "\x0fReportingPlugin\x12U\n" + + "\x05Query\x12%.loop.internal.pb.ocr3_1.QueryRequest\x1a#.loop.internal.pb.ocr3_1.QueryReply\"\x00\x12g\n" + + "\vObservation\x12+.loop.internal.pb.ocr3_1.ObservationRequest\x1a).loop.internal.pb.ocr3_1.ObservationReply\"\x00\x12d\n" + + "\x13ValidateObservation\x123.loop.internal.pb.ocr3_1.ValidateObservationRequest\x1a\x16.google.protobuf.Empty\"\x00\x12y\n" + + "\x11ObservationQuorum\x121.loop.internal.pb.ocr3_1.ObservationQuorumRequest\x1a/.loop.internal.pb.ocr3_1.ObservationQuorumReply\"\x00\x12s\n" + + "\x0fStateTransition\x12/.loop.internal.pb.ocr3_1.StateTransitionRequest\x1a-.loop.internal.pb.ocr3_1.StateTransitionReply\"\x00\x12P\n" + + "\tCommitted\x12).loop.internal.pb.ocr3_1.CommittedRequest\x1a\x16.google.protobuf.Empty\"\x00\x12[\n" + + "\aReports\x12'.loop.internal.pb.ocr3_1.ReportsRequest\x1a%.loop.internal.pb.ocr3_1.ReportsReply\"\x00\x12\x94\x01\n" + + "\x1aShouldAcceptAttestedReport\x12:.loop.internal.pb.ocr3_1.ShouldAcceptAttestedReportRequest\x1a8.loop.internal.pb.ocr3_1.ShouldAcceptAttestedReportReply\"\x00\x12\x9a\x01\n" + + "\x1cShouldTransmitAcceptedReport\x12<.loop.internal.pb.ocr3_1.ShouldTransmitAcceptedReportRequest\x1a:.loop.internal.pb.ocr3_1.ShouldTransmitAcceptedReportReply\"\x00\x129\n" + + "\x05Close\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\"\x00\x12y\n" + + "\x11KeyValueStateRead\x121.loop.internal.pb.ocr3_1.KeyValueStateReadRequest\x1a/.loop.internal.pb.ocr3_1.KeyValueStateReadReply\"\x00\x12b\n" + + "\x12KeyValueStateWrite\x122.loop.internal.pb.ocr3_1.KeyValueStateWriteRequest\x1a\x16.google.protobuf.Empty\"\x00\x12d\n" + + "\x13KeyValueStateDelete\x123.loop.internal.pb.ocr3_1.KeyValueStateDeleteRequest\x1a\x16.google.protobuf.Empty\"\x00\x12m\n" + + "\rBroadcastBlob\x12-.loop.internal.pb.ocr3_1.BroadcastBlobRequest\x1a+.loop.internal.pb.ocr3_1.BroadcastBlobReply\"\x00\x12a\n" + + "\tFetchBlob\x12).loop.internal.pb.ocr3_1.FetchBlobRequest\x1a'.loop.internal.pb.ocr3_1.FetchBlobReply\"\x00BSZQgithub.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/ocr3_1;ocr3_1pbb\x06proto3" + +var ( + file_ocr3_1_reporting_proto_rawDescOnce sync.Once + file_ocr3_1_reporting_proto_rawDescData []byte +) + +func file_ocr3_1_reporting_proto_rawDescGZIP() []byte { + file_ocr3_1_reporting_proto_rawDescOnce.Do(func() { + file_ocr3_1_reporting_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ocr3_1_reporting_proto_rawDesc), len(file_ocr3_1_reporting_proto_rawDesc))) + }) + return file_ocr3_1_reporting_proto_rawDescData +} + +var file_ocr3_1_reporting_proto_msgTypes = make([]protoimpl.MessageInfo, 34) +var file_ocr3_1_reporting_proto_goTypes = []any{ + (*NewReportingPluginRequest)(nil), // 0: loop.internal.pb.ocr3_1.NewReportingPluginRequest + (*NewReportingPluginReply)(nil), // 1: loop.internal.pb.ocr3_1.NewReportingPluginReply + (*ReportingPluginConfig)(nil), // 2: loop.internal.pb.ocr3_1.ReportingPluginConfig + (*ReportingPluginLimits)(nil), // 3: loop.internal.pb.ocr3_1.ReportingPluginLimits + (*ReportingPluginInfo)(nil), // 4: loop.internal.pb.ocr3_1.ReportingPluginInfo + (*FetchBlobRequest)(nil), // 5: loop.internal.pb.ocr3_1.FetchBlobRequest + (*FetchBlobReply)(nil), // 6: loop.internal.pb.ocr3_1.FetchBlobReply + (*BroadcastBlobRequest)(nil), // 7: loop.internal.pb.ocr3_1.BroadcastBlobRequest + (*BroadcastBlobReply)(nil), // 8: loop.internal.pb.ocr3_1.BroadcastBlobReply + (*KeyValueStateReadRequest)(nil), // 9: loop.internal.pb.ocr3_1.KeyValueStateReadRequest + (*KeyValueStateWriteRequest)(nil), // 10: loop.internal.pb.ocr3_1.KeyValueStateWriteRequest + (*KeyValueStateDeleteRequest)(nil), // 11: loop.internal.pb.ocr3_1.KeyValueStateDeleteRequest + (*KeyValueStateReadReply)(nil), // 12: loop.internal.pb.ocr3_1.KeyValueStateReadReply + (*QueryRequest)(nil), // 13: loop.internal.pb.ocr3_1.QueryRequest + (*AttributedQuery)(nil), // 14: loop.internal.pb.ocr3_1.AttributedQuery + (*AttributedObservation)(nil), // 15: loop.internal.pb.ocr3_1.AttributedObservation + (*QueryReply)(nil), // 16: loop.internal.pb.ocr3_1.QueryReply + (*ObservationRequest)(nil), // 17: loop.internal.pb.ocr3_1.ObservationRequest + (*ObservationReply)(nil), // 18: loop.internal.pb.ocr3_1.ObservationReply + (*ValidateObservationRequest)(nil), // 19: loop.internal.pb.ocr3_1.ValidateObservationRequest + (*ObservationQuorumRequest)(nil), // 20: loop.internal.pb.ocr3_1.ObservationQuorumRequest + (*ObservationQuorumReply)(nil), // 21: loop.internal.pb.ocr3_1.ObservationQuorumReply + (*StateTransitionRequest)(nil), // 22: loop.internal.pb.ocr3_1.StateTransitionRequest + (*StateTransitionReply)(nil), // 23: loop.internal.pb.ocr3_1.StateTransitionReply + (*CommittedRequest)(nil), // 24: loop.internal.pb.ocr3_1.CommittedRequest + (*ReportsRequest)(nil), // 25: loop.internal.pb.ocr3_1.ReportsRequest + (*ReportsReply)(nil), // 26: loop.internal.pb.ocr3_1.ReportsReply + (*ReportPlus)(nil), // 27: loop.internal.pb.ocr3_1.ReportPlus + (*ReportWithInfo)(nil), // 28: loop.internal.pb.ocr3_1.ReportWithInfo + (*TransmissionSchedule)(nil), // 29: loop.internal.pb.ocr3_1.TransmissionSchedule + (*ShouldAcceptAttestedReportRequest)(nil), // 30: loop.internal.pb.ocr3_1.ShouldAcceptAttestedReportRequest + (*ShouldAcceptAttestedReportReply)(nil), // 31: loop.internal.pb.ocr3_1.ShouldAcceptAttestedReportReply + (*ShouldTransmitAcceptedReportRequest)(nil), // 32: loop.internal.pb.ocr3_1.ShouldTransmitAcceptedReportRequest + (*ShouldTransmitAcceptedReportReply)(nil), // 33: loop.internal.pb.ocr3_1.ShouldTransmitAcceptedReportReply + (*emptypb.Empty)(nil), // 34: google.protobuf.Empty +} +var file_ocr3_1_reporting_proto_depIdxs = []int32{ + 2, // 0: loop.internal.pb.ocr3_1.NewReportingPluginRequest.reportingPluginConfig:type_name -> loop.internal.pb.ocr3_1.ReportingPluginConfig + 4, // 1: loop.internal.pb.ocr3_1.NewReportingPluginReply.reportingPluginInfo:type_name -> loop.internal.pb.ocr3_1.ReportingPluginInfo + 3, // 2: loop.internal.pb.ocr3_1.ReportingPluginInfo.reportingPluginLimits:type_name -> loop.internal.pb.ocr3_1.ReportingPluginLimits + 14, // 3: loop.internal.pb.ocr3_1.ObservationRequest.query:type_name -> loop.internal.pb.ocr3_1.AttributedQuery + 14, // 4: loop.internal.pb.ocr3_1.ValidateObservationRequest.query:type_name -> loop.internal.pb.ocr3_1.AttributedQuery + 15, // 5: loop.internal.pb.ocr3_1.ValidateObservationRequest.observation:type_name -> loop.internal.pb.ocr3_1.AttributedObservation + 14, // 6: loop.internal.pb.ocr3_1.ObservationQuorumRequest.query:type_name -> loop.internal.pb.ocr3_1.AttributedQuery + 15, // 7: loop.internal.pb.ocr3_1.ObservationQuorumRequest.observations:type_name -> loop.internal.pb.ocr3_1.AttributedObservation + 14, // 8: loop.internal.pb.ocr3_1.StateTransitionRequest.query:type_name -> loop.internal.pb.ocr3_1.AttributedQuery + 15, // 9: loop.internal.pb.ocr3_1.StateTransitionRequest.observation:type_name -> loop.internal.pb.ocr3_1.AttributedObservation + 27, // 10: loop.internal.pb.ocr3_1.ReportsReply.reportPlus:type_name -> loop.internal.pb.ocr3_1.ReportPlus + 28, // 11: loop.internal.pb.ocr3_1.ReportPlus.reportWithInfo:type_name -> loop.internal.pb.ocr3_1.ReportWithInfo + 29, // 12: loop.internal.pb.ocr3_1.ReportPlus.transmissionScheduleOverride:type_name -> loop.internal.pb.ocr3_1.TransmissionSchedule + 28, // 13: loop.internal.pb.ocr3_1.ShouldAcceptAttestedReportRequest.ri:type_name -> loop.internal.pb.ocr3_1.ReportWithInfo + 28, // 14: loop.internal.pb.ocr3_1.ShouldTransmitAcceptedReportRequest.ri:type_name -> loop.internal.pb.ocr3_1.ReportWithInfo + 0, // 15: loop.internal.pb.ocr3_1.ReportingPluginFactory.NewReportingPlugin:input_type -> loop.internal.pb.ocr3_1.NewReportingPluginRequest + 13, // 16: loop.internal.pb.ocr3_1.ReportingPlugin.Query:input_type -> loop.internal.pb.ocr3_1.QueryRequest + 17, // 17: loop.internal.pb.ocr3_1.ReportingPlugin.Observation:input_type -> loop.internal.pb.ocr3_1.ObservationRequest + 19, // 18: loop.internal.pb.ocr3_1.ReportingPlugin.ValidateObservation:input_type -> loop.internal.pb.ocr3_1.ValidateObservationRequest + 20, // 19: loop.internal.pb.ocr3_1.ReportingPlugin.ObservationQuorum:input_type -> loop.internal.pb.ocr3_1.ObservationQuorumRequest + 22, // 20: loop.internal.pb.ocr3_1.ReportingPlugin.StateTransition:input_type -> loop.internal.pb.ocr3_1.StateTransitionRequest + 24, // 21: loop.internal.pb.ocr3_1.ReportingPlugin.Committed:input_type -> loop.internal.pb.ocr3_1.CommittedRequest + 25, // 22: loop.internal.pb.ocr3_1.ReportingPlugin.Reports:input_type -> loop.internal.pb.ocr3_1.ReportsRequest + 30, // 23: loop.internal.pb.ocr3_1.ReportingPlugin.ShouldAcceptAttestedReport:input_type -> loop.internal.pb.ocr3_1.ShouldAcceptAttestedReportRequest + 32, // 24: loop.internal.pb.ocr3_1.ReportingPlugin.ShouldTransmitAcceptedReport:input_type -> loop.internal.pb.ocr3_1.ShouldTransmitAcceptedReportRequest + 34, // 25: loop.internal.pb.ocr3_1.ReportingPlugin.Close:input_type -> google.protobuf.Empty + 9, // 26: loop.internal.pb.ocr3_1.ReportingPlugin.KeyValueStateRead:input_type -> loop.internal.pb.ocr3_1.KeyValueStateReadRequest + 10, // 27: loop.internal.pb.ocr3_1.ReportingPlugin.KeyValueStateWrite:input_type -> loop.internal.pb.ocr3_1.KeyValueStateWriteRequest + 11, // 28: loop.internal.pb.ocr3_1.ReportingPlugin.KeyValueStateDelete:input_type -> loop.internal.pb.ocr3_1.KeyValueStateDeleteRequest + 7, // 29: loop.internal.pb.ocr3_1.ReportingPlugin.BroadcastBlob:input_type -> loop.internal.pb.ocr3_1.BroadcastBlobRequest + 5, // 30: loop.internal.pb.ocr3_1.ReportingPlugin.FetchBlob:input_type -> loop.internal.pb.ocr3_1.FetchBlobRequest + 1, // 31: loop.internal.pb.ocr3_1.ReportingPluginFactory.NewReportingPlugin:output_type -> loop.internal.pb.ocr3_1.NewReportingPluginReply + 16, // 32: loop.internal.pb.ocr3_1.ReportingPlugin.Query:output_type -> loop.internal.pb.ocr3_1.QueryReply + 18, // 33: loop.internal.pb.ocr3_1.ReportingPlugin.Observation:output_type -> loop.internal.pb.ocr3_1.ObservationReply + 34, // 34: loop.internal.pb.ocr3_1.ReportingPlugin.ValidateObservation:output_type -> google.protobuf.Empty + 21, // 35: loop.internal.pb.ocr3_1.ReportingPlugin.ObservationQuorum:output_type -> loop.internal.pb.ocr3_1.ObservationQuorumReply + 23, // 36: loop.internal.pb.ocr3_1.ReportingPlugin.StateTransition:output_type -> loop.internal.pb.ocr3_1.StateTransitionReply + 34, // 37: loop.internal.pb.ocr3_1.ReportingPlugin.Committed:output_type -> google.protobuf.Empty + 26, // 38: loop.internal.pb.ocr3_1.ReportingPlugin.Reports:output_type -> loop.internal.pb.ocr3_1.ReportsReply + 31, // 39: loop.internal.pb.ocr3_1.ReportingPlugin.ShouldAcceptAttestedReport:output_type -> loop.internal.pb.ocr3_1.ShouldAcceptAttestedReportReply + 33, // 40: loop.internal.pb.ocr3_1.ReportingPlugin.ShouldTransmitAcceptedReport:output_type -> loop.internal.pb.ocr3_1.ShouldTransmitAcceptedReportReply + 34, // 41: loop.internal.pb.ocr3_1.ReportingPlugin.Close:output_type -> google.protobuf.Empty + 12, // 42: loop.internal.pb.ocr3_1.ReportingPlugin.KeyValueStateRead:output_type -> loop.internal.pb.ocr3_1.KeyValueStateReadReply + 34, // 43: loop.internal.pb.ocr3_1.ReportingPlugin.KeyValueStateWrite:output_type -> google.protobuf.Empty + 34, // 44: loop.internal.pb.ocr3_1.ReportingPlugin.KeyValueStateDelete:output_type -> google.protobuf.Empty + 8, // 45: loop.internal.pb.ocr3_1.ReportingPlugin.BroadcastBlob:output_type -> loop.internal.pb.ocr3_1.BroadcastBlobReply + 6, // 46: loop.internal.pb.ocr3_1.ReportingPlugin.FetchBlob:output_type -> loop.internal.pb.ocr3_1.FetchBlobReply + 31, // [31:47] is the sub-list for method output_type + 15, // [15:31] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name +} + +func init() { file_ocr3_1_reporting_proto_init() } +func file_ocr3_1_reporting_proto_init() { + if File_ocr3_1_reporting_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_ocr3_1_reporting_proto_rawDesc), len(file_ocr3_1_reporting_proto_rawDesc)), + NumEnums: 0, + NumMessages: 34, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_ocr3_1_reporting_proto_goTypes, + DependencyIndexes: file_ocr3_1_reporting_proto_depIdxs, + MessageInfos: file_ocr3_1_reporting_proto_msgTypes, + }.Build() + File_ocr3_1_reporting_proto = out.File + file_ocr3_1_reporting_proto_goTypes = nil + file_ocr3_1_reporting_proto_depIdxs = nil +} diff --git a/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.proto b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.proto new file mode 100644 index 0000000000..159949ff85 --- /dev/null +++ b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.proto @@ -0,0 +1,213 @@ +syntax = "proto3"; + +option go_package = "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/ocr3_1;ocr3_1pb"; + +package loop.internal.pb.ocr3_1; + +import "google/protobuf/empty.proto"; + +service ReportingPluginFactory { + rpc NewReportingPlugin (NewReportingPluginRequest) returns (NewReportingPluginReply) {} +} + +message NewReportingPluginRequest { + ReportingPluginConfig reportingPluginConfig = 1; +} + +message NewReportingPluginReply { + uint32 reportingPluginID = 1; + ReportingPluginInfo reportingPluginInfo = 2; +} + +message ReportingPluginConfig { + bytes configDigest = 1; + uint32 oracleID = 2; + uint32 n = 3; + uint32 f = 4; + bytes onchainConfig = 5; + bytes offchainConfig = 6; + int64 estimatedRoundInterval = 7; + int64 maxDurationQuery = 8; + int64 maxDurationObservation = 9; + int64 MaxDurationShouldAcceptAttestedReport = 10; + int64 MaxDurationShouldTransmitAcceptedReport = 11; + +} + +message ReportingPluginLimits { + uint64 maxQueryLength = 1; + uint64 maxObservationLength = 2; + uint64 MaxReportLength = 3; + uint64 MaxReportCount = 4; +} + +message ReportingPluginInfo { + string name = 1; + ReportingPluginLimits reportingPluginLimits = 2; +} + + +service ReportingPlugin { + rpc Query(QueryRequest) returns (QueryReply) {} + rpc Observation(ObservationRequest)returns (ObservationReply) {} + rpc ValidateObservation(ValidateObservationRequest) returns (google.protobuf.Empty) {} + rpc ObservationQuorum(ObservationQuorumRequest) returns (ObservationQuorumReply) {} + rpc StateTransition(StateTransitionRequest) returns (StateTransitionReply) {} + rpc Committed(CommittedRequest) returns (google.protobuf.Empty) {} + rpc Reports(ReportsRequest)returns (ReportsReply) {} + rpc ShouldAcceptAttestedReport(ShouldAcceptAttestedReportRequest) returns (ShouldAcceptAttestedReportReply) {} + rpc ShouldTransmitAcceptedReport(ShouldTransmitAcceptedReportRequest) returns (ShouldTransmitAcceptedReportReply) {} + rpc Close(google.protobuf.Empty) returns (google.protobuf.Empty) {} + + rpc KeyValueStateRead(KeyValueStateReadRequest) returns (KeyValueStateReadReply) {} + rpc KeyValueStateWrite(KeyValueStateWriteRequest) returns (google.protobuf.Empty) {} + rpc KeyValueStateDelete(KeyValueStateDeleteRequest) returns (google.protobuf.Empty) {} + + rpc BroadcastBlob(BroadcastBlobRequest) returns (BroadcastBlobReply) {} // here how to implement these to pass blob handle etc + rpc FetchBlob(FetchBlobRequest) returns (FetchBlobReply) {} // here how to implement these to pass blob handle etc +} + +// TODO the blob cannot be constructed outside of libocr right now, need to modify libocr to allow to support cross process blob-handles +message FetchBlobRequest { + bytes blobHandle = 1; +} + +message FetchBlobReply { + bytes payload = 1; +} + +message BroadcastBlobRequest { + bytes payload = 1; + uint64 blobExpirationHint = 2; +} + +message BroadcastBlobReply { + bytes blobHandle = 1; +} + +message KeyValueStateReadRequest { + string keyValueStateReaderID = 1; + bytes key = 2; +} + +message KeyValueStateWriteRequest { + string keyValueStateReaderID = 1; + bytes key = 2; + bytes value = 3; +} + +message KeyValueStateDeleteRequest { + string keyValueStateReaderID = 1; + bytes key = 2; +} + +message KeyValueStateReadReply { + bytes value = 1; +} + +message QueryRequest { + string keyValueStateReaderID = 1; + uint64 seqNr=2; + +} + +message AttributedQuery{ + bytes query=1; + uint32 oracleID=2; +} + +message AttributedObservation{ + bytes observation=1; + uint32 oracleID=2; +} + + +message QueryReply { + bytes query =1; +} + +message ObservationRequest { + string keyValueStateReaderID = 1; + uint64 seqNr=2; + AttributedQuery query=3; +} + +message ObservationReply { + bytes observation=1; +} + +message ValidateObservationRequest{ + string keyValueStateReaderID = 1; + uint64 seqNr=2; + AttributedQuery query=3; + AttributedObservation observation=4; +} + +message ObservationQuorumRequest { + string keyValueStateReaderID = 1; + uint64 seqNr=2; + AttributedQuery query=3; + repeated AttributedObservation observations=4; +} + +message ObservationQuorumReply { + bool quorumReached=1; +} + +message StateTransitionRequest{ + string keyValueStateReaderID = 1; + uint64 seqNr=2; + AttributedQuery query=3; + repeated AttributedObservation observation=4; +} + +message StateTransitionReply{ + bytes outcome=1; +} + +message CommittedRequest{ + string keyValueStateReaderID = 1; + uint64 seqNr=2; +} + +message ReportsRequest{ + uint64 seqNr=1; + bytes outcome=2; +} + +message ReportsReply{ + repeated ReportPlus reportPlus=1; +} + +message ReportPlus{ + ReportWithInfo reportWithInfo=1; + TransmissionSchedule transmissionScheduleOverride=2; +} + +message ReportWithInfo{ + bytes report=1; + bytes info=2; +} + +message TransmissionSchedule{ + repeated uint32 transmitters=1; // OracleID + repeated int64 transmissionDelays=2; +} + +message ShouldAcceptAttestedReportRequest{ + uint64 segNr=1; + ReportWithInfo ri=2; +} + +message ShouldAcceptAttestedReportReply{ + bool shouldAccept=1; +} + +message ShouldTransmitAcceptedReportRequest{ + uint64 segNr=1; + ReportWithInfo ri=2; +} + +message ShouldTransmitAcceptedReportReply{ + bool shouldTransmit=1; +} diff --git a/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting_grpc.pb.go b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting_grpc.pb.go new file mode 100644 index 0000000000..d08b6641e3 --- /dev/null +++ b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting_grpc.pb.go @@ -0,0 +1,757 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 +// source: ocr3_1_reporting.proto + +package ocr3_1pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + ReportingPluginFactory_NewReportingPlugin_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPluginFactory/NewReportingPlugin" +) + +// ReportingPluginFactoryClient is the client API for ReportingPluginFactory service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ReportingPluginFactoryClient interface { + NewReportingPlugin(ctx context.Context, in *NewReportingPluginRequest, opts ...grpc.CallOption) (*NewReportingPluginReply, error) +} + +type reportingPluginFactoryClient struct { + cc grpc.ClientConnInterface +} + +func NewReportingPluginFactoryClient(cc grpc.ClientConnInterface) ReportingPluginFactoryClient { + return &reportingPluginFactoryClient{cc} +} + +func (c *reportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, in *NewReportingPluginRequest, opts ...grpc.CallOption) (*NewReportingPluginReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(NewReportingPluginReply) + err := c.cc.Invoke(ctx, ReportingPluginFactory_NewReportingPlugin_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ReportingPluginFactoryServer is the server API for ReportingPluginFactory service. +// All implementations must embed UnimplementedReportingPluginFactoryServer +// for forward compatibility. +type ReportingPluginFactoryServer interface { + NewReportingPlugin(context.Context, *NewReportingPluginRequest) (*NewReportingPluginReply, error) + mustEmbedUnimplementedReportingPluginFactoryServer() +} + +// UnimplementedReportingPluginFactoryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedReportingPluginFactoryServer struct{} + +func (UnimplementedReportingPluginFactoryServer) NewReportingPlugin(context.Context, *NewReportingPluginRequest) (*NewReportingPluginReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method NewReportingPlugin not implemented") +} +func (UnimplementedReportingPluginFactoryServer) mustEmbedUnimplementedReportingPluginFactoryServer() { +} +func (UnimplementedReportingPluginFactoryServer) testEmbeddedByValue() {} + +// UnsafeReportingPluginFactoryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ReportingPluginFactoryServer will +// result in compilation errors. +type UnsafeReportingPluginFactoryServer interface { + mustEmbedUnimplementedReportingPluginFactoryServer() +} + +func RegisterReportingPluginFactoryServer(s grpc.ServiceRegistrar, srv ReportingPluginFactoryServer) { + // If the following call pancis, it indicates UnimplementedReportingPluginFactoryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ReportingPluginFactory_ServiceDesc, srv) +} + +func _ReportingPluginFactory_NewReportingPlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NewReportingPluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginFactoryServer).NewReportingPlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPluginFactory_NewReportingPlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginFactoryServer).NewReportingPlugin(ctx, req.(*NewReportingPluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ReportingPluginFactory_ServiceDesc is the grpc.ServiceDesc for ReportingPluginFactory service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ReportingPluginFactory_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "loop.internal.pb.ocr3_1.ReportingPluginFactory", + HandlerType: (*ReportingPluginFactoryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "NewReportingPlugin", + Handler: _ReportingPluginFactory_NewReportingPlugin_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ocr3_1_reporting.proto", +} + +const ( + ReportingPlugin_Query_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/Query" + ReportingPlugin_Observation_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/Observation" + ReportingPlugin_ValidateObservation_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/ValidateObservation" + ReportingPlugin_ObservationQuorum_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/ObservationQuorum" + ReportingPlugin_StateTransition_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/StateTransition" + ReportingPlugin_Committed_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/Committed" + ReportingPlugin_Reports_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/Reports" + ReportingPlugin_ShouldAcceptAttestedReport_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/ShouldAcceptAttestedReport" + ReportingPlugin_ShouldTransmitAcceptedReport_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/ShouldTransmitAcceptedReport" + ReportingPlugin_Close_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/Close" + ReportingPlugin_KeyValueStateRead_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/KeyValueStateRead" + ReportingPlugin_KeyValueStateWrite_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/KeyValueStateWrite" + ReportingPlugin_KeyValueStateDelete_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/KeyValueStateDelete" + ReportingPlugin_BroadcastBlob_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/BroadcastBlob" + ReportingPlugin_FetchBlob_FullMethodName = "/loop.internal.pb.ocr3_1.ReportingPlugin/FetchBlob" +) + +// ReportingPluginClient is the client API for ReportingPlugin service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ReportingPluginClient interface { + Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryReply, error) + Observation(ctx context.Context, in *ObservationRequest, opts ...grpc.CallOption) (*ObservationReply, error) + ValidateObservation(ctx context.Context, in *ValidateObservationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + ObservationQuorum(ctx context.Context, in *ObservationQuorumRequest, opts ...grpc.CallOption) (*ObservationQuorumReply, error) + StateTransition(ctx context.Context, in *StateTransitionRequest, opts ...grpc.CallOption) (*StateTransitionReply, error) + Committed(ctx context.Context, in *CommittedRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + Reports(ctx context.Context, in *ReportsRequest, opts ...grpc.CallOption) (*ReportsReply, error) + ShouldAcceptAttestedReport(ctx context.Context, in *ShouldAcceptAttestedReportRequest, opts ...grpc.CallOption) (*ShouldAcceptAttestedReportReply, error) + ShouldTransmitAcceptedReport(ctx context.Context, in *ShouldTransmitAcceptedReportRequest, opts ...grpc.CallOption) (*ShouldTransmitAcceptedReportReply, error) + Close(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) + KeyValueStateRead(ctx context.Context, in *KeyValueStateReadRequest, opts ...grpc.CallOption) (*KeyValueStateReadReply, error) + KeyValueStateWrite(ctx context.Context, in *KeyValueStateWriteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + KeyValueStateDelete(ctx context.Context, in *KeyValueStateDeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + BroadcastBlob(ctx context.Context, in *BroadcastBlobRequest, opts ...grpc.CallOption) (*BroadcastBlobReply, error) + FetchBlob(ctx context.Context, in *FetchBlobRequest, opts ...grpc.CallOption) (*FetchBlobReply, error) +} + +type reportingPluginClient struct { + cc grpc.ClientConnInterface +} + +func NewReportingPluginClient(cc grpc.ClientConnInterface) ReportingPluginClient { + return &reportingPluginClient{cc} +} + +func (c *reportingPluginClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueryReply) + err := c.cc.Invoke(ctx, ReportingPlugin_Query_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) Observation(ctx context.Context, in *ObservationRequest, opts ...grpc.CallOption) (*ObservationReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ObservationReply) + err := c.cc.Invoke(ctx, ReportingPlugin_Observation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) ValidateObservation(ctx context.Context, in *ValidateObservationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, ReportingPlugin_ValidateObservation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) ObservationQuorum(ctx context.Context, in *ObservationQuorumRequest, opts ...grpc.CallOption) (*ObservationQuorumReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ObservationQuorumReply) + err := c.cc.Invoke(ctx, ReportingPlugin_ObservationQuorum_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) StateTransition(ctx context.Context, in *StateTransitionRequest, opts ...grpc.CallOption) (*StateTransitionReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StateTransitionReply) + err := c.cc.Invoke(ctx, ReportingPlugin_StateTransition_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) Committed(ctx context.Context, in *CommittedRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, ReportingPlugin_Committed_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) Reports(ctx context.Context, in *ReportsRequest, opts ...grpc.CallOption) (*ReportsReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReportsReply) + err := c.cc.Invoke(ctx, ReportingPlugin_Reports_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) ShouldAcceptAttestedReport(ctx context.Context, in *ShouldAcceptAttestedReportRequest, opts ...grpc.CallOption) (*ShouldAcceptAttestedReportReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ShouldAcceptAttestedReportReply) + err := c.cc.Invoke(ctx, ReportingPlugin_ShouldAcceptAttestedReport_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) ShouldTransmitAcceptedReport(ctx context.Context, in *ShouldTransmitAcceptedReportRequest, opts ...grpc.CallOption) (*ShouldTransmitAcceptedReportReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ShouldTransmitAcceptedReportReply) + err := c.cc.Invoke(ctx, ReportingPlugin_ShouldTransmitAcceptedReport_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) Close(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, ReportingPlugin_Close_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) KeyValueStateRead(ctx context.Context, in *KeyValueStateReadRequest, opts ...grpc.CallOption) (*KeyValueStateReadReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KeyValueStateReadReply) + err := c.cc.Invoke(ctx, ReportingPlugin_KeyValueStateRead_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) KeyValueStateWrite(ctx context.Context, in *KeyValueStateWriteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, ReportingPlugin_KeyValueStateWrite_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) KeyValueStateDelete(ctx context.Context, in *KeyValueStateDeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, ReportingPlugin_KeyValueStateDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) BroadcastBlob(ctx context.Context, in *BroadcastBlobRequest, opts ...grpc.CallOption) (*BroadcastBlobReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BroadcastBlobReply) + err := c.cc.Invoke(ctx, ReportingPlugin_BroadcastBlob_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *reportingPluginClient) FetchBlob(ctx context.Context, in *FetchBlobRequest, opts ...grpc.CallOption) (*FetchBlobReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(FetchBlobReply) + err := c.cc.Invoke(ctx, ReportingPlugin_FetchBlob_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ReportingPluginServer is the server API for ReportingPlugin service. +// All implementations must embed UnimplementedReportingPluginServer +// for forward compatibility. +type ReportingPluginServer interface { + Query(context.Context, *QueryRequest) (*QueryReply, error) + Observation(context.Context, *ObservationRequest) (*ObservationReply, error) + ValidateObservation(context.Context, *ValidateObservationRequest) (*emptypb.Empty, error) + ObservationQuorum(context.Context, *ObservationQuorumRequest) (*ObservationQuorumReply, error) + StateTransition(context.Context, *StateTransitionRequest) (*StateTransitionReply, error) + Committed(context.Context, *CommittedRequest) (*emptypb.Empty, error) + Reports(context.Context, *ReportsRequest) (*ReportsReply, error) + ShouldAcceptAttestedReport(context.Context, *ShouldAcceptAttestedReportRequest) (*ShouldAcceptAttestedReportReply, error) + ShouldTransmitAcceptedReport(context.Context, *ShouldTransmitAcceptedReportRequest) (*ShouldTransmitAcceptedReportReply, error) + Close(context.Context, *emptypb.Empty) (*emptypb.Empty, error) + KeyValueStateRead(context.Context, *KeyValueStateReadRequest) (*KeyValueStateReadReply, error) + KeyValueStateWrite(context.Context, *KeyValueStateWriteRequest) (*emptypb.Empty, error) + KeyValueStateDelete(context.Context, *KeyValueStateDeleteRequest) (*emptypb.Empty, error) + BroadcastBlob(context.Context, *BroadcastBlobRequest) (*BroadcastBlobReply, error) + FetchBlob(context.Context, *FetchBlobRequest) (*FetchBlobReply, error) + mustEmbedUnimplementedReportingPluginServer() +} + +// UnimplementedReportingPluginServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedReportingPluginServer struct{} + +func (UnimplementedReportingPluginServer) Query(context.Context, *QueryRequest) (*QueryReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") +} +func (UnimplementedReportingPluginServer) Observation(context.Context, *ObservationRequest) (*ObservationReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Observation not implemented") +} +func (UnimplementedReportingPluginServer) ValidateObservation(context.Context, *ValidateObservationRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateObservation not implemented") +} +func (UnimplementedReportingPluginServer) ObservationQuorum(context.Context, *ObservationQuorumRequest) (*ObservationQuorumReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ObservationQuorum not implemented") +} +func (UnimplementedReportingPluginServer) StateTransition(context.Context, *StateTransitionRequest) (*StateTransitionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method StateTransition not implemented") +} +func (UnimplementedReportingPluginServer) Committed(context.Context, *CommittedRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Committed not implemented") +} +func (UnimplementedReportingPluginServer) Reports(context.Context, *ReportsRequest) (*ReportsReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Reports not implemented") +} +func (UnimplementedReportingPluginServer) ShouldAcceptAttestedReport(context.Context, *ShouldAcceptAttestedReportRequest) (*ShouldAcceptAttestedReportReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ShouldAcceptAttestedReport not implemented") +} +func (UnimplementedReportingPluginServer) ShouldTransmitAcceptedReport(context.Context, *ShouldTransmitAcceptedReportRequest) (*ShouldTransmitAcceptedReportReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ShouldTransmitAcceptedReport not implemented") +} +func (UnimplementedReportingPluginServer) Close(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Close not implemented") +} +func (UnimplementedReportingPluginServer) KeyValueStateRead(context.Context, *KeyValueStateReadRequest) (*KeyValueStateReadReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method KeyValueStateRead not implemented") +} +func (UnimplementedReportingPluginServer) KeyValueStateWrite(context.Context, *KeyValueStateWriteRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method KeyValueStateWrite not implemented") +} +func (UnimplementedReportingPluginServer) KeyValueStateDelete(context.Context, *KeyValueStateDeleteRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method KeyValueStateDelete not implemented") +} +func (UnimplementedReportingPluginServer) BroadcastBlob(context.Context, *BroadcastBlobRequest) (*BroadcastBlobReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method BroadcastBlob not implemented") +} +func (UnimplementedReportingPluginServer) FetchBlob(context.Context, *FetchBlobRequest) (*FetchBlobReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchBlob not implemented") +} +func (UnimplementedReportingPluginServer) mustEmbedUnimplementedReportingPluginServer() {} +func (UnimplementedReportingPluginServer) testEmbeddedByValue() {} + +// UnsafeReportingPluginServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ReportingPluginServer will +// result in compilation errors. +type UnsafeReportingPluginServer interface { + mustEmbedUnimplementedReportingPluginServer() +} + +func RegisterReportingPluginServer(s grpc.ServiceRegistrar, srv ReportingPluginServer) { + // If the following call pancis, it indicates UnimplementedReportingPluginServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ReportingPlugin_ServiceDesc, srv) +} + +func _ReportingPlugin_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).Query(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_Query_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).Query(ctx, req.(*QueryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_Observation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ObservationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).Observation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_Observation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).Observation(ctx, req.(*ObservationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_ValidateObservation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateObservationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).ValidateObservation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_ValidateObservation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).ValidateObservation(ctx, req.(*ValidateObservationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_ObservationQuorum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ObservationQuorumRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).ObservationQuorum(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_ObservationQuorum_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).ObservationQuorum(ctx, req.(*ObservationQuorumRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_StateTransition_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StateTransitionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).StateTransition(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_StateTransition_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).StateTransition(ctx, req.(*StateTransitionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_Committed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CommittedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).Committed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_Committed_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).Committed(ctx, req.(*CommittedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_Reports_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReportsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).Reports(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_Reports_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).Reports(ctx, req.(*ReportsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_ShouldAcceptAttestedReport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ShouldAcceptAttestedReportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).ShouldAcceptAttestedReport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_ShouldAcceptAttestedReport_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).ShouldAcceptAttestedReport(ctx, req.(*ShouldAcceptAttestedReportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_ShouldTransmitAcceptedReport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ShouldTransmitAcceptedReportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).ShouldTransmitAcceptedReport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_ShouldTransmitAcceptedReport_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).ShouldTransmitAcceptedReport(ctx, req.(*ShouldTransmitAcceptedReportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_Close_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).Close(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_Close_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).Close(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_KeyValueStateRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KeyValueStateReadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).KeyValueStateRead(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_KeyValueStateRead_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).KeyValueStateRead(ctx, req.(*KeyValueStateReadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_KeyValueStateWrite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KeyValueStateWriteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).KeyValueStateWrite(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_KeyValueStateWrite_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).KeyValueStateWrite(ctx, req.(*KeyValueStateWriteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_KeyValueStateDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KeyValueStateDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).KeyValueStateDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_KeyValueStateDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).KeyValueStateDelete(ctx, req.(*KeyValueStateDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_BroadcastBlob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BroadcastBlobRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).BroadcastBlob(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_BroadcastBlob_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).BroadcastBlob(ctx, req.(*BroadcastBlobRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReportingPlugin_FetchBlob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchBlobRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReportingPluginServer).FetchBlob(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReportingPlugin_FetchBlob_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReportingPluginServer).FetchBlob(ctx, req.(*FetchBlobRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ReportingPlugin_ServiceDesc is the grpc.ServiceDesc for ReportingPlugin service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ReportingPlugin_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "loop.internal.pb.ocr3_1.ReportingPlugin", + HandlerType: (*ReportingPluginServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Query", + Handler: _ReportingPlugin_Query_Handler, + }, + { + MethodName: "Observation", + Handler: _ReportingPlugin_Observation_Handler, + }, + { + MethodName: "ValidateObservation", + Handler: _ReportingPlugin_ValidateObservation_Handler, + }, + { + MethodName: "ObservationQuorum", + Handler: _ReportingPlugin_ObservationQuorum_Handler, + }, + { + MethodName: "StateTransition", + Handler: _ReportingPlugin_StateTransition_Handler, + }, + { + MethodName: "Committed", + Handler: _ReportingPlugin_Committed_Handler, + }, + { + MethodName: "Reports", + Handler: _ReportingPlugin_Reports_Handler, + }, + { + MethodName: "ShouldAcceptAttestedReport", + Handler: _ReportingPlugin_ShouldAcceptAttestedReport_Handler, + }, + { + MethodName: "ShouldTransmitAcceptedReport", + Handler: _ReportingPlugin_ShouldTransmitAcceptedReport_Handler, + }, + { + MethodName: "Close", + Handler: _ReportingPlugin_Close_Handler, + }, + { + MethodName: "KeyValueStateRead", + Handler: _ReportingPlugin_KeyValueStateRead_Handler, + }, + { + MethodName: "KeyValueStateWrite", + Handler: _ReportingPlugin_KeyValueStateWrite_Handler, + }, + { + MethodName: "KeyValueStateDelete", + Handler: _ReportingPlugin_KeyValueStateDelete_Handler, + }, + { + MethodName: "BroadcastBlob", + Handler: _ReportingPlugin_BroadcastBlob_Handler, + }, + { + MethodName: "FetchBlob", + Handler: _ReportingPlugin_FetchBlob_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ocr3_1_reporting.proto", +} diff --git a/pkg/types/core/oracle_factory_3_1.go b/pkg/types/core/oracle_factory_3_1.go new file mode 100644 index 0000000000..7b4d722c05 --- /dev/null +++ b/pkg/types/core/oracle_factory_3_1.go @@ -0,0 +1,19 @@ +package core + +import ( + "context" + + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3_1types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" +) + +type OracleFactory3_1 interface { + NewOracle(ctx context.Context, args OracleArgs) (Oracle, error) +} + +type OracleArgs3_1 struct { + LocalConfig types.LocalConfig + ReportingPluginFactoryService ocr3_1types.ReportingPluginFactory[[]byte] + ContractTransmitter ocr3types.ContractTransmitter[[]byte] +} From 34464c39c8aec45971cc05b494bb2bd38bde1fcc Mon Sep 17 00:00:00 2001 From: Matthew Pendrey Date: Tue, 13 Jan 2026 17:42:04 +0000 Subject: [PATCH 2/4] wip --- .../reportingplugin/ocr3_1/reporting.go | 112 +++++++++++------- .../internal/pb/ocr3_1/ocr3_1_reporting.pb.go | 14 +-- .../internal/pb/ocr3_1/ocr3_1_reporting.proto | 2 +- 3 files changed, 75 insertions(+), 53 deletions(-) diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go index e9c51f27e0..a319b4dbbb 100644 --- a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go @@ -11,9 +11,9 @@ import ( "google.golang.org/protobuf/types/known/emptypb" "github.com/smartcontractkit/libocr/commontypes" - "github.com/smartcontractkit/libocr/offchainreporting2/types" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3_1types" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/goplugin" @@ -127,47 +127,79 @@ func (r *reportingPluginFactoryServer) NewReportingPlugin(ctx context.Context, r var _ ocr3_1types.ReportingPlugin[[]byte] = (*reportingPluginClient)(nil) -type keyValueReaders struct { - keyValueReaders sync.Map +type methodScopedStore[T any] struct { + store sync.Map } -func newKeyValueReaders() *keyValueReaders { - return &keyValueReaders{keyValueReaders: sync.Map{}} +func newMethodScopedStore[T any]() *methodScopedStore[T] { + return &methodScopedStore[T]{store: sync.Map{}} } -func (kvr *keyValueReaders) Get(id string) ocr3_1types.KeyValueReader { - v, ok := kvr.keyValueReaders.Load(id) +func (kvr *methodScopedStore[T]) Get(id string) T { + v, ok := kvr.store.Load(id) if !ok { - return nil + var zero T + return zero } - return v.(ocr3_1types.KeyValueReader) + return v.(T) } -func (kvr *keyValueReaders) Put(kvr2 ocr3_1types.KeyValueReader) string { +func (kvr *methodScopedStore[T]) Put(kvr2 T) string { id := uuid.NewString() - kvr.keyValueReaders.Store(id, kvr2) - + kvr.store.Store(id, kvr2) return id } -func (kvr *keyValueReaders) Delete(id string) { - kvr.keyValueReaders.Delete(id) +func (kvr *methodScopedStore[T]) Delete(id string) { + kvr.store.Delete(id) } type reportingPluginClient struct { *net.BrokerExt - grpc ocr3.ReportingPluginClient - keyValueReaders *keyValueReaders + grpc ocr3.ReportingPluginClient + keyValueReaders *methodScopedStore[ocr3_1types.KeyValueReader] + keyValueReaderWriters *methodScopedStore[ocr3_1types.KeyValueReadWriter] } -func (o *reportingPluginClient) StateTransition(ctx context.Context, seqNr uint64, aq libocr.AttributedQuery, aos []libocr.AttributedObservation, keyValueReadWriter ocr3_1types.KeyValueReadWriter, blobFetcher ocr3_1types.BlobFetcher) (ocr3_1types.ReportsPlusPrecursor, error) { - //TODO implement me - panic("implement me") +func (o *reportingPluginClient) StateTransition(ctx context.Context, seqNr uint64, + aq types.AttributedQuery, + aos []types.AttributedObservation, + keyValueReaderWriter ocr3_1types.KeyValueReadWriter, blobBroadcastFetcher ocr3_1types.BlobFetcher) (ocr3_1types.ReportsPlusPrecursor, error) { + kvrID := o.keyValueReaderWriters.Put(keyValueReaderWriter) + defer o.keyValueReaderWriters.Delete(kvrID) + + var observations []*ocr3_1.AttributedObservation + for _, ao := range aos { + observations = append(observations, &ocr3_1.AttributedObservation{ + Observation: ao.Observation, + OracleID: uint32(ao.Observer), + }) + } + + reply, err := o.grpc.StateTransition(ctx, &ocr3_1.StateTransitionRequest{ + KeyValueStateReaderID: kvrID, + SeqNr: seqNr, + Query: &ocr3_1.AttributedQuery{ + Query: aq.Query, + OracleID: uint32(aq.Proposer), + }, + Observations: observations, + }) + if err != nil { + return nil, err + } + return reply.Outcome, nil } func (o *reportingPluginClient) Committed(ctx context.Context, seqNr uint64, keyValueReader ocr3_1types.KeyValueReader) error { - //TODO implement me - panic("implement me") + kvrID := o.keyValueReaders.Put(keyValueReader) + defer o.keyValueReaders.Delete(kvrID) + + _, err := o.grpc.Committed(ctx, &ocr3_1.CommittedRequest{ + KeyValueStateReaderID: kvrID, + SeqNr: seqNr, + }) + return err } func (o *reportingPluginClient) Query(ctx context.Context, seqNr uint64, keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobBroadcastFetcher) (libocr.Query, error) { @@ -203,7 +235,7 @@ func (o *reportingPluginClient) Observation(ctx context.Context, seqNr uint64, a func (o *reportingPluginClient) ValidateObservation(ctx context.Context, seqNr uint64, aq libocr.AttributedQuery, ao libocr.AttributedObservation, - keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobBroadcastFetcher) error { + keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobFetcher) error { kvrID := o.keyValueReaders.Put(keyValueReader) defer o.keyValueReaders.Delete(kvrID) _, err := o.grpc.ValidateObservation(ctx, &ocr3.ValidateObservationRequest{ @@ -224,24 +256,26 @@ func (o *reportingPluginClient) ValidateObservation(ctx context.Context, seqNr u func (o *reportingPluginClient) ObservationQuorum(ctx context.Context, seqNr uint64, aq libocr.AttributedQuery, aos []types.AttributedObservation, - keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobBroadcastFetcher) (bool, error) { + keyValueReader ocr3_1types.KeyValueReader, blobBroadcastFetcher ocr3_1types.BlobFetcher) (bool, error) { kvrID := o.keyValueReaders.Put(keyValueReader) defer o.keyValueReaders.Delete(kvrID) - observations := []types.AttributedObservation, + var observations []*ocr3_1.AttributedObservation + for _, ao := range aos { + observations = append(observations, &ocr3_1.AttributedObservation{ + Observation: ao.Observation, + OracleID: uint32(ao.Observer), + }) + } - reply, err := o.grpc.ObservationQuorum(ctx, &ocr3.ObservationQuorumRequest{ + reply, err := o.grpc.ObservationQuorum(ctx, &ocr3_1.ObservationQuorumRequest{ KeyValueStateReaderID: kvrID, SeqNr: seqNr, Query: &ocr3_1.AttributedQuery{ Query: aq.Query, OracleID: uint32(aq.Proposer), }, - Observation: &ocr3_1.AttributedObservation{ - Observation: ao.Observation, - OracleID: uint32(ao.Observer), - }, - + Observations: observations, }) if err != nil { return false, err @@ -249,22 +283,10 @@ func (o *reportingPluginClient) ObservationQuorum(ctx context.Context, seqNr uin return reply.QuorumReached, nil } -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, - Ao: pbAttributedObservations(aos), - }) - if err != nil { - return nil, err - } - return reply.Outcome, nil -} - -func (o *reportingPluginClient) Reports(ctx context.Context, seqNr uint64, outcome ocr3types.Outcome) ([]ocr3types.ReportPlus[[]byte], error) { - reply, err := o.grpc.Reports(ctx, &ocr3.ReportsRequest{ +func (o *reportingPluginClient) Reports(ctx context.Context, seqNr uint64, reportsPlusPrecursor ocr3_1types.ReportsPlusPrecursor) ([]ocr3types.ReportPlus[[]byte], error) { + reply, err := o.grpc.Reports(ctx, &ocr3_1.ReportsRequest{ SeqNr: seqNr, - Outcome: outcome, + Outcome: reportsPlusPrecursor, }) if err != nil { return nil, err diff --git a/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.pb.go b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.pb.go index 0466a094d1..cd3a5cf9b6 100644 --- a/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.pb.go +++ b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.pb.go @@ -1244,7 +1244,7 @@ type StateTransitionRequest struct { KeyValueStateReaderID string `protobuf:"bytes,1,opt,name=keyValueStateReaderID,proto3" json:"keyValueStateReaderID,omitempty"` SeqNr uint64 `protobuf:"varint,2,opt,name=seqNr,proto3" json:"seqNr,omitempty"` Query *AttributedQuery `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` - Observation []*AttributedObservation `protobuf:"bytes,4,rep,name=observation,proto3" json:"observation,omitempty"` + Observations []*AttributedObservation `protobuf:"bytes,4,rep,name=observations,proto3" json:"observations,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1300,9 +1300,9 @@ func (x *StateTransitionRequest) GetQuery() *AttributedQuery { return nil } -func (x *StateTransitionRequest) GetObservation() []*AttributedObservation { +func (x *StateTransitionRequest) GetObservations() []*AttributedObservation { if x != nil { - return x.Observation + return x.Observations } return nil } @@ -1932,12 +1932,12 @@ const file_ocr3_1_reporting_proto_rawDesc = "" + "\x05query\x18\x03 \x01(\v2(.loop.internal.pb.ocr3_1.AttributedQueryR\x05query\x12R\n" + "\fobservations\x18\x04 \x03(\v2..loop.internal.pb.ocr3_1.AttributedObservationR\fobservations\">\n" + "\x16ObservationQuorumReply\x12$\n" + - "\rquorumReached\x18\x01 \x01(\bR\rquorumReached\"\xf6\x01\n" + + "\rquorumReached\x18\x01 \x01(\bR\rquorumReached\"\xf8\x01\n" + "\x16StateTransitionRequest\x124\n" + "\x15keyValueStateReaderID\x18\x01 \x01(\tR\x15keyValueStateReaderID\x12\x14\n" + "\x05seqNr\x18\x02 \x01(\x04R\x05seqNr\x12>\n" + - "\x05query\x18\x03 \x01(\v2(.loop.internal.pb.ocr3_1.AttributedQueryR\x05query\x12P\n" + - "\vobservation\x18\x04 \x03(\v2..loop.internal.pb.ocr3_1.AttributedObservationR\vobservation\"0\n" + + "\x05query\x18\x03 \x01(\v2(.loop.internal.pb.ocr3_1.AttributedQueryR\x05query\x12R\n" + + "\fobservations\x18\x04 \x03(\v2..loop.internal.pb.ocr3_1.AttributedObservationR\fobservations\"0\n" + "\x14StateTransitionReply\x12\x18\n" + "\aoutcome\x18\x01 \x01(\fR\aoutcome\"^\n" + "\x10CommittedRequest\x124\n" + @@ -2049,7 +2049,7 @@ var file_ocr3_1_reporting_proto_depIdxs = []int32{ 14, // 6: loop.internal.pb.ocr3_1.ObservationQuorumRequest.query:type_name -> loop.internal.pb.ocr3_1.AttributedQuery 15, // 7: loop.internal.pb.ocr3_1.ObservationQuorumRequest.observations:type_name -> loop.internal.pb.ocr3_1.AttributedObservation 14, // 8: loop.internal.pb.ocr3_1.StateTransitionRequest.query:type_name -> loop.internal.pb.ocr3_1.AttributedQuery - 15, // 9: loop.internal.pb.ocr3_1.StateTransitionRequest.observation:type_name -> loop.internal.pb.ocr3_1.AttributedObservation + 15, // 9: loop.internal.pb.ocr3_1.StateTransitionRequest.observations:type_name -> loop.internal.pb.ocr3_1.AttributedObservation 27, // 10: loop.internal.pb.ocr3_1.ReportsReply.reportPlus:type_name -> loop.internal.pb.ocr3_1.ReportPlus 28, // 11: loop.internal.pb.ocr3_1.ReportPlus.reportWithInfo:type_name -> loop.internal.pb.ocr3_1.ReportWithInfo 29, // 12: loop.internal.pb.ocr3_1.ReportPlus.transmissionScheduleOverride:type_name -> loop.internal.pb.ocr3_1.TransmissionSchedule diff --git a/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.proto b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.proto index 159949ff85..0e2df8e417 100644 --- a/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.proto +++ b/pkg/loop/internal/pb/ocr3_1/ocr3_1_reporting.proto @@ -158,7 +158,7 @@ message StateTransitionRequest{ string keyValueStateReaderID = 1; uint64 seqNr=2; AttributedQuery query=3; - repeated AttributedObservation observation=4; + repeated AttributedObservation observations=4; } message StateTransitionReply{ From bb881b0419d9efb6f69f2ef0bbd604231391effb Mon Sep 17 00:00:00 2001 From: Matthew Pendrey Date: Wed, 14 Jan 2026 10:40:07 +0000 Subject: [PATCH 3/4] client --- .../reportingplugin/ocr3_1/reporting.go | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go index a319b4dbbb..3f0e4ac6eb 100644 --- a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go @@ -34,7 +34,7 @@ func NewReportingPluginFactoryClient(b *net.BrokerExt, cc grpc.ClientConnInterfa return &reportingPluginFactoryClient{b, goplugin.NewServiceClient(b, cc), ocr3.NewReportingPluginFactoryClient(cc)} } -func (r *reportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, config ocr3types.ReportingPluginConfig) (ocr3_1types.ReportingPlugin[[]byte], ocr3types.ReportingPluginInfo, error) { +func (r *reportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, config ocr3types.ReportingPluginConfig) (ocr3_1types.ReportingPlugin[[]byte], ocr3_1types.ReportingPluginInfo, error) { reply, err := r.grpc.NewReportingPlugin(ctx, &ocr3.NewReportingPluginRequest{ReportingPluginConfig: &ocr3.ReportingPluginConfig{ ConfigDigest: config.ConfigDigest[:], OracleID: uint32(config.OracleID), @@ -49,7 +49,7 @@ func (r *reportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, c MaxDurationShouldAcceptAttestedReport: int64(config.MaxDurationShouldAcceptAttestedReport), }}) if err != nil { - return nil, ocr3types.ReportingPluginInfo{}, err + return nil, ocr3_1types.ReportingPluginInfo{}, err } rpi := ocr3_1types.ReportingPluginInfo{ Name: reply.ReportingPluginInfo.Name, @@ -62,7 +62,7 @@ func (r *reportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, c } cc, err := r.BrokerExt.Dial(reply.ReportingPluginID) if err != nil { - return nil, ocr3types.ReportingPluginInfo{}, err + return nil, ocr3_1types.ReportingPluginInfo{}, err } return newReportingPluginClient(r.BrokerExt, cc), rpi, nil } @@ -107,7 +107,7 @@ func (r *reportingPluginFactoryServer) NewReportingPlugin(ctx context.Context, r const name = "OCR3_1ReportingPlugin" id, _, err := r.ServeNew(name, func(s *grpc.Server) { - ocr3.RegisterReportingPluginServer(s, &reportingPluginServer{impl: rp}) + ocr3_1.RegisterReportingPluginServer(s, &reportingPluginServer{impl: rp}) }, net.Resource{Closer: rp, Name: name}) if err != nil { return nil, err @@ -325,8 +325,11 @@ func (o *reportingPluginClient) Close() error { } func newReportingPluginClient(b *net.BrokerExt, cc grpc.ClientConnInterface) *reportingPluginClient { - return &reportingPluginClient{b.WithName("OCR3ReportingPluginClient"), ocr3.NewReportingPluginClient(cc), - keyValueReaders: *newKeyValueReaders()} + return &reportingPluginClient{b.WithName("OCR3ReportingPluginClient"), + ocr3_1.NewReportingPluginClient(cc), + newMethodScopedStore[ocr3_1types.KeyValueReader](), + newMethodScopedStore[ocr3_1types.KeyValueReadWriter](), + } } var _ ocr3.ReportingPluginServer = (*reportingPluginServer)(nil) @@ -429,15 +432,6 @@ func (o *reportingPluginServer) Close(ctx context.Context, empty *emptypb.Empty) return &emptypb.Empty{}, o.impl.Close() } -func pbOutcomeContext(oc ocr3types.OutcomeContext) *ocr3.OutcomeContext { - return &ocr3.OutcomeContext{ - SeqNr: oc.SeqNr, - PreviousOutcome: oc.PreviousOutcome, - Epoch: oc.Epoch, //nolint:all - Round: oc.Round, //nolint:all - } -} - func pbAttributedObservation(ao libocr.AttributedObservation) *ocr3.AttributedObservation { return &ocr3.AttributedObservation{ Observation: ao.Observation, From c96937463099ee63160977ae375b228bf12a85f1 Mon Sep 17 00:00:00 2001 From: Matthew Pendrey Date: Wed, 14 Jan 2026 12:03:14 +0000 Subject: [PATCH 4/4] spike wip --- .../core/services/reportingplugin/ocr3_1/reporting.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go index 3f0e4ac6eb..ecd3001c75 100644 --- a/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go +++ b/pkg/loop/internal/core/services/reportingplugin/ocr3_1/reporting.go @@ -332,15 +332,15 @@ func newReportingPluginClient(b *net.BrokerExt, cc grpc.ClientConnInterface) *re } } -var _ ocr3.ReportingPluginServer = (*reportingPluginServer)(nil) +var _ ocr3_1.ReportingPluginServer = (*reportingPluginServer)(nil) type reportingPluginServer struct { ocr3.UnimplementedReportingPluginServer - impl ocr3types.ReportingPlugin[[]byte] + impl ocr3_1types.ReportingPlugin[[]byte] } -func (o *reportingPluginServer) Query(ctx context.Context, request *ocr3.QueryRequest) (*ocr3.QueryReply, error) { +func (o *reportingPluginServer) Query(ctx context.Context, request *ocr3_1.QueryRequest) (*ocr3_1.QueryReply, error) { oc := outcomeContext(request.OutcomeContext) q, err := o.impl.Query(ctx, oc) if err != nil { @@ -378,7 +378,7 @@ func (o *reportingPluginServer) ObservationQuorum(ctx context.Context, request * return &ocr3.ObservationQuorumReply{QuorumReached: oq}, nil } -func (o *reportingPluginServer) Outcome(ctx context.Context, request *ocr3.OutcomeRequest) (*ocr3.OutcomeReply, error) { +func (o *reportingPluginServer) StateTransition(ctx context.Context, request *ocr3.OutcomeRequest) (*ocr3.OutcomeReply, error) { aos, err := attributedObservations(request.Ao) if err != nil { return nil, err