From e7f5e832787213e03006d931b9d38d8260638b45 Mon Sep 17 00:00:00 2001 From: Roman Kashitsyn Date: Thu, 7 Mar 2024 10:43:56 +0100 Subject: [PATCH] feat(relay): allow specifying queueing topics (#12238) * feat(relay): allow specifying queueing topics This change makes it possible to specify custom topic when calling newOnChainContractTransmitter. The use case is to be able to specify one topic per chain in CCIP. * use opts to pass the subjectID --- core/services/relay/evm/evm.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 94d971b61e0..3797e6633a6 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" + "github.com/google/uuid" "github.com/jmoiron/sqlx" pkgerrors "github.com/pkg/errors" "golang.org/x/exp/maps" @@ -454,10 +455,13 @@ func (c *configWatcher) ContractConfigTracker() ocrtypes.ContractConfigTracker { } type configTransmitterOpts struct { - // override the gas limit default provided in the config watcher + // pluginGasLimit overrides the gas limit default provided in the config watcher. pluginGasLimit *uint32 + // subjectID overrides the queueing subject id (the job external id will be used by default). + subjectID *uuid.UUID } +// newOnChainContractTransmitter creates a new contract transmitter. func newOnChainContractTransmitter(ctx context.Context, lggr logger.Logger, rargs commontypes.RelayArgs, transmitterID string, ethKeystore keystore.Eth, configWatcher *configWatcher, opts configTransmitterOpts, transmissionContractABI abi.ABI) (*contractTransmitter, error) { var relayConfig types.RelayConfig if err := json.Unmarshal(rargs.RelayConfig, &relayConfig); err != nil { @@ -487,8 +491,12 @@ func newOnChainContractTransmitter(ctx context.Context, lggr logger.Logger, rarg fromAddresses = append(fromAddresses, common.HexToAddress(s)) } + subject := rargs.ExternalJobID + if opts.subjectID != nil { + subject = *opts.subjectID + } scoped := configWatcher.chain.Config() - strategy := txmgrcommon.NewQueueingTxStrategy(rargs.ExternalJobID, scoped.OCR2().DefaultTransactionQueueDepth(), scoped.Database().DefaultQueryTimeout()) + strategy := txmgrcommon.NewQueueingTxStrategy(subject, scoped.OCR2().DefaultTransactionQueueDepth(), scoped.Database().DefaultQueryTimeout()) var checker txm.TransmitCheckerSpec if configWatcher.chain.Config().OCR2().SimulateTransactions() {