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

Kusama: Make the current inflation formula adjustable. #364

Merged
merged 57 commits into from
Aug 20, 2024

Conversation

kianenigma
Copy link
Contributor

@kianenigma kianenigma commented Jun 27, 2024

This PR does not alter the inflation of Kusama, but instead make the current parameters of the system fully configurable.

Parameters

The parameters are as follows:

/// Minimum inflation rate used to calculate era payouts.
pub static MinInflation: Perquintill = Perquintill::from_rational(25u64, 1000);

/// Maximum inflation rate used to calculate era payouts.
pub static MaxInflation: Perquintill = Perquintill::from_percent(10);

/// Ideal stake ratio used to calculate era payouts.
pub static IdealStake: Perquintill = Perquintill::from_percent(75);

/// Falloff used to calculate era payouts.
pub static Falloff: Perquintill = Perquintill::from_percent(5);

/// Whether to use auction slots or not in the calculation of era payouts, then we subtract
/// `num_auctioned_slots.min(60) / 200` from `ideal_stake`.
///
/// That is, we assume up to 60 parachains that are leased can reduce the ideal stake by a
/// maximum of 30%.
///
/// With the move to agile-coretime, this parameter does not make much sense and should
/// generally be set to false.
pub static UseAuctionSlots: bool = true;

All of the above are exactly the current values in Kusama, and leave everything unchanged, leading to roughly 1kKSM minted for validators, and around 90KSM for treasury.

All of the above can be changed via the Root track only.

Given that it is hard to come to consensus, I highly advise this PR (and a similar PR to Polkadot) to NOT alter any parameter and leave that to the token holders.

Just to provide one example, if we set UseAuctionSlots = false and leave everything else un-changed, the amount minted per era would be:

  • 807KSM for staking
  • 238KSM for treasury

This, in my opinion, is the most non-controversial change as the incorporation of auctions in the inflation rate is already meaningless with agile-coretime.

Consideration for UIs

This PR is shipped with a new runtime API that is only added to the Kusama runtime: Inflation_experimental_inflation_info. I hope this API is used by the UIs to show the inflation parameters of the network, rather than re-creating the Rust logic in the front-end.

@kianenigma kianenigma changed the title .Kiz new staking reward params Make the current inflation formula adjustable. Jun 27, 2024
ggwpez added 7 commits July 14, 2024 12:39
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
s0me0ne-unkn0wn and others added 9 commits July 17, 2024 13:49
Simply updates the encointer-pallets to v1.14.0. Nothing else happened
there in the meantime. cc @brenzi
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@kianenigma
Copy link
Contributor Author

Some updates:

  1. Depends on Update to SDK 1.14 #381
  2. Would also preferably depend on sdk 1.15 to get the new relay_inflation helper fn.
  3. Based on the last fellowship call, for now we will only add this to Kusama https://www.youtube.com/live/oWppBMrgU7M?si=b4O-G_mIEBp1tnV4&t=2137

ggwpez and others added 7 commits July 17, 2024 18:00
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
…llows#393)

In the update to [sdk
1.14](polkadot-fellows#381) the
`request_revenue_info` is now implemented but this call had been
switched off when it was added in
polkadot-fellows#212.

This PR just enables this again in the coretime interface.

cc @ggwpez @s0me0ne-unkn0wn
@ggwpez ggwpez mentioned this pull request Aug 19, 2024
3 tasks
Copy link
Contributor

@acatangiu acatangiu left a comment

Choose a reason for hiding this comment

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

high-level looks good, did not double-check the actual staking initial values coded in

Comment on lines +114 to +115
// ---- TODO: Above is copy pasted from sdk, remove once we pull the version containing
// https://github.com/paritytech/polkadot-sdk/pull/4938
Copy link
Contributor

Choose a reason for hiding this comment

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

would be better if you referenced the crate name and (min) version required, instead of this PR, otherwise it becomes a non-trivial chore to figure out when this can be removed and no one will do it :)

(same above)

Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

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

Code looks good, some nits with docs/comments

relay/common/src/lib.rs Outdated Show resolved Hide resolved
type AdminOrigin = DynamicParameterOrigin;
type WeightInfo = weights::pallet_parameters::WeightInfo<Runtime>;
}

pub struct EraPayout;
Copy link
Contributor

Choose a reason for hiding this comment

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

pub with no docs

relay/kusama/src/lib.rs Outdated Show resolved Hide resolved
relay/kusama/src/lib.rs Outdated Show resolved Hide resolved
relay/kusama/src/lib.rs Outdated Show resolved Hide resolved
@joepetrowski
Copy link
Contributor

/merge

@fellowship-merge-bot fellowship-merge-bot bot enabled auto-merge (squash) August 20, 2024 09:18
@fellowship-merge-bot
Copy link
Contributor

Enabled auto-merge in Pull Request

Available commands
  • /merge: Enables auto-merge for Pull Request
  • /merge cancel: Cancels auto-merge for Pull Request
  • /merge help: Shows this menu

For more information see the documentation

@fellowship-merge-bot fellowship-merge-bot bot merged commit 4fd2981 into polkadot-fellows:main Aug 20, 2024
47 checks passed
fellowship-merge-bot bot added a commit that referenced this pull request Aug 20, 2024
Trigger the v1.3.0 release with the following additional changes:

- Bump `polkadot-runtime-parachains` version to get
paritytech/polkadot-sdk#5369 in
[63cb34d](63cb34d)
and update tests in
[e718c64](e718c64).
- Filter calls to `interlace` on the Polkadot Coretime Chain until the
relay implementation matures in
[1126cf7](1126cf7).
- Update all runtime versions to `1_003_000` in
[08744df](08744df)

TODO:
- [x] Finalise changelog
- [x] Wait for #433
- [x] Wait for #364

Closes #186

---------

Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
fellowship-merge-bot bot pushed a commit that referenced this pull request Oct 1, 2024
Counterpart of #364.

Similarly, it has no impact on the inflation as-is, and just exposes the
params to the Root track.

## UI Consideration

Similarly, it adds `Inflation_experimental_inflation_info` Runtime API,
which can be used by UIs to fetch information about the inflation,
without needing to rely on storage items.

## Example

- With current parameters: 

```
Inflation ==> staking = 402244.054 DOT (4,022,440,540,915,948) / leftover = 4178.285 DOT (41,782,856,835,356)
```

- With `UseLegacyAuctions = false`, which means we no longer set aside
around 15% of tokens for auctions. This makes the difference between
actual staked and ideal staking rate (staking inefficiency) grow, and
therefore reduce the staking reward and increase the treasury income.

```
Inflation ==> staking = 340780.189 DOT (3,407,801,892,871,273) / leftover = 65642.150 DOT (656,421,504,843,446)
```

---------

Co-authored-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Gonçalo Pestana <[email protected]>
Co-authored-by: Ankan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants