-
Notifications
You must be signed in to change notification settings - Fork 72
rewards_per_chain should not depend on chains without collators #1412
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
base: master
Are you sure you want to change the base?
Conversation
WASM runtime size check:Compared to target branchdancebox runtime: 1900 KB (+4 KB) flashbox runtime: 1128 KB (no changes) ✅ dancelight runtime: 2668 KB (+12 KB) 🚨 starlight runtime: 2580 KB (+12 KB) 🚨 container chain template simple runtime: 1472 KB (no changes) ✅ container chain template frontier runtime: 1832 KB (no changes) ✅ |
Coverage Report@@ Coverage Diff @@
## master tomasz-inflation-only-chains-with-collators +/- ##
===============================================================================
+ Coverage 71.03% 71.31% +0.28%
Files 550 550
+ Lines 75341 76090 +749
===============================================================================
+ Hits 53516 54262 +746
+ Misses 21825 21828 +3
|
…ly-chains-with-collators
…ly-chains-with-collators
…ly-chains-with-collators
|
|
||
| let all_rewards = RewardsPortion::get() * summary.inflation; | ||
| // rewards are shared between the 2 paras | ||
| let orchestrator_rewards = all_rewards / 2; |
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.
This is actually the collator reward and not the orchestrator one right? The name confused me a bit initially.
| const expectedOrchestratorReward = chainRewards / 3n; | ||
| const reward = await filterRewardFromOrchestrator(events, account); | ||
| expect(reward).to.equal(expectedOrchestratorReward); | ||
| expect(reward).to.equal(expectedOrchestratorReward + 1n); |
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.
Why this +1? Is it related to rounding errors?
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.
I wish I knew, because if I put +1 starlight tests fail, and if I don't then dancelight tests fail 😂
| await polkadotJs.query.system.account(DANCELIGHT_BOND) | ||
| ).data.free.toBigInt(); | ||
|
|
||
| expectedAmountParachainBond += (issuance * 3n) / 10n + dust + 1n; |
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.
Same question here for the +1
…ly-chains-with-collators
We have a small bug in pallet_inflation_rewards, where we calculate the reward per chain based on the total number of registered chains, regardless of whether they have collators or not. This case doesn't happen in any live runtime because we have enough collators for all chains (for now).
In the case of some chains without collators, there is a portion of the inflation that always goes to the parachain bond. This PR fixes this, increasing the rewards_per_chain in that case. It doesn't affect inflation, the total inflated value is still the same. (except in the edge case where we have 0 collators, because now we won't mint anything).