mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Rococo: ability to programatically assign slots to teams (#3943)
* Permanent & Temp parachain slots on Rococo - WIP * Revert test change * Revert test change * Fix formatting * Extract logic to separate assigned_slots pallet * Formatting * Parachain downgrade logic * Pallet doc comment * Revert unnecessary changes * Fix few issues, tweak temp slots allocation logic; add a bunch of tests * Address review comments; track active temp slots * Update runtime/common/src/assigned_slots.rs * Update runtime/common/src/assigned_slots.rs * Remove assigned_slots calls from paras_sudo_wrapper * Unassign is a perfectly valid verb * Remove unneeded collect * Update code following #3980 * Cleanup * Generate storage info for pallet * Address review comments * Add ForceOrigin to slots pallet * Track permanent slot duration in storage * Fix tests build Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
@@ -29,9 +29,10 @@ use primitives::v1::{
|
||||
SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
|
||||
};
|
||||
use runtime_common::{
|
||||
auctions, crowdloan, impls::ToAuthor, paras_registrar, paras_sudo_wrapper, slots, xcm_sender,
|
||||
BlockHashCount, BlockLength, BlockWeights, CurrencyToVote, OffchainSolutionLengthLimit,
|
||||
OffchainSolutionWeightLimit, RocksDbWeight, SlowAdjustingFeeUpdate,
|
||||
assigned_slots, auctions, crowdloan, impls::ToAuthor, paras_registrar, paras_sudo_wrapper,
|
||||
slots, xcm_sender, BlockHashCount, BlockLength, BlockWeights, CurrencyToVote,
|
||||
OffchainSolutionLengthLimit, OffchainSolutionWeightLimit, RocksDbWeight,
|
||||
SlowAdjustingFeeUpdate,
|
||||
};
|
||||
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
|
||||
|
||||
@@ -862,6 +863,25 @@ impl parachains_initializer::Config for Runtime {
|
||||
|
||||
impl paras_sudo_wrapper::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
pub const PermanentSlotLeasePeriodLength: u32 = 26;
|
||||
pub const TemporarySlotLeasePeriodLength: u32 = 1;
|
||||
pub const MaxPermanentSlots: u32 = 5;
|
||||
pub const MaxTemporarySlots: u32 = 20;
|
||||
pub const MaxTemporarySlotPerLeasePeriod: u32 = 5;
|
||||
}
|
||||
|
||||
impl assigned_slots::Config for Runtime {
|
||||
type Event = Event;
|
||||
type AssignSlotOrigin = EnsureRoot<AccountId>;
|
||||
type Leaser = Slots;
|
||||
type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
|
||||
type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength;
|
||||
type MaxPermanentSlots = MaxPermanentSlots;
|
||||
type MaxTemporarySlots = MaxTemporarySlots;
|
||||
type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ParaDeposit: Balance = 2000 * CENTS;
|
||||
pub const DataDepositPerByte: Balance = deposit(0, 1);
|
||||
@@ -887,6 +907,7 @@ impl slots::Config for Runtime {
|
||||
type Registrar = Registrar;
|
||||
type LeasePeriod = LeasePeriod;
|
||||
type LeaseOffset = ();
|
||||
type ForceOrigin = EnsureRoot<AccountId>;
|
||||
type WeightInfo = weights::runtime_common_slots::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
@@ -1112,6 +1133,7 @@ construct_runtime! {
|
||||
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62,
|
||||
Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 63,
|
||||
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 64,
|
||||
AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event<T>} = 65,
|
||||
|
||||
// Pallet for sending XCM.
|
||||
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99,
|
||||
|
||||
Reference in New Issue
Block a user