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

Commit

Permalink
Runtime: Kusama gets Society v2 (#7356)
Browse files Browse the repository at this point in the history
* Remove println

* Kusama gets the new society

* Integrate migration

* Formatting

* Add Society weights

* Remive diener

* Fixes

* Update Cargo.toml

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>

* Add real historical payment info for Society.

* Fixes

* Bump Substrate

---------

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
  • Loading branch information
gavofyork and liamaharon authored Jun 18, 2023
1 parent 48bbf36 commit 47c8c36
Show file tree
Hide file tree
Showing 12 changed files with 972 additions and 265 deletions.
391 changes: 198 additions & 193 deletions Cargo.lock

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
35 changes: 16 additions & 19 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ mod weights;
// Voter bag threshold definitions.
mod bag_thresholds;

// Historical information of society finances.
mod past_payouts;

// XCM configurations.
pub mod xcm_config;

Expand Down Expand Up @@ -863,33 +866,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 @@ -1529,6 +1523,7 @@ pub mod migrations {
pallet_offences::migration::v1::MigrateToV1<Runtime>,
runtime_common::session::migration::ClearOldSessionStorage<Runtime>,
);

pub type V0943 = (
SetStorageVersions,
// Remove UMP dispatch queue <https://github.com/paritytech/polkadot/pull/6271>
Expand All @@ -1537,7 +1532,8 @@ pub mod migrations {
);

/// Unreleased migrations. Add new ones here:
pub type Unreleased = ();
pub type Unreleased =
(pallet_society::migrations::MigrateToV2<Runtime, (), past_payouts::PastPayouts>,);

/// Migrations that set `StorageVersion`s we missed to set.
pub struct SetStorageVersions;
Expand Down Expand Up @@ -1641,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
Loading

0 comments on commit 47c8c36

Please sign in to comment.