Skip to content

Commit

Permalink
Pass the configWatcher as a parameter to indicate that its required
Browse files Browse the repository at this point in the history
  • Loading branch information
ferglor committed Dec 11, 2023
1 parent c12cab2 commit 785faa6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions core/services/relay/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,11 @@ func newConfigProvider(lggr logger.Logger, chain legacyevm.Chain, opts *types.Re
}

type configTransmitterOpts struct {
configWatcher *configWatcher
// override the gas limit default provided in the config watcher
pluginGasLimit *uint32
}

func newContractTransmitter(lggr logger.Logger, rargs commontypes.RelayArgs, transmitterID string, ethKeystore keystore.Eth, opts configTransmitterOpts) (*contractTransmitter, error) {
func newContractTransmitter(lggr logger.Logger, rargs commontypes.RelayArgs, transmitterID string, ethKeystore keystore.Eth, configWatcher *configWatcher, opts configTransmitterOpts) (*contractTransmitter, error) {
var relayConfig types.RelayConfig
if err := json.Unmarshal(rargs.RelayConfig, &relayConfig); err != nil {
return nil, err
Expand All @@ -394,8 +393,6 @@ func newContractTransmitter(lggr logger.Logger, rargs commontypes.RelayArgs, tra
return nil, pkgerrors.New("no sending keys provided")
}

configWatcher := opts.configWatcher

// If we are using multiple sending keys, then a forwarder is needed to rotate transmissions.
// Ensure that this forwarder is not set to a local sending key, and ensure our sending keys are enabled.
for _, s := range sendingKeys {
Expand Down Expand Up @@ -473,7 +470,7 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp
}

reportCodec := evmreportcodec.ReportCodec{}
contractTransmitter, err := newContractTransmitter(lggr, rargs, pargs.TransmitterID, r.ks.Eth(), configTransmitterOpts{configWatcher: configWatcher})
contractTransmitter, err := newContractTransmitter(lggr, rargs, pargs.TransmitterID, r.ks.Eth(), configWatcher, configTransmitterOpts{})
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/ocr2keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (r *ocr2keeperRelayer) NewOCR2KeeperProvider(rargs commontypes.RelayArgs, p
}

gasLimit := cfgWatcher.chain.Config().EVM().OCR2().Automation().GasLimit()
contractTransmitter, err := newContractTransmitter(r.lggr, rargs, pargs.TransmitterID, r.ethKeystore, configTransmitterOpts{configWatcher: cfgWatcher, pluginGasLimit: &gasLimit})
contractTransmitter, err := newContractTransmitter(r.lggr, rargs, pargs.TransmitterID, r.ethKeystore, cfgWatcher, configTransmitterOpts{pluginGasLimit: &gasLimit})
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions core/services/relay/evm/ocr2vrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (r *ocr2vrfRelayer) NewDKGProvider(rargs commontypes.RelayArgs, pargs commo
if err != nil {
return nil, err
}
contractTransmitter, err := newContractTransmitter(r.lggr, rargs, pargs.TransmitterID, r.ethKeystore, configTransmitterOpts{configWatcher: configWatcher})
contractTransmitter, err := newContractTransmitter(r.lggr, rargs, pargs.TransmitterID, r.ethKeystore, configWatcher, configTransmitterOpts{})
if err != nil {
return nil, err
}
Expand All @@ -90,7 +90,7 @@ func (r *ocr2vrfRelayer) NewOCR2VRFProvider(rargs commontypes.RelayArgs, pargs c
if err != nil {
return nil, err
}
contractTransmitter, err := newContractTransmitter(r.lggr, rargs, pargs.TransmitterID, r.ethKeystore, configTransmitterOpts{configWatcher: configWatcher})
contractTransmitter, err := newContractTransmitter(r.lggr, rargs, pargs.TransmitterID, r.ethKeystore, configWatcher, configTransmitterOpts{})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 785faa6

Please sign in to comment.