Skip to content

Commit

Permalink
feat(relay): allow specifying queueing topics (#12238)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
roman-kashitsyn authored Mar 7, 2024
1 parent f2f0d7f commit e7f5e83
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/services/relay/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit e7f5e83

Please sign in to comment.