winner:BriVault state variable should be made private as the contract uses a getWinner function, therefore increasing the gas fee.In the BriVault contract, the visibility specifier for winner state variable is public.
The contract uses a getWinner function, which returns the value of winner state variable.
Use of public specifier for a state variable also creates a view function, but the view function is already there for winner public variable (i.e. getWinner).
Making the variable winner private will reduce the gas price and hence optimize the code.
Likelihood: Low
Impact: Low
A user who wants to see the winner, actually has 2 options:
1.) call the getWinner function
2.) call the winner function (as it's declared public).
Hence, it is just a waste of gas, therefore winner should be made private .
It is best recommended to change the visibility specifier for winner from public -> private
Gas optimizations are invalid according to the CodeHawks documentation.
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.