diff --git a/.github/env b/.github/env index 6ff0ec8a9b..14bcafb097 100644 --- a/.github/env +++ b/.github/env @@ -1,3 +1,3 @@ -RUST_STABLE_VERSION=1.77.0 -RUST_NIGHTLY_VERSION=2024-04-14 -TAPLO_VERSION=0.8.1 +RUST_STABLE_VERSION=1.81.0 +RUST_NIGHTLY_VERSION=2024-09-11 +TAPLO_VERSION=0.9.3 diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index f2f2d621ee..968ff80c00 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -53,10 +53,10 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Build EXTRA_ARGS + - name: Build EXTRA_FLAGS run: | # When running on relay, we don't need weight checks. - EXTRA_FLAGS="" + EXTRA_FLAGS="${{ matrix.runtime.extra_args }}" if [[ "${{ matrix.runtime.is_relay }}" == "true" ]]; then EXTRA_FLAGS+="--no-weight-warnings" echo "Disabling weight checks since we are on a relay" @@ -70,6 +70,8 @@ jobs: CHECKS="all" fi + EXTRA_FLAGS+=" --blocktime ${{ matrix.runtime.blocktime }} " + # Disable the spec version check when we dont want to release. # The program prints either `1` or `0`. if [ "$(.github/changelog-processor.py CHANGELOG.md --should-release)" = "0" ]; then @@ -82,16 +84,51 @@ jobs: echo "Flags: $EXTRA_FLAGS" echo "Checks: $CHECKS" - echo "EXTRA_ARGS=$EXTRA_FLAGS" >> $GITHUB_ENV + echo "EXTRA_FLAGS=$EXTRA_FLAGS" >> $GITHUB_ENV echo "CHECKS=$CHECKS" >> $GITHUB_ENV - - name: Run ${{ matrix.runtime.name }} Runtime Checks - uses: "paritytech/try-runtime-gha@v0.2.0" + - name: Install Protoc + uses: arduino/setup-protoc@v1.3.0 with: - runtime-package: ${{ matrix.runtime.package }} - node-uri: ${{ matrix.runtime.uri }} - checks: ${{ env.CHECKS }} - extra-args: ${{ env.EXTRA_ARGS }} + version: "3.6.1" + + - name: Add wasm32-unknown-unknown target + run: rustup target add wasm32-unknown-unknown + shell: bash + + - name: Add rust-src component + run: rustup component add rust-src + shell: bash + + - name: Run ${{ matrix.runtime.name }} Runtime Checks + #uses: "paritytech/try-runtime-gha@v0.2.0" + env: + EXTRA_FLAGS: ${{ env.EXTRA_FLAGS }} + CHECKS: ${{ env.CHECKS }} + run: | + cargo install -q --git https://github.com/paritytech/try-runtime-cli --tag v0.8.0 --locked && try-runtime --version + + cargo build --profile production -p ${{ matrix.runtime.package }} --features try-runtime -q --locked + + PACKAGE_NAME=${{ matrix.runtime.package }} + RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm + RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME + export RUST_LOG=remote-ext=debug,runtime=debug + + echo "Extra args: $EXTRA_FLAGS" + + # Store the command in a variable so we can log it + COMMAND="try-runtime \ + --runtime $RUNTIME_BLOB_PATH \ + on-runtime-upgrade --checks=$CHECKS \ + $EXTRA_FLAGS \ + live --uri ${{ matrix.runtime.uri }}" + + # Echo the command before running it, for debugging purposes + echo "Running command:" + echo "$COMMAND" + eval "$COMMAND" + # This will only run if all the tests in its "needs" array passed. # Add this as your required job, becuase if the matrix changes size (new things get added) diff --git a/.github/workflows/runtimes-matrix.json b/.github/workflows/runtimes-matrix.json index b38a129e60..172c53929c 100644 --- a/.github/workflows/runtimes-matrix.json +++ b/.github/workflows/runtimes-matrix.json @@ -4,89 +4,103 @@ "package": "polkadot-runtime", "path": "relay/polkadot", "uri": "wss://try-runtime.polkadot.io:443", - "is_relay": true + "is_relay": true, + "blocktime": 6000 }, { "name": "kusama", "package": "staging-kusama-runtime", "path": "relay/kusama", "uri": "wss://try-runtime-kusama.polkadot.io:443", - "is_relay": true + "is_relay": true, + "blocktime": 6000 }, { "name": "glutton-kusama", "package": "glutton-kusama-runtime", "path": "system-parachains/gluttons/glutton-kusama", - "is_relay": false + "is_relay": false, + "blocktime": 12000 }, { "name": "asset-hub-kusama", "package": "asset-hub-kusama-runtime", "path": "system-parachains/asset-hubs/asset-hub-kusama", "uri": "wss://kusama-asset-hub-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000 }, { "name": "asset-hub-polkadot", "package": "asset-hub-polkadot-runtime", "path": "system-parachains/asset-hubs/asset-hub-polkadot", "uri": "wss://polkadot-asset-hub-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000 }, { "name": "bridge-hub-kusama", "package": "bridge-hub-kusama-runtime", "path": "system-parachains/bridge-hubs/bridge-hub-kusama", "uri": "wss://kusama-bridge-hub-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000 }, { "name": "bridge-hub-polkadot", "package": "bridge-hub-polkadot-runtime", "path": "system-parachains/bridge-hubs/bridge-hub-polkadot", "uri": "wss://polkadot-bridge-hub-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000 }, { "name": "collectives-polkadot", "package": "collectives-polkadot-runtime", "path": "system-parachains/collectives/collectives-polkadot", "uri": "wss://polkadot-collectives-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000 }, { "name": "coretime-kusama", "package": "coretime-kusama-runtime", "path": "system-parachains/coretime/coretime-kusama", "uri": "wss://kusama-coretime-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000 }, { "name": "coretime-polkadot", "package": "coretime-polkadot-runtime", "path": "system-parachains/coretime/coretime-polkadot", - "uri": "wss://polkadot-coretime-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000, + "uri": "wss://polkadot-coretime-rpc.polkadot.io:443" }, { "name": "people-kusama", "package": "people-kusama-runtime", "path": "system-parachains/people/people-kusama", "uri": "wss://kusama-people-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 6000 }, { "name": "people-polkadot", "package": "people-polkadot-runtime", "path": "system-parachains/people/people-polkadot", "uri": "wss://polkadot-people-rpc.polkadot.io:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000 }, { "name": "encointer-kusama", "package": "encointer-kusama-runtime", "path": "system-parachains/encointer", "uri": "wss://kusama.api.encointer.org:443", - "is_relay": false + "is_relay": false, + "blocktime": 12000, + "extra_args": "--disable-mbm-checks" } ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 263d11c1dd..4d9cbc5dfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Changelog for the runtimes governed by the Polkadot Fellowship. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### Changed + +Change Polkadot inflation to 120M DOT per year ([polkadot-fellows/runtimes#471](https://github.com/polkadot-fellows/runtimes/pull/471)) + ## [1.3.3] 01.10.2024 ### Changed diff --git a/Cargo.lock b/Cargo.lock index 4f4d467771..ef1c6afbbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7420,6 +7420,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-format" version = "0.4.4" @@ -10063,6 +10069,7 @@ dependencies = [ name = "polkadot-runtime" version = "1.0.0" dependencies = [ + "approx", "binary-merkle-tree", "frame-benchmarking", "frame-election-provider-support", @@ -15088,12 +15095,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -15108,10 +15116,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] diff --git a/Cargo.toml b/Cargo.toml index 13199f41e3..e96581a7b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ license = "GPL-3.0-only" # TODO ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) + >( + test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest + ) }); // Sender's balance is reduced diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs index 882543cc1b..5037a4379f 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs @@ -272,7 +272,9 @@ fn limited_teleport_native_assets_from_system_para_to_relay_fails() { let delivery_fees = AssetHubPolkadot::execute_with(|| { xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) + >( + test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest + ) }); // Sender's balance is reduced diff --git a/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs index 7bcf0fdedd..279473dd3f 100644 --- a/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs @@ -122,7 +122,9 @@ fn limited_teleport_native_assets_from_system_para_to_relay_fails() { let delivery_fees = PeopleKusama::execute_with(|| { xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) + >( + test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest + ) }); // Sender's balance is reduced diff --git a/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs index c10d8c777f..4d994d648d 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs @@ -122,7 +122,9 @@ fn limited_teleport_native_assets_from_system_para_to_relay_fails() { let delivery_fees = PeoplePolkadot::execute_with(|| { xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) + >( + test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest + ) }); // Sender's balance is reduced diff --git a/relay/kusama/src/governance/origins.rs b/relay/kusama/src/governance/origins.rs index 24dcf17801..a8ef1bc86c 100644 --- a/relay/kusama/src/governance/origins.rs +++ b/relay/kusama/src/governance/origins.rs @@ -18,6 +18,7 @@ pub use pallet_custom_origins::*; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet_custom_origins { use crate::{Balance, GRAND, QUID}; diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 13d0bfbbda..a29936ec5e 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1213,7 +1213,8 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | + RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) @@ -1617,8 +1618,10 @@ impl pallet_nomination_pools::Config for Runtime { } /// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the -/// `AssetRate` pallet instance, with additional decoration to identify different IDs/locations of -/// native asset and provide a one-to-one balance conversion for them. +/// `AssetRate` pallet instance. +/// +/// With additional decoration to identify different IDs/locations of native asset and provide a +/// one-to-one balance conversion for them. pub type AssetRateWithNative = UnityOrOuterConversion< ContainsLocationParts< FromContains< @@ -1828,10 +1831,10 @@ pub mod migrations { /// /// It consists of: /// * Call into `pallet_staking::Pallet::::restore_ledger` with: -/// * Root origin; -/// * Default `None` paramters. +/// * Root origin; +/// * Default `None` paramters. /// * Forces unstake of recovered ledger if the final restored ledger has higher stake than the -/// stash's free balance. +/// stash's free balance. /// /// The stashes associated with corrupted ledgers that will be "migrated" are set in /// [`CorruptedStashes`]. @@ -1914,14 +1917,13 @@ pub(crate) mod restore_corrupted_ledgers { stash_account.clone(), slashing_spans, ) - .map_err(|err| { + .inspect_err(|err| { log::error!( target: LOG_TARGET, "migrations::corrupted_ledgers: error force unstaking ledger, unexpected. {:?}", err ); err_migration += 1; - err }); log::info!( diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index 89d0c4879e..ed69433257 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -110,6 +110,7 @@ sp-debug-derive = { workspace = true } polkadot-parachain-primitives = { workspace = true } [dev-dependencies] +approx = { workspace = true } sp-keyring = { workspace = true } sp-trie = { workspace = true } separator = { workspace = true } diff --git a/relay/polkadot/src/governance/origins.rs b/relay/polkadot/src/governance/origins.rs index f1283b551e..b71466c208 100644 --- a/relay/polkadot/src/governance/origins.rs +++ b/relay/polkadot/src/governance/origins.rs @@ -18,6 +18,7 @@ pub use pallet_custom_origins::*; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet_custom_origins { use crate::{Balance, DOLLARS, GRAND}; diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 7431585f0d..9e6064e5c7 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -700,39 +700,31 @@ impl pallet_parameters::Config for Runtime { type AdminOrigin = DynamicParameterOrigin; type WeightInfo = weights::pallet_parameters::WeightInfo; } + /// Defines how much should the inflation be for an era given its duration. pub struct EraPayout; impl pallet_staking::EraPayout for EraPayout { fn era_payout( - total_staked: Balance, + _total_staked: Balance, _total_issuance: Balance, era_duration_millis: u64, ) -> (Balance, Balance) { - const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; - - let params = relay_common::EraPayoutParams { - total_staked, - total_stakable: Balances::total_issuance(), - ideal_stake: dynamic_params::inflation::IdealStake::get(), - max_annual_inflation: dynamic_params::inflation::MaxInflation::get(), - min_annual_inflation: dynamic_params::inflation::MinInflation::get(), - falloff: dynamic_params::inflation::Falloff::get(), - period_fraction: Perquintill::from_rational(era_duration_millis, MILLISECONDS_PER_YEAR), - legacy_auction_proportion: if dynamic_params::inflation::UseAuctionSlots::get() { - let auctioned_slots = parachains_paras::Parachains::::get() - .into_iter() - // all active para-ids that do not belong to a system chain is the number of - // parachains that we should take into account for inflation. - .filter(|i| *i >= LOWEST_PUBLIC_ID) - .count() as u64; - Some(Perquintill::from_rational(auctioned_slots.min(60), 300u64)) - } else { - None - }, - }; + const MILLISECONDS_PER_YEAR: u64 = (1000 * 3600 * 24 * 36525) / 100; + // A normal-sized era will have 1 / 365.25 here: + let relative_era_len = + FixedU128::from_rational(era_duration_millis.into(), MILLISECONDS_PER_YEAR.into()); + + // TI at the time of execution of [Referendum 1139](https://polkadot.subsquare.io/referenda/1139), block hash: `0x39422610299a75ef69860417f4d0e1d94e77699f45005645ffc5e8e619950f9f`. + let fixed_total_issuance: i128 = 15_011_657_390_566_252_333; + let fixed_inflation_rate = FixedU128::from_rational(8, 100); + let yearly_emission = fixed_inflation_rate.saturating_mul_int(fixed_total_issuance); + + let era_emission = relative_era_len.saturating_mul_int(yearly_emission); + // 15% to treasury, as per ref 1139. + let to_treasury = FixedU128::from_rational(15, 100).saturating_mul_int(era_emission); + let to_stakers = era_emission.saturating_sub(to_treasury); - log::debug!(target: LOG_TARGET, "params: {:?}", params); - relay_common::relay_era_payout(params) + (to_stakers.saturated_into(), to_treasury.saturated_into()) } } @@ -1183,7 +1175,8 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | + RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) @@ -1581,8 +1574,10 @@ impl pallet_state_trie_migration::Config for Runtime { } /// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the -/// `AssetRate` pallet instance, with additional decoration to identify different IDs/locations of -/// native asset and provide a one-to-one balance conversion for them. +/// `AssetRate` pallet instance. +/// +/// With additional decoration to identify different IDs/locations of native asset and provide a +/// one-to-one balance conversion for them. pub type AssetRateWithNative = UnityOrOuterConversion< ContainsLocationParts< FromContains< @@ -2005,10 +2000,10 @@ pub mod migrations { /// /// Safety: /// - /// - After coretime is launched, there are no auctions anymore. So if this forgotten to - /// be removed after the runtime upgrade, running this again on the next one is harmless. - /// - I am assuming scheduler `TaskName`s are unique, so removal of the scheduled entry - /// multiple times should also be fine. + /// - After coretime is launched, there are no auctions anymore. So if this forgotten to be + /// removed after the runtime upgrade, running this again on the next one is harmless. + /// - I am assuming scheduler `TaskName`s are unique, so removal of the scheduled entry multiple + /// times should also be fine. pub struct CancelAuctions; impl OnRuntimeUpgrade for CancelAuctions { fn on_runtime_upgrade() -> Weight { @@ -2067,10 +2062,10 @@ pub mod migrations { /// /// It consists of: /// * Call into `pallet_staking::Pallet::::restore_ledger` with: -/// * Root origin; -/// * Default `None` paramters. +/// * Root origin; +/// * Default `None` paramters. /// * Forces unstake of recovered ledger if the final restored ledger has higher stake than the -/// stash's free balance. +/// stash's free balance. /// /// The stashes associated with corrupted ledgers that will be "migrated" are set in /// [`CorruptedStashes`]. @@ -2155,14 +2150,13 @@ pub(crate) mod restore_corrupted_ledgers { stash_account.clone(), slashing_spans, ) - .map_err(|err| { + .inspect_err(|err| { log::error!( target: LOG_TARGET, "migrations::corrupted_ledgers: error force unstaking ledger, unexpected. {:?}", err ); err_migration += 1; - err }); log::info!( @@ -3377,6 +3371,7 @@ mod multiplier_tests { dispatch::DispatchInfo, traits::{OnFinalize, PalletInfoAccess}, }; + use pallet_staking::EraPayout; use polkadot_runtime_common::{MinimumMultiplier, TargetBlockFullness}; use separator::Separatable; use sp_runtime::traits::Convert; @@ -3408,6 +3403,113 @@ mod multiplier_tests { }) } + use approx::assert_relative_eq; + const MILLISECONDS_PER_DAY: u64 = 24 * 60 * 60 * 1000; + + #[test] + fn staking_inflation_correct_single_era() { + let (to_stakers, to_treasury) = super::EraPayout::era_payout( + 123, // ignored + 456, // ignored + MILLISECONDS_PER_DAY, + ); + + // Values are within 0.1% + assert_relative_eq!(to_stakers as f64, (279_477 * UNITS) as f64, max_relative = 0.001); + assert_relative_eq!(to_treasury as f64, (49_320 * UNITS) as f64, max_relative = 0.001); + // Total per day is ~328,797 DOT + assert_relative_eq!( + (to_stakers as f64 + to_treasury as f64), + (328_797 * UNITS) as f64, + max_relative = 0.001 + ); + } + + #[test] + fn staking_inflation_correct_longer_era() { + // Twice the era duration means twice the emission: + let (to_stakers, to_treasury) = super::EraPayout::era_payout( + 123, // ignored + 456, // ignored + 2 * MILLISECONDS_PER_DAY, + ); + + assert_relative_eq!( + to_stakers as f64, + (279_477 * UNITS) as f64 * 2.0, + max_relative = 0.001 + ); + assert_relative_eq!( + to_treasury as f64, + (49_320 * UNITS) as f64 * 2.0, + max_relative = 0.001 + ); + } + + #[test] + fn staking_inflation_correct_whole_year() { + let (to_stakers, to_treasury) = super::EraPayout::era_payout( + 123, // ignored + 456, // ignored + (36525 * MILLISECONDS_PER_DAY) / 100, // 1 year + ); + + // Our yearly emissions is about 120M DOT: + let yearly_emission = 120_093_259 * UNITS; + assert_relative_eq!( + to_stakers as f64 + to_treasury as f64, + yearly_emission as f64, + max_relative = 0.001 + ); + + assert_relative_eq!(to_stakers as f64, yearly_emission as f64 * 0.85, max_relative = 0.001); + assert_relative_eq!( + to_treasury as f64, + yearly_emission as f64 * 0.15, + max_relative = 0.001 + ); + } + + // 10 years into the future, our values do not overflow. + #[test] + fn staking_inflation_correct_not_overflow() { + let (to_stakers, to_treasury) = super::EraPayout::era_payout( + 123, // ignored + 456, // ignored + (36525 * MILLISECONDS_PER_DAY) / 10, // 10 years + ); + let initial_ti: i128 = 15_011_657_390_566_252_333; + let projected_total_issuance = (to_stakers as i128 + to_treasury as i128) + initial_ti; + + // In 2034, there will be about 2.7 billion DOT in existence. + assert_relative_eq!( + projected_total_issuance as f64, + (2_700_000_000 * UNITS) as f64, + max_relative = 0.001 + ); + } + + // Print percent per year, just as convenience. + #[test] + fn staking_inflation_correct_print_percent() { + let (to_stakers, to_treasury) = super::EraPayout::era_payout( + 123, // ignored + 456, // ignored + (36525 * MILLISECONDS_PER_DAY) / 100, // 1 year + ); + let yearly_emission = to_stakers + to_treasury; + let mut ti: i128 = 15_011_657_390_566_252_333; + + for y in 0..10 { + let new_ti = ti + yearly_emission as i128; + let inflation = 100.0 * (new_ti - ti) as f64 / ti as f64; + println!("Year {y} inflation: {inflation}%"); + ti = new_ti; + + assert!(inflation <= 8.0 && inflation > 2.0, "sanity check"); + } + } + #[test] fn fast_unstake_estimate() { use pallet_fast_unstake::WeightInfo; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 141b693afe..ec92b587f7 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -137,7 +137,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("statemine"), impl_name: create_runtime_str!("statemine"), authoring_version: 1, - spec_version: 1_003_000, + spec_version: 1_003_003, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 15, @@ -431,10 +431,12 @@ parameter_types! { pub const ForeignAssetsMetadataDepositPerByte: Balance = MetadataDepositPerByte::get(); } -/// Assets managed by some foreign location. Note: we do not declare a `ForeignAssetsCall` type, as -/// this type is used in proxy definitions. We assume that a foreign location would not want to set -/// an individual, local account as a proxy for the issuance of their assets. This issuance should -/// be managed by the foreign location's governance. +/// Assets managed by some foreign location. +/// +/// Note: we do not declare a `ForeignAssetsCall` type, as this type is used in proxy definitions. +/// We assume that a foreign location would not want to set an individual, local account as a proxy +/// for the issuance of their assets. This issuance should be managed by the foreign location's +/// governance. pub type ForeignAssetsInstance = pallet_assets::Instance2; impl pallet_assets::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -568,7 +570,8 @@ impl InstanceFilter for ProxyType { RuntimeCall::Utility { .. } | RuntimeCall::Multisig { .. } | RuntimeCall::NftFractionalization { .. } | - RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. } + RuntimeCall::Nfts { .. } | + RuntimeCall::Uniques { .. } ) }, ProxyType::AssetOwner => matches!( diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs index 2da556f7ce..5a7d089e1e 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs @@ -86,9 +86,10 @@ parameter_types! { .unwrap_or(TreasuryAccount::get()); } -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -199,8 +200,9 @@ pub type AssetTransactors = (FungibleTransactor, FungiblesTransactor, ForeignFungiblesTransactor, PoolFungiblesTransactor); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can -/// biases the kind of local `Origin` it will become. +/// ready for dispatching a transaction with Xcm's `Transact`. +/// +/// There is an `OriginKind` which can biases the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for @@ -603,7 +605,8 @@ pub mod bridging { } } impl, OriginLocation: Get> - ContainsPair for RemoteAssetFromLocation + ContainsPair + for RemoteAssetFromLocation { fn contains(asset: &Asset, origin: &Location) -> bool { >::contains(&asset.id.0, origin) diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index 87bcd43d17..2a8764ee48 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -352,10 +352,12 @@ parameter_types! { pub const ForeignAssetsMetadataDepositPerByte: Balance = MetadataDepositPerByte::get(); } -/// Assets managed by some foreign location. Note: we do not declare a `ForeignAssetsCall` type, as -/// this type is used in proxy definitions. We assume that a foreign location would not want to set -/// an individual, local account as a proxy for the issuance of their assets. This issuance should -/// be managed by the foreign location's governance. +/// Assets managed by some foreign location. +/// +/// Note: we do not declare a `ForeignAssetsCall` type, as this type is used in proxy definitions. +/// We assume that a foreign location would not want to set an individual, local account as a proxy +/// for the issuance of their assets. This issuance should be managed by the foreign location's +/// governance. pub type ForeignAssetsInstance = pallet_assets::Instance2; impl pallet_assets::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -492,7 +494,8 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets { .. } | RuntimeCall::Utility { .. } | RuntimeCall::Multisig { .. } | - RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. } + RuntimeCall::Nfts { .. } | + RuntimeCall::Uniques { .. } ) }, ProxyType::AssetOwner => matches!( diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs index c127a0f17c..2873ac3d12 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs @@ -86,9 +86,10 @@ parameter_types! { .unwrap_or(TreasuryAccount::get()); } -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -199,8 +200,9 @@ pub type AssetTransactors = (FungibleTransactor, FungiblesTransactor, ForeignFungiblesTransactor, PoolFungiblesTransactor); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can -/// biases the kind of local `Origin` it will become. +/// ready for dispatching a transaction with Xcm's `Transact`. +/// +/// There is an `OriginKind` which can biases the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for @@ -671,7 +673,8 @@ pub mod bridging { } } impl, OriginLocation: Get> - ContainsPair for RemoteAssetFromLocation + ContainsPair + for RemoteAssetFromLocation { fn contains(asset: &Asset, origin: &Location) -> bool { >::contains(&asset.id.0, origin) diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index c02b8fe1ee..2a16b42aed 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -66,9 +66,10 @@ parameter_types! { pub StakingPot: AccountId = CollatorSelection::account_id(); } -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -95,8 +96,9 @@ pub type FungibleTransactor = FungibleAdapter< >; /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can -/// biases the kind of local `Origin` it will become. +/// ready for dispatching a transaction with Xcm's `Transact`. +/// +/// There is an `OriginKind` which can biases the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index 352d14c578..c56990f7ed 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -73,9 +73,10 @@ parameter_types! { pub StakingPot: AccountId = CollatorSelection::account_id(); } -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -102,8 +103,9 @@ pub type FungibleTransactor = FungibleAdapter< >; /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can -/// biases the kind of local `Origin` it will become. +/// ready for dispatching a transaction with Xcm's `Transact`. +/// +/// There is an `OriginKind` which can biases the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for @@ -301,6 +303,7 @@ impl cumulus_pallet_xcm::Config for Runtime { } /// A `FeeManager` implementation that forces fees for any message delivered to Ethereum. +/// /// Otherwise, it permits the specified `WaivedLocations` to not pay for fees and uses the provided /// `HandleFee` implementation. pub struct XcmFeeManagerFromComponentsBridgeHub( diff --git a/system-parachains/collectives/collectives-polkadot/src/ambassador/mod.rs b/system-parachains/collectives/collectives-polkadot/src/ambassador/mod.rs index 034206c542..6096c2ef27 100644 --- a/system-parachains/collectives/collectives-polkadot/src/ambassador/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/ambassador/mod.rs @@ -17,15 +17,15 @@ //! //! The module defines the following on-chain functionality of the Ambassador Program: //! -//! - Managed set of program members, where every member has a [rank](ranks) -//! (via [AmbassadorCollective](pallet_ranked_collective)). -//! - Referendum functionality for the program members to propose, vote on, and execute -//! proposals on behalf of the members of a certain [rank](Origin) -//! (via [AmbassadorReferenda](pallet_referenda)). -//! - Promotion and demotion periods, register of members' activity, and rank based salaries -//! (via [AmbassadorCore](pallet_core_fellowship)). -//! - Members' salaries (via [AmbassadorSalary](pallet_salary), requiring a member to be -//! imported or inducted into [AmbassadorCore](pallet_core_fellowship)). +//! - Managed set of program members, where every member has a [rank](ranks) (via +//! [AmbassadorCollective](pallet_ranked_collective)). +//! - Referendum functionality for the program members to propose, vote on, and execute proposals on +//! behalf of the members of a certain [rank](Origin) (via +//! [AmbassadorReferenda](pallet_referenda)). +//! - Promotion and demotion periods, register of members' activity, and rank based salaries (via +//! [AmbassadorCore](pallet_core_fellowship)). +//! - Members' salaries (via [AmbassadorSalary](pallet_salary), requiring a member to be imported or +//! inducted into [AmbassadorCore](pallet_core_fellowship)). //! - Ambassador Program Sub-Treasury (via [AmbassadorTreasury](pallet_treasury)). pub mod migrations; diff --git a/system-parachains/collectives/collectives-polkadot/src/ambassador/origins.rs b/system-parachains/collectives/collectives-polkadot/src/ambassador/origins.rs index 691fd10f24..adb076fc8a 100644 --- a/system-parachains/collectives/collectives-polkadot/src/ambassador/origins.rs +++ b/system-parachains/collectives/collectives-polkadot/src/ambassador/origins.rs @@ -15,6 +15,7 @@ //! The Ambassador Program's origins. +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet_origins { use crate::ambassador::ranks; diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs index ed998422a0..10213635c7 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs @@ -19,6 +19,7 @@ use super::ranks; pub use pallet_origins::*; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet_origins { use super::ranks; @@ -134,7 +135,9 @@ pub mod pallet_origins { /// A `TryMorph` implementation which is designed to convert an aggregate `RuntimeOrigin` /// value into the Fellowship voice it represents if it is a Fellowship pallet origin an - /// appropriate variant. See also [Origin::as_voice]. + /// appropriate variant. + /// + /// See also [Origin::as_voice]. pub struct ToVoice; impl<'a, O: 'a + TryInto<&'a Origin>> sp_runtime::traits::TryMorph for ToVoice { type Outcome = pallet_ranked_collective::Rank; diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index eccb696614..c8ccd42bd3 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -653,7 +653,9 @@ impl pallet_preimage::Config for Runtime { } /// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the -/// `AssetRate` pallet instance, with additional decoration to identify different IDs/locations of +/// `AssetRate` pallet instance. +/// +/// With additional decoration to identify different IDs/locations of /// native asset and provide a one-to-one balance conversion for them. pub type AssetRateWithNative = UnityOrOuterConversion< ContainsLocationParts< diff --git a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs index efb2fe532f..7e37611c76 100644 --- a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs +++ b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs @@ -76,9 +76,10 @@ parameter_types! { pub SelfParaId: ParaId = ParachainInfo::parachain_id(); } -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -107,8 +108,9 @@ pub type FungibleTransactor = FungibleAdapter< >; /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can -/// biases the kind of local `Origin` it will become. +/// ready for dispatching a transaction with Xcm's `Transact`. +/// +/// There is an `OriginKind` which can biases the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for diff --git a/system-parachains/constants/src/lib.rs b/system-parachains/constants/src/lib.rs index 7f31f7e149..e6e2012c35 100644 --- a/system-parachains/constants/src/lib.rs +++ b/system-parachains/constants/src/lib.rs @@ -27,9 +27,10 @@ use frame_support::{ pub use parachains_common::BlockNumber; use sp_runtime::Perbill; -/// This determines the average expected block time that we are targeting. Blocks will be -/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by -/// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn +/// This determines the average expected block time that we are targeting. +/// +/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is +/// picked up by `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn /// slot_duration()`. /// /// Change this to adjust the block time. diff --git a/system-parachains/coretime/coretime-kusama/src/xcm_config.rs b/system-parachains/coretime/coretime-kusama/src/xcm_config.rs index df0adb72c4..3869ca63d7 100644 --- a/system-parachains/coretime/coretime-kusama/src/xcm_config.rs +++ b/system-parachains/coretime/coretime-kusama/src/xcm_config.rs @@ -62,9 +62,10 @@ parameter_types! { pub StakingPot: AccountId = CollatorSelection::account_id(); } -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -111,8 +112,9 @@ pub type RegionTransactor = NonFungibleAdapter< pub type AssetTransactors = (FungibleTransactor, RegionTransactor); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with XCM's `Transact`. There is an `OriginKind` that can -/// bias the kind of local `Origin` it will become. +/// ready for dispatching a transaction with XCM's `Transact`. +/// +/// There is an `OriginKind` that can bias the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for diff --git a/system-parachains/coretime/coretime-polkadot/src/lib.rs b/system-parachains/coretime/coretime-polkadot/src/lib.rs index 0da037ecb4..0b23c97884 100644 --- a/system-parachains/coretime/coretime-polkadot/src/lib.rs +++ b/system-parachains/coretime/coretime-polkadot/src/lib.rs @@ -180,9 +180,10 @@ parameter_types! { pub const SS58Prefix: u8 = 0; } -/// Filter out credit purchase calls until the credit system is implemented. Otherwise, users -/// may have chance of locking their funds forever on purchased credits they cannot use. -/// Also filter the interlace call until the relay can support this fully. +/// Filter out credit purchase calls until the credit system is implemented. +/// +/// Otherwise, users may have chance of locking their funds forever on purchased credits they cannot +/// use. Also filter the interlace call until the relay can support this fully. pub struct IsFilteredBrokerCall; impl Contains for IsFilteredBrokerCall { fn contains(c: &RuntimeCall) -> bool { diff --git a/system-parachains/coretime/coretime-polkadot/src/xcm_config.rs b/system-parachains/coretime/coretime-polkadot/src/xcm_config.rs index c75c0a574c..e3b46d0d41 100644 --- a/system-parachains/coretime/coretime-polkadot/src/xcm_config.rs +++ b/system-parachains/coretime/coretime-polkadot/src/xcm_config.rs @@ -63,9 +63,10 @@ parameter_types! { pub StakingPot: AccountId = CollatorSelection::account_id(); } -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -112,8 +113,9 @@ pub type RegionTransactor = NonFungibleAdapter< pub type AssetTransactors = (FungibleTransactor, RegionTransactor); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with XCM's `Transact`. There is an `OriginKind` that can -/// bias the kind of local `Origin` it will become. +/// ready for dispatching a transaction with XCM's `Transact`. +/// +/// There is an `OriginKind` that can bias the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index db28814684..f93906d02e 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -746,9 +746,10 @@ construct_runtime! { } } -/// This determines the average expected block time that we are targeting. Blocks will be -/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by -/// `pallet_timestamp`, which is in turn picked up by `pallet_aura` to implement `fn +/// This determines the average expected block time that we are targeting. +/// +/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is +/// picked up by `pallet_timestamp`, which is in turn picked up by `pallet_aura` to implement `fn /// slot_duration()`. /// /// Change this to adjust the block time. diff --git a/system-parachains/encointer/src/xcm_config.rs b/system-parachains/encointer/src/xcm_config.rs index 50cacb1e5b..af152d6afc 100644 --- a/system-parachains/encointer/src/xcm_config.rs +++ b/system-parachains/encointer/src/xcm_config.rs @@ -54,9 +54,10 @@ parameter_types! { pub StakingPot: AccountId = CollatorSelection::account_id(); } -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -83,8 +84,9 @@ pub type FungibleTransactor = FungibleAdapter< >; /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can -/// biases the kind of local `Origin` it will become. +/// ready for dispatching a transaction with Xcm's `Transact`. +/// +/// There is an `OriginKind` which can biases the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for diff --git a/system-parachains/gluttons/glutton-kusama/src/xcm_config.rs b/system-parachains/gluttons/glutton-kusama/src/xcm_config.rs index 00dbd9cea1..b92f5e24e1 100644 --- a/system-parachains/gluttons/glutton-kusama/src/xcm_config.rs +++ b/system-parachains/gluttons/glutton-kusama/src/xcm_config.rs @@ -34,8 +34,9 @@ parameter_types! { } /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can -/// bias the kind of local `Origin` it will become. +/// ready for dispatching a transaction with Xcm's `Transact`. +/// +/// There is an `OriginKind` which can bias the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for diff --git a/system-parachains/people/people-kusama/src/lib.rs b/system-parachains/people/people-kusama/src/lib.rs index 3cc6c85e53..619cd0422d 100644 --- a/system-parachains/people/people-kusama/src/lib.rs +++ b/system-parachains/people/people-kusama/src/lib.rs @@ -84,9 +84,10 @@ use xcm_runtime_apis::{ fees::Error as XcmPaymentApiError, }; -/// This determines the average expected block time that we are targeting. Blocks will be -/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by -/// `pallet_timestamp`, which is in turn picked up by `pallet_aura` to implement `fn +/// This determines the average expected block time that we are targeting. +/// +/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is +/// picked up by `pallet_timestamp`, which is in turn picked up by `pallet_aura` to implement `fn /// slot_duration()`. /// /// Change this to adjust the block time. diff --git a/system-parachains/people/people-kusama/src/xcm_config.rs b/system-parachains/people/people-kusama/src/xcm_config.rs index 54b0c75b66..fe7ac7c4c6 100644 --- a/system-parachains/people/people-kusama/src/xcm_config.rs +++ b/system-parachains/people/people-kusama/src/xcm_config.rs @@ -84,9 +84,10 @@ pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender: XcmpQueue, >; -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -115,8 +116,9 @@ pub type FungibleTransactor = FungibleAdapter< >; /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with XCM's `Transact`. There is an `OriginKind` that can -/// bias the kind of local `Origin` it will become. +/// ready for dispatching a transaction with XCM's `Transact`. +/// +/// There is an `OriginKind` that can bias the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for diff --git a/system-parachains/people/people-polkadot/src/xcm_config.rs b/system-parachains/people/people-polkadot/src/xcm_config.rs index 2a0e80d4d3..0b9e1c110d 100644 --- a/system-parachains/people/people-polkadot/src/xcm_config.rs +++ b/system-parachains/people/people-polkadot/src/xcm_config.rs @@ -85,9 +85,10 @@ pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender: XcmpQueue, >; -/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used -/// when determining ownership of accounts for asset transacting and when attempting to use XCM -/// `Transact` in order to determine the dispatch Origin. +/// Type for specifying how a `Location` can be converted into an `AccountId`. +/// +/// This is used when determining ownership of accounts for asset transacting and when attempting to +/// use XCM `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. ParentIsPreset, @@ -116,8 +117,9 @@ pub type FungibleTransactor = FungibleAdapter< >; /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, -/// ready for dispatching a transaction with XCM's `Transact`. There is an `OriginKind` that can -/// bias the kind of local `Origin` it will become. +/// ready for dispatching a transaction with XCM's `Transact`. +/// +/// There is an `OriginKind` that can bias the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for