Functions in the contract are not properly marked with the correct state mutability modifiers (view, pure), leading to higher gas costs and potential state modifications in what should be read-only functions.
In NonOptimizedContract
, a function that should be read-only modifies state:
Test results show:
Soit une différence de ~22,000 gas !
Low severity because:
Significant gas cost (~4x more gas)
Possible unintentional state modifications
Risk of unexpected behaviors for integrators who assume the function is read-only
Tests demonstrate that state can be modified when it shouldn't be
Slither static analyzer
Gas comparative testing
State modification tests
Manual code review
Use appropriate modifiers:
Check all functions and add view
or pure
when possible
Implement specific tests to verify that no view
function modifies state
Consider using static analysis tools to automatically detect these issues
This vulnerability demonstrates the importance of proper state mutability declarations and their impact on both gas costs and contract behavior predictability.
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.