XCM Revamp Continued (#2865)

* Introduce plurality XCM locations

* Add RelayedFrom

* DMP dispatch weight handling.

* Add pallet for XCM sending, add routing logic.

* Update error types & doc

* Fix warnings.

* Fixes

* Fixes

* Fixes

* Bump Substrate

* Fixes

* Docs

* Docs

* Docs

* Fixes

* Fixes

* Fixes

* Update xcm/pallet-xcm/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Docs

* Fixes

* Update lib.rs

* Fixes

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Gavin Wood
2021-04-09 20:34:28 +02:00
committed by GitHub
parent 8961628e7c
commit c9102c11a4
18 changed files with 632 additions and 227 deletions
+14
View File
@@ -61,12 +61,26 @@ pub enum BodyPart {
Voice,
/// A given number of members of the body.
Members { #[codec(compact)] count: u32 },
/// A given number of members of the body, out of some larger caucus.
Fraction { #[codec(compact)] nom: u32, #[codec(compact)] denom: u32 },
/// No less than the given proportion of members of the body.
AtLeastProportion { #[codec(compact)] nom: u32, #[codec(compact)] denom: u32 },
/// More than than the given proportion of members of the body.
MoreThanProportion { #[codec(compact)] nom: u32, #[codec(compact)] denom: u32 },
}
impl BodyPart {
/// Returns `true` if the part represents a strict majority (> 50%) of the body in question.
pub fn is_majority(&self) -> bool {
match self {
BodyPart::Fraction { nom, denom } if *nom * 2 > *denom => true,
BodyPart::AtLeastProportion { nom, denom } if *nom * 2 > *denom => true,
BodyPart::MoreThanProportion { nom, denom } if *nom * 2 >= *denom => true,
_ => false,
}
}
}
/// A single item in a path to describe the relative location of a consensus system.
///
/// Each item assumes a pre-existing location as its context and is defined in terms of it.