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

Add unclaimed reward invariant test #80

Merged
merged 4 commits into from
Feb 19, 2025

Conversation

garyghayrat
Copy link
Collaborator

closes #15

@garyghayrat garyghayrat force-pushed the test/add-sum-of-rewards-invariant branch from 54da214 to 738740b Compare February 12, 2025 19:25
@garyghayrat garyghayrat marked this pull request as ready for review February 12, 2025 20:44
Copy link
Collaborator

@apbendi apbendi left a comment

Choose a reason for hiding this comment

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

Looks great @garyghayrat. One nit on naming, but we can merge after fixing!

@@ -77,6 +77,13 @@ contract StakerInvariants is Test {
);
}

function invariant_Sum_of_unclaimed_reward_should_be_less_than_or_equal_to_total_rewards() public {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should consider extending the last part of the name for clarity: _total_rewards_balance(). Saying simply "total rewards" makes it sound like it could mean all rewards ever.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

renamed in 8d2844e

Copy link

Coverage after merging test/add-sum-of-rewards-invariant into main will be

98.41%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   DelegationSurrogate.sol100%100%100%100%
   DelegationSurrogateVotes.sol100%100%100%100%
   Staker.sol98.48%100%97.22%98.58%297–299
src/calculators
   BinaryEligibilityOracleEarningPowerCalculator.sol100%100%100%100%
   IdentityEarningPowerCalculator.sol100%100%100%100%
src/extensions
   StakerCapDeposits.sol100%100%100%100%
   StakerDelegateSurrogateVotes.sol87.50%50%100%90.91%27–28
   StakerOnBehalf.sol100%100%100%100%
   StakerPermitAndStake.sol76.47%0%100%76.92%21–22, 50, 78
src/notifiers
   MintRewardNotifier.sol100%100%100%100%
   RewardTokenNotifierBase.sol100%100%100%100%
   TransferFromRewardNotifier.sol100%100%100%100%
   TransferRewardNotifier.sol100%100%100%100%

@garyghayrat garyghayrat merged commit 7098d7c into main Feb 19, 2025
6 checks passed
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.

Rewrite "sum of rewards" invariant
2 participants