Coretime Feature branch (relay chain) (#1694)

Also fixes: https://github.com/paritytech/polkadot-sdk/issues/1417

- [x] CoreIndex -> AssignmentProvider mapping will be able to change any
time.
- [x] Implement
- [x] Provide Migrations
- [x] Add and fix tests
- [x] Implement bulk assigner logic
- [x] bulk assigner tests
- [x] Port over current assigner to use bulk designer (+ share on-demand
with bulk): top-level assigner has core ranges: legacy, bulk
- [x] Adjust migrations to reflect new assigner structure
- [x] Move migration code to Assignment code directly and make it
recursive (make it possible to skip releases) -> follow up ticket.
- [x] Test migrations
- [x] Add migration PR to runtimes repo -> follow up ticket.
- [x] Wire up with actual UMP messages
- [x] Write PR docs

---------

Co-authored-by: eskimor <eskimor@no-such-url.com>
Co-authored-by: Bradley Olson <34992650+BradleyOlson64@users.noreply.github.com>
Co-authored-by: BradleyOlson64 <lotrftw9@gmail.com>
Co-authored-by: Anton Vilhelm Ásgeirsson <antonva@users.noreply.github.com>
Co-authored-by: antonva <anton.asgeirsson@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Marcin S. <marcin@realemail.net>
Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: command-bot <>
This commit is contained in:
eskimor
2023-12-21 19:06:58 +01:00
committed by GitHub
parent 18d53dbf91
commit 69434d9a32
71 changed files with 4059 additions and 1213 deletions
@@ -18,7 +18,9 @@ use super::*;
use crate::{inclusion, ParaId};
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
use frame_system::RawOrigin;
use sp_std::collections::btree_map::BTreeMap;
use sp_std::{cmp::min, collections::btree_map::BTreeMap};
use primitives::v6::GroupIndex;
use crate::builder::BenchBuilder;
@@ -116,7 +118,9 @@ benchmarks! {
// There is 1 backed,
assert_eq!(benchmark.backed_candidates.len(), 1);
// with `v` validity votes.
assert_eq!(benchmark.backed_candidates.get(0).unwrap().validity_votes.len(), v as usize);
// let votes = v as usize;
let votes = min(scheduler::Pallet::<T>::group_validators(GroupIndex::from(0)).unwrap().len(), v as usize);
assert_eq!(benchmark.backed_candidates.get(0).unwrap().validity_votes.len(), votes);
benchmark.bitfields.clear();
benchmark.disputes.clear();
@@ -138,7 +142,7 @@ benchmarks! {
let descriptor = backing_validators.0.descriptor();
assert_eq!(ParaId::from(para_id), descriptor.para_id);
assert_eq!(header.hash(), descriptor.relay_parent);
assert_eq!(backing_validators.1.len(), v as usize);
assert_eq!(backing_validators.1.len(), votes);
}
assert_eq!(
@@ -167,11 +171,14 @@ benchmarks! {
let mut benchmark = scenario.data.clone();
// let votes = BenchBuilder::<T>::fallback_min_validity_votes() as usize;
let votes = min(scheduler::Pallet::<T>::group_validators(GroupIndex::from(0)).unwrap().len(), BenchBuilder::<T>::fallback_min_validity_votes() as usize);
// There is 1 backed
assert_eq!(benchmark.backed_candidates.len(), 1);
assert_eq!(
benchmark.backed_candidates.get(0).unwrap().validity_votes.len() as u32,
BenchBuilder::<T>::fallback_min_validity_votes()
benchmark.backed_candidates.get(0).unwrap().validity_votes.len(),
votes,
);
benchmark.bitfields.clear();
@@ -197,8 +204,8 @@ benchmarks! {
assert_eq!(ParaId::from(para_id), descriptor.para_id);
assert_eq!(header.hash(), descriptor.relay_parent);
assert_eq!(
backing_validators.1.len() as u32,
BenchBuilder::<T>::fallback_min_validity_votes()
backing_validators.1.len(),
votes,
);
}