Show the destination the transaction encodes, not the one echoed back - #226
Merged
Conversation
ADR-019 says the approval screen must be derived from the decoded transaction rather than from result.params, because params is the composer repeating what it was asked for and so cannot testify about the composer. Only the send screen did that; the other twenty-seven rendered the echo. For the types with byte equality the echo is sound -- matching bytes prove the params describe the message -- but the ones verified field by field are exactly where an unenumerated difference could hide, and btcpay, dispenser, both pool screens and the three UTXO screens all render their recipient through the shared review screen. Preferring the decoded destination there fixes all of them at one point instead of rewriting seven UIs, and every other screen inherits it. The context is read optionally, since the component is also rendered outside a compose flow, and the response is still the fallback when a transaction carries no decodable destination -- an issuance has none, and a dispense names its dispenser rather than a payee. Claude-Session: https://claude.ai/code/session_01CcjnCrgosSeshymXLBxdGj
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.
PRIORITIES.md item 2.
The problem
ADR-019 layer 4 says the approval screen must be derived from the decoded transaction, never from
result.params— the composer repeating what it was asked for cannot testify about the composer. In practice onlycompose/send/review.tsxdid that; the other 27 rendered the echo.Severity depends on whether byte equality covers the type. Where it does, the echo is sound: matching bytes prove the params describe the message. Where it doesn't — btcpay, dispenser, both pool screens, and the three UTXO screens — field comparison speaks only to fields it was taught about, and the screen showed the request's version of everything else.
The change
All seven of those screens render their recipient through the shared
ReviewScreen, so preferring the decoded destination there fixes them at one point rather than rewriting seven UIs — and every other screen inherits it.useComposerOptional), becauseReviewScreenis also rendered outside a compose flow.Tests
Two new cases in
review-screen.test.tsxcovering the substitution directly: when the response echoes one recipient and the transaction encodes another, the screen shows the encoded one and not the echoed one; when the decoded message carries no destination, it falls back.The context is mocked rather than wrapped in a real provider — the real module reaches for
webext-bridge, and this stays a component test.tsc --noEmitclean; 1205 tests across components/pages/contexts.compose/utxo9/9,compose/dispenser/index.spec.ts7/7 (which includes "full flow: dispenser form → review → verify content").Note
This closes the destination half of item 2, which is where value routing is visible. Per-type amount and asset fields on those screens still come from params; they are covered by the field verifier and by output accounting, and correcting them needs per-type field mapping — the enumeration problem ADR-019 warns about. Worth doing per screen if it proves necessary, but it is a different shape of work than this one-point fix.
https://claude.ai/code/session_01CcjnCrgosSeshymXLBxdGj