The veRAACToken.sol
contract contains two functions named getVotingPower
:
getVotingPower(address account)
: Returns the current voting power for an account.
getVotingPower(address account, uint256 timestamp)
: Returns the voting power for an account at a specific timestamp.
Additionally, the internal functions calculatePowerAtTimestamp
and getCurrentPower
appear to perform similar calculations, but there is no clear distinction between their use cases. This creates confusion for developers and users, as it is unclear which function to use in a given scenario. Furthermore, the overlapping logic in these functions suggests potential redundancy or inconsistency in the implementation.
Ambiguous Function Naming:
The two external functions share the same name (getVotingPower
), making it unclear which one to use in a given scenario.
The internal functions calculatePowerAtTimestamp
and getCurrentPower
also appear to perform similar calculations, but there is no clear distinction between their use cases.
Overlapping Logic:
Both calculatePowerAtTimestamp
and getCurrentPower
calculate voting power by applying time-based decay to a user's voting power. However, the logic is not consistent:
calculatePowerAtTimestamp
returns 0
if timestamp < point.timestamp
.
getCurrentPower
returns point.bias
if timestamp < point.timestamp
.
This inconsistency could lead to incorrect results depending on which function is used.
Lack of Clarity:
There is no clear guidance on when to use calculatePowerAtTimestamp
versus getCurrentPower
. This could lead to developers using the wrong function, resulting in incorrect voting power calculations.
Manual Review
Rename External Functions:
Rename getVotingPower(address account)
to getCurrentVotingPower(address account)
.
Rename getVotingPower(address account, uint256 timestamp)
to getVotingPowerAtTimestamp(address account, uint256 timestamp)
.
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.