diff --git a/pkg/loop/internal/relayer.go b/pkg/loop/internal/relayer.go index 62214ef9fa..c0287ef875 100644 --- a/pkg/loop/internal/relayer.go +++ b/pkg/loop/internal/relayer.go @@ -448,11 +448,14 @@ func healthReport(s map[string]string) (hr map[string]error) { return hr } -// RegisterStandAloneProvider register the servers needed for a plugin provider, +// RegisterStandAloneMedianProvider register the servers needed for a median plugin provider, // this is a workaround to test the Node API on EVM until the EVM relayer is loopifyed -func RegisterStandAloneProvider(s *grpc.Server, p types.PluginProvider) { +func RegisterStandAloneMedianProvider(s *grpc.Server, p types.MedianProvider) { pb.RegisterServiceServer(s, &serviceServer{srv: p}) pb.RegisterOffchainConfigDigesterServer(s, &offchainConfigDigesterServer{impl: p.OffchainConfigDigester()}) pb.RegisterContractConfigTrackerServer(s, &contractConfigTrackerServer{impl: p.ContractConfigTracker()}) pb.RegisterContractTransmitterServer(s, &contractTransmitterServer{impl: p.ContractTransmitter()}) + pb.RegisterReportCodecServer(s, &reportCodecServer{impl: p.ReportCodec()}) + pb.RegisterMedianContractServer(s, &medianContractServer{impl: p.MedianContract()}) + pb.RegisterOnchainConfigCodecServer(s, &onchainConfigCodecServer{impl: p.OnchainConfigCodec()}) } diff --git a/pkg/loop/provider.go b/pkg/loop/provider.go index ac2fafb65a..053211d13f 100644 --- a/pkg/loop/provider.go +++ b/pkg/loop/provider.go @@ -1,6 +1,9 @@ package loop import ( + "errors" + "fmt" + "google.golang.org/grpc" "github.com/smartcontractkit/chainlink-relay/pkg/loop/internal" @@ -9,6 +12,16 @@ import ( // RegisterStandAloneProvider register the servers needed for a plugin provider, // this is a workaround to test the Node API on EVM until the EVM relayer is loopifyed -func RegisterStandAloneProvider(s *grpc.Server, p types.PluginProvider) { - internal.RegisterStandAloneProvider(s, p) +func RegisterStandAloneProvider(s *grpc.Server, p types.PluginProvider, pType types.OCR2PluginType) error { + switch pType { + case types.Median: + mp, ok := p.(types.MedianProvider) + if !ok { + return errors.New(fmt.Sprintf("expected median provider got %t", p)) + } + internal.RegisterStandAloneMedianProvider(s, mp) + return nil + default: + return errors.New(fmt.Sprintf("stand alone provider only supports median, got %q", pType)) + } }