From 67a5f8ad943696dd93e933d32049d6ecb9fe26fc Mon Sep 17 00:00:00 2001 From: Joe Huang Date: Thu, 8 Aug 2024 16:50:58 -0500 Subject: [PATCH] fix unit tests --- core/chains/evm/txmgr/evm_tx_store_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/chains/evm/txmgr/evm_tx_store_test.go b/core/chains/evm/txmgr/evm_tx_store_test.go index c7f1ddd788a..4daa790de61 100644 --- a/core/chains/evm/txmgr/evm_tx_store_test.go +++ b/core/chains/evm/txmgr/evm_tx_store_test.go @@ -649,7 +649,7 @@ func TestORM_FindTxesPendingCallback(t *testing.T) { etx1 := cltest.MustInsertConfirmedEthTxWithLegacyAttempt(t, txStore, 3, 1, fromAddress) pgtest.MustExec(t, db, `UPDATE evm.txes SET meta='{"FailOnRevert": true}'`) attempt1 := etx1.TxAttempts[0] - mustInsertEthReceipt(t, txStore, head.BlockNumber(), head.Hash, attempt1.Hash) + receipt1 := mustInsertEthReceipt(t, txStore, head.BlockNumber(), head.Hash, attempt1.Hash) pgtest.MustExec(t, db, `UPDATE evm.txes SET pipeline_task_run_id = $1, signal_callback = TRUE WHERE id = $2`, &tr1.ID, etx1.ID) // Callback to pipeline service completed. Should be ignored @@ -668,7 +668,7 @@ func TestORM_FindTxesPendingCallback(t *testing.T) { etx3 := cltest.MustInsertConfirmedEthTxWithLegacyAttempt(t, txStore, 5, 1, fromAddress) pgtest.MustExec(t, db, `UPDATE evm.txes SET meta='{"FailOnRevert": false}'`) attempt3 := etx3.TxAttempts[0] - mustInsertEthReceipt(t, txStore, head.Number, head.Hash, attempt3.Hash) + receipt3 := mustInsertEthReceipt(t, txStore, head.Number, head.Hash, attempt3.Hash) pgtest.MustExec(t, db, `UPDATE evm.txes SET pipeline_task_run_id = $1, signal_callback = TRUE WHERE id = $2`, &tr3.ID, etx3.ID) // Tx not marked for callback. Should be ignore @@ -679,6 +679,12 @@ func TestORM_FindTxesPendingCallback(t *testing.T) { // Unconfirmed Tx without receipts. Should be ignored cltest.MustInsertConfirmedEthTxWithLegacyAttempt(t, txStore, 7, 1, fromAddress) + // update txes state to be 'finalized' using finalizer + err := txStore.UpdateTxStatesToFinalizedUsingReceiptIds(tests.Context(t), []int64{receipt1.ID}, testutils.FixtureChainID) + require.NoError(t, err) + err = txStore.UpdateTxStatesToFinalizedUsingReceiptIds(tests.Context(t), []int64{receipt3.ID}, testutils.FixtureChainID) + require.NoError(t, err) + // Search evm.txes table for tx requiring callback receiptsPlus, err := txStore.FindTxesPendingCallback(tests.Context(t), ethClient.ConfiguredChainID()) require.NoError(t, err)