Expand CONTRACT_ERROR_MESSAGES with real pool contract error codes - #181
Merged
prodbycorne merged 7 commits intoAug 18, 2026
Merged
Conversation
✅ Deploy Preview for spiffy-melomakarona-eb1e8a ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for smart-drop ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
ci passed |
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
CONTRACT_ERROR_MESSAGEShad exactly one entry despite substantial, purpose-built XDR error-extraction machinery (findContractErrorCode/extractContractErrorCodeFromXdr/extractContractErrorCode/normalizeContractErrorCode) — every other on-chain lock/unlock/boost failure fell through to a generic, actionlessTransaction {hash} failed on-chainmessage.PoolErrorenum (SmartDropLabs/smartdrop-contracts,soroban/contracts/farming-pool/src/types.rs) rather than guessed — I have direct, current knowledge of that enum from working on that exact contract earlier. Code'1'is left unchanged: the real contract's code 1 isAlreadyInitialized, which doesn't match the existing"Assets are still locked"message, and that specific failure is actually a plainassert!in the current contract rather than a typed error — documented in a comment rather than silently reinterpreted, since there's no way to confirm from here whether it reflects an older contract build's mapping.getContractErrorMessagenow logs unmapped codes viaconsole.warn('[SmartDrop] Unmapped contract error code:', ...)so gaps are discoverable from real usage instead of requiring a user complaint first.lockAssets,unlockAssets) now includes the raw error code when one was extracted, via a smallgenericOnChainFailureMessagehelper.setBoostpreviously returned success immediately after submission, without ever polling for on-chain confirmation or extracting a contract error code — unlikelockAssets/unlockAssets. Extended it to poll and map errors the same way, per the issue's explicit callout that this gap would otherwise persist once boost UI ships.Test plan
soroban.contractErrors.test.tsenumerates every entry in the updated table viagetContractErrorMessage, plus unmapped-code warning behavior and hex/embedded-code normalizationsetBoost's existing success test for the new confirmation fields; added a new test proving its on-chain failure path now decodes contract errors the same waylockAssetsdoesnpx vitest run— 247/248 passing (the one failure,soroban-parsers.test.ts'sdecodeScStringtest, is pre-existing and unrelated — confirmed present on a clean, unmodifiedupstream/maincheckout)npx tsc --noEmit— cleannpx next lint— clean (only pre-existing warnings in files this PR doesn't touch)npx next build— succeedsCloses #146