Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getRewardsAmount might return wrong result #80

Open
code423n4 opened this issue Dec 12, 2021 · 1 comment
Open

getRewardsAmount might return wrong result #80

code423n4 opened this issue Dec 12, 2021 · 1 comment
Assignees
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

certora

Vulnerability details

getRewardsAmount gets epochs ids as uint256[]. However, it should be uint8[].

In _calculateRewardAmount, the epoch start time and end time are calculated:

uint256 _epochStartTimestamp = _promotion.startTimestamp + (_epochDuration * _epochId);
uint256 _epochEndTimestamp = _epochStartTimestamp + _epochDuration;

and then are casted to uint64 for the rest of the function.
if it's greater than 2**64, it will be truncated.

Impact

getRewardsAmount might return wrong result

Tools Used

manual review

Recommended Mitigation Steps

get _epochIds as uint8[] instead uint256[]

@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working labels Dec 12, 2021
code423n4 added a commit that referenced this issue Dec 12, 2021
@PierrickGT PierrickGT self-assigned this Dec 13, 2021
@PierrickGT PierrickGT added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Dec 13, 2021
@PierrickGT
Copy link
Member

Will be fixed with this issue: #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

2 participants