mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 02:08: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:
@@ -43,8 +43,9 @@ use primitives::v1::{
|
||||
ValidatorIndex,
|
||||
};
|
||||
use runtime_common::{
|
||||
auctions, crowdloan, impls::ToAuthor, paras_registrar, paras_sudo_wrapper, slots, xcm_sender,
|
||||
BlockHashCount, BlockLength, BlockWeights, RocksDbWeight, SlowAdjustingFeeUpdate,
|
||||
assigned_slots, auctions, crowdloan, impls::ToAuthor, paras_registrar, paras_sudo_wrapper,
|
||||
slots, xcm_sender, BlockHashCount, BlockLength, BlockWeights, RocksDbWeight,
|
||||
SlowAdjustingFeeUpdate,
|
||||
};
|
||||
use runtime_parachains::{self, runtime_api_impl::v1 as runtime_api_impl};
|
||||
use scale_info::TypeInfo;
|
||||
@@ -239,11 +240,12 @@ construct_runtime! {
|
||||
ParasDisputes: parachains_disputes,
|
||||
|
||||
// Parachain Onboarding Pallets
|
||||
Registrar: paras_registrar,
|
||||
Auctions: auctions,
|
||||
Crowdloan: crowdloan,
|
||||
Slots: slots,
|
||||
ParasSudoWrapper: paras_sudo_wrapper,
|
||||
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>, Config},
|
||||
Auctions: auctions::{Pallet, Call, Storage, Event<T>},
|
||||
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>},
|
||||
Slots: slots::{Pallet, Call, Storage, Event<T>},
|
||||
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call},
|
||||
AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event<T>},
|
||||
|
||||
// Sudo
|
||||
Sudo: pallet_sudo,
|
||||
@@ -786,6 +788,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 = 5 * DOLLARS;
|
||||
pub const DataDepositPerByte: Balance = deposit(0, 1);
|
||||
@@ -1019,7 +1040,7 @@ impl auctions::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const LeasePeriod: BlockNumber = 1 * DAYS;
|
||||
pub const LeasePeriod: BlockNumber = 7 * DAYS;
|
||||
}
|
||||
|
||||
impl slots::Config for Runtime {
|
||||
@@ -1028,6 +1049,7 @@ impl slots::Config for Runtime {
|
||||
type Registrar = Registrar;
|
||||
type LeasePeriod = LeasePeriod;
|
||||
type LeaseOffset = ();
|
||||
type ForceOrigin = EnsureRoot<AccountId>;
|
||||
type WeightInfo = slots::TestWeightInfo;
|
||||
}
|
||||
|
||||
@@ -1108,8 +1130,9 @@ impl InstanceFilter<Call> for ProxyType {
|
||||
fn filter(&self, c: &Call) -> bool {
|
||||
match self {
|
||||
ProxyType::Any => true,
|
||||
ProxyType::CancelProxy =>
|
||||
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })),
|
||||
ProxyType::CancelProxy => {
|
||||
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. }))
|
||||
},
|
||||
ProxyType::Auction => matches!(
|
||||
c,
|
||||
Call::Auctions { .. } |
|
||||
|
||||
Reference in New Issue
Block a user