You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.
sherlock-admin opened this issue
Mar 13, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
_rewardDiff is calculated based on the cumulativeTauRewardPerCollateral. Since TAU is 18 decimals, _rewardDiff is 18 decimals. Constants.PRECISION is 18 decimals as well, and hence the resulting computation of _tauEarned will be based on the number of decimals of _userCollateral.
However, correct decimals for _tauEarned should be 18 as TAU token is 18 decimals. Subsequent computations based on either an inflated or deflated value of _tauEarned will break the protocol.
Impact
Protocol cannot function correctly if collateral used is not 18 decimals.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
yixxas
high
Rewards are updated wrongly if collateral is not 18 decimals
Summary
The calculation of
tauEarned
inupdateReward
is incorrect when collateral used is not 18 decimals. This can critically break the protocol.Vulnerability Detail
This is how
_tauEarned
is calculated inupdateReward
_rewardDiff
is calculated based on the cumulativeTauRewardPerCollateral. Since TAU is 18 decimals,_rewardDiff
is 18 decimals.Constants.PRECISION
is 18 decimals as well, and hence the resulting computation of_tauEarned
will be based on the number of decimals of_userCollateral
.However, correct decimals for
_tauEarned
should be 18 as TAU token is 18 decimals. Subsequent computations based on either an inflated or deflated value of_tauEarned
will break the protocol.Impact
Protocol cannot function correctly if collateral used is not 18 decimals.
Code Snippet
https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/Vault/BaseVault.sol#L90
Tool used
Manual Review
Recommendation
Consider dividing by number of decimals of collateral instead of
Constants.PRECISION
Duplicate of #35
The text was updated successfully, but these errors were encountered: