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

Add Hybrid Inflation to Shiden #1095

Merged
merged 5 commits into from
Dec 5, 2023
Merged

Conversation

PierreOssun
Copy link
Member

@PierreOssun PierreOssun commented Dec 4, 2023

Pull Request Summary

  • Add Hybrid Inflation to Shiden + migration
  • Removed Migration from Shibua

Updated Reward Model

Current blockReward: 2,664 SDN

collatorReward = 0,0689 SDN (100x less than Astar)
treasuryReward = 0,1076 SDN (100x less than Astar)

Stakers and dApp reward should be the same on absolute value:

dAppRewards = 15.00% * 2,664 = 0,3996 SDN
baseStakerPercent = 20.00% * 2,664 = 0,5328 SDN
adjustablePercent = 45.00% * 2,664 = 1,1988 SDN

So new max reward (sum of all) = 2,3077 SDN

New percentages (based on this new block reward const):

{
  // 4.662_651
  treasuryPercent: 4.669%
  // 23.087_923
  baseStakerPercent: 23.09%
  // 17.315_942
  dappsPercent: 17.32%
  // 2.985_656
  collatorsPercent: 2.99%
  // 51.947_830
  adjustablePercent: 51.95%
  // unchanged
  idealDappsStakingTvl: 60.00%
}

Check list

  • added migration for Shiden
  • removed (already applied) migration for Shibuya

@PierreOssun PierreOssun changed the title Ad Hybrid Inflation to Shiden Add Hybrid Inflation to Shiden Dec 4, 2023
@PierreOssun PierreOssun added shiden related to shiden runtime runtime This PR/Issue is related to the topic “runtime”. labels Dec 4, 2023
Copy link
Member

@Dinonard Dinonard left a comment

Choose a reason for hiding this comment

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

The overall code is good!

However, I believe the approach to Shiden has to be different than to Shibuya.
There it was fine to set parameters calculated way before for Astar, since it's not like anyone cares about Shibuya.

But for Shiden & Astar we need to be more precise.
The new inflation model will have 7% yearly inflation, and 3.2% of that will go towards collators, and 5% towards the treasury.

So for both Shiden & Astar, when PR is being prepared:

inflation = total_issuance * 0.07;
collator_reward_per_block = inflation * 0.032 / (7200 * 365)
treasury_reward_per_block = inflation * 0.05 / (7200 * 365)

According to this, collators should get around 0,071244 SDN per block.

@PierreOssun
Copy link
Member Author

71244

Based on today issuance 83596484670898374984051349 the 7% inflation is 5851753926962886248883594 calc here

collator_reward_per_block = inflation * 0.032 / (7200 * 365) = 0.0712542335 calc here
treasury_reward_per_block = inflation * 0.05 / (7200 * 365) = 0.1113347398 calc here

Stakers and dApp reward should be the same on absolute value:

dAppRewards = 15.00% * 2,664 = 0,3996 SDN
baseStakerPercent = 20.00% * 2,664 = 0,5328 SDN
adjustablePercent = 45.00% * 2,664 = 1,1988 SDN

So new max reward (sum of all) = 2.313789 SDN calc here

New percentages (based on this new block reward const):

{
  // 0.048117931
  treasuryPercent: 4.81%
  // 0.230271645
  baseStakerPercent: 23.03%
  // 0.172703734
  dappsPercent: 17.27%
  // 0.030795475
  collatorsPercent: 3.08%
  // 0.518111202
  adjustablePercent: 51.81%
  // unchanged
  idealDappsStakingTvl: 60.00%
}

@Dinonard
Copy link
Member

Dinonard commented Dec 5, 2023

@PierreOssun the numbers look good to me! 👍

Copy link

github-actions bot commented Dec 5, 2023

Code Coverage

Package Line Rate Branch Rate Health
chain-extensions/types/xvm/src 0% 0%
chain-extensions/types/unified-accounts/src 0% 0%
precompiles/utils/src 55% 0%
pallets/block-rewards-hybrid/src 87% 0%
chain-extensions/unified-accounts/src 0% 0%
chain-extensions/dapps-staking/src 0% 0%
pallets/dynamic-evm-base-fee/src 81% 0%
pallets/dapps-staking/src 81% 0%
pallets/unified-accounts/src 84% 0%
primitives/src 65% 0%
primitives/src/xcm 66% 0%
chain-extensions/types/assets/src 0% 0%
pallets/xvm/src 40% 0%
precompiles/xvm/src 75% 0%
chain-extensions/xvm/src 0% 0%
precompiles/utils/src/testing 38% 0%
pallets/block-reward/src 85% 0%
pallets/dapps-staking/src/pallet 85% 0%
pallets/xc-asset-config/src 53% 0%
precompiles/xcm/src 75% 0%
pallets/contracts-migration/src 0% 0%
pallets/ethereum-checked/src 48% 0%
pallets/collator-selection/src 69% 0%
chain-extensions/pallet-assets/src 0% 0%
precompiles/dapps-staking/src 93% 0%
precompiles/sr25519/src 79% 0%
precompiles/assets-erc20/src 77% 0%
precompiles/substrate-ecdsa/src 78% 0%
precompiles/utils/macro/src 0% 0%
chain-extensions/types/dapps-staking/src 0% 0%
Summary 57% (2278 / 4017) 0% (0 / 0)

Minimum allowed line rate is 50%

@PierreOssun PierreOssun merged commit 34522c0 into master Dec 5, 2023
8 checks passed
@PierreOssun PierreOssun deleted the feat/hybrid-inflation-shiden branch December 5, 2023 13:26
@PierreOssun PierreOssun mentioned this pull request Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runtime This PR/Issue is related to the topic “runtime”. shiden related to shiden runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants