-
Notifications
You must be signed in to change notification settings - Fork 11
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
claimGaugeRewards - users who have not yet apply loss still can receive new rewards #262
Comments
0xSorryNotSorry marked the issue as sufficient quality report |
0xSorryNotSorry marked the issue as primary issue |
eswak (sponsor) acknowledged |
eswak marked the issue as disagree with severity |
The call to This likely won't be mitigated, and I'd qualify this as a Low given the low impact to users (minor rewards difference) and the likeliness of the situation (unlikely that no slashing is performed by other users given that the calls are permissionless). |
Trumpero changed the severity to QA (Quality Assurance) |
Trumpero marked the issue as grade-a |
Trumpero marked the issue as grade-b |
Hello, @Trumpero, We would like to dispute the statement of the judge and reconsideration of the validity:
This won’t be the case because there is a direct reward for the user who slashed another user:
Even if we take the scenario when a user is being slashed days by someone after bad debt occurred in the system and then |
@Slavchew Regarding the sponsor's comment, reward distribution of protocol is intended to be a game between users. They can follow and slash each other, so I believe it's a fair situation. New stakers will have motivation to slash the old stakers, and slashed users won't receive rewards (because their gauge weight become 0) until they increment their gauge back. Therefore, I don't consider this issue as a loss of yield or loss of rewards, it should be a QA/info issue. |
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/tokens/GuildToken.sol#L133
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/ProfitManager.sol#L409
Vulnerability details
Impact
Users who potentially lost weight due to the gauge loss is able to claim newly minted rewards after the loss occurs.
Proof of Concept
If a user has a loss on a gauge they have invested in, they will not be able to interact with that gauge until the loss has been applied by
applyGaugeLoss
.If there is a loss, user needs to call
applyGaugeLoss
to reset the weight assigned to that gauge, and burn as many Guild tokens as the weight assigned. This means that the loss is not immediately reflected in, and someone needs to callapplyGaugeLoss
to apply it.However,
ProfitManager.claimGaugeRewards
does not take into account the loss to calculate how much reward the user can receive.Therefore, if a loss occurs, user can call the ProfitManager's
claimRewards
orclaimGaugeRewards
function directly without callingapplyGaugeLoss
to receive the new reward using the old weight.This is PoC. Add it to GuildToken.t.sol.
Tools Used
Manual Review
Recommended Mitigation Steps
Users should be able to claim their rewards up to the time of the loss, but not any new rewards earned after the loss. Each change in reward and loss should recorded as checkpoint-style, and users in a loss state can only claim rewards for last received~closest loss.
Assessed type
Other
The text was updated successfully, but these errors were encountered: