Skip to content

Oev 618 update max retries logic#276

Merged
dimriou merged 2 commits into
developfrom
oev-618_update_max_retries_logic
Oct 18, 2025
Merged

Oev 618 update max retries logic#276
dimriou merged 2 commits into
developfrom
oev-618_update_max_retries_logic

Conversation

@dimriou
Copy link
Copy Markdown
Contributor

@dimriou dimriou commented Oct 16, 2025

This PR implements two new changes:

  1. Updates max retries logic: TXM no longer stops rebroadcasting new attempts for transactions that have reached the maximum threshold. Instead, it throws an error, purges old attempts, and retries. You should now rely exclusively on monitoring to catch abnormalities in broadcasting.
  2. Updates time-based stuck transaction logic: along with the time-based heuristic, the time-based method also adds a max attempts threshold heuristic, even if the transaction has no successful broadcasts.

@dimriou dimriou marked this pull request as ready for review October 17, 2025 08:41
@dimriou dimriou requested review from a team as code owners October 17, 2025 08:41
Copy link
Copy Markdown
Contributor

@cl-efornaciari cl-efornaciari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, added a few comments/questions

Comment on lines -88 to +91
attempt.ID = uint64(len(tx.Attempts)) // Attempts are not collectively tracked by the in-memory store so attemptIDs are not unique between transactions and can be reused.
attempt.ID = uint64(tx.AttemptCount) // Attempts are not collectively tracked by the in-memory store so attemptIDs are not unique between transactions and can be reused.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this patch, the length of the attempts slice is finite, but the total number of attempts can exceed that threshold due to pruning. To accurately count them we need to make this switch.

attempt.ID = uint64(tx.AttemptCount) // Attempts are not collectively tracked by the in-memory store so attemptIDs are not unique between transactions and can be reused.
tx.AttemptCount++
// Prune oldest attempt.
if len(tx.Attempts) >= MaxAllowedAttempts {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of the lock I think its not possible for this to exceed at most 1 attempts over the max allowed attempts, is that correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, that's just safer.

require.NoError(t, m2.AppendAttemptToTransaction(nonce, newAttempt))
}
tx, _ := m2.FetchUnconfirmedTransactionAtNonceWithCount(nonce)
fmt.Println("TX:", tx)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we want this print here?

Comment on lines +125 to +126
assert.Equal(t, attemptsTried, tx.AttemptCount)
assert.Equal(t, uint64(attemptsTried-MaxAllowedAttempts), tx.Attempts[0].ID)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@dimriou dimriou merged commit 567b214 into develop Oct 18, 2025
34 checks passed
@dimriou dimriou deleted the oev-618_update_max_retries_logic branch October 18, 2025 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants