Solidity functions declared as internal view returns (uint256) should pass their return values through the stack to callers. However, totalSupply_() uses inline assembly to directly execute return(0x00, 0x20), which terminates the current execution context and returns raw memory data, bypassing Solidity's standard return mechanism. When called by other Solidity functions (e.g., totalSupply() public calling totalSupply_()), callers fail to receive the correct return value, instead getting undefined/zero values, causing logic errors.
Likelihood:
Currently not triggered as the contract doesn't internally call this function; however, its internal visibility makes it vulnerable if extended/reused (e.g., in child contracts or new features)
Developers may mistakenly assume it behaves like standard Solidity functions, using it in composite logic (e.g., adding virtual supplies, snapshots)
Impact:
Caller functions cannot obtain correct _totalSupply values, potentially causing persistent zero/random results
If used in critical logic (token distribution, staking ratios, governance weights), could lead to fund misallocation or protocol state inconsistencies
If future contract ERC20 implements:
Due to the return value issue in totalSupply_(), totalSupply() will permanently lose the + virSupply addition.
Add test to Token.t.sol:
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.