-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fix get-entitled-stacking-reward to pass value after shutdown #200
Conversation
This commit can be reverted or the changes removed when done, but will show that both the core-v2 tests still pass after the change, and adds a new test to ensure both CityCoins and STX are transferred when claiming in the current cycle. This will also provide an artifact of the testing with the related github action.
Codecov Report
@@ Coverage Diff @@
## develop #200 +/- ##
========================================
Coverage 98.39% 98.39%
========================================
Files 22 22
Lines 4416 4418 +2
========================================
+ Hits 4345 4347 +2
Misses 71 71
Continue to review full report at Codecov.
|
In commit 1ac3984 we can see that if we apply the changes to the core-v1 contracts, the tests show that both STX/CityCoins are returned after a contract shutdown, and all other tests continue to operate as expected. This should be safe to merge in before the next deployment! Will revert these changes to v1 contracts but leave them in V2 on the next commit, then PR will be ready for review. From the related GitHub Action to the changes in 859791b and 1ac3984: MIA Referencecontracts/contracts/cities/mia/local/miamicoin-core-v1.clar Lines 633 to 641 in 1ac3984
contracts/tests/cities/mia/upgrade/miamicoin-core-v1-v2.test.ts Lines 427 to 450 in 1ac3984
NYC Referencecontracts/contracts/cities/nyc/local/newyorkcitycoin-core-v1.clar Lines 637 to 645 in 1ac3984
contracts/tests/cities/nyc/upgrade/newyorkcitycoin-core-v1-v2.test.ts Lines 427 to 450 in 1ac3984
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! 🥇
This PR fixes #196 by adding an extra check to calculate the reward if the contract is shut down.
The logic here is that after a shutdown call is made, mining/stacking are immediately disabled. This means the cycle is effectively over as no new contributions will be made to stackers.
Because of that, after an upgrade, stackers should be able to claim their CityCoins and their portion of the STX contributed by miners within that cycle.
It's a simple change, but was hard to test given our configuration and is something we'll have to revisit for future upgrade tests.