Closed sherlock-admin2 closed 1 year ago
2 comment(s) were left on this issue during the judging contest.
panprog commented:
invalid, because lack of updateUserState doesn't influence overall reward rate. And overall pool state (updatePoolState) is correct, because transferring some shares to couriers doesn't change totalSupply
MohammedRizwan commented:
invalid issue seems intended design
feelereth
medium
Skipping rewards accounting for couriers does reduce the effective rewards rate for other users
Summary
Rewards accounting is skipped for couriers. This reduces the effective rewards rate for other users.
Vulnerability Detail
The lack of proper rewards accounting for couriers does reduce the effective rewards rate for other users. Here is a detailed explanation: The key code sections are:
In _mint():
In _burn():
In _transfer():
The issue is that rewards accounting is properly tracked for normal users via the Rewards.updateUserState() calls in _transfer(). However, for couriers, the rewards accounting is skipped in _mint() and _burn(). This means that as fees are transferred from users to couriers, the rewards owed to couriers are not properly tracked. Over time, this results in the total rewards owed diverging from the total rewards being tracked and paid out. Specifically, rewards owed will be higher than tracked rewards. Since the total rewards rate and payouts are based on the tracked rewards, this effectively reduces the rewards rate for other users.
Impact
It reduces the effective rewards rate for other users. Over time, as fees are transferred from users to couriers, the rewards owed to couriers will diverge from the rewards being tracked and paid out. Specifically, rewards owed will be higher than tracked rewards.
Since the total rewards rate and payouts are based on the tracked rewards, skipping accounting for couriers means the effective rewards rate will be lower than the configured rate.
Code Snippet
https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Lender.sol#L517-L519 https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Lender.sol#L415-L421
Tool used
Manual Review
Recommendation
Rewards accounting should also be done for couriers. A suggestive example:
In _mint():
In _burn():
This ensures proper tracking of rewards owed to couriers, maintaining the effective rewards rate for all users.
Duplicate of #115