getVotesPerPeriod() is incorrectly implemented to be equivalent to getPoolVotesPerPeriod().
Vulnerability Detail
getVotesPerPeriod() should return the number of votes casted in a given period. However, it additionally takes in a pool parameter, making it equivalent to getPoolVotesPerPeriod(). There is an unused private mapping _poolVotesPerPeriod that seems to be intended to be used for this purpose.
Lone Opaque Mustang
Low/Info
Incorrect
getVotesPerPeriod()
implementationSummary
getVotesPerPeriod()
is incorrectly implemented to be equivalent togetPoolVotesPerPeriod()
.Vulnerability Detail
getVotesPerPeriod()
should return the number of votes casted in a given period. However, it additionally takes in apool
parameter, making it equivalent togetPoolVotesPerPeriod()
. There is an unused private mapping_poolVotesPerPeriod
that seems to be intended to be used for this purpose.Impact
Inconvenience to storage state access.
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/Voter.sol#L324-L326 https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/Voter.sol#L44-L45
Tool used
Manual Review
Recommendation
Incorporate vote tracking per period in
_poolVotesPerPeriod
for use ingetVotesPerPeriod()
.