The reviewCount
state variable in the LevelOne contract is declared but never initialized before being used in the contract logic.
Slither detected that the reviewCount
state variable at line 48 of LevelOne.sol is never initialized but is used in the giveReview
function (lines 277-293). In Solidity, uninitialized state variables default to zero values (0 for integers, false for booleans, address(0) for addresses, etc.). When contract logic relies on these variables having specific initial values, using them without proper initialization can lead to unexpected behavior.
Medium. If the contract's logic depends on reviewCount
having a specific non-zero initial value, the contract may operate incorrectly from the start. This could lead to logical errors in the review system implementation, potentially affecting user experience, data integrity, or even financial operations if the review system is tied to rewards or penalties.
Slither static analysis tool
Initialize the reviewCount
variable in the contract's constructor or in the initialize function for upgradeable contracts.
Add a check in the giveReview
function to ensure reviewCount
has a valid value before use.
Consider implementing a migration function if this issue exists in a deployed contract to explicitly set the correct value.
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.