-
Notifications
You must be signed in to change notification settings - Fork 45
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
bonding: Skip fee calculation for voting power #633
Conversation
Pull Request Test Coverage Report for Build 6513140765
💛 - Coveralls |
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.
A few minor nits, but generally looks good and await the updated unit tests (which should also fix converage).
5169752
to
16e8010
Compare
16e8010
to
011c5f3
Compare
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.
Looks like coverage is failing because EarningsPoolLIP36.delegatorCumulativeFees() lacks coverage for initial conditional statements. Those conditionals aren't triggered in tests right now because this function is only ever called by EarningsPoolLIP36.delegatorCumulativeStakeAndFees() which will always initialize _startPool.cumulativeRewardFactor and _endPool.cumulativeRewardFactor if needed before calling delegatorCumulativeFees().
A few options I see to address:
- Write tests for EarningsPoolLIP36.delegatorCumulativeFees()
- Inline the fee calculation from delegatorCumulativeFees() into delegatorCumulativeStakeAndFees() after the call to delegatorCumulativeStake()
@yondonfu added tests to the |
What does this pull request do? Explain your changes. (required)
This fixes a bug observed after deploying the new BondingVotes to production.
It happens when trying to calculate voting power for a delegator whose transcoder hadn't
initialized their
cumulativeFeeFactor
on the corresponding round.This causes the voting power calculation to underflow, because we don't initialize the
cumulativeFeeFactor
of theendPool
likeBondingManager
does. Even though wedon't really care about fees for voting power, the underflow causes a revert on any
transaction that needs to access the delegator votes at the uninitialized round.
Specific updates (required)
delegatorCumulativeStakeAndFees
logic in 2, to allow calculating only stake or only feesHow did you test each of these updates (required)
yarn test
that it didnt change any existing behavior on BondingManagerNew tests on BondingVotes
May do a tenderly fork test before actual deploy
Does this pull request close any open issues?
N/A
Checklist:
yarn test
pass