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

Polkadot: Make the current inflation formula adjustable #443

Merged
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Chain-spec generator: propagate the `on_chain_release_build` feature to the chain-spec generator. Without this the live/genesis chain-specs contain a wrongly-configured WASM blob ([polkadot-fellows/runtimes#450](https://github.com/polkadot-fellows/runtimes/pull/450)).

### Added

- Polkadot: Make the current inflation formula adjustable ([polkadot-fellows/runtimes#443](https://github.com/polkadot-fellows/runtimes/pull/443))

## [1.3.2] 27.08.2024

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 16 additions & 13 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ use kusama_runtime_constants::{
currency::*, fee::*, system_parachain, time::*, TREASURY_PALLET_ID,
};

/// Default logging target.
pub const LOG_TARGET: &str = "runtime::kusama";

// Genesis preset configurations.
pub mod genesis_config_presets;

Expand Down Expand Up @@ -1919,11 +1922,11 @@ impl Runtime {
};

// We assume un-delayed 6h eras.
let era_duration = 6 * HOURS;
let era_duration = 6 * 60 * 60 * 1000;
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
let next_mint = <Self as pallet_staking::Config>::EraPayout::era_payout(
staked,
stake_able_issuance,
era_duration.into(),
era_duration,
);

InflationInfo { inflation, next_mint }
Expand Down Expand Up @@ -3044,17 +3047,17 @@ mod remote_tests {
use ss58_registry::TokenRegistry;
let token: ss58_registry::Token = TokenRegistry::Ksm.into();

log::info!(target: "runtime::kusama", "total-staked = {:?}", token.amount(total_staked));
log::info!(target: "runtime::kusama", "total-issuance = {:?}", token.amount(total_issuance));
log::info!(target: "runtime::kusama", "staking-rate = {:?}", Perquintill::from_rational(total_staked, total_issuance));
log::info!(target: "runtime::kusama", "era-duration = {:?}", average_era_duration_millis);
log::info!(target: "runtime::kusama", "min-inflation = {:?}", dynamic_params::inflation::MinInflation::get());
log::info!(target: "runtime::kusama", "max-inflation = {:?}", dynamic_params::inflation::MaxInflation::get());
log::info!(target: "runtime::kusama", "falloff = {:?}", dynamic_params::inflation::Falloff::get());
log::info!(target: "runtime::kusama", "useAuctionSlots = {:?}", dynamic_params::inflation::UseAuctionSlots::get());
log::info!(target: "runtime::kusama", "idealStake = {:?}", dynamic_params::inflation::IdealStake::get());
log::info!(target: "runtime::kusama", "maxStakingRewards = {:?}", pallet_staking::MaxStakedRewards::<Runtime>::get());
log::info!(target: "runtime::kusama", "💰 Inflation ==> staking = {:?} / leftover = {:?}", token.amount(staking), token.amount(leftover));
log::info!(target: LOG_TARGET, "total-staked = {:?}", token.amount(total_staked));
log::info!(target: LOG_TARGET, "total-issuance = {:?}", token.amount(total_issuance));
log::info!(target: LOG_TARGET, "staking-rate = {:?}", Perquintill::from_rational(total_staked, total_issuance));
log::info!(target: LOG_TARGET, "era-duration = {:?}", average_era_duration_millis);
log::info!(target: LOG_TARGET, "min-inflation = {:?}", dynamic_params::inflation::MinInflation::get());
log::info!(target: LOG_TARGET, "max-inflation = {:?}", dynamic_params::inflation::MaxInflation::get());
log::info!(target: LOG_TARGET, "falloff = {:?}", dynamic_params::inflation::Falloff::get());
log::info!(target: LOG_TARGET, "useAuctionSlots = {:?}", dynamic_params::inflation::UseAuctionSlots::get());
log::info!(target: LOG_TARGET, "idealStake = {:?}", dynamic_params::inflation::IdealStake::get());
log::info!(target: LOG_TARGET, "maxStakingRewards = {:?}", pallet_staking::MaxStakedRewards::<Runtime>::get());
log::info!(target: LOG_TARGET, "💰 Inflation ==> staking = {:?} / leftover = {:?}", token.amount(staking), token.amount(leftover));
});
}

Expand Down
8 changes: 8 additions & 0 deletions relay/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pallet-multisig = { workspace = true }
pallet-nomination-pools = { workspace = true }
pallet-nomination-pools-runtime-api = { workspace = true }
pallet-offences = { workspace = true }
pallet-parameters = { workspace = true }
pallet-preimage = { workspace = true }
pallet-proxy = { workspace = true }
pallet-referenda = { workspace = true }
Expand Down Expand Up @@ -96,6 +97,7 @@ pallet-nomination-pools-benchmarking = { optional = true, workspace = true }
polkadot-runtime-common = { workspace = true }
runtime-parachains = { workspace = true }
polkadot-primitives = { workspace = true }
relay-common = { workspace = true }

xcm = { workspace = true }
xcm-executor = { workspace = true }
Expand All @@ -114,6 +116,8 @@ separator = { workspace = true }
remote-externalities = { workspace = true }
tokio = { features = ["macros"], workspace = true }
sp-tracing = { workspace = true }
hex-literal = { workspace = true }
ss58-registry = { workspace = true }

[build-dependencies]
substrate-wasm-builder = { workspace = true, optional = true }
Expand Down Expand Up @@ -164,6 +168,7 @@ std = [
"pallet-nomination-pools/std",
"pallet-offences-benchmarking?/std",
"pallet-offences/std",
"pallet-parameters/std",
"pallet-preimage/std",
"pallet-proxy/std",
"pallet-referenda/std",
Expand All @@ -187,6 +192,7 @@ std = [
"polkadot-primitives/std",
"polkadot-runtime-common/std",
"polkadot-runtime-constants/std",
"relay-common/std",
"runtime-parachains/std",
"scale-info/std",
"serde_json/std",
Expand Down Expand Up @@ -242,6 +248,7 @@ runtime-benchmarks = [
"pallet-nomination-pools/runtime-benchmarks",
"pallet-offences-benchmarking/runtime-benchmarks",
"pallet-offences/runtime-benchmarks",
"pallet-parameters/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
Expand Down Expand Up @@ -295,6 +302,7 @@ try-runtime = [
"pallet-multisig/try-runtime",
"pallet-nomination-pools/try-runtime",
"pallet-offences/try-runtime",
"pallet-parameters/try-runtime",
"pallet-preimage/try-runtime",
"pallet-proxy/try-runtime",
"pallet-referenda/try-runtime",
Expand Down
Loading
Loading