The _balanceOf() and _allowance() functions revert when queried with zero address instead of returning 0.
Standard ERC20 implementations return 0 for these edge cases.
Likelihood:
Protocols querying balanceOf(address(0)) for burn tracking will fail
Some integrations check zero address allowances
Impact:
Breaks compatibility with protocols expecting standard behavior
View functions should not revert on valid (if unusual) inputs
No direct fund loss, but integration failures possible
These tests confirm that querying balance or allowance with zero address causes a revert rather than returning 0. Some protocols use balanceOf(address(0)) to track burned tokens (tokens sent to the zero address). This non-standard behavior breaks such integrations.
Place these tests in test/ViewFunctionsRevertPOC.t.sol and run with forge test --match-contract ViewFunctionsRevertPOC -vv:
Instead of reverting when the zero address is passed, return 0. This matches OpenZeppelin's behavior and maintains compatibility with protocols that may query these edge cases. The zero address cannot hold tokens or have allowances, so returning 0 is semantically correct.
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.
The contest is complete and the rewards are being distributed.