Skip to content
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

[audit] 1. Rewards are lost if the distribution is funded after the expiry #862

Merged
merged 2 commits into from
Aug 11, 2024

Conversation

NoahSaso
Copy link
Member

@NoahSaso NoahSaso commented Aug 2, 2024

From Oak:

In contracts/distribution/dao-rewards-distributor/src/contract.rs:303, the execute_fund function restarts the distribution if it is not continuous and already expired at the current block. This is problematic because the rewards that accrued from the last updated timestamp (active_epoch.last_updated_total_earned_puvp) to the ending timestamp (active_epoch.ends_at) will be lost.
Consequently, stakers will not receive the rewards for the staking period, causing a loss of rewards.

This fix ensures rewards are calculated and stored before restarting the distribution so they are not lost.

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 99.31507% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.65%. Comparing base (75272b9) to head (029f9a8).

Files Patch % Lines
...stribution/dao-rewards-distributor/src/contract.rs 98.41% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           development     #862    +/-   ##
=============================================
  Coverage        96.64%   96.65%            
=============================================
  Files              240      240            
  Lines            65294    65427   +133     
=============================================
+ Hits             63106    63236   +130     
- Misses            2188     2191     +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…eviously expired discontinuous linear distribution
Copy link
Collaborator

@bekauz bekauz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just one nit about naming

@bekauz bekauz merged commit c082711 into development Aug 11, 2024
9 checks passed
@bekauz bekauz deleted the noah/rewards-audit-fix-1 branch August 11, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants