Normal error handling in ERC20 implementations should provide specific error selectors to distinguish between different failure modes. The _allowance() function in Token-0x's base implementation uses a generic revert(0, 0) for both invalid owner and invalid spender addresses, making it impossible to determine which parameter caused the validation failure.
Other functions like _approve() correctly use specific error selectors from IERC20Errors , but _allowance() fails to follow this pattern .
Likelihood:
Every call to allowance() with zero addresses triggers this ambiguous error
DeFi integrations that need to handle different error types cannot distinguish failures
Any frontend or contract interacting with the token will experience this ambiguity
Impact:
Poor debugging experience - developers cannot identify which parameter is invalid
Frontend error handling becomes generic and unhelpful for users
Smart contract integrations cannot implement different logic for different error types
The test demonstrates that both invalid owner and invalid spender addresses produce identical generic reverts. This makes it impossible for callers to determine whether the owner or spender parameter caused the failure, forcing them to treat all validation failures identically.
Replace the generic revert with specific error selectors that match the IERC20Errors interface. This allows callers to distinguish between invalid owner and invalid spender errors, enabling proper error handling and debugging.
accounting related issue in token-0x
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.