Skip to content

Commit

Permalink
Compatibility with chainlink
Browse files Browse the repository at this point in the history
  • Loading branch information
winder committed Dec 18, 2024
1 parent 4b15bd3 commit c4e2208
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions commit/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ func (p *PluginFactory) NewReportingPlugin(ctx context.Context, config ocr3types
if err1 != nil {
return nil, ocr3types.ReportingPluginInfo{}, fmt.Errorf("failed to get chain id from selector: %w", err1)
}
readers[chain] = contractreader.NewObserverReader(
contractreader.NewExtendedContractReader(cr), lggr, chainID)
readers[chain] = contractreader.NewExtendedContractReader(
contractreader.NewObserverReader(cr, lggr, chainID))
}

// Bind the RMNHome contract
Expand Down
4 changes: 2 additions & 2 deletions execute/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ func (p PluginFactory) NewReportingPlugin(
if err1 != nil {
return nil, ocr3types.ReportingPluginInfo{}, fmt.Errorf("failed to get chain id from selector: %w", err1)
}
readers[chain] = contractreader.NewObserverReader(
contractreader.NewExtendedContractReader(cr), lggr, chainID)
readers[chain] = contractreader.NewExtendedContractReader(
contractreader.NewObserverReader(cr, lggr, chainID))
}

ccipReader := readerpkg.NewCCIPChainReader(
Expand Down
4 changes: 2 additions & 2 deletions internal/reader/home_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type homeChainPoller struct {
wg sync.WaitGroup
stopCh services.StopChan
sync services.StateMachine
homeChainReader contractreader.Extended
homeChainReader contractreader.ContractReaderFacade
lggr logger.Logger
mutex *sync.RWMutex
state state
Expand All @@ -68,7 +68,7 @@ type homeChainPoller struct {
const MaxFailedPolls = 10

func NewHomeChainConfigPoller(
homeChainReader contractreader.Extended,
homeChainReader contractreader.ContractReaderFacade,
lggr logger.Logger,
pollingInterval time.Duration,
ccipConfigBoundContract types.BoundContract,
Expand Down
10 changes: 5 additions & 5 deletions pkg/contractreader/observed.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var (
)

type Observed struct {
Extended
ContractReaderFacade
lggr logger.Logger
chainID string

Expand All @@ -75,12 +75,12 @@ type Observed struct {
}

func NewObserverReader(
cr Extended,
cr ContractReaderFacade,
lggr logger.Logger,
chainID string,
) *Observed {
return &Observed{
Extended: cr,
ContractReaderFacade: cr,
lggr: lggr,
chainID: chainID,
directRequestsDurations: CrDirectRequestsDurations,
Expand All @@ -97,7 +97,7 @@ func (o *Observed) GetLatestValue(
params, returnVal any,
) error {
start := time.Now()
err := o.Extended.GetLatestValue(ctx, readIdentifier, confidenceLevel, params, returnVal)
err := o.ContractReaderFacade.GetLatestValue(ctx, readIdentifier, confidenceLevel, params, returnVal)
duration := time.Since(start)

contract, function := unpackReadIdentifier(readIdentifier)
Expand All @@ -121,7 +121,7 @@ func (o *Observed) BatchGetLatestValues(
request types.BatchGetLatestValuesRequest,
) (types.BatchGetLatestValuesResult, error) {
start := time.Now()
result, err := o.Extended.BatchGetLatestValues(ctx, request)
result, err := o.ContractReaderFacade.BatchGetLatestValues(ctx, request)
duration := time.Since(start)

o.batchRequestsDurations.
Expand Down
2 changes: 1 addition & 1 deletion pkg/reader/home_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type OCR3Config = reader_internal.OCR3Config
type OCR3Node = reader_internal.OCR3Node

func NewObservedHomeChainReader(
homeChainReader contractreader.Extended,
homeChainReader contractreader.ContractReaderFacade,
lggr logger.Logger,
pollingInterval time.Duration,
ccipConfigBoundContract types.BoundContract,
Expand Down

0 comments on commit c4e2208

Please sign in to comment.