fix(sdk-coin-ada): mark change outputs in explainTransaction#8945
Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Draft
fix(sdk-coin-ada): mark change outputs in explainTransaction#8945bitgo-ai-agent-dev[bot] wants to merge 1 commit into
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Conversation
ADA's explainTransaction() returned all outputs in a flat array with no change marker, causing intent verification to count change outputs as recipients and fire false-positive TransactionFailsIntentVerification alerts. Add _changeAddress to Transaction, set it from all three build paths in TransactionBuilder, and mark matching outputs with change: true in explainTransaction(). Also add change?: boolean to the explainTransaction return type. Ticket: WCI-633 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Session-Id: 9d7a233b-1b25-4206-87ef-85d2a74410a4 Task-Id: 2eafb02e-6fe8-44a3-a0e9-1825491a8e31
016671c to
95b673f
Compare
2 tasks
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
explainTransaction()returned all outputs in a flat array with nochangemarker, causing intent verification to count change outputs as recipients and fire false-positiveTransactionFailsIntentVerificationalerts (~20 prod incidents)_changeAddressfield toTransactionclass with getter/setterchangeAddresson the transaction from all three build paths inTransactionBuilder(processTokenBuild,processExplicitOutputsBuild,buildImplementation)explainTransaction(), mark outputs whose address matches_changeAddresswithchange: truechange?: booleanto theexplainTransactionreturn type signatureRoot Cause
sdk-coin-adaexplainTransaction()set neitherchange: truenorisChange: trueon change outputs. The intent verification parser readsoutput.change || output.isChangeto filter change outputs — since ADA set neither, change outputs were counted as recipients, producing arecipients.countmismatch (intent: 1, transaction: 2).A prior fix attempt (PR #58785, WAL-1464) was a no-op for ADA because it filtered on
isChange: truewhich ADA never sets.Test plan
should mark the change output with change: true for a shelley send txshould mark the change output with change: true for a byron send txshould not set change on any output when no change address is set (consolidation)sdk-coin-adaunit tests passTicket: WCI-633