Repository navigation
fix: classify tx_bad_seq, tx_bad_auth, tx_no_account, and time-bound RPC errors - #813
Open
Isaacayomide28 wants to merge 1 commit into
Conversation
|
@Isaacayomide28 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! 🚀 |
Collaborator
|
@Isaacayomide28 welldone, kindly fix the failing CI workflow |
This branch has not been deployed
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.
Overview
This PR extends
classifySorobanRpcErrorinsrc/soroban/rpcErrorMapper.tsto recognize Horizon/RPC transaction error codes that previously fell through toCONTRACT_INVOKE_FAILED:tx_bad_seq,tx_bad_auth,tx_no_account, and the time-bound codestx_too_late/tx_too_early. It also adds matchingSorokitErrorCodevalues insrc/shared/response.tsand wires actionablerecoveryguidance inmapSorobanRpcErrorso callers can distinguish retryable sequence races from non-retryable auth failures.Related Issue
Changes
🧭 RPC Error Classification
[MODIFY]
src/soroban/rpcErrorMapper.tsclassifySorobanRpcErrornow matches the following patterns (case-insensitive, checked before the genericCONTRACT_INVOKE_FAILEDfallback):tx_bad_seq→TX_BAD_SEQ— matchestx_bad_seq,txBadSeq,bad seq,sequence numbertx_bad_auth→TX_BAD_AUTH— matchestx_bad_auth,txBadAuth,bad authtx_no_account→TX_NO_ACCOUNT— matchestx_no_account,txNoAccount,account not found,source account does not existtx_too_late/tx_too_early→TX_TIME_BOUNDS— matchestx_too_late,tx_too_early,txTooLate,txTooEarly,time bounds,timeboundmapSorobanRpcErrorreturns targetedrecoveryguidance per new code:TX_BAD_SEQ— "Re-fetch the source account sequence number and rebuild/resubmit the transaction."TX_BAD_AUTH— "Verify the signer set and signatures; do not retry without fixing authorization."TX_NO_ACCOUNT— "Fund or create the source account before resubmitting."TX_TIME_BOUNDS— "Rebuild the transaction with validtimeBoundsrelative to current ledger time."RATE_LIMITED,INVALID_AUTH,INSUFFICIENT_FEE,RESOURCE_LIMIT_EXCEEDED,XDR_INVALID,SOROBAN_SIMULATION_FAILED) are unchanged and still evaluated in the same order.[MODIFY]
src/shared/response.tsTX_BAD_SEQ,TX_BAD_AUTH,TX_NO_ACCOUNT, andTX_TIME_BOUNDStoSorokitErrorCode(confirmed none of these existed prior to this change).[MODIFY]
examples/react-wallet-connect/src/App.tsxVerification Results
classifySorobanRpcErrorreturns a distinct, documented code fortx_bad_seq,tx_bad_auth, andtx_no_accounterror messagesTX_BAD_SEQ,TX_BAD_AUTH,TX_NO_ACCOUNTcodesmapSorobanRpcErrorreturns actionablerecoveryguidance for each new coderpcErrorMappertest suiteCONTRACT_INVOKE_FAILEDfallback; prior patterns untouchedCloses #742