Skip to content

fix(token-analyzer): handle USDT-style approve without bool return in token analyzer#1065

Open
mev15 wants to merge 1 commit into
propeller-heads:mainfrom
mev15:fix/usdt-approve-bool-decode
Open

fix(token-analyzer): handle USDT-style approve without bool return in token analyzer#1065
mev15 wants to merge 1 commit into
propeller-heads:mainfrom
mev15:fix/usdt-approve-bool-decode

Conversation

@mev15
Copy link
Copy Markdown

@mev15 mev15 commented Jun 4, 2026

Problem

The eth_call token analyzer misclassifies USDT (and any token whose approve() omits the bool return) as Bad. Forwarder.forwardApprove used a typed call IERC20(token).approve(...), which requires a 32-byte bool return. USDT's approve() returns no data, so ABI decoding reverts; the Analyzer's try/catch sets approvalOk = false and the token is reported Bad ("Approval of U256::MAX failed"). forwardTransfer already used a low-level call for this exact reason — only forwardApprove was inconsistent.

Fix

  • forwardApprove: use a low-level call that tolerates an empty return, mirroring forwardTransfer.
  • Recompile the Forwarder runtime bytecode and update FORWARDER_BYTECODE (solc 0.8.34 --bin-runtime --via-ir --optimize --optimize-runs 200 --no-cbor-metadata --evm-version berlin, matching the documented build in bytecode.rs).
  • Add a USDT integration test.

Verification

Before the fix the new test fails at the approve step:

test_detect_impl_usdt ... FAILED
< Bad { reason: "Approval of U256::MAX failed" }
> Good

After the fix it passes; USDC/WETH analysis is unchanged. forge-recompiled bytecode matches the committed FORWARDER_BYTECODE byte-for-byte.

🤖 Generated with Claude Code

Forwarder.forwardApprove used a typed call requiring a 32-byte bool return, but USDT's approve() returns no data, so ABI decoding reverted: approvalOk became false and USDT was misclassified as Bad. Use a low-level call tolerating an empty return (mirroring forwardTransfer), recompile FORWARDER_BYTECODE, and add a USDT integration test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to Todo in Tycho Jun 4, 2026
@mev15 mev15 changed the title fix: handle USDT-style approve without bool return in token analyzer fix(token-analyzer): handle USDT-style approve without bool return in token analyzer Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant