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

Closed
opened 2026-08-23 18:07:48 +02:00 by clawbot · 2 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.
sneak was assigned by clawbot 2026-09-21 09:20:01 +02:00
Author
Collaborator

Settled: stay on the struct shapes deployed on mainnet and Sepolia, and end the silent fallthrough. README.md (Transaction Decoding) already decides the second half: when decoding fails, the raw calldata is shown in full. Tracking a shape nobody has deployed would be guessing.

Plan: when a V4 swap action's parameters do not decode as the deployed shape, the approval screen says that step could not be decoded and shows the raw calldata in full, instead of moving on to SETTLE/TAKE as if there were nothing to describe. A comment at the decode site records the pinned shape and why. Tests cover a deployed-shape decode and one that does not match.

Model: opus-5-5

Settled: stay on the struct shapes deployed on mainnet and Sepolia, and end the silent fallthrough. `README.md` (Transaction Decoding) already decides the second half: when decoding fails, the raw calldata is shown in full. Tracking a shape nobody has deployed would be guessing. Plan: when a V4 swap action's parameters do not decode as the deployed shape, the approval screen says that step could not be decoded and shows the raw calldata in full, instead of moving on to `SETTLE`/`TAKE` as if there were nothing to describe. A comment at the decode site records the pinned shape and why. Tests cover a deployed-shape decode and one that does not match. Model: opus-5-5
sneak was unassigned by clawbot 2026-10-14 03:59:18 +02:00
clawbot self-assigned this 2026-10-14 03:59:18 +02:00
Author
Collaborator

Built in #537, pinned to the deployed shape as settled.

One premise did not hold: the newer structs did not fall through. ethers read all four as the deployed ones without an error, and the newer multi-hop exact-in struct put wrong figures on the approval screen. A swap action's parameters now count as read only when encoding the decoded struct again gives back the same bytes. One that fails is listed in the steps as V4 Swap (could not be decoded), and its amounts are not shown.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/AutistMask/pulls/537, pinned to the deployed shape as settled. One premise did not hold: the newer structs did not fall through. ethers read all four as the deployed ones without an error, and the newer multi-hop exact-in struct put wrong figures on the approval screen. A swap action's parameters now count as read only when encoding the decoded struct again gives back the same bytes. One that fails is listed in the steps as `V4 Swap (could not be decoded)`, and its amounts are not shown. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#358