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

feat: improve invariant checks and tests #171

Closed
dongsam opened this issue Oct 15, 2021 · 2 comments · Fixed by #186
Closed

feat: improve invariant checks and tests #171

dongsam opened this issue Oct 15, 2021 · 2 comments · Fixed by #186
Assignees
Labels
test and simulation test and simulation

Comments

@dongsam
Copy link
Contributor

dongsam commented Oct 15, 2021

Summary

Improve and add invariants for farming module.

Proposal

Let's first come up with what invariant checks the farming module needs and implement those afterwards.

Tasks

  • Add test cases to cover those invariants
  • Add, Improve invariants in farming module

References


@dongsam dongsam added the test and simulation test and simulation label Oct 15, 2021
@dongsam dongsam added this to the Farming F1 v1.0 milestone Oct 19, 2021
@hallazzang
Copy link
Contributor

I propose these invariants for the farming module:

  • The balance of StakingReserveAcc must be greater or equal than coins in all Stakings and QueuedStakings.
  • The balance of RewardsReserveAcc must be greater or equal than total rewards calculated by WithdrawRewards.
  • The balance of RewardsReserveAcc must be greater or equal than coins in all OutstandingRewards.
  • Plans that should have been terminated should be marked as terminated.
  • HistoricalRewards must not have negative CumulativeUnitRewards.
  • OutstandingRewards must not have negative Rewards.
  • TotalStakings must not have negative Amount.
  • Staking and QueuedStaking must not have negative Amount.

@hallazzang
Copy link
Contributor

hallazzang commented Oct 21, 2021

Additional invariants:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test and simulation test and simulation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants