Unused Error Declaration Increases Code Size and Reduces Code Quality
In the TokenDivider smart contract, there is an unused error declaration TokenDivier__InvalidAmount()
which not only increases the contract's bytecode size unnecessarily but also has a typo in its name ("TokenDivier" instead of "TokenDivider"). Unused code declarations in smart contracts are considered poor practice as they can lead to confusion, and increase gas costs during deployment.
A grep or search through the entire codebase shows that TokenDivier__InvalidAmount()
is never used in any revert statement. Instead, amount validations use other error declarations like TokenDivider__AmountCantBeZero()
, making this declaration redundant.
The presence of this unused error has several negative implications:
Increased deployment gas cost due to unnecessary bytecode
Reduced code quality and maintainability
Potential confusion for auditors and developers who may spend time trying to understand where this error is used
The typo in the name could lead to further confusion if someone attempts to use this error in future code additions
May indicate missing validation logic that was intended but never implemented
Foundry
Remove the unused error declaration to improve code quality and reduce deployment gas costs:
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.