Repository navigation
feat: complete empty vs provider-fail in recover() - #9938
Open
pranishnepal wants to merge 1 commit into
Open
pranishnepal wants to merge 1 commit into
pranishnepal wants to merge 1 commit into
Conversation
This is a follow-up to PR #9932 (#9932) which introduced honest "empty vs provider-failed" classification in recover(). This commit closes the loop by applying the same fix to all 17 remaining coin modules (and their abstract bases) that still conflated the two. Key changes across SUI, ADA, NEAR, POLYX, DOT, Substrate base, Cosmos base (and subclasses), XTZ, ICP, VET, HBAR, TRX, ALGO, TON, RUNE, STX, and XRP: - Retype verifiably-empty throws to ErrorNoInputToRecover - Wrap provider query boundaries in RecoveryProviderError - Convert scan loop empty string-match checks to ErrorNoInputToRecover - Add type-based negative assertions and provider-failure tests per coin Ticket: WCN-3036
Contributor
Contributor
|
|
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.
Context
This PR is a follow-up to PR #9932 (which implemented honest "empty vs provider-failed" classification in
recover()for SOL, XLM, and IOTA). It completes the migration across all 17 remaining coin modules (and their abstract bases) that still conflated wallet-empty states with node/explorer/RPC failures.Key Refinement Highlights
Beyond the mechanical retypes, this PR addresses critical edge cases and bugs discovered during rigorous review of the uncommitted state:
abstract-cosmos): superagent v9 rejects on non-2xx (including 404). The existing base code and overrides (injective, islm, zeta) checkedresponse.status === 404downstream, which was dead code (empty accounts threw generic provider errors). Fixed by catching the 404 ingetAccountFromNode's catch block and properly throwingErrorNoInputToRecover.balance - fee <= 0checks (which historically collapsed empty and underfunded) into two separate paths:balance <= 0throwsErrorNoInputToRecover, while0 < balance <= feethrows a plainError(needs gas).TypeErrorGuard: Added an emptybalancesarray guard inrune.tsto prevent a rawTypeErroronbalances[0].amountfor empty accounts, routing it toErrorNoInputToRecover."Does not have Trustline with ${issuer}"asErrorNoInputToRecover(empty of that token), aligning it with the"Does not have funds to recover"zero-balance check.makeRPCfor SUI,getFeeEstimatefor TON,recoveryPost/Getfor TRX) inRecoveryProviderErrorto comprehensively cover all node/explorer boundaries.Verification & Testing
Negative tests asserting by type (
ErrorNoInputToRecover/RecoveryProviderError) have been added or upgraded for all affected coins, and verified green