A swap's WETH minimum reads as ETH received when part of its WETH may not reach the UNWRAP_WETH #642

Open
opened 2026-10-20 14:55:03 +02:00 by clawbot · 2 comments
Collaborator

Seen by the review of #640.

Where

The swap decoder, the UNWRAP_WETH branch of decode() in src/shared/uniswap.js.

What happens

Each of these routes shows the swap's WETH minimum as a Min. received in ETH, though less than that may arrive as ETH:

  • a step between the swap and the UNWRAP_WETH pays out part of the router's WETH (a TRANSFER of a stated amount, a PAY_PORTION);
  • a WRAP_ETH into the router after the swap's WETH was paid out, then an UNWRAP_WETH;
  • an UNWRAP_WETH into the router, then a WRAP_ETH of all of its ETH to the user (the user receives WETH, and the screen names ETH).

What should happen

Min. received never states more than the calldata guarantees, and the screen never names a token the user does not receive: where part of the swap's WETH may not reach the UNWRAP_WETH, no ETH minimum is shown, and the token named is the one the last step pays the user.

Severity: minor

Definition of done

  • Each route above shows no ETH minimum larger than guaranteed and names the token the user receives.
  • A test for each, failing on next.

Model: opus-5-5

Seen by the review of https://git.eeqj.de/sneak/AutistMask/pulls/640. ## Where The swap decoder, the `UNWRAP_WETH` branch of `decode()` in `src/shared/uniswap.js`. ## What happens Each of these routes shows the swap's WETH minimum as a `Min. received` in ETH, though less than that may arrive as ETH: - a step between the swap and the `UNWRAP_WETH` pays out part of the router's WETH (a `TRANSFER` of a stated amount, a `PAY_PORTION`); - a `WRAP_ETH` into the router after the swap's WETH was paid out, then an `UNWRAP_WETH`; - an `UNWRAP_WETH` into the router, then a `WRAP_ETH` of all of its ETH to the user (the user receives WETH, and the screen names ETH). ## What should happen `Min. received` never states more than the calldata guarantees, and the screen never names a token the user does not receive: where part of the swap's WETH may not reach the `UNWRAP_WETH`, no ETH minimum is shown, and the token named is the one the last step pays the user. Severity: minor ## Definition of done - [ ] Each route above shows no ETH minimum larger than guaranteed and names the token the user receives. - [ ] A test for each, failing on `next`. Model: opus-5-5
clawbot self-assigned this 2026-10-20 14:55:03 +02:00
Author
Collaborator

Plan: one PR to next, in the UNWRAP_WETH branch of decode() in src/shared/uniswap.js, extending the rule #640 put there. The output side reads ETH with its minimum only when the decoder can tell that all the WETH of the step that set the output side is still in the router when the UNWRAP_WETH runs; any step between them that may pay out or add to the router's WETH (a TRANSFER of a stated amount, a PAY_PORTION, a WRAP_ETH into the router) leaves ETH with no minimum. An UNWRAP_WETH into the router followed by a WRAP_ETH of all of its ETH to the user reads as WETH paid to the user. Tests for each route in the issue, failing on next; every other route reads as on next; README Display Consistency matches.

Model: opus-5-5

Plan: one PR to `next`, in the `UNWRAP_WETH` branch of `decode()` in `src/shared/uniswap.js`, extending the rule https://git.eeqj.de/sneak/AutistMask/pulls/640 put there. The output side reads ETH with its minimum only when the decoder can tell that all the WETH of the step that set the output side is still in the router when the `UNWRAP_WETH` runs; any step between them that may pay out or add to the router's WETH (a `TRANSFER` of a stated amount, a `PAY_PORTION`, a `WRAP_ETH` into the router) leaves ETH with no minimum. An `UNWRAP_WETH` into the router followed by a `WRAP_ETH` of all of its ETH to the user reads as WETH paid to the user. Tests for each route in the issue, failing on `next`; every other route reads as on `next`; README Display Consistency matches. Model: opus-5-5
Author
Collaborator

Built in #645: the first two routes now read ETH with no minimum, and the third reads WETH with no minimum.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/AutistMask/pulls/645: the first two routes now read ETH with no minimum, and the third reads WETH with no minimum. 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#642