I'm going over some protocol contracts, and I've seen they check pretty obvious math operations with a require() statement. This contract uses solidity 0.8.11
uint256 id = vaultCount;
vaultCount = vaultCount + 1;
require(vaultCount >= id);
What is the reason for this? I understand that this was needed before 0.8 due to under and overflows. But why is it needed now?
vaultCount + 1
could cause an overflow, but that should be covered by solc 0.8. Perhaps they upgraded from a previous version and didn't remove the unnecessary code.