Skip to content

Commit

Permalink
Update to only support median provider
Browse files Browse the repository at this point in the history
  • Loading branch information
george-dorin committed Nov 8, 2023
1 parent b78c09b commit 248d6d3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pkg/loop/internal/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()})
}
17 changes: 15 additions & 2 deletions pkg/loop/provider.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package loop

import (
"errors"
"fmt"

"google.golang.org/grpc"

"github.com/smartcontractkit/chainlink-relay/pkg/loop/internal"
Expand All @@ -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))
}
}

0 comments on commit 248d6d3

Please sign in to comment.