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
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
Let's suppose rewardData.duration is 1 week = 604800 seconds. When notifyRewardAmount is called If reward token is WBTC which has 8 decimals, up to 604799 / 1e8 WBTC can be lost (as if the amount was 604799 less). 604799 / 1e8 WBTC = 0.006 WBTC = 400 USD lost to precision loss. This 400 USD then cannot be distributed to stakers.
Internal pre-conditions
WBTC used
External pre-conditions
n/a
Attack Path
n/a
Impact
Precision loss of 400 USDC
PoC
No response
Mitigation
Store the rewardRate scaled by 1e18, so loss of precision will be lower by magnitude of 1e18.
sherlock-admin2
changed the title
Shambolic Iron Shetland - Precision loss when calculating rewardData.rate
HaxSecurity - Precision loss when calculating rewardData.rate
Aug 9, 2024
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
HaxSecurity
Medium
Precision loss when calculating rewardData.rate
Summary
Precision loss when calculating rewardData.rate
Root Cause
In function below precision loss can occur:
https://github.com/sherlock-audit/2024-07-exactly-stacking-contracts/blob/main/protocol/contracts/StakedEXA.sol#L213
Let's suppose rewardData.duration is 1 week = 604800 seconds. When
notifyRewardAmount
is called If reward token is WBTC which has 8 decimals, up to 604799 / 1e8 WBTC can be lost (as if the amount was 604799 less). 604799 / 1e8 WBTC = 0.006 WBTC = 400 USD lost to precision loss. This 400 USD then cannot be distributed to stakers.Internal pre-conditions
WBTC used
External pre-conditions
n/a
Attack Path
n/a
Impact
Precision loss of 400 USDC
PoC
No response
Mitigation
Store the rewardRate scaled by 1e18, so loss of precision will be lower by magnitude of 1e18.
Duplicate of #96
The text was updated successfully, but these errors were encountered: