A PERMIT2_PERMIT_BATCH, or a permit that cannot be read, shows nothing of what it allows #652

Closed
opened 2026-10-20 22:58:24 +02:00 by clawbot · 2 comments
Collaborator

Seen by the review of #651.

Where

The swap decoder, decode() in src/shared/uniswap.js. PERMIT2_PERMIT_BATCH is named in the Steps line but never read, and a PERMIT2_PERMIT the decoder cannot read gets no lines.

What happens

A transaction with a PERMIT2_PERMIT_BATCH asks the user to sign allowances for one or more tokens to a spender, possibly not the router, and the approval screen shows none of them: no token, no amount, no spender. A PERMIT2_PERMIT whose input cannot be read is shown the same way. The user authorizes what the screen does not state.

What should happen

Settled on #370: nothing the user authorizes goes unstated. Each allowance a PERMIT2_PERMIT_BATCH grants is shown with its token, amount and spender, as a single PERMIT2_PERMIT that does not stand now is; a permit or batch that cannot be read is shown as one whose allowances could not be decoded, and leaves no Amount figure that may be too low.

Severity: major

Definition of done

  • Each allowance of a PERMIT2_PERMIT_BATCH is shown with its token, amount and spender.
  • A permit or batch the decoder cannot read is shown as not decoded.
  • Tests for a batch of two allowances (one to another spender) and for an unreadable permit, failing on next.

Model: opus-5-5

Seen by the review of https://git.eeqj.de/sneak/AutistMask/pulls/651. ## Where The swap decoder, `decode()` in `src/shared/uniswap.js`. `PERMIT2_PERMIT_BATCH` is named in the Steps line but never read, and a `PERMIT2_PERMIT` the decoder cannot read gets no lines. ## What happens A transaction with a `PERMIT2_PERMIT_BATCH` asks the user to sign allowances for one or more tokens to a spender, possibly not the router, and the approval screen shows none of them: no token, no amount, no spender. A `PERMIT2_PERMIT` whose input cannot be read is shown the same way. The user authorizes what the screen does not state. ## What should happen Settled on https://git.eeqj.de/sneak/AutistMask/issues/370: nothing the user authorizes goes unstated. Each allowance a `PERMIT2_PERMIT_BATCH` grants is shown with its token, amount and spender, as a single `PERMIT2_PERMIT` that does not stand now is; a permit or batch that cannot be read is shown as one whose allowances could not be decoded, and leaves no `Amount` figure that may be too low. Severity: major ## Definition of done - [ ] Each allowance of a `PERMIT2_PERMIT_BATCH` is shown with its token, amount and spender. - [ ] A permit or batch the decoder cannot read is shown as not decoded. - [ ] Tests for a batch of two allowances (one to another spender) and for an unreadable permit, failing on `next`. Model: opus-5-5
clawbot self-assigned this 2026-10-20 22:58:24 +02:00
Author
Collaborator

Plan: one PR to next, in src/shared/uniswap.js. A decodePermit2PermitBatch() beside the single permit's reader reads (PermitBatch{details[]{token, amount, expiration, nonce}, spender, sigDeadline}, signature); each allowance it grants gets the three lines a permit that does not stand now gets (#651), and a batch never names Token In or stands as the Amount figure. A PERMIT2_PERMIT or batch whose input cannot be read gets one line saying its allowances could not be decoded, and leaves no Amount figure. A batch already ends a single permit's standing; keep that. Tests for a batch of two allowances (one to another spender) and for an unreadable permit and batch, each failing on next.

Model: opus-5-5

Plan: one PR to `next`, in `src/shared/uniswap.js`. A `decodePermit2PermitBatch()` beside the single permit's reader reads `(PermitBatch{details[]{token, amount, expiration, nonce}, spender, sigDeadline}, signature)`; each allowance it grants gets the three lines a permit that does not stand now gets (https://git.eeqj.de/sneak/AutistMask/pulls/651), and a batch never names `Token In` or stands as the `Amount` figure. A `PERMIT2_PERMIT` or batch whose input cannot be read gets one line saying its allowances could not be decoded, and leaves no `Amount` figure. A batch already ends a single permit's standing; keep that. Tests for a batch of two allowances (one to another spender) and for an unreadable permit and batch, each failing on `next`. Model: opus-5-5
Author
Collaborator

Built in #656: each allowance of a PERMIT2_PERMIT_BATCH gets the three lines of a permit whose amount does not stand, and a permit or batch that cannot be read gets one Permit2 allowance line reading Unknown (could not be decoded) and leaves no Amount line.

Judgement call, stated on the PR: any batch in the transaction now keeps a PERMIT2_PERMIT's amount from standing, a batch before the permit included.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/AutistMask/pulls/656: each allowance of a `PERMIT2_PERMIT_BATCH` gets the three lines of a permit whose amount does not stand, and a permit or batch that cannot be read gets one `Permit2 allowance` line reading `Unknown (could not be decoded)` and leaves no `Amount` line. Judgement call, stated on the PR: any batch in the transaction now keeps a `PERMIT2_PERMIT`'s amount from standing, a batch before the permit included. 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#652