fix(token-analyzer): handle USDT-style approve without bool return in token analyzer#1065
Open
mev15 wants to merge 1 commit into
Open
fix(token-analyzer): handle USDT-style approve without bool return in token analyzer#1065mev15 wants to merge 1 commit into
mev15 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The eth_call token analyzer misclassifies USDT (and any token whose
approve()omits the bool return) as Bad.Forwarder.forwardApproveused a typed callIERC20(token).approve(...), which requires a 32-byte bool return. USDT'sapprove()returns no data, so ABI decoding reverts; the Analyzer's try/catch setsapprovalOk = falseand the token is reported Bad ("Approval of U256::MAX failed").forwardTransferalready used a low-level call for this exact reason — onlyforwardApprovewas inconsistent.Fix
forwardApprove: use a low-level call that tolerates an empty return, mirroringforwardTransfer.FORWARDER_BYTECODE(solc 0.8.34 --bin-runtime --via-ir --optimize --optimize-runs 200 --no-cbor-metadata --evm-version berlin, matching the documented build inbytecode.rs).Verification
Before the fix the new test fails at the approve step:
After the fix it passes; USDC/WETH analysis is unchanged.
forge-recompiled bytecode matches the committedFORWARDER_BYTECODEbyte-for-byte.🤖 Generated with Claude Code