Skip to content

Commit

Permalink
offchain - explicit initialisations (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkouv authored Oct 18, 2023
1 parent 10433af commit c337d1f
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 3 deletions.
4 changes: 4 additions & 0 deletions core/services/ocr2/plugins/ccip/commit_reporting_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ func NewCommitReportingPluginFactory(config CommitPluginStaticConfig) *CommitRep
return &CommitReportingPluginFactory{
config: config,
readersMu: &sync.Mutex{},

// the fields below are initially empty and populated on demand
destPriceRegReader: nil,
destPriceRegAddr: common.Address{},
}
}

Expand Down
4 changes: 4 additions & 0 deletions core/services/ocr2/plugins/ccip/execution_reporting_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func NewExecutionReportingPluginFactory(config ExecutionPluginStaticConfig) *Exe
return &ExecutionReportingPluginFactory{
config: config,
readersMu: &sync.Mutex{},

// the fields below are initially empty and populated on demand
destPriceRegReader: nil,
destPriceRegAddr: common.Address{},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,5 +352,10 @@ func NewCommitStoreV1_0_0(lggr logger.Logger, addr common.Address, ec client.Cli
reportAcceptedSig: eventSig,
// offset || priceUpdatesOffset || minSeqNum || maxSeqNum || merkleRoot
reportAcceptedMaxSeqIndex: 3,
configMu: sync.RWMutex{},

// The fields below are initially empty and set on ChangeConfig method
offchainConfig: CommitOffchainConfig{},
gasPriceEstimator: prices.ExecGasPriceEstimator{},
}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -377,5 +377,10 @@ func NewCommitStoreV1_2_0(lggr logger.Logger, addr common.Address, ec client.Cli
reportAcceptedSig: eventSig,
// offset || priceUpdatesOffset || minSeqNum || maxSeqNum || merkleRoot
reportAcceptedMaxSeqIndex: 3,
configMu: sync.RWMutex{},

// The fields below are initially empty and set on ChangeConfig method
offchainConfig: CommitOffchainConfig{},
gasPriceEstimator: prices.DAGasPriceEstimator{},
}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ type LogPollerReader struct {

func NewLogPollerReader(lp logpoller.LogPoller, lggr logger.Logger, client evmclient.Client) *LogPollerReader {
return &LogPollerReader{
lp: lp,
lggr: lggr,
client: client,
lp: lp,
lggr: lggr,
client: client,
dependencyCache: sync.Map{},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,5 +368,11 @@ func NewOffRampV1_0_0(lggr logger.Logger, addr common.Address, ec client.Client,
executionReportArgs: executionReportArgs,
eventSig: ExecutionStateChangedEventV1_0_0,
eventIndex: executionStateChangedSequenceNumberIndex,
configMu: sync.RWMutex{},

// values set on the fly after ChangeConfig is called
gasPriceEstimator: prices.ExecGasPriceEstimator{},
offchainConfig: ExecOffchainConfig{},
onchainConfig: ExecOnchainConfig{},
}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,11 @@ func NewOffRampV1_2_0(lggr logger.Logger, addr common.Address, ec client.Client,
OffRampV1_0_0: v100,
offRamp: offRamp,
executionReportArgs: executionReportArgs,
configMu: sync.RWMutex{},

// values set on the fly after ChangeConfig is called
gasPriceEstimator: prices.ExecGasPriceEstimator{},
offchainConfig: ExecOffchainConfig{},
onchainConfig: ExecOnchainConfig{},
}, nil
}

0 comments on commit c337d1f

Please sign in to comment.