Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Runtime: Kusama gets Society v2 #7356

Merged
merged 15 commits into from
Jun 18, 2023
Merged
547 changes: 327 additions & 220 deletions Cargo.lock

Large diffs are not rendered by default.

265 changes: 265 additions & 0 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master",
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
polkadot-core-primitives = { path = "../core-primitives", default-features = false }
derive_more = "0.99.11"
bounded-collections = { version = "0.1.7", default-features = false, features = ["serde"] }
bounded-collections = { version = "0.1.8", default-features = false, features = ["serde"] }

# all optional crates.
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }
Expand Down
4 changes: 1 addition & 3 deletions runtime/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate",
pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
pallet-election-provider-support-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
hex-literal = { version = "0.4.1", optional = true }
hex-literal = "0.4.1"

runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false }
Expand All @@ -104,7 +104,6 @@ xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", defa
xcm-builder = { package = "xcm-builder", path = "../../xcm/xcm-builder", default-features = false }

[dev-dependencies]
hex-literal = "0.4.1"
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down Expand Up @@ -249,7 +248,6 @@ runtime-benchmarks = [
"pallet-whitelist/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"hex-literal",
"xcm-builder/runtime-benchmarks",
"frame-election-provider-support/runtime-benchmarks",
"pallet-bags-list/runtime-benchmarks",
Expand Down
37 changes: 19 additions & 18 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,33 +865,24 @@ impl pallet_recovery::Config for Runtime {
}

parameter_types! {
pub const CandidateDeposit: Balance = 10 * QUID;
pub const WrongSideDeduction: Balance = 2 * QUID;
pub const MaxStrikes: u32 = 10;
pub const RotationPeriod: BlockNumber = 7 * DAYS;
pub const PeriodSpend: Balance = 500 * QUID;
pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS;
pub const ChallengePeriod: BlockNumber = 7 * DAYS;
pub const MaxCandidateIntake: u32 = 1;
pub const SocietyPalletId: PalletId = PalletId(*b"py/socie");
}

impl pallet_society::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
type CandidateDeposit = CandidateDeposit;
type WrongSideDeduction = WrongSideDeduction;
type MaxStrikes = MaxStrikes;
type PeriodSpend = PeriodSpend;
type MembershipChanged = ();
type RotationPeriod = RotationPeriod;
type MaxLockDuration = MaxLockDuration;
type GraceStrikes = ConstU32<10>;
type PeriodSpend = ConstU128<{ 500 * QUID }>;
type VotingPeriod = ConstU32<{ 5 * DAYS }>;
type ClaimPeriod = ConstU32<{ 2 * DAYS }>;
type MaxLockDuration = ConstU32<{ 36 * 30 * DAYS }>;
type FounderSetOrigin = EnsureRoot<AccountId>;
type SuspensionJudgementOrigin = pallet_society::EnsureFounder<Runtime>;
type ChallengePeriod = ChallengePeriod;
type MaxCandidateIntake = MaxCandidateIntake;
type ChallengePeriod = ConstU32<{ 7 * DAYS }>;
type MaxPayouts = ConstU32<8>;
type MaxBids = ConstU32<512>;
type PalletId = SocietyPalletId;
type WeightInfo = weights::pallet_society::WeightInfo<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -1512,6 +1503,8 @@ pub type Migrations =
pub mod migrations {
use super::*;
use frame_support::traits::{GetStorageVersion, OnRuntimeUpgrade, StorageVersion};
use hex_literal::hex;
use pallet_society::migrations::from_raw_past_payouts;

pub type V0940 = (
pallet_nomination_pools::migration::v4::MigrateToV4<
Expand All @@ -1527,12 +1520,19 @@ pub mod migrations {
runtime_common::session::migration::ClearOldSessionStorage<Runtime>,
);

parameter_types! {
pub PastPayouts: Vec<(AccountId, Balance)> = from_raw_past_payouts::<Runtime, ()>(vec![
(hex!["1234567890123456789012345678901234567890123456789012345678901234"], 0u128),
].into_iter());
}

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (
SetStorageVersions,
// Remove UMP dispatch queue <https://github.com/paritytech/polkadot/pull/6271>
parachains_configuration::migration::v6::MigrateToV6<Runtime>,
ump_migrations::UpdateUmpLimits,
pallet_society::migrations::MigrateToV2<Runtime, (), PastPayouts>,
);

/// Migrations that set `StorageVersion`s we missed to set.
Expand Down Expand Up @@ -1637,6 +1637,7 @@ mod benches {
[pallet_referenda, FellowshipReferenda]
[pallet_scheduler, Scheduler]
[pallet_session, SessionBench::<Runtime>]
[pallet_society, Society]
[pallet_staking, Staking]
[frame_system, SystemBench::<Runtime>]
[pallet_timestamp, Timestamp]
Expand Down
1 change: 1 addition & 0 deletions runtime/kusama/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub mod pallet_referenda_fellowship_referenda;
pub mod pallet_referenda_referenda;
pub mod pallet_scheduler;
pub mod pallet_session;
pub mod pallet_society;
pub mod pallet_staking;
pub mod pallet_timestamp;
pub mod pallet_tips;
Expand Down
14 changes: 1 addition & 13 deletions runtime/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,7 @@ impl Contains<RuntimeCall> for SafeCallFilter {
pallet_identity::Call::remove_sub { .. } |
pallet_identity::Call::quit_sub { .. },
) |
RuntimeCall::Society(
pallet_society::Call::bid { .. } |
pallet_society::Call::unbid { .. } |
pallet_society::Call::vouch { .. } |
pallet_society::Call::unvouch { .. } |
pallet_society::Call::vote { .. } |
pallet_society::Call::defender_vote { .. } |
pallet_society::Call::payout { .. } |
pallet_society::Call::unfound { .. } |
pallet_society::Call::judge_suspended_member { .. } |
pallet_society::Call::judge_suspended_candidate { .. } |
pallet_society::Call::set_max_members { .. },
) |
RuntimeCall::Society(..) |
RuntimeCall::Recovery(..) |
RuntimeCall::Vesting(..) |
RuntimeCall::Bounties(
Expand Down
31 changes: 11 additions & 20 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,34 +811,24 @@ impl pallet_recovery::Config for Runtime {
}

parameter_types! {
pub const CandidateDeposit: Balance = 1000 * CENTS;
pub const WrongSideDeduction: Balance = 200 * CENTS;
pub const MaxStrikes: u32 = 10;
pub const RotationPeriod: BlockNumber = 7 * DAYS;
pub const PeriodSpend: Balance = 50000 * CENTS;
pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS;
pub const ChallengePeriod: BlockNumber = 7 * DAYS;
pub const MaxCandidateIntake: u32 = 1;
pub const SocietyPalletId: PalletId = PalletId(*b"py/socie");
}

impl pallet_society::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
type CandidateDeposit = CandidateDeposit;
type WrongSideDeduction = WrongSideDeduction;
type MaxStrikes = MaxStrikes;
type PeriodSpend = PeriodSpend;
type MembershipChanged = ();
type RotationPeriod = RotationPeriod;
type MaxLockDuration = MaxLockDuration;
type FounderSetOrigin =
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>;
type SuspensionJudgementOrigin = pallet_society::EnsureFounder<Runtime>;
type ChallengePeriod = ChallengePeriod;
type MaxCandidateIntake = MaxCandidateIntake;
type GraceStrikes = ConstU32<1>;
type PeriodSpend = ConstU128<{ 50_000 * CENTS }>;
type VotingPeriod = ConstU32<{ 5 * DAYS }>;
type ClaimPeriod = ConstU32<{ 2 * DAYS }>;
type MaxLockDuration = ConstU32<{ 36 * 30 * DAYS }>;
type FounderSetOrigin = EnsureRoot<AccountId>;
type ChallengePeriod = ConstU32<{ 7 * DAYS }>;
type MaxPayouts = ConstU32<8>;
type MaxBids = ConstU32<512>;
type PalletId = SocietyPalletId;
type WeightInfo = ();
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
}

parameter_types! {
Expand Down Expand Up @@ -1629,6 +1619,7 @@ pub mod migrations {
// Remove UMP dispatch queue <https://github.com/paritytech/polkadot/pull/6271>
parachains_configuration::migration::v6::MigrateToV6<Runtime>,
ump_migrations::UpdateUmpLimits,
pallet_society::migrations::MigrateToV2<Runtime, (), ()>,
gavofyork marked this conversation as resolved.
Show resolved Hide resolved
);
}

Expand Down
14 changes: 1 addition & 13 deletions runtime/rococo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,19 +259,7 @@ impl Contains<RuntimeCall> for SafeCallFilter {
pallet_identity::Call::remove_sub { .. } |
pallet_identity::Call::quit_sub { .. },
) |
RuntimeCall::Society(
pallet_society::Call::bid { .. } |
pallet_society::Call::unbid { .. } |
pallet_society::Call::vouch { .. } |
pallet_society::Call::unvouch { .. } |
pallet_society::Call::vote { .. } |
pallet_society::Call::defender_vote { .. } |
pallet_society::Call::payout { .. } |
pallet_society::Call::unfound { .. } |
pallet_society::Call::judge_suspended_member { .. } |
pallet_society::Call::judge_suspended_candidate { .. } |
pallet_society::Call::set_max_members { .. },
) |
RuntimeCall::Society(..) |
RuntimeCall::Recovery(..) |
RuntimeCall::Vesting(..) |
RuntimeCall::Bounties(
Expand Down
2 changes: 1 addition & 1 deletion xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors.workspace = true
edition.workspace = true

[dependencies]
bounded-collections = { version = "0.1.7", default-features = false, features = ["serde"] }
bounded-collections = { version = "0.1.8", default-features = false, features = ["serde"] }
derivative = { version = "2.2.0", default-features = false, features = [ "use_core" ] }
impl-trait-for-tuples = "0.2.2"
log = { version = "0.4.17", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion xcm/pallet-xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version.workspace = true


[dependencies]
bounded-collections = { version = "0.1.7", default-features = false }
bounded-collections = { version = "0.1.8", default-features = false }
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.163", optional = true, features = ["derive"] }
Expand Down