Skip to content

Commit 37483bb

Browse files
committed
Address feedback
1 parent d34d05d commit 37483bb

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pkg/txm/clientwrappers/dualbroadcast/meta_error_handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ func (e *errorHandler) HandleError(
2424
txErr error,
2525
txStore txm.TxStore,
2626
setNonce func(common.Address, uint64),
27-
isFromBroadcastMethod bool,
2827
) (noTransmission bool, err error) {
2928
// Mark the tx as fatal only if this is the first broadcast. In any other case, other txs might be included on-chain.
3029
if (errors.Is(txErr, ErrNoBids) || errors.Is(txErr, ErrAuction)) && tx.AttemptCount == 1 {
3130
if err := txStore.MarkTxFatal(ctx, tx, tx.FromAddress); err != nil {
3231
return false, err
3332
}
3433
setNonce(tx.FromAddress, *tx.Nonce)
35-
lggr.Infof("transaction with txID: %d marked as fatal", tx.ID)
34+
l := logger.Sugared(logger.Named(lggr, "Txm.MetaErrorHandler"))
35+
l.Infow("transaction marked as fatal", "txID", tx.ID, "transactionLifecycleID", tx.GetTransactionLifecycleID(l))
3636
return true, nil
3737
}
3838

pkg/txm/clientwrappers/dualbroadcast/meta_error_handler_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ func TestMetaErrorHandler(t *testing.T) {
4747
_, err = txStore.AppendAttemptToTransaction(*tx.Nonce, attempt)
4848
require.NoError(t, err)
4949
tx, _ = txStore.FetchUnconfirmedTransactionAtNonceWithCount(nonce)
50-
noTransmission, err := errorHandler.HandleError(t.Context(), lggr, tx, ErrNoBids, txStoreManager, setNonce, false)
50+
noTransmission, err := errorHandler.HandleError(t.Context(), lggr, tx, ErrNoBids, txStoreManager, setNonce)
5151
require.NoError(t, err)
5252
require.True(t, noTransmission)
53-
tests.AssertLogEventually(t, observedLogs, "transaction with txID: 0 marked as fatal")
53+
tests.AssertLogEventually(t, observedLogs, "transaction marked as fatal")
5454
_, unconfirmedCount := txStore.FetchUnconfirmedTransactionAtNonceWithCount(nonce)
5555
assert.Equal(t, 0, unconfirmedCount)
5656
})
@@ -82,7 +82,7 @@ func TestMetaErrorHandler(t *testing.T) {
8282
_, err = txStore.AppendAttemptToTransaction(*tx.Nonce, attempt)
8383
require.NoError(t, err)
8484
tx, _ = txStore.FetchUnconfirmedTransactionAtNonceWithCount(nonce)
85-
noTransmission, err := errorHandler.HandleError(t.Context(), logger.Test(t), tx, txErr, txStoreManager, setNonce, false)
85+
noTransmission, err := errorHandler.HandleError(t.Context(), logger.Test(t), tx, txErr, txStoreManager, setNonce)
8686
require.NoError(t, err)
8787
require.False(t, noTransmission)
8888
_, unconfirmedCount := txStore.FetchUnconfirmedTransactionAtNonceWithCount(nonce)
@@ -115,10 +115,10 @@ func TestMetaErrorHandler(t *testing.T) {
115115
_, err = txStore.AppendAttemptToTransaction(*tx.Nonce, attempt)
116116
require.NoError(t, err)
117117
tx, _ = txStore.FetchUnconfirmedTransactionAtNonceWithCount(nonce)
118-
noTransmission, err := errorHandler.HandleError(t.Context(), lggr, tx, txErr, txStoreManager, setNonce, false)
118+
noTransmission, err := errorHandler.HandleError(t.Context(), lggr, tx, txErr, txStoreManager, setNonce)
119119
require.NoError(t, err)
120120
require.True(t, noTransmission)
121-
tests.AssertLogEventually(t, observedLogs, "transaction with txID: 0 marked as fatal")
121+
tests.AssertLogEventually(t, observedLogs, "transaction marked as fatal")
122122
_, unconfirmedCount := txStore.FetchUnconfirmedTransactionAtNonceWithCount(nonce)
123123
assert.Equal(t, 0, unconfirmedCount)
124124
})

pkg/txm/txm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type AttemptBuilder interface {
5959
type ErrorHandler interface {
6060
// HandleError tries to decide if there was a successful transmission by parsing the error message. If it can't decide, it returns control to
6161
// the standard execution path.
62-
HandleError(context.Context, logger.Logger, *types.Transaction, error, TxStore, func(common.Address, uint64), bool) (noTransmission bool, err error)
62+
HandleError(context.Context, logger.Logger, *types.Transaction, error, TxStore, func(common.Address, uint64)) (noTransmission bool, err error)
6363
}
6464

6565
type StuckTxDetector interface {
@@ -342,7 +342,7 @@ func (t *Txm) sendTransactionWithError(ctx context.Context, tx *types.Transactio
342342
if txErr != nil {
343343
// If ErrorHandler is set, try to decide if there was a successful transmission by parsing the error message. If there wasn't, we return early.
344344
if t.errorHandler != nil {
345-
noTransmission, hErr := t.errorHandler.HandleError(ctx, t.lggr, tx, txErr, t.txStore, t.SetNonce, false)
345+
noTransmission, hErr := t.errorHandler.HandleError(ctx, t.lggr, tx, txErr, t.txStore, t.SetNonce)
346346
if hErr != nil {
347347
return hErr
348348
}

pkg/txm/txm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ func TestFlow_ErrorHandler(t *testing.T) {
546546
client.On("SendTransaction", mock.Anything, mock.Anything, mock.Anything).Return(dualbroadcast.ErrNoBids).Once()
547547
_, err = tm.BroadcastTransaction(t.Context(), address)
548548
require.NoError(t, err)
549-
tests.AssertLogEventually(t, observedLogs, "transaction with txID: 0 marked as fatal")
549+
tests.AssertLogEventually(t, observedLogs, "transaction marked as fatal")
550550
_, count, err := txStoreManager.FetchUnconfirmedTransactionAtNonceWithCount(t.Context(), 0, address)
551551
require.NoError(t, err)
552552
require.Equal(t, 0, count)

0 commit comments

Comments
 (0)