From 3bd32a3038af5028d8b85dd645c3802f8df95b3b Mon Sep 17 00:00:00 2001 From: george-dorin Date: Wed, 27 Nov 2024 18:25:17 +0200 Subject: [PATCH] Implement feedback --- core/services/job/orm.go | 5 ----- .../relay/evm/dual_contract_transmitter.go | 17 +++-------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/core/services/job/orm.go b/core/services/job/orm.go index 7679b1f0860..5e8b5ce127f 100644 --- a/core/services/job/orm.go +++ b/core/services/job/orm.go @@ -324,11 +324,6 @@ func (o *orm) CreateJob(ctx context.Context, jb *Job) error { return errors.New("invalid transmitter address in dual transmission config") } - _, ok = dualTransmissionConfig["meta"].(map[string][]string) - if !ok || !common.IsHexAddress(dtTransmitterAddress) { - return errors.New("invalid dual transmission config") - } - if err = validateKeyStoreMatchForRelay(ctx, jb.OCR2OracleSpec.Relay, tx.keyStore, dtTransmitterAddress); err != nil { return errors.Wrap(err, "unknown dual transmission transmitterAddress") } diff --git a/core/services/relay/evm/dual_contract_transmitter.go b/core/services/relay/evm/dual_contract_transmitter.go index ba84475ba7f..645a8b6c3e1 100644 --- a/core/services/relay/evm/dual_contract_transmitter.go +++ b/core/services/relay/evm/dual_contract_transmitter.go @@ -7,6 +7,7 @@ import ( errors2 "errors" "fmt" "strings" + "sync" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" @@ -24,8 +25,6 @@ import ( // TODO: Remove when new dual transmitter contracts are merged var dtABI = `[{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"report","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmitSecondary","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -var _ ContractTransmitter = &dualContractTransmitter{} - type dualContractTransmitter struct { contractAddress gethcommon.Address contractABI abi.ABI @@ -39,13 +38,13 @@ type dualContractTransmitter struct { transmitterOptions *transmitterOps } -func dualTransmissionABI() abi.ABI { +var dualTransmissionABI = sync.OnceValue(func() abi.ABI { dualTransmissionABI, err := abi.JSON(strings.NewReader(dtABI)) if err != nil { panic(fmt.Errorf("failed to parse dualTransmission ABI: %w", err)) } return dualTransmissionABI -} +}) func NewOCRDualContractTransmitter( ctx context.Context, @@ -169,13 +168,3 @@ func (oc *dualContractTransmitter) LatestConfigDigestAndEpoch(ctx context.Contex func (oc *dualContractTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { return ocrtypes.Account(oc.transmitter.FromAddress(ctx).String()), nil } - -func (oc *dualContractTransmitter) Start(ctx context.Context) error { return nil } -func (oc *dualContractTransmitter) Close() error { return nil } - -// Has no state/lifecycle so it's always healthy and ready -func (oc *dualContractTransmitter) Ready() error { return nil } -func (oc *dualContractTransmitter) HealthReport() map[string]error { - return map[string]error{oc.Name(): nil} -} -func (oc *dualContractTransmitter) Name() string { return oc.lggr.Name() }