Repository navigation
#752 getAccount uses deduplicateRequest but dedup key does not include sequence number — stale results on rapid retries - #823
Merged
k-deejah merged 1 commit intoOct 18, 2026
Conversation
…tion (Sorokit#752) Ensure getAccount deduplication does not return stale sequence numbers on rapid concurrent fetches and retries. Includes sequence in the deduplication key when provided, tracks per-account mutation version, clears in-flight deduplicated requests on account invalidation, and automatically invalidates source account sequence state upon transaction submission.
|
@jotel-dev 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
Fixes #752
Ensures
getAccountdeduplication does not return stale sequence numbers on rapid retries or concurrent transaction submissions.How Sequence Is Invalidated or Refreshed After Submission
Sequence & Version-Aware Deduplication Key:
src/account/getAccount.tshas been updated to include per-account mutation version tracking and optional sequence parameters:getAccount:${horizonUrl}:${publicKey}:v${version}${seqSuffix}.sequence,expectedSequence, orforceRefreshviaGetAccountOptionsto isolate concurrent requests expecting distinct ledger states.Automatic Post-Submission Invalidation:
src/transaction/submitTransaction.ts, successful transaction submissions (and submission attempts) automatically invokeinvalidateSubmittedTxAccounts(tx, horizonUrl).TransactionandFeeBumpTransaction(including inner transaction source and fee source), demuxes muxed addresses to Ed25519 public keys, and callsinvalidateAccount(sourceKey, horizonUrl).In-Flight Cache Eviction:
invalidateInflightRequestsandremoveInflightRequesttosrc/shared/utils.ts.invalidateAccountis called, the mutation version is bumped and all matching in-flight deduplicated promises are evicted from_inflightRequests. Any concurrent or subsequent fetch initiates a fresh Horizon query rather than returning the stale sequence number.Public Invalidation APIs:
invalidateAccount,invalidateAccountCache,refreshAccountSequence,clearAccountDeduplication, andGetAccountOptionsfromsrc/account/index.tsfor direct lifecycle control.Acceptance Criteria Covered
src/tests/getAccountDeduplication.test.ts.