chore: V4 struct decodes target the deployed shape, and silently stop describing swaps if periphery adds a field #358

Open
opened 2026-08-23 18:07:48 +02:00 by clawbot · 0 comments
Collaborator

Raised while resolving #353. Judged deliberate rather than defective, so filed as a question to settle rather than a bug.

decodeV4Swap() in src/shared/uniswap.js decodes the currently deployed V4 struct shapes — e.g. ExactInputParams as (Currency, PathKey[], uint128, uint128). Uniswap/v4-periphery main has since added a minHopPriceX36 field to those structs.

Targeting the deployed shape is almost certainly correct today. The concern is the failure mode if a chain the extension targets ever runs the newer periphery: the tuple decodes fail and fall through to SETTLE/TAKE, so the approval screen quietly stops describing the swap. It degrades safely — no wrong number — but silently, and the user is left with an approval screen that does not say what the transaction does.

Definition of done

  • Decide whether to track the newer struct shape, support both, or stay pinned to the deployed one.
  • Whichever is chosen, a decode that falls through because the shape did not match is distinguishable from one that genuinely had nothing to describe — the screen should not present "could not decode" as "nothing to see".
  • Record the decision at the decode site so the next reader does not re-derive it.
  • make check green.
Raised while resolving https://git.eeqj.de/sneak/AutistMask/issues/353. Judged deliberate rather than defective, so filed as a question to settle rather than a bug. `decodeV4Swap()` in `src/shared/uniswap.js` decodes the currently deployed V4 struct shapes — e.g. `ExactInputParams` as `(Currency, PathKey[], uint128, uint128)`. `Uniswap/v4-periphery` `main` has since added a `minHopPriceX36` field to those structs. Targeting the deployed shape is almost certainly correct today. The concern is the failure mode if a chain the extension targets ever runs the newer periphery: the tuple decodes fail and fall through to `SETTLE`/`TAKE`, so the approval screen quietly stops describing the swap. It degrades safely — no wrong number — but silently, and the user is left with an approval screen that does not say what the transaction does. ## Definition of done - [ ] Decide whether to track the newer struct shape, support both, or stay pinned to the deployed one. - [ ] Whichever is chosen, a decode that falls through because the shape did not match is distinguishable from one that genuinely had nothing to describe — the screen should not present "could not decode" as "nothing to see". - [ ] Record the decision at the decode site so the next reader does not re-derive it. - [ ] `make check` green.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#358