Skip to content

Commit

Permalink
fix test attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhen1997 committed Aug 8, 2024
1 parent 7091ba8 commit cdcbb99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions core/chains/evm/txmgr/confirmer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2999,6 +2999,8 @@ func TestEthConfirmer_ResumePendingRuns(t *testing.T) {
receipt := mustInsertEthReceipt(t, txStore, head.Number, head.Hash, etx.TxAttempts[0].Hash)

pgtest.MustExec(t, db, `UPDATE evm.txes SET pipeline_task_run_id = $1, signal_callback = TRUE WHERE id = $2`, &tr.ID, etx.ID)
err = txStore.UpdateTxStatesToFinalizedUsingReceiptIds(tests.Context(t), []int64{receipt.ID}, testutils.FixtureChainID)
require.NoError(t, err)

done := make(chan struct{})
t.Cleanup(func() { <-done })
Expand Down
7 changes: 4 additions & 3 deletions core/chains/evm/txmgr/evm_tx_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ type dbReceiptPlus struct {
ID uuid.UUID `db:"pipeline_task_run_id"`
Receipt evmtypes.Receipt `db:"receipt"`
FailOnRevert bool `db:"FailOnRevert"`
State string `db:"state"`
}

func fromDBReceipts(rs []DbReceipt) []*evmtypes.Receipt {
Expand Down Expand Up @@ -1023,11 +1024,11 @@ func (o *evmTxStore) FindTxesPendingCallback(ctx context.Context, chainID *big.I
defer cancel()

err = o.q.SelectContext(ctx, &rs, `
SELECT evm.txes.pipeline_task_run_id, evm.receipts.receipt, COALESCE((evm.txes.meta->>'FailOnRevert')::boolean, false) "FailOnRevert" FROM evm.txes
SELECT evm.txes.state, evm.txes.pipeline_task_run_id, evm.receipts.receipt, COALESCE((evm.txes.meta->>'FailOnRevert')::boolean, false) "FailOnRevert" FROM evm.txes
INNER JOIN evm.tx_attempts ON evm.txes.id = evm.tx_attempts.eth_tx_id
INNER JOIN evm.receipts ON evm.tx_attempts.hash = evm.receipts.tx_hash
WHERE evm.txes.pipeline_task_run_id IS NOT NULL AND evm.txes.signal_callback = TRUE AND evm.txes.callback_completed = FALSE
AND evm.txes.state = 'finalized' AND evm.txes.evm_chain_id = $1
AND evm.txes.evm_chain_id = $1
`, chainID.String())
if err != nil {
return nil, fmt.Errorf("failed to retrieve transactions pending pipeline resume callback: %w", err)
Expand Down Expand Up @@ -1094,7 +1095,7 @@ func (o *evmTxStore) FindTxWithSequence(ctx context.Context, fromAddress common.
err = o.Transact(ctx, true, func(orm *evmTxStore) error {
var dbEtx DbEthTx
err = orm.q.GetContext(ctx, &dbEtx, `
SELECT * FROM evm.txes WHERE from_address = $1 AND nonce = $2 AND state IN ('confirmed', 'confirmed_missing_receipt', 'unconfirmed')
SELECT * FROM evm.txes WHERE from_address = $1 AND nonce = $2 AND state IN ('confirmed', 'confirmed_missing_receipt', 'unconfirmed', 'finalized')
`, fromAddress, nonce.Int64())
if err != nil {
return pkgerrors.Wrap(err, "FindEthTxWithNonce failed to load evm.txes")
Expand Down

0 comments on commit cdcbb99

Please sign in to comment.