Skip to content

fix(sdk-coin-ada): mark change outputs in explainTransaction#8945

Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
fix/WCI-633-ada-change-outputs-explain-transaction
Draft

fix(sdk-coin-ada): mark change outputs in explainTransaction#8945
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
fix/WCI-633-ada-change-outputs-explain-transaction

Conversation

@bitgo-ai-agent-dev
Copy link
Copy Markdown

Summary

  • 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 (~20 prod incidents)
  • Add _changeAddress field to Transaction class with getter/setter
  • Set changeAddress on the transaction from all three build paths in TransactionBuilder (processTokenBuild, processExplicitOutputsBuild, buildImplementation)
  • In explainTransaction(), mark outputs whose address matches _changeAddress with change: true
  • Add change?: boolean to the explainTransaction return type signature

Root Cause

sdk-coin-ada explainTransaction() set neither change: true nor isChange: true on change outputs. The intent verification parser reads output.change || output.isChange to filter change outputs — since ADA set neither, change outputs were counted as recipients, producing a recipients.count mismatch (intent: 1, transaction: 2).

A prior fix attempt (PR #58785, WAL-1464) was a no-op for ADA because it filtered on isChange: true which ADA never sets.

Test plan

  • should mark the change output with change: true for a shelley send tx
  • should mark the change output with change: true for a byron send tx
  • should not set change on any output when no change address is set (consolidation)
  • All existing sdk-coin-ada unit tests pass

Ticket: WCI-633

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
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 4, 2026

WCI-633

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the fix/WCI-633-ada-change-outputs-explain-transaction branch from 016671c to 95b673f Compare June 4, 2026 10:50
@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot marked this pull request as ready for review June 4, 2026 13:00
@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot requested a review from a team as a code owner June 4, 2026 13:00
Copy link
Copy Markdown
Contributor

@mohammadalfaiyazbitgo mohammadalfaiyazbitgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@abhishekagrawal080 abhishekagrawal080 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@Marzooqa Marzooqa marked this pull request as draft June 5, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants