Make ParaId value of public paras non-discretionary (#2988)

* Make ParaId value of public paras non-discretionary

* Fixes

* Fixes

* fix tests

* fix benchmark tests

* dont use hardcoded number

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Gavin Wood
2021-05-07 17:52:26 +02:00
committed by GitHub
parent c0df140ec6
commit ce4edd0398
5 changed files with 241 additions and 221 deletions
+12
View File
@@ -122,10 +122,14 @@ impl From<i32> for Id {
}
const USER_INDEX_START: u32 = 1000;
const PUBLIC_INDEX_START: u32 = 2000;
/// The ID of the first user (non-system) parachain.
pub const LOWEST_USER_ID: Id = Id(USER_INDEX_START);
/// The ID of the first publicly registerable parachain.
pub const LOWEST_PUBLIC_ID: Id = Id(PUBLIC_INDEX_START);
impl Id {
/// Create an `Id`.
pub const fn new(id: u32) -> Self {
@@ -151,6 +155,14 @@ impl sp_std::ops::Add<u32> for Id {
}
}
impl sp_std::ops::Sub<u32> for Id {
type Output = Self;
fn sub(self, other: u32) -> Self {
Self(self.0 - other)
}
}
#[derive(Clone, Copy, Default, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, RuntimeDebug)]
pub struct Sibling(pub Id);