feat: add asynchronous nonce manager for multi-account soroban transa… - #78
Merged
Merged
Conversation
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.
Title
feat: Add Asynchronous Nonce Manager for Multi-Account Soroban Transactions
Description
What was done
NonceManager(src/services/nonceManager.ts) to pre-fetch and handle a pool of 20 nonces per account.src/store/slices/nonceSlice.ts) tracking the nonce state, avoiding the need for heavy new Redux dependencies.submitWithNonce(src/services/soroban.ts) to handle blockchain failures.useNonceManager()to safely acquire and lease nonces to components with a 120-second lease timeout.NonceManagerflush and initialize steps into theuseWallet/WalletProviderlifecycle so that changing accounts safely flushes the active nonce queue to prevent invalid sequence collisions.Why it was done
Soroban transactions from the dashboard require sequential nonce management per source account. With multiple UI components submitting transactions concurrently, they risk nonce collisions or sequence gaps. This Asynchronous Nonce Manager with pool pre-fetching completely mitigates these race conditions and sequence misalignments by leasing nonces out sequentially and providing automatic queue flushing and sequence re-fetching upon any
tx_bad_seqfailures.How it was verified
src/tests/nonceManager.test.ts.tx_bad_seqcatch, flush, re-fetch, and automatic transaction reconstruction / retry loop without component disruption.Closes #58