fix(sdk-coin-ada): mark change outputs with change:true in explainTransaction#8943
Closed
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Closed
fix(sdk-coin-ada): mark change outputs with change:true in explainTransaction#8943bitgo-ai-agent-dev[bot] wants to merge 1 commit into
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Conversation
…nsaction ADA's explainTransaction() returned all outputs in a flat outputs[] array with no change marker, causing intent verification to count change outputs as recipients and trigger false-positive TransactionFailsIntentVerification alerts. Fix: add a _changeAddress field to Transaction. TransactionBuilder sets it after building. explainTransaction() uses it to add change:true on matching outputs. ExplainTransactionOptions accepts an optional changeAddress so callers with only raw hex can supply the wallet address. Ticket: WCI-633 Session-Id: 9d7a233b-1b25-4206-87ef-85d2a74410a4 Task-Id: 2eafb02e-6fe8-44a3-a0e9-1825491a8e31
01b4683 to
a1dd601
Compare
Contributor
|
Using #8945 instead |
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
Transactionnow tracks a_changeAddressfield set byTransactionBuilderafter each build path (standard, token, and explicit-output paths).explainTransaction()uses_changeAddressto addchange: trueon matching outputs, so intent verification can distinguish change from recipient outputs.ExplainTransactionOptionsgains an optionalchangeAddressfield — callers that only have raw hex can supply the wallet's base address to get correct change marking.Root Cause
sdk-coin-adaexplainTransaction()returned all outputs in a flatoutputs[]array with no change marker.changeOutputswas always[]. The intent verification parser readsoutput.change || output.isChangeto detect change outputs; since ADA set neither, change outputs were counted as recipients, producing arecipients.countCRITICAL mismatch (intent: 1, transaction: 2).Fixes recurring false-positive
TransactionFailsIntentVerificationalerts for ADA self-custodial transactions.Related: WCI-633, WAL-1464
Test plan
transactionBuilder.tsverifychange: trueis set on the change output for a standard transfer, absent when nochangeAddressis provided, and set for consolidation transactions.yarn unit-test --scope @bitgo/sdk-coin-ada— 102 passing, 3 pre-existing env-var failures (unrelated to this change).🤖 Generated with Ralph