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

test: more incentive test flows #2124

Closed
wants to merge 30 commits into from
Closed

test: more incentive test flows #2124

wants to merge 30 commits into from

Conversation

toteki
Copy link
Member

@toteki toteki commented Jun 30, 2023

Additional reward calculation and timing scenarios as requested

@codecov
Copy link

codecov bot commented Jun 30, 2023

Codecov Report

Merging #2124 (866ad31) into main (7f05ad4) will decrease coverage by 0.91%.
The diff coverage is 77.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2124      +/-   ##
==========================================
- Coverage   75.38%   74.48%   -0.91%     
==========================================
  Files         100      127      +27     
  Lines        8025     9968    +1943     
==========================================
+ Hits         6050     7425    +1375     
- Misses       1589     2039     +450     
- Partials      386      504     +118     
Impacted Files Coverage Δ
ante/spam_prevention.go 75.92% <ø> (ø)
x/incentive/codec.go 47.82% <ø> (+9.89%) ⬆️
x/incentive/keeper/invariants.go 0.00% <0.00%> (ø)
x/leverage/client/tests/suite.go 100.00% <ø> (ø)
x/leverage/client/tests/tests.go 100.00% <ø> (ø)
x/leverage/keeper/borrows.go 75.93% <ø> (-2.64%) ⬇️
x/leverage/keeper/collateral.go 72.72% <ø> (-0.16%) ⬇️
x/leverage/keeper/errors.go 100.00% <ø> (ø)
x/leverage/keeper/exchange_rate.go 72.72% <ø> (ø)
x/leverage/keeper/genesis.go 87.23% <ø> (ø)
... and 60 more

... and 29 files with indirect coverage changes

@toteki toteki marked this pull request as ready for review June 30, 2023 14:53
@toteki toteki requested a review from a team as a code owner June 30, 2023 14:53
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

  • program can have leftovers if there are people who are not bonded by the end of the program. As discussed - recovering the leftovers is not a blocker for the release, but must be documented and scheduled for the next release
  • documentation: we need to clearly document what is happening when there is a gap in bonding, and when leftovers are produced
  • New Test case is needed:
    • alice and bob joins before the program. Alice bonds 3x what bob bonds
    • alice exits at 20% of the time
    • bob exits at 30% of the time
    • bob rejoins at 50% of the time and stays till the end.
    • expected rewards (T = total rewards of the program):
      • alice = T*20%*3/4
      • bob = T - alice_rewards
      • so all rewards are distributed, there are no leftovers

util/coin/fixtures.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
toteki and others added 4 commits July 7, 2023 10:12
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
@toteki
Copy link
Member Author

toteki commented Jul 7, 2023

Added the final test scenario

There is also documentation (in the EndBlocker functions) about what happens in the zero-bonded edge case, which I have highlighted in the diff by adding more.

@toteki toteki requested a review from a team as a code owner July 7, 2023 22:17
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

Few final comments to improve the test.
Overall good job. Thanks @toteki and @EbrahimUmee for getting this test suite to the finish line.

x/incentive/README.md Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Outdated Show resolved Hide resolved
x/incentive/keeper/scenario_test.go Show resolved Hide resolved
@robert-zaremba
Copy link
Member

let's make sure to fill checkboxes before merging: #2124 (review)

@robert-zaremba
Copy link
Member

Let's move this PR to the finish line. There are few open comments which have to be solved.

@toteki
Copy link
Member Author

toteki commented Jul 11, 2023

Resolved all issues, but need to redo PR due to unsigned commits

#2141

@robert-zaremba
Copy link
Member

replaced by: #2124

@robert-zaremba robert-zaremba deleted the adam/test branch July 11, 2023 20:20
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