fix(sdk-core,sdk-coin-xlm): fix enabletoken approval failing with no operations - #9399
fix(sdk-core,sdk-coin-xlm): fix enabletoken approval failing with no operations#9399akarath wants to merge 1 commit into
Conversation
…operations Approving a dual-approval Stellar enable-token (trustline) pending approval failed with "transaction prebuild does not have any operations". recreateAndSignTransaction() rebuilds the transaction during approval but did not preserve verification.verifyTokenEnablement, so Xlm.verifyTransaction() fell through to the generic createAccount/payment check instead of the trustline verification path, and the changeTrust operation was never recognized. verifyTokenEnablement is a coin-agnostic verification flag also used by near, sol, algo, hbar, and xrp to gate their own enabletoken verification branches, so this same gap affects those coins too, not just XLM. - recreateAndSignTransaction() now sets verifyTokenEnablement when rebuilding an enabletoken pending approval - widen PendingApprovalInfo.buildParams.type to include 'enabletoken' - add regression tests in sdk-coin-xlm and bitgo CSHLD-1358 TICKET: CSHLD-1358
af07e1d to
fc3f21b
Compare
|
@claude review |
|
Claude finished @akarath's task —— View job Code Review Complete ✅Reviewing PR #9399: fix enabletoken approval failing with no operations Todo List:
Review SummaryThis is a well-implemented fix for a critical multi-coin issue. The solution is elegant, targeted, and properly tested. ✅ Strengths
🔍 Technical AnalysisThe Fix Logic (
XLM Verification Flow (confirmed in if (txParams.verification && txParams.verification.verifyTokenEnablement) {
return this.verifyTokenEnablementTransaction(txParams, transactionJson);
}Without the flag, it falls through to generic checks that throw the error at line 421. Interface Change ( 🎯 Verification
💡 Minor Suggestions
🎉 ConclusionLGTM - This PR effectively fixes a critical issue affecting multiple blockchain integrations. The implementation is clean, well-tested, and addresses the root cause without introducing complexity or side effects. The comprehensive test plan execution and multi-coin consideration demonstrate thorough engineering. Recommendation: ✅ Approve and merge |
Summary
transaction prebuild does not have any operations.recreateAndSignTransaction()rebuilds the tx during approval but didn't preserveverification.verifyTokenEnablement, soXlm.verifyTransaction()fell through to the genericcreateAccount/paymentcheck instead of the trustline verification path, and never recognized thechangeTrustoperation.verifyTokenEnablementis a coin-agnostic verification flag also used bynear,sol,algo,hbar, andxrpto gate their ownenabletokenverification branches, so this same gap affects those coins too, not just XLM.recreateAndSignTransaction()now setsverifyTokenEnablementwhen rebuilding anenabletokenpending approval, so it takes the correct verification path regardless of coin.Fixes CSHLD-1358.
Test plan
yarn lintclean on all changed filesyarn prettier --checkclean on all changed filestscbuild cleansdk-coin-xlmunit tests: 108 passingsdk-coreunit tests: 534 passingbitgopendingApproval.tsunit tests: 18 passing (incl. 2 new tests). 1 pre-existing failing test ([tbtc] should recreate the transaction...) confirmed unrelated — reproduces identically with this fix reverted.🤖 Generated with Claude Code