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

Invalid equation check on require #2

Open
code423n4 opened this issue Nov 25, 2021 · 1 comment
Open

Invalid equation check on require #2

code423n4 opened this issue Nov 25, 2021 · 1 comment
Labels
bug Something isn't working G (Gas Optimization) sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Handle

hagrid

Vulnerability details

The withdraw(uint256 rewardAmount) function on the AbstractRewardMine contract is wrongly controlling the reward amount.

Impact

Using the withdraw function instead of withdrawAll function will cost nearly same gas amount since these functions are nearly identical.

Proof of Concept

Tools Used

Manual Review

Recommended Mitigation Steps

require(rewardAmount <= rewardEarned, "< earned");
The require function above should be replaced with:
require(rewardAmount < rewardEarned, "< earned");

Else, both withdraw functions will be nearly identical.

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Nov 25, 2021
code423n4 added a commit that referenced this issue Nov 25, 2021
@0xScotch 0xScotch added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Dec 8, 2021
@GalloDaSballo
Copy link
Collaborator

I agree with the warden that withdrawAll is basically the same as withdraw
withdraw could be made public and reused in withdrawAll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization) sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

3 participants