From 969f50aeef57d848148e0dbd65aba46af3c736a4 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Mon, 27 Nov 2023 10:29:27 -0500 Subject: [PATCH] update cltest --- core/chains/evm/txmgr/evm_tx_store_test.go | 18 +++++++----------- core/chains/evm/txmgr/tracker_test.go | 10 +++++----- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/core/chains/evm/txmgr/evm_tx_store_test.go b/core/chains/evm/txmgr/evm_tx_store_test.go index ed6a17c0f41..47188468793 100644 --- a/core/chains/evm/txmgr/evm_tx_store_test.go +++ b/core/chains/evm/txmgr/evm_tx_store_test.go @@ -795,7 +795,7 @@ func TestORM_IsTxFinalized(t *testing.T) { t.Run("confirmed tx not past finality_depth", func(t *testing.T) { confirmedAddr := cltest.MustGenerateRandomKey(t).Address - tx := cltest.MustInsertConfirmedEthTxWithReceipt(t, txStore, confirmedAddr, 123, 1) + tx := mustInsertConfirmedEthTxWithReceipt(t, txStore, confirmedAddr, 123, 1) finalized, err := txStore.IsTxFinalized(testutils.Context(t), 2, tx.ID) require.NoError(t, err) require.False(t, finalized) @@ -803,7 +803,7 @@ func TestORM_IsTxFinalized(t *testing.T) { t.Run("confirmed tx past finality_depth", func(t *testing.T) { confirmedAddr := cltest.MustGenerateRandomKey(t).Address - tx := cltest.MustInsertConfirmedEthTxWithReceipt(t, txStore, confirmedAddr, 123, 1) + tx := mustInsertConfirmedEthTxWithReceipt(t, txStore, confirmedAddr, 123, 1) finalized, err := txStore.IsTxFinalized(testutils.Context(t), 10, tx.ID) require.NoError(t, err) require.True(t, finalized) @@ -1406,18 +1406,14 @@ func TestORM_GetNonFatalTransactions(t *testing.T) { }) t.Run("get in progress, unstarted, and unconfirmed eth transactions", func(t *testing.T) { - inProgressTx := cltest.MustInsertInProgressEthTxWithAttempt(t, txStore, 123, fromAddress) - unconfirmedTx := cltest.MustInsertUnconfirmedEthTx(t, txStore, 124, fromAddress) - unstartedTx := cltest.MustCreateUnstartedGeneratedTx(t, txStore, fromAddress, ethClient.ConfiguredChainID()) + inProgressTx := mustInsertInProgressEthTxWithAttempt(t, txStore, 123, fromAddress) + unstartedTx := mustCreateUnstartedGeneratedTx(t, txStore, fromAddress, ethClient.ConfiguredChainID()) txes, err := txStore.GetNonFatalTransactions(testutils.Context(t)) require.NoError(t, err) for _, tx := range txes { - require.True(t, - tx.ID == inProgressTx.ID || - tx.ID == unconfirmedTx.ID || - tx.ID == unstartedTx.ID) + require.True(t, tx.ID == inProgressTx.ID || tx.ID == unstartedTx.ID) } }) } @@ -1438,7 +1434,7 @@ func TestORM_GetTxByID(t *testing.T) { }) t.Run("get transaction by ID", func(t *testing.T) { - insertedTx := cltest.MustInsertInProgressEthTxWithAttempt(t, txStore, 123, fromAddress) + insertedTx := mustInsertInProgressEthTxWithAttempt(t, txStore, 123, fromAddress) tx, err := txStore.GetTxByID(testutils.Context(t), insertedTx.ID) require.NoError(t, err) require.NotNil(t, tx) @@ -1461,7 +1457,7 @@ func TestORM_GetFatalTransactions(t *testing.T) { }) t.Run("get fatal transactions", func(t *testing.T) { - fatalTx := cltest.MustInsertFatalErrorEthTx(t, txStore, fromAddress) + fatalTx := mustInsertFatalErrorEthTx(t, txStore, fromAddress) txes, err := txStore.GetFatalTransactions(testutils.Context(t)) require.NoError(t, err) require.Equal(t, txes[0].ID, fatalTx.ID) diff --git a/core/chains/evm/txmgr/tracker_test.go b/core/chains/evm/txmgr/tracker_test.go index 185ec3e255b..0daafbff080 100644 --- a/core/chains/evm/txmgr/tracker_test.go +++ b/core/chains/evm/txmgr/tracker_test.go @@ -71,9 +71,9 @@ func TestEthTracker_AddressTracking(t *testing.T) { inProgressAddr := cltest.MustGenerateRandomKey(t).Address unconfirmedAddr := cltest.MustGenerateRandomKey(t).Address confirmedAddr := cltest.MustGenerateRandomKey(t).Address - _ = cltest.MustInsertInProgressEthTxWithAttempt(t, txStore, 123, inProgressAddr) + _ = mustInsertInProgressEthTxWithAttempt(t, txStore, 123, inProgressAddr) _ = cltest.MustInsertUnconfirmedEthTx(t, txStore, 123, unconfirmedAddr) - _ = cltest.MustInsertConfirmedEthTxWithReceipt(t, txStore, confirmedAddr, 123, 1) + _ = mustInsertConfirmedEthTxWithReceipt(t, txStore, confirmedAddr, 123, 1) err := tracker.Start(context.Background()) require.NoError(t, err) @@ -91,7 +91,7 @@ func TestEthTracker_AddressTracking(t *testing.T) { t.Run("stop tracking finalized tx", func(t *testing.T) { tracker, txStore, _, _ := newTestEvmTrackerSetup(t) confirmedAddr := cltest.MustGenerateRandomKey(t).Address - _ = cltest.MustInsertConfirmedEthTxWithReceipt(t, txStore, confirmedAddr, 123, 1) + _ = mustInsertConfirmedEthTxWithReceipt(t, txStore, confirmedAddr, 123, 1) err := tracker.Start(context.Background()) require.NoError(t, err) @@ -118,7 +118,7 @@ func TestEthTracker_ExceedingTTL(t *testing.T) { t.Run("confirmed but unfinalized transaction still tracked", func(t *testing.T) { tracker, txStore, _, _ := newTestEvmTrackerSetup(t) addr1 := cltest.MustGenerateRandomKey(t).Address - _ = cltest.MustInsertConfirmedEthTxWithReceipt(t, txStore, addr1, 123, 1) + _ = mustInsertConfirmedEthTxWithReceipt(t, txStore, addr1, 123, 1) err := tracker.Start(context.Background()) require.NoError(t, err) @@ -134,7 +134,7 @@ func TestEthTracker_ExceedingTTL(t *testing.T) { tracker, txStore, _, _ := newTestEvmTrackerSetup(t) addr1 := cltest.MustGenerateRandomKey(t).Address addr2 := cltest.MustGenerateRandomKey(t).Address - tx1 := cltest.MustInsertInProgressEthTxWithAttempt(t, txStore, 123, addr1) + tx1 := mustInsertInProgressEthTxWithAttempt(t, txStore, 123, addr1) tx2 := cltest.MustInsertUnconfirmedEthTx(t, txStore, 123, addr2) tracker.XXXTestSetTTL(time.Nanosecond)