This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
Clean up vesting reward use in miner tests #1251
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anorth
force-pushed
the
anorth/prefactor
branch
from
October 14, 2020 02:22
e90293d
to
baf154a
Compare
6 tasks
Codecov Report
@@ Coverage Diff @@
## master #1251 +/- ##
======================================
Coverage 70.3% 70.3%
======================================
Files 72 72
Lines 7169 7169
======================================
Hits 5046 5046
Misses 1306 1306
Partials 817 817 |
ZenGround0
approved these changes
Oct 14, 2020
@@ -1307,7 +1308,7 @@ func TestCCUpgrade(t *testing.T) { | |||
oldPower := miner.QAPowerForSector(actor.sectorSize, oldSector) | |||
expectedFee := miner.PledgePenaltyForContinuedFault(actor.epochRewardSmooth, actor.epochQAPowerSmooth, oldPower) | |||
expectedPowerDelta := miner.NewPowerPairZero() | |||
actor.applyRewards(rt, expectedFee, big.Zero()) | |||
actor.applyRewards(rt, bigRewards, big.Zero()) |
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.
Non-blocking -- I think the use of applyRewards to set up test state for penalization is wrong. This PR solves the problem at hand but the brittleness from relying on the production reward function won't go away.
repaidFeeDebt abi.TokenAmount | ||
continuedFaultsPenalty abi.TokenAmount // Expected amount burnt to pay continued fault penalties. | ||
repaidFeeDebt abi.TokenAmount // Expected amount burnt to repay fee debt. | ||
penaltyFromUnlocked abi.TokenAmount // Expected reduction in unlocked balance from penalties exceeding vesting funds. |
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.
❤️
acruikshank
approved these changes
Oct 14, 2020
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.
Definitely an improvement.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Miner tests almost all apply some rewards to a miner actor from which penalties will be paid, both because this is the usual, expected case and also makes the delta easy to explicitly test. However, they didn't previously support part of the penalty coming from unlocked balance (after the vesting funds are exhausted).
This PR:
bigRewards
number to use as a constant value for rewards that are used only as a target for penalties, replacing a bunch of ad-hoc constantspenaltyFromUnlocked
to the cron config, supporting some or all penalty being paid from unlocked fundsThis is intended as a prefactor to #1249. Once rebased upon this PR, most of the delta to miner tests can disappear. Only that part related to the changed vesting schedule remains.
This PR changes tests only.