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

Upgrade runtime v1.3.3 #142

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
75bdbcb
Upgrade relay to v1.3.1
raynaudoe Oct 11, 2024
503e01a
Upgrade people
raynaudoe Oct 11, 2024
af031ad
Upgrade assethub
raynaudoe Oct 15, 2024
3d6782c
Upgrade bridgehub
raynaudoe Oct 15, 2024
e623c16
Create patch file for coretime
raynaudoe Oct 15, 2024
2208ced
Upgrade coretime
raynaudoe Oct 15, 2024
e2ab0f8
Coretime tests fix attempt
raynaudoe Oct 15, 2024
8ec19fe
Merge branch 'main' into release/1.3.3-runtime
raynaudoe Oct 16, 2024
1a13bb9
Delete LeaseOffset
raynaudoe Oct 17, 2024
e4388b3
Fix async_backing_params values
raynaudoe Oct 17, 2024
a864c53
sepolia fork versions not mainnet
claravanstaden Oct 21, 2024
55fbe5c
add fork version test
claravanstaden Oct 21, 2024
0ea90cc
Revert "add fork version test"
claravanstaden Oct 21, 2024
1d52ab2
Merge pull request #147 from paseo-network/fix/fork-versions-1.3.3-ru…
hbulgarini Oct 21, 2024
31ce99c
chore: paseo genesis config preset
al3mart Oct 22, 2024
13818a3
chore: remove corrupted ledgers migration
al3mart Oct 22, 2024
46bbbf1
chore: ss58 for relay
al3mart Oct 22, 2024
e050579
chore: improve executor declaration
al3mart Oct 22, 2024
712725d
chore: update README
al3mart Oct 22, 2024
d8c0e91
Merge pull request #148 from paseo-network/al3mart/1.3.3-feedback
hbulgarini Oct 22, 2024
dc0635e
add write permissions
raynaudoe Oct 22, 2024
e46e08b
Update chain specs for version v1.3.3
github-actions[bot] Oct 22, 2024
3f8da50
try fixing release permissions
raynaudoe Oct 22, 2024
498cb10
add manual release job
raynaudoe Oct 22, 2024
8cc840f
Try adding packages permission
raynaudoe Oct 23, 2024
b59d0b0
Adjusting coretime chain weights
hbulgarini Oct 23, 2024
615b415
release/1.3.3-runtime
hbulgarini Oct 23, 2024
03f08f7
Adding sudo to system chains
hbulgarini Oct 23, 2024
8fba627
add pallet-sudo/try-runtime
al3mart Oct 23, 2024
61a58f5
fix compilation
raynaudoe Oct 29, 2024
2a93292
update cargo.lock
raynaudoe Oct 29, 2024
4f1c03c
chore: include #149
al3mart Nov 5, 2024
30b48fe
Merge pull request #154 from paseo-network/al3mart/chore-backport-spe…
hbulgarini Nov 5, 2024
c7d23e9
chore: remove CancelAuctions
al3mart Nov 5, 2024
bd59f2d
Merge pull request #155 from paseo-network/al3mart/chore-clean-migrat…
hbulgarini Nov 5, 2024
de2407a
fix: add sudo weights
al3mart Nov 5, 2024
2483245
Merge pull request #156 from paseo-network/al3mart/fix-1.3.3-build
hbulgarini Nov 5, 2024
5860e7d
fix: coretime integration tests
al3mart Nov 5, 2024
e84bbb9
typo
al3mart Nov 5, 2024
b5b58fa
Update chain specs for version v1.3.3
github-actions[bot] Nov 5, 2024
4d8cb89
Merge pull request #157 from paseo-network/al3mart/fix-1.3.3-build
hbulgarini Nov 5, 2024
75b9534
Automate github release fix attempt
raynaudoe Nov 5, 2024
0e6df1a
chore(system-ps): add sudo at genesis
al3mart Nov 7, 2024
ccbfee8
fix: missing imports
al3mart Nov 7, 2024
5f370e4
fix: spec generation
al3mart Nov 7, 2024
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
55 changes: 45 additions & 10 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ repository = "https://github.com/paseo-network/runtimes.git"
license = "GPL-3.0-only"

[workspace.dependencies]
kusama-runtime-constants = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.3.1", package = "kusama-runtime-constants", default-features = false }
bp-bridge-hub-kusama = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.3.1", package = "bp-bridge-hub-kusama", default-features = false }
bp-bridge-hub-polkadot = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.3.1", package = "bp-bridge-hub-polkadot", default-features = false }
bp-asset-hub-kusama = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.3.1", package = "bp-asset-hub-kusama", default-features = false }
kusama-runtime-constants = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.3.3", package = "kusama-runtime-constants", default-features = false }
bp-bridge-hub-kusama = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.3.3", package = "bp-bridge-hub-kusama", default-features = false }
bp-bridge-hub-polkadot = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.3.3", package = "bp-bridge-hub-polkadot", default-features = false }
bp-asset-hub-kusama = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.3.3", package = "bp-asset-hub-kusama", default-features = false }

# Local dependencies

Expand Down
30 changes: 30 additions & 0 deletions relay/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
authors.workspace = true
description = "Shared utilities between relay runtimes"
edition.workspace = true
license.workspace = true
name = "relay-common"
repository.workspace = true
version.workspace = true

[dependencies]
codec = { features = ["derive", "max-encoded-len"], workspace = true }
scale-info = { features = ["derive"], workspace = true }

sp-api = { workspace = true }
sp-runtime = { workspace = true }
polkadot-primitives = { workspace = true }
pallet-staking-reward-fn = { workspace = true }


[features]
default = ["std"]
std = [
"codec/std",
"scale-info/std",

"pallet-staking-reward-fn/std",
"polkadot-primitives/std",
"sp-api/std",
"sp-runtime/std",
]
115 changes: 115 additions & 0 deletions relay/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Shared code between the Kusama nd Polkadot RC Runtimes.
#![cfg_attr(not(feature = "std"), no_std)]

use polkadot_primitives::Balance;
use sp_runtime::{Perquintill, Saturating};

/// Extra runtime APIs for kusama runtime.
pub mod apis {
/// Information about the current inflation rate of the system.
///
/// Both fields should be treated as best-effort, given that the inflation rate might not be
/// fully predict-able.
#[derive(scale_info::TypeInfo, codec::Encode, codec::Decode)]
pub struct InflationInfo {
/// The rate of inflation estimated per annum.
pub inflation: sp_runtime::Perquintill,
/// Next amount that we anticipate to mint.
///
/// First item is the amount that goes to stakers, second is the leftover that is usually
/// forwarded to the treasury.
pub next_mint: (polkadot_primitives::Balance, polkadot_primitives::Balance),
}

sp_api::decl_runtime_apis! {
pub trait Inflation {
/// Return the current estimates of the inflation amount.
///
/// This is marked as experimental in light of RFC#89. Nonetheless, its usage is highly
/// recommended over trying to read-storage, or re-create the onchain logic.
fn experimental_inflation_prediction_info() -> InflationInfo;
}
}
}

// ---- TODO: Below is copy pasted from sdk, remove once we pull the version containing
// https://github.com/paritytech/polkadot-sdk/pull/4938

#[derive(Debug, Clone)]
/// Parameters passed into [`relay_era_payout`] function.
pub struct EraPayoutParams {
/// Total staked amount.
pub total_staked: Balance,
/// Total stakable amount.
///
/// Usually, this is equal to the total issuance, except if a large part of the issuance is
/// locked in another sub-system.
pub total_stakable: Balance,
/// Ideal stake ratio, which is reduced by `legacy_auction_proportion` if not `None`.
pub ideal_stake: Perquintill,
/// Maximum inflation rate.
pub max_annual_inflation: Perquintill,
/// Minimum inflation rate.
pub min_annual_inflation: Perquintill,
/// Falloff used to calculate era payouts.
pub falloff: Perquintill,
/// Fraction of the era period used to calculate era payouts.
pub period_fraction: Perquintill,
/// Legacy auction proportion, which, if not `None`, is subtracted from `ideal_stake`.
pub legacy_auction_proportion: Option<Perquintill>,
}

/// A specialized function to compute the inflation of the staking system, tailored for Polkadot
/// Relay Chains, such as Polkadot, Kusama, and Westend.
pub fn relay_era_payout(params: EraPayoutParams) -> (Balance, Balance) {
let EraPayoutParams {
total_staked,
total_stakable,
ideal_stake,
max_annual_inflation,
min_annual_inflation,
falloff,
period_fraction,
legacy_auction_proportion,
} = params;

let delta_annual_inflation = max_annual_inflation.saturating_sub(min_annual_inflation);

let ideal_stake = ideal_stake.saturating_sub(legacy_auction_proportion.unwrap_or_default());

let stake = Perquintill::from_rational(total_staked, total_stakable);
let adjustment = pallet_staking_reward_fn::compute_inflation(stake, ideal_stake, falloff);
let staking_inflation =
min_annual_inflation.saturating_add(delta_annual_inflation * adjustment);

let max_payout = period_fraction * max_annual_inflation * total_stakable;
let staking_payout = (period_fraction * staking_inflation) * total_stakable;
let rest = max_payout.saturating_sub(staking_payout);

let other_issuance = total_stakable.saturating_sub(total_staked);
if total_staked > other_issuance {
let _cap_rest = Perquintill::from_rational(other_issuance, total_staked) * staking_payout;
// We don't do anything with this, but if we wanted to, we could introduce a cap on the
// treasury amount with: `rest = rest.min(cap_rest);`
}
(staking_payout, rest)
}

// ---- TODO: Above is copy pasted from sdk, remove once we pull the version containing
// https://github.com/paritytech/polkadot-sdk/pull/4938
11 changes: 10 additions & 1 deletion relay/paseo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "paseo-runtime"
build = "build.rs"
repository.workspace = true
version = "1.3.1"
version = "1.3.3"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down 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 @@ -93,10 +94,12 @@ pallet-election-provider-support-benchmarking = { optional = true, workspace = t
pallet-offences-benchmarking = { optional = true, workspace = true }
pallet-session-benchmarking = { optional = true, workspace = true }
pallet-nomination-pools-benchmarking = { optional = true, workspace = true }
hex-literal = { 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 @@ -115,6 +118,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 @@ -165,6 +170,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 @@ -189,6 +195,7 @@ std = [
"polkadot-primitives/std",
"polkadot-runtime-common/std",
"paseo-runtime-constants/std",
"relay-common/std",
"runtime-parachains/std",
"scale-info/std",
"serde_json/std",
Expand Down Expand Up @@ -244,6 +251,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 @@ -298,6 +306,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