From 491a8d7693becb64b39764edc9205253ad938127 Mon Sep 17 00:00:00 2001 From: simsonraj Date: Mon, 19 Jun 2023 17:42:20 +0530 Subject: [PATCH] removed evm prefix for transmitchecker --- core/chains/evm/txmgr/broadcaster_test.go | 10 +++++----- core/chains/evm/txmgr/transmitchecker.go | 14 +++++++------- core/chains/evm/txmgr/transmitchecker_test.go | 12 ++++++------ core/chains/evm/txmgr/txmgr_test.go | 8 ++++---- core/internal/cltest/factories.go | 2 +- core/services/fluxmonitorv2/delegate.go | 2 +- core/services/fluxmonitorv2/flux_monitor_test.go | 2 +- core/services/fluxmonitorv2/orm.go | 4 ++-- core/services/fluxmonitorv2/orm_test.go | 2 +- core/services/ocr/delegate.go | 2 +- core/services/ocrcommon/transmitter.go | 4 ++-- core/services/ocrcommon/transmitter_pipeline.go | 4 ++-- .../ocrcommon/transmitter_pipeline_test.go | 2 +- core/services/ocrcommon/transmitter_test.go | 8 ++++---- core/services/pipeline/task.eth_tx.go | 4 ++-- core/services/pipeline/task.eth_tx_test.go | 2 +- core/services/relay/evm/evm.go | 4 ++-- core/services/vrf/listener_v2.go | 2 +- 18 files changed, 44 insertions(+), 44 deletions(-) diff --git a/core/chains/evm/txmgr/broadcaster_test.go b/core/chains/evm/txmgr/broadcaster_test.go index 1ed95f2cf8e..a262d91a3c6 100644 --- a/core/chains/evm/txmgr/broadcaster_test.go +++ b/core/chains/evm/txmgr/broadcaster_test.go @@ -159,7 +159,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) { encodedPayload := []byte{1, 2, 3} value := big.Int(assets.NewEthValue(142)) gasLimit := uint32(242) - checker := txmgr.EvmTransmitCheckerSpec{ + checker := txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeSimulate, } @@ -402,7 +402,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) { Value: big.Int(assets.NewEthValue(442)), FeeLimit: gasLimit, Strategy: txmgrcommon.NewSendEveryStrategy(), - Checker: txmgr.EvmTransmitCheckerSpec{ + Checker: txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeSimulate, }, } @@ -503,7 +503,7 @@ func TestEthBroadcaster_TransmitChecking(t *testing.T) { eb, err := NewTestEthBroadcaster(t, txStore, ethClient, ethKeyStore, evmcfg, checkerFactory, false) require.NoError(t, err) - checker := txmgr.EvmTransmitCheckerSpec{ + checker := txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeSimulate, } t.Run("when transmit checking times out, sends tx as normal", func(t *testing.T) { @@ -1870,7 +1870,7 @@ func TestEthBroadcaster_SyncNonce(t *testing.T) { } -func checkerToJson(t *testing.T, checker txmgr.EvmTransmitCheckerSpec) *datatypes.JSON { +func checkerToJson(t *testing.T, checker txmgr.TransmitCheckerSpec) *datatypes.JSON { b, err := json.Marshal(checker) require.NoError(t, err) j := datatypes.JSON(b) @@ -1881,7 +1881,7 @@ type testCheckerFactory struct { err error } -func (t *testCheckerFactory) BuildChecker(spec txmgr.EvmTransmitCheckerSpec) (txmgr.EvmTransmitChecker, error) { +func (t *testCheckerFactory) BuildChecker(spec txmgr.TransmitCheckerSpec) (txmgr.TransmitChecker, error) { return &testChecker{t.err}, nil } diff --git a/core/chains/evm/txmgr/transmitchecker.go b/core/chains/evm/txmgr/transmitchecker.go index 3aba0962008..ad655d23d48 100644 --- a/core/chains/evm/txmgr/transmitchecker.go +++ b/core/chains/evm/txmgr/transmitchecker.go @@ -25,18 +25,18 @@ import ( ) type ( - EvmTransmitChecker = txmgr.TransmitChecker[*big.Int, common.Address, common.Hash, common.Hash, evmtypes.Nonce, gas.EvmFee] - EvmTransmitCheckerSpec = txmgrtypes.TransmitCheckerSpec[common.Address] + TransmitChecker = txmgr.TransmitChecker[*big.Int, common.Address, common.Hash, common.Hash, evmtypes.Nonce, gas.EvmFee] + TransmitCheckerSpec = txmgrtypes.TransmitCheckerSpec[common.Address] ) var ( // NoChecker is a TransmitChecker that always determines a transaction should be submitted. - NoChecker EvmTransmitChecker = noChecker{} + NoChecker TransmitChecker = noChecker{} _ TransmitCheckerFactory = &CheckerFactory{} - _ EvmTransmitChecker = &SimulateChecker{} - _ EvmTransmitChecker = &VRFV1Checker{} - _ EvmTransmitChecker = &VRFV2Checker{} + _ TransmitChecker = &SimulateChecker{} + _ TransmitChecker = &VRFV1Checker{} + _ TransmitChecker = &VRFV2Checker{} ) // CheckerFactory is a real implementation of TransmitCheckerFactory. @@ -45,7 +45,7 @@ type CheckerFactory struct { } // BuildChecker satisfies the TransmitCheckerFactory interface. -func (c *CheckerFactory) BuildChecker(spec EvmTransmitCheckerSpec) (EvmTransmitChecker, error) { +func (c *CheckerFactory) BuildChecker(spec TransmitCheckerSpec) (TransmitChecker, error) { switch spec.CheckerType { case TransmitCheckerTypeSimulate: return &SimulateChecker{c.Client}, nil diff --git a/core/chains/evm/txmgr/transmitchecker_test.go b/core/chains/evm/txmgr/transmitchecker_test.go index b884e7c0fb1..eb5da045c30 100644 --- a/core/chains/evm/txmgr/transmitchecker_test.go +++ b/core/chains/evm/txmgr/transmitchecker_test.go @@ -37,13 +37,13 @@ func TestFactory(t *testing.T) { factory := &txmgr.CheckerFactory{Client: client} t.Run("no checker", func(t *testing.T) { - c, err := factory.BuildChecker(txmgr.EvmTransmitCheckerSpec{}) + c, err := factory.BuildChecker(txmgr.TransmitCheckerSpec{}) require.NoError(t, err) require.Equal(t, txmgr.NoChecker, c) }) t.Run("vrf v1 checker", func(t *testing.T) { - c, err := factory.BuildChecker(txmgr.EvmTransmitCheckerSpec{ + c, err := factory.BuildChecker(txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeVRFV1, VRFCoordinatorAddress: testutils.NewAddressPtr(), }) @@ -52,7 +52,7 @@ func TestFactory(t *testing.T) { }) t.Run("vrf v2 checker", func(t *testing.T) { - c, err := factory.BuildChecker(txmgr.EvmTransmitCheckerSpec{ + c, err := factory.BuildChecker(txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeVRFV2, VRFCoordinatorAddress: testutils.NewAddressPtr(), VRFRequestBlockNumber: big.NewInt(1), @@ -61,7 +61,7 @@ func TestFactory(t *testing.T) { require.IsType(t, &txmgr.VRFV2Checker{}, c) // request block number not provided should error out. - c, err = factory.BuildChecker(txmgr.EvmTransmitCheckerSpec{ + c, err = factory.BuildChecker(txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeVRFV2, VRFCoordinatorAddress: testutils.NewAddressPtr(), }) @@ -70,7 +70,7 @@ func TestFactory(t *testing.T) { }) t.Run("simulate checker", func(t *testing.T) { - c, err := factory.BuildChecker(txmgr.EvmTransmitCheckerSpec{ + c, err := factory.BuildChecker(txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeSimulate, }) require.NoError(t, err) @@ -78,7 +78,7 @@ func TestFactory(t *testing.T) { }) t.Run("invalid checker type", func(t *testing.T) { - _, err := factory.BuildChecker(txmgr.EvmTransmitCheckerSpec{ + _, err := factory.BuildChecker(txmgr.TransmitCheckerSpec{ CheckerType: "invalid", }) require.EqualError(t, err, "unrecognized checker type: invalid") diff --git a/core/chains/evm/txmgr/txmgr_test.go b/core/chains/evm/txmgr/txmgr_test.go index 2a77b070dd2..a15ebbc0342 100644 --- a/core/chains/evm/txmgr/txmgr_test.go +++ b/core/chains/evm/txmgr/txmgr_test.go @@ -220,7 +220,7 @@ func TestTxm_CreateTransaction(t *testing.T) { t.Run("simulate transmit checker", func(t *testing.T) { pgtest.MustExec(t, db, `DELETE FROM eth_txes`) - checker := txmgr.EvmTransmitCheckerSpec{ + checker := txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeSimulate, } evmConfig.maxQueued = uint64(1) @@ -237,7 +237,7 @@ func TestTxm_CreateTransaction(t *testing.T) { var dbEtx txmgr.DbEthTx require.NoError(t, db.Get(&dbEtx, `SELECT * FROM eth_txes ORDER BY id ASC LIMIT 1`)) - var c txmgr.EvmTransmitCheckerSpec + var c txmgr.TransmitCheckerSpec require.NotNil(t, etx.TransmitChecker) require.NoError(t, json.Unmarshal(*etx.TransmitChecker, &c)) require.Equal(t, checker, c) @@ -258,7 +258,7 @@ func TestTxm_CreateTransaction(t *testing.T) { SubID: &testDefaultSubID, } evmConfig.maxQueued = uint64(1) - checker := txmgr.EvmTransmitCheckerSpec{ + checker := txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeVRFV2, VRFCoordinatorAddress: testutils.NewAddressPtr(), } @@ -280,7 +280,7 @@ func TestTxm_CreateTransaction(t *testing.T) { require.NoError(t, err) require.Equal(t, meta, m) - var c txmgr.EvmTransmitCheckerSpec + var c txmgr.TransmitCheckerSpec require.NotNil(t, etx.TransmitChecker) require.NoError(t, json.Unmarshal(*etx.TransmitChecker, &c)) require.Equal(t, checker, c) diff --git a/core/internal/cltest/factories.go b/core/internal/cltest/factories.go index 0b07dce0909..95986611aab 100644 --- a/core/internal/cltest/factories.go +++ b/core/internal/cltest/factories.go @@ -337,7 +337,7 @@ func EvmTxRequestWithStrategy(strategy txmgrtypes.TxStrategy) func(*txmgr.TxRequ } } -func EvmTxRequestWithChecker(checker txmgr.EvmTransmitCheckerSpec) func(*txmgr.TxRequest) { +func EvmTxRequestWithChecker(checker txmgr.TransmitCheckerSpec) func(*txmgr.TxRequest) { return func(tx *txmgr.TxRequest) { tx.Checker = checker } diff --git a/core/services/fluxmonitorv2/delegate.go b/core/services/fluxmonitorv2/delegate.go index 2b5d03c4e70..ba2edf9e0f0 100644 --- a/core/services/fluxmonitorv2/delegate.go +++ b/core/services/fluxmonitorv2/delegate.go @@ -69,7 +69,7 @@ func (d *Delegate) ServicesForSpec(jb job.Job) (services []job.ServiceCtx, err e } cfg := chain.Config() strategy := txmgrcommon.NewQueueingTxStrategy(jb.ExternalJobID, cfg.FluxMonitor().DefaultTransactionQueueDepth(), cfg.Database().DefaultQueryTimeout()) - var checker txmgr.EvmTransmitCheckerSpec + var checker txmgr.TransmitCheckerSpec if chain.Config().FluxMonitor().SimulateTransactions() { checker.CheckerType = txmgr.TransmitCheckerTypeSimulate } diff --git a/core/services/fluxmonitorv2/flux_monitor_test.go b/core/services/fluxmonitorv2/flux_monitor_test.go index 5e0b8171362..923658fef09 100644 --- a/core/services/fluxmonitorv2/flux_monitor_test.go +++ b/core/services/fluxmonitorv2/flux_monitor_test.go @@ -54,7 +54,7 @@ var ( type answerSet struct{ latestAnswer, polledAnswer int64 } func newORM(t *testing.T, db *sqlx.DB, cfg pg.QConfig, txm txmgr.TxManager) fluxmonitorv2.ORM { - return fluxmonitorv2.NewORM(db, logger.TestLogger(t), cfg, txm, txmgrcommon.NewSendEveryStrategy(), txmgr.EvmTransmitCheckerSpec{}) + return fluxmonitorv2.NewORM(db, logger.TestLogger(t), cfg, txm, txmgrcommon.NewSendEveryStrategy(), txmgr.TransmitCheckerSpec{}) } var ( diff --git a/core/services/fluxmonitorv2/orm.go b/core/services/fluxmonitorv2/orm.go index 4990a0a512d..c2f99c8345e 100644 --- a/core/services/fluxmonitorv2/orm.go +++ b/core/services/fluxmonitorv2/orm.go @@ -34,12 +34,12 @@ type orm struct { q pg.Q txm transmitter strategy types.TxStrategy - checker txmgr.EvmTransmitCheckerSpec + checker txmgr.TransmitCheckerSpec logger logger.Logger } // NewORM initializes a new ORM -func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig, txm transmitter, strategy types.TxStrategy, checker txmgr.EvmTransmitCheckerSpec) ORM { +func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig, txm transmitter, strategy types.TxStrategy, checker txmgr.TransmitCheckerSpec) ORM { namedLogger := lggr.Named("FluxMonitorORM") q := pg.NewQ(db, namedLogger, cfg) return &orm{ diff --git a/core/services/fluxmonitorv2/orm_test.go b/core/services/fluxmonitorv2/orm_test.go index 40a4d1c5dc1..90b5c5a4308 100644 --- a/core/services/fluxmonitorv2/orm_test.go +++ b/core/services/fluxmonitorv2/orm_test.go @@ -175,7 +175,7 @@ func TestORM_CreateEthTransaction(t *testing.T) { var ( txm = txmmocks.NewMockEvmTxManager(t) - orm = fluxmonitorv2.NewORM(db, logger.TestLogger(t), cfg, txm, strategy, txmgr.EvmTransmitCheckerSpec{}) + orm = fluxmonitorv2.NewORM(db, logger.TestLogger(t), cfg, txm, strategy, txmgr.TransmitCheckerSpec{}) _, from = cltest.MustInsertRandomKey(t, ethKeyStore, 0) to = testutils.NewAddress() diff --git a/core/services/ocr/delegate.go b/core/services/ocr/delegate.go index f7f594b20d9..f64acb659cb 100644 --- a/core/services/ocr/delegate.go +++ b/core/services/ocr/delegate.go @@ -222,7 +222,7 @@ func (d *Delegate) ServicesForSpec(jb job.Job) (services []job.ServiceCtx, err e cfg := chain.Config() strategy := txmgrcommon.NewQueueingTxStrategy(jb.ExternalJobID, cfg.OCR().DefaultTransactionQueueDepth(), cfg.Database().DefaultQueryTimeout()) - var checker txmgr.EvmTransmitCheckerSpec + var checker txmgr.TransmitCheckerSpec if chain.Config().OCR().SimulateTransactions() { checker.CheckerType = txmgr.TransmitCheckerTypeSimulate } diff --git a/core/services/ocrcommon/transmitter.go b/core/services/ocrcommon/transmitter.go index 8b7433f59a4..24e985048f0 100644 --- a/core/services/ocrcommon/transmitter.go +++ b/core/services/ocrcommon/transmitter.go @@ -31,7 +31,7 @@ type transmitter struct { gasLimit uint32 effectiveTransmitterAddress common.Address strategy types.TxStrategy - checker txmgr.EvmTransmitCheckerSpec + checker txmgr.TransmitCheckerSpec chainID *big.Int keystore roundRobinKeystore } @@ -43,7 +43,7 @@ func NewTransmitter( gasLimit uint32, effectiveTransmitterAddress common.Address, strategy types.TxStrategy, - checker txmgr.EvmTransmitCheckerSpec, + checker txmgr.TransmitCheckerSpec, chainID *big.Int, keystore roundRobinKeystore, ) (Transmitter, error) { diff --git a/core/services/ocrcommon/transmitter_pipeline.go b/core/services/ocrcommon/transmitter_pipeline.go index e870737638b..23b672a5e32 100644 --- a/core/services/ocrcommon/transmitter_pipeline.go +++ b/core/services/ocrcommon/transmitter_pipeline.go @@ -33,7 +33,7 @@ type pipelineTransmitter struct { gasLimit uint32 effectiveTransmitterAddress common.Address strategy types.TxStrategy - checker txmgr.EvmTransmitCheckerSpec + checker txmgr.TransmitCheckerSpec pr pipeline.Runner spec job.Job chainID string @@ -46,7 +46,7 @@ func NewPipelineTransmitter( gasLimit uint32, effectiveTransmitterAddress common.Address, strategy types.TxStrategy, - checker txmgr.EvmTransmitCheckerSpec, + checker txmgr.TransmitCheckerSpec, pr pipeline.Runner, spec job.Job, chainID string, diff --git a/core/services/ocrcommon/transmitter_pipeline_test.go b/core/services/ocrcommon/transmitter_pipeline_test.go index 6cad12b8be9..84294a1dde6 100644 --- a/core/services/ocrcommon/transmitter_pipeline_test.go +++ b/core/services/ocrcommon/transmitter_pipeline_test.go @@ -34,7 +34,7 @@ func Test_PipelineTransmitter_CreateEthTransaction(t *testing.T) { toAddress := testutils.NewAddress() payload := []byte{1, 2, 3} strategy := newMockTxStrategy(t) - checker := txmgr.EvmTransmitCheckerSpec{CheckerType: txmgr.TransmitCheckerTypeSimulate} + checker := txmgr.TransmitCheckerSpec{CheckerType: txmgr.TransmitCheckerTypeSimulate} runner := pipelinemocks.NewRunner(t) transmitter := ocrcommon.NewPipelineTransmitter( diff --git a/core/services/ocrcommon/transmitter_test.go b/core/services/ocrcommon/transmitter_test.go index f278ba5b8df..65a5f382830 100644 --- a/core/services/ocrcommon/transmitter_test.go +++ b/core/services/ocrcommon/transmitter_test.go @@ -45,7 +45,7 @@ func Test_DefaultTransmitter_CreateEthTransaction(t *testing.T) { gasLimit, effectiveTransmitterAddress, strategy, - txmgr.EvmTransmitCheckerSpec{}, + txmgr.TransmitCheckerSpec{}, chainID, ethKeyStore, ) @@ -87,7 +87,7 @@ func Test_DefaultTransmitter_Forwarding_Enabled_CreateEthTransaction(t *testing. gasLimit, effectiveTransmitterAddress, strategy, - txmgr.EvmTransmitCheckerSpec{}, + txmgr.TransmitCheckerSpec{}, chainID, ethKeyStore, ) @@ -138,7 +138,7 @@ func Test_DefaultTransmitter_Forwarding_Enabled_CreateEthTransaction_Round_Robin gasLimit, effectiveTransmitterAddress, strategy, - txmgr.EvmTransmitCheckerSpec{}, + txmgr.TransmitCheckerSpec{}, chainID, ethKeyStore, ) @@ -168,7 +168,7 @@ func Test_DefaultTransmitter_Forwarding_Enabled_CreateEthTransaction_No_Keystore gasLimit, effectiveTransmitterAddress, strategy, - txmgr.EvmTransmitCheckerSpec{}, + txmgr.TransmitCheckerSpec{}, chainID, nil, ) diff --git a/core/services/pipeline/task.eth_tx.go b/core/services/pipeline/task.eth_tx.go index f8fcb9e5f87..c0585b5448d 100644 --- a/core/services/pipeline/task.eth_tx.go +++ b/core/services/pipeline/task.eth_tx.go @@ -199,8 +199,8 @@ func decodeMeta(metaMap MapParam) (*txmgr.TxMeta, error) { return &txMeta, nil } -func decodeTransmitChecker(checkerMap MapParam) (txmgr.EvmTransmitCheckerSpec, error) { - var transmitChecker txmgr.EvmTransmitCheckerSpec +func decodeTransmitChecker(checkerMap MapParam) (txmgr.TransmitCheckerSpec, error) { + var transmitChecker txmgr.TransmitCheckerSpec checkerDecoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ Result: &transmitChecker, ErrorUnused: true, diff --git a/core/services/pipeline/task.eth_tx_test.go b/core/services/pipeline/task.eth_tx_test.go index 8bfdb2bc4e9..0afd008d88e 100644 --- a/core/services/pipeline/task.eth_tx_test.go +++ b/core/services/pipeline/task.eth_tx_test.go @@ -89,7 +89,7 @@ func TestETHTxTask(t *testing.T) { FeeLimit: gasLimit, Meta: txMeta, Strategy: txmgrcommon.NewSendEveryStrategy(), - Checker: txmgr.EvmTransmitCheckerSpec{ + Checker: txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeVRFV2, VRFCoordinatorAddress: &addr, }, diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 679960821b3..9b8e21ced35 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -337,7 +337,7 @@ func newContractTransmitter(lggr logger.Logger, rargs relaytypes.RelayArgs, tran scoped := configWatcher.chain.Config() strategy := txmgrcommon.NewQueueingTxStrategy(rargs.ExternalJobID, scoped.OCR2().DefaultTransactionQueueDepth(), scoped.Database().DefaultQueryTimeout()) - var checker txm.EvmTransmitCheckerSpec + var checker txm.TransmitCheckerSpec if configWatcher.chain.Config().OCR2().SimulateTransactions() { checker.CheckerType = txm.TransmitCheckerTypeSimulate } @@ -388,7 +388,7 @@ func newPipelineContractTransmitter(lggr logger.Logger, rargs relaytypes.RelayAr scoped := configWatcher.chain.Config() strategy := txmgrcommon.NewQueueingTxStrategy(rargs.ExternalJobID, scoped.OCR2().DefaultTransactionQueueDepth(), scoped.Database().DefaultQueryTimeout()) - var checker txm.EvmTransmitCheckerSpec + var checker txm.TransmitCheckerSpec if configWatcher.chain.Config().OCR2().SimulateTransactions() { checker.CheckerType = txm.TransmitCheckerTypeSimulate } diff --git a/core/services/vrf/listener_v2.go b/core/services/vrf/listener_v2.go index fa219b06f40..411f1c9dc5e 100644 --- a/core/services/vrf/listener_v2.go +++ b/core/services/vrf/listener_v2.go @@ -980,7 +980,7 @@ func (lsn *listenerV2) processRequestsPerSub( RequestTxHash: &p.req.req.Raw.TxHash, }, Strategy: txmgrcommon.NewSendEveryStrategy(), - Checker: txmgr.EvmTransmitCheckerSpec{ + Checker: txmgr.TransmitCheckerSpec{ CheckerType: txmgr.TransmitCheckerTypeVRFV2, VRFCoordinatorAddress: &coordinatorAddress, VRFRequestBlockNumber: new(big.Int).SetUint64(p.req.req.Raw.BlockNumber),