-
Notifications
You must be signed in to change notification settings - Fork 0
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
Internal _withdraw, reading from storage twice. #26
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
G (Gas Optimization)
sponsor disputed
Comments
JasoonS
added
resolved
sponsor confirmed
sponsor disputed
and removed
sponsor confirmed
resolved
labels
Aug 11, 2021
Verdict: given the code this optimization introduces a bug. Final code indeed only reads |
I am not sure where the divergence in code is here but the line that was reference by the warden is
where the _mintAccumulatedFloat does not modify the userAmountStaked. Given this information, I am reopening the issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
G (Gas Optimization)
sponsor disputed
Handle
evertkors
Vulnerability details
Impact
userAmountStaked[token][msg.sender]
is read from storage twice on Staker.sol:925Recommended Mitigation Steps
uint256 amountUser = userAmountStaked[token][msg.sender]
require(amountUser > 0, "nothing to withdraw")
_mintAccumulatedFloat(marketIndex, msg.sender);
userAmountStaked[token][msg.sender] = amountUser - amount
The text was updated successfully, but these errors were encountered: