fix: recover from Horizon bad_seq via account re-fetch, with chaos test coverage (closes #708) - #790
Open
Wizdee-001 wants to merge 2 commits into
Open
Conversation
|
@Wizdee-001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #708. Adds chaos test coverage for intermittent Horizon
bad_seqresponses, and fixes a gap found while writing that coverage: the
submission retry loop was resending the same signed transaction
unchanged, which can never succeed after a bad_seq error since the
sequence number is baked into the signature.
Fix
sendTransactionWithRetrynow, on aBAD_SEQUENCEclassification,re-fetches the source account via the existing
getAccountWithRetryhelper and rebuilds + re-signs the transaction before retrying. If the
account can't be re-fetched (e.g. it no longer exists after a merge),
the original bad_seq failure is surfaced immediately rather than
retrying blindly.
Test coverage
succeeds
the call fails loudly (throws) rather than hanging or retrying
forever
and the original error still surfaces without unbounded retries
Notes
stellarRpcFailure.ts— existingBAD_SEQUENCEclassification and
shouldRetryStellarRPCFailurebudget logic werealready correct; the gap was purely in the retry loop resending a
stale signed transaction.
maxRetries) remains the existing private field(default 3); happy to make it a constructor parameter in a follow-up
if that's wanted separately.
Testing
npm test -- stellarSubmissionService.chaospasses locallynpm test -- --coveragerun to confirm the 95% threshold