Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ef3adf9
Revert "fix(review-bot): pull secrets from `master` environment" (#1748)
Sep 29, 2023
d8d90a8
Enable mocking contracts (#1331)
pmikolajczyk41 Sep 29, 2023
0691c91
Move import queue from `ChainSync` to `SyncingEngine` (#1736)
dmitry-markin Sep 29, 2023
f820dc0
[NPoS] Fix for Reward Deficit in the pool (#1255)
Ank4n Sep 29, 2023
9485b0b
Point documentation links to monorepo (#1741)
skunert Sep 29, 2023
7d4f829
frame-support: `RuntimeDebug\Eq\PartialEq` impls for `Imbalance` (#1717)
muharem Sep 29, 2023
8fe947a
improve service error (#1734)
yjhmelody Sep 30, 2023
e8baac7
Tvl pool staking (#1322)
PieWol Oct 1, 2023
2ed66a0
migrate alliance, fast-unstake and bags list to use derive-impl (#1636)
kianenigma Oct 1, 2023
c54ea64
no-bound derives: Use absolute path for `core` (#1763)
bkchr Oct 1, 2023
db3fd68
Init System Parachain storage versions and add migration check jobs t…
liamaharon Oct 2, 2023
3ea497b
expose the last relay chain block number as an API from parachain-sys…
rphmeier Oct 3, 2023
aad80cc
feat: compute pallet/storage prefix hash at compile time (#1539)
yjhmelody Oct 3, 2023
d80171e
Update bridges subtree (#1740)
svyatonik Oct 3, 2023
cd076d7
Upgraded review-bot to version 2.0.1 (#1784)
Bullrich Oct 4, 2023
f4827dc
remove outdated scripts (#1769)
yjhmelody Oct 4, 2023
0a6dfdf
Updating glutton for async backing (#1619)
BradleyOlson64 Oct 4, 2023
2bafc11
Fixed test compile errors
BradleyOlson64 Oct 4, 2023
4a971d7
Merge branch 'rk-core-time-prep' of https://github.com/paritytech/pol…
BradleyOlson64 Oct 4, 2023
2a079fa
Fixing errors after merge
BradleyOlson64 Oct 4, 2023
7ab7e38
Fix builder compilation.
Oct 4, 2023
83a589b
changing mem_replace back to sp_std
BradleyOlson64 Oct 5, 2023
bfa35cd
Merge branch 'brad-core-time-tests' of https://github.com/paritytech/…
BradleyOlson64 Oct 5, 2023
86955ee
Remove deprecated CI config files (#1799)
sergejparity Oct 5, 2023
51c0c24
PVF: Add back socket path parameter, use tmp socket path (#1780)
mrcnski Oct 5, 2023
d21113c
Delete full db directory with `purge-chain` subcommand (#1786)
skunert Oct 5, 2023
0c59232
Bump the known_good_semver group with 1 update (#1752)
dependabot[bot] Oct 5, 2023
b6dd905
Partial mock assigner with static storage
BradleyOlson64 Oct 6, 2023
1835c09
Revive Substrate Crate (#1477)
ggwpez Oct 6, 2023
02e4eab
Mock assigner take 1
BradleyOlson64 Oct 6, 2023
ddf5e5c
Bump the known_good_semver group with 1 update (#1802)
dependabot[bot] Oct 6, 2023
35ed272
migrate babe and authorship to use derive-impl (#1790)
Dmitry-Borodin Oct 7, 2023
a330ea2
Merge branch 'master' of https://github.com/paritytech/polkadot-sdk i…
BradleyOlson64 Oct 7, 2023
0f01b22
Fixed assigner test
BradleyOlson64 Oct 7, 2023
07ec512
Tests passed and mock assigner fixed
BradleyOlson64 Oct 7, 2023
7e820f3
Revert "Merge branch 'master'
BradleyOlson64 Oct 7, 2023
696abda
made constructor private, and fmt
BradleyOlson64 Oct 7, 2023
b13e058
Fixed unneeded config tweak
BradleyOlson64 Oct 7, 2023
6eb9057
More tweaks
BradleyOlson64 Oct 7, 2023
f9e84aa
Streamlining add_on_demand_order
BradleyOlson64 Oct 7, 2023
dcf3e24
Dropped unified assignment in favor of V0
BradleyOlson64 Oct 9, 2023
59ad88e
Added to assigner_on_demand tests
BradleyOlson64 Oct 9, 2023
9a7c643
Remove assigner state check from scheduler tests
BradleyOlson64 Oct 9, 2023
0b93e26
fmt
BradleyOlson64 Oct 9, 2023
5504170
Final tweaks
BradleyOlson64 Oct 9, 2023
6334d0a
added assert
BradleyOlson64 Oct 9, 2023
d7b7d53
Added comments to MockAssigner
BradleyOlson64 Oct 10, 2023
495ac04
Generic get_assignment_provider_config
BradleyOlson64 Oct 14, 2023
b7e6d36
Simplified mock assigner
BradleyOlson64 Oct 14, 2023
c9c4f08
Fixed builder to work with Mock Assigner
BradleyOlson64 Oct 15, 2023
f4dd55b
Edited scheduler tests for minimal mock assigner
BradleyOlson64 Oct 16, 2023
12a2289
Added unified assigner test file
BradleyOlson64 Oct 16, 2023
d0c2a9b
fmt
BradleyOlson64 Oct 17, 2023
41c15e2
Removed parachain + parathread mentions from tests
BradleyOlson64 Oct 23, 2023
7a191c8
fmt
BradleyOlson64 Oct 23, 2023
41e1d35
Comment fix
BradleyOlson64 Oct 23, 2023
c1d2add
Merge branch 'rk-core-time-prep' of https://github.com/paritytech/pol…
BradleyOlson64 Oct 24, 2023
46ef8cd
Cleanup + better logic.
Oct 25, 2023
3f0b797
Shored up assigner_parachains encapsulation
BradleyOlson64 Oct 25, 2023
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
3 changes: 1 addition & 2 deletions polkadot/runtime/parachains/src/assigner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ pub mod pallet {
}

/// Assignments as of this top-level assignment provider.
#[derive(Encode, Decode, TypeInfo, RuntimeDebug)]
// Generic arguments, because instance generation of above traits breaks with generic `T` parameter.
#[derive(Encode, Decode, TypeInfo, RuntimeDebug, PartialEq, Clone)]
pub enum UnifiedAssignment<OnDemand, Legacy> {
/// Assignment came from on-demand assignment provider.
#[codec(index = 0)]
Expand Down
43 changes: 40 additions & 3 deletions polkadot/runtime/parachains/src/assigner_on_demand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,41 @@ pub enum SpotTrafficCalculationErr {
}

/// Assignments as provided by the on-demand `AssignmentProvider`.
#[derive(RuntimeDebug, Encode, Decode, TypeInfo)]
#[derive(RuntimeDebug, Encode, Decode, TypeInfo, PartialEq, Clone)]
pub struct OnDemandAssignment {
/// The assigned para id.
para_id: ParaId,
/// The core index the para got assigned to.
core_index: CoreIndex,
}

#[cfg(test)]
impl OnDemandAssignment {
pub fn new(para_id: ParaId, core_index: CoreIndex) -> Self {
Self { para_id, core_index }
}
}

impl Assignment for OnDemandAssignment {
fn para_id(&self) -> ParaId {
self.para_id
}
}

/// Internal representation of an order after it has been enqueued already.
#[derive(Encode, Decode, TypeInfo)]
#[cfg(not(test))]
#[derive(Encode, Decode, TypeInfo, Debug, PartialEq)]
pub(super) struct EnqueuedOrder {
pub para_id: ParaId,
}

// Looser encapsulation for tests
Comment thread
eskimor marked this conversation as resolved.
Outdated
#[cfg(test)]
#[derive(Encode, Decode, TypeInfo, Debug, PartialEq)]
pub(crate) struct EnqueuedOrder {
pub para_id: ParaId,
}

impl EnqueuedOrder {
pub fn new(para_id: ParaId) -> Self {
Self { para_id }
Expand Down Expand Up @@ -471,6 +486,7 @@ where
/// Errors:
/// - `InvalidParaId`
/// - `QueueFull`
#[cfg(not(test))]
fn add_on_demand_order(
order: EnqueuedOrder,
location: QueuePushDirection,
Expand All @@ -491,6 +507,27 @@ where
})
}

#[cfg(test)]
pub fn add_on_demand_order(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

order: EnqueuedOrder,
location: QueuePushDirection,
) -> Result<(), DispatchError> {
// Only parathreads are valid paraids for on the go parachains.
ensure!(<paras::Pallet<T>>::is_parathread(order.para_id), Error::<T>::InvalidParaId);

let config = <configuration::Pallet<T>>::config();

OnDemandQueue::<T>::try_mutate(|queue| {
// Abort transaction if queue is too large
ensure!(Self::queue_size() < config.on_demand_queue_max_size, Error::<T>::QueueFull);
match location {
QueuePushDirection::Back => queue.push_back(order),
QueuePushDirection::Front => queue.push_front(order),
};
Ok(())
})
}

/// Get the size of the on demand queue.
///
/// Returns:
Expand All @@ -511,7 +548,7 @@ where

/// Getter for the order queue.
#[cfg(test)]
fn get_queue() -> VecDeque<EnqueuedOrder> {
pub fn get_queue() -> VecDeque<EnqueuedOrder> {
OnDemandQueue::<T>::get()
}

Expand Down
Loading