Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
0363803
Introduce peeking for the `AssignmentProvider`.
Oct 24, 2024
09b51a6
Fix peek_impl
Oct 24, 2024
3c71790
Fmt
Oct 24, 2024
92ed93f
Simplification
Oct 24, 2024
02cd806
Fixes
Oct 24, 2024
2f6a52b
Remove AssignmentProvider trait.
Oct 25, 2024
2ae4373
Individual advance (broken)
Oct 25, 2024
ddff0b7
WIP: Take advantage of cores moving in tandem.
Oct 25, 2024
fe00780
Fixes
Oct 25, 2024
88e74c2
Initial duplication handling.
Oct 26, 2024
2675e4c
Simplification + look into the future.
Oct 26, 2024
52fd740
Fix max ondemand_queue size.
Oct 26, 2024
4cc2d8c
Remove `Assignment` + inherent integration
Oct 26, 2024
0500344
Fixes, cleanup.
Oct 26, 2024
3269103
Merge branch 'master' into rk-peek-assigner
Nov 4, 2024
2179a9c
Fixes
Nov 4, 2024
556816b
Merge branch 'master' into rk-peek-assigner
Nov 5, 2024
4d7813f
Make it typecheck.
Nov 5, 2024
ba713fc
Merge branch 'master' into rk-peek-assigner
Nov 8, 2024
32b23b5
Fix on-demand peeking
Nov 8, 2024
52df001
Minor doc fixes.
Nov 8, 2024
91fa451
Change hash format
Nov 25, 2024
e6cf2dc
WIP: Fix tests
Jan 1, 2025
4a7d400
Merge branch 'master' into rk-peek-assigner
eskimor Jan 1, 2025
8673220
Merge remote-tracking branch 'origin/master' into rk-peek-assigner
Jan 7, 2025
d962184
Expose types used in public API.
Jan 7, 2025
e551daa
More fixes
Jan 7, 2025
ed2b8d8
Merge remote-tracking branch 'origin/master' into rk-peek-assigner
Feb 14, 2025
88fb317
Compile fixes
Feb 15, 2025
71f7fb8
Merge remote-tracking branch 'origin/master' into rk-peek-assigner
Mar 19, 2025
2003f55
Fixes
Mar 24, 2025
f7ce848
Fixes
Mar 28, 2025
8419f3e
Merge remote-tracking branch 'origin/rk-peek-assigner' into rk-peek-a…
Mar 28, 2025
efe5536
Fixes
Apr 2, 2025
6549921
Cleanup: Make assigner_coretime internal to scheduler.
Apr 18, 2025
5772989
Fmt
Apr 18, 2025
45ce037
Doc fix
Apr 18, 2025
04db5f1
Fixes
Apr 19, 2025
b284ec8
RuntimeDebug is better
Apr 19, 2025
b57a6ac
Tests compile
Apr 20, 2025
1150ac6
Fix ondemand tests
May 3, 2025
f9b631a
Merge remote-tracking branch 'origin/master' into rk-peek-assigner
Aug 30, 2025
a9abd25
Fmt
Aug 30, 2025
1ae6ba7
Fix benchmarks
Oct 27, 2025
3c5c66e
Fix core handling in make_inherent_data
Nov 1, 2025
4cb3473
Fix tests.
Nov 1, 2025
2d16d0e
Fix weight functions.
Nov 1, 2025
53f5528
Formatting
Nov 1, 2025
20ba0cd
Merge remote-tracking branch 'origin/master' into rk-peek-assigner-fixed
Nov 2, 2025
0507b6c
Fix imports
Nov 2, 2025
1fdf6cb
Add missing tests (again)
Nov 2, 2025
18c59df
First iteration of the scheduler migration
Nov 6, 2025
ce19382
Shorten references.
Nov 6, 2025
fe09203
Better tests + assigner_coretime changes.
Nov 6, 2025
ec866e8
Better hygine in assigner_coretime.
Nov 6, 2025
63eebf7
Finish migrations.
Nov 6, 2025
f46c0e0
Get rid of obsolete coretime migration.
Nov 6, 2025
9506ded
Remove obsolete todos
Nov 6, 2025
ff0f47e
Add first iteration of migration for on_demand pallet rename.
Nov 7, 2025
a4b6926
Fix migration order.
Nov 7, 2025
7f1eaca
Remove removed migration reference
Nov 7, 2025
1ff4838
Fix formatting and remove unused migration.
Nov 7, 2025
359d488
Add prdoc.
Nov 7, 2025
c8d8571
Fix benchmarks
Nov 7, 2025
03d3e18
Compliation fixes.
Nov 7, 2025
0095198
Fix deprecation warnings.
Nov 7, 2025
61aa346
Fixes
Nov 7, 2025
99ebb38
Fixes.
Nov 7, 2025
521fe09
more fixes
Nov 7, 2025
2607182
Fix clippy issues.
Nov 7, 2025
50e7090
Fixes in staking-async runtime
Nov 7, 2025
cb908a5
Fix
Nov 7, 2025
c8b9d89
CI Fixes
Nov 8, 2025
b582c64
Merge remote-tracking branch 'origin/master' into rk-peek-assigner
Nov 8, 2025
bd4776f
nexttest fix
Nov 9, 2025
03ec328
Add missing import
Nov 9, 2025
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
6 changes: 2 additions & 4 deletions polkadot/primitives/src/v9/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,8 @@ pub const ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE: u32 = 10_000;

/// Maximum for maximum queue size.
///
/// Setting `on_demand_queue_max_size` to a value higher than this is unsound. This is more a
/// theoretical limit, just below enough what the target type supports, so comparisons are possible
/// even with indices that are overflowing the underyling type.
pub const ON_DEMAND_MAX_QUEUE_MAX_SIZE: u32 = 1_000_000_000;
/// We use this value for benchmarking.
pub const ON_DEMAND_MAX_QUEUE_MAX_SIZE: u32 = 10_000;

/// Backing votes threshold used from the host prior to runtime API version 6 and from the runtime
/// prior to v9 configuration migration.
Expand Down
170 changes: 170 additions & 0 deletions polkadot/runtime/parachains/src/assigner_coretime.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
// 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/>.

//! # DEPRECATED: AssignerCoretime Pallet (Stub for Migration)
//!
//! **⚠️ THIS PALLET IS DEPRECATED ⚠️**
//!
//! This pallet exists only to facilitate storage migration to the scheduler pallet.
//! The functionality has been moved to `scheduler::assigner_coretime` submodule.
//!
//! **This pallet should be removed after all networks have successfully migrated to v4.**
//!
//! ## Migration Path
//!
//! Storage items `CoreSchedules` and `CoreDescriptors` are migrated from this pallet
//! to the `Scheduler` pallet via the `scheduler::migration::v4::MigrateV3ToV4` migration.

use alloc::vec::Vec;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pallet_broker::CoreAssignment;
use polkadot_primitives::CoreIndex;

/// Fraction expressed as a nominator with an assumed denominator of 57,600.
#[derive(
RuntimeDebug,
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Encode,
Decode,
DecodeWithMemTracking,
TypeInfo,
)]
pub struct PartsOf57600(pub u16);

impl PartsOf57600 {
pub const ZERO: Self = Self(0);
pub const FULL: Self = Self(57600);

pub fn new_saturating(v: u16) -> Self {
Self::ZERO.saturating_add(Self(v))
}

pub fn is_full(&self) -> bool {
*self == Self::FULL
}

pub fn saturating_add(self, rhs: Self) -> Self {
let inner = self.0.saturating_add(rhs.0);
if inner > 57600 {
Self(57600)
} else {
Self(inner)
}
}

pub fn saturating_sub(self, rhs: Self) -> Self {
Self(self.0.saturating_sub(rhs.0))
}
}

/// Assignments as they are scheduled by block number for a particular core.
#[derive(Encode, Decode, TypeInfo)]
#[cfg_attr(test, derive(PartialEq, RuntimeDebug))]
pub struct Schedule<N> {
/// Original assignments
pub assignments: Vec<(CoreAssignment, PartsOf57600)>,
/// When do our assignments become invalid, if at all?
pub end_hint: Option<N>,
/// The next queued schedule for this core.
pub next_schedule: Option<N>,
}

/// Descriptor for a core.
#[derive(Encode, Decode, TypeInfo, Default)]
#[cfg_attr(test, derive(PartialEq, RuntimeDebug, Clone))]
pub struct CoreDescriptor<N> {
/// Meta data about the queued schedules for this core.
pub queue: Option<QueueDescriptor<N>>,
/// Currently performed work.
pub current_work: Option<WorkState<N>>,
}

/// Pointers into `CoreSchedules` for a particular core.
#[derive(Encode, Decode, TypeInfo, Copy, Clone)]
#[cfg_attr(test, derive(PartialEq, RuntimeDebug))]
pub struct QueueDescriptor<N> {
/// First scheduled item, that is not yet active.
pub first: N,
/// Last scheduled item.
pub last: N,
}

/// Work state for a core.
#[derive(Encode, Decode, TypeInfo)]
#[cfg_attr(test, derive(PartialEq, RuntimeDebug, Clone))]
pub struct WorkState<N> {
/// Assignments with current state.
pub assignments: Vec<(CoreAssignment, AssignmentState)>,
/// When do our assignments become invalid if at all?
pub end_hint: Option<N>,
/// Position in the assignments we are currently in.
pub pos: u16,
/// Step width
pub step: PartsOf57600,
}

/// Assignment state.
#[derive(Encode, Decode, TypeInfo)]
#[cfg_attr(test, derive(PartialEq, RuntimeDebug, Clone, Copy))]
pub struct AssignmentState {
/// Ratio of the core this assignment has.
pub ratio: PartsOf57600,
/// How many parts are remaining in this round?
pub remaining: PartsOf57600,
}

#[allow(deprecated)]
#[frame_support::pallet]
pub mod pallet {
use super::*;

#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);

#[pallet::config]
pub trait Config: frame_system::Config {}

#[pallet::call]
impl<T: Config> Pallet<T> {}

/// Old CoreSchedules storage - migrated to Scheduler pallet in v4.
///
/// **DEPRECATED:** This storage will be empty after migration completes.
#[pallet::storage]
pub type CoreSchedules<T: Config> = StorageMap<
_,
Twox256,
(BlockNumberFor<T>, CoreIndex),
Schedule<BlockNumberFor<T>>,
OptionQuery,
>;

/// Old CoreDescriptors storage - migrated to Scheduler pallet in v4.
///
/// **DEPRECATED:** This storage will be empty after migration completes.
#[pallet::storage]
pub type CoreDescriptors<T: Config> =
StorageMap<_, Twox256, CoreIndex, CoreDescriptor<BlockNumberFor<T>>, ValueQuery>;
}

pub use pallet::*;
Loading
Loading