Skip to content

Commit

Permalink
Implement feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
george-dorin committed Nov 27, 2024
1 parent 2dd6da0 commit 71170dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
5 changes: 0 additions & 5 deletions core/services/job/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
17 changes: 3 additions & 14 deletions core/services/relay/evm/dual_contract_transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
errors2 "errors"
"fmt"
"strings"
"sync"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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() }

0 comments on commit 71170dc

Please sign in to comment.