Same procedure as not every day (#636)

* Same procedure as not every day

* Remove warning

* Update
This commit is contained in:
Bastian Köcher
2021-10-01 13:23:56 +02:00
committed by GitHub
parent 24f8cd72cf
commit a8d84dba8e
7 changed files with 448 additions and 430 deletions
+427 -409
View File
File diff suppressed because it is too large Load Diff
+8 -12
View File
@@ -327,7 +327,7 @@ mod tests {
use cumulus_test_runtime::{Block, Header};
use futures::{channel::mpsc, executor::block_on, StreamExt};
use polkadot_node_subsystem_test_helpers::ForwardSubsystem;
use polkadot_overseer::{AllSubsystems, HeadSupportsParachains, Overseer};
use polkadot_overseer::{dummy::dummy_overseer_builder, HeadSupportsParachains};
use sp_consensus::BlockOrigin;
use sp_core::{testing::TaskExecutor, Pair};
use sp_runtime::traits::BlakeTwo256;
@@ -383,16 +383,12 @@ mod tests {
let (sub_tx, sub_rx) = mpsc::channel(64);
let all_subsystems =
AllSubsystems::<()>::dummy().replace_collation_generation(|_| ForwardSubsystem(sub_tx));
let (overseer, handle) = Overseer::new(
Vec::new(),
all_subsystems,
None,
AlwaysSupportsParachains,
spawner.clone(),
)
.expect("Creates overseer");
let (overseer, handle) =
dummy_overseer_builder(spawner.clone(), AlwaysSupportsParachains, None)
.expect("Creates overseer builder")
.replace_collation_generation(|_| ForwardSubsystem(sub_tx))
.build()
.expect("Builds overseer");
spawner.spawn("overseer", overseer.run().then(|_| async { () }).boxed());
@@ -400,7 +396,7 @@ mod tests {
runtime_api: client.clone(),
block_status: client.clone(),
announce_block: Arc::new(announce_block),
overseer_handle: OverseerHandle::Connected(handle),
overseer_handle: OverseerHandle::new(handle),
spawner,
para_id,
key: CollatorPair::generate().0,
+2 -2
View File
@@ -240,7 +240,7 @@ pub mod pallet {
Ok(0)
},
Ok(Ok(x)) => {
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x, limit);
let outcome = T::XcmExecutor::execute_xcm(Parent, x, limit);
match outcome {
Outcome::Error(XcmError::WeightLimitReached(required)) =>
Err((id, required)),
@@ -420,7 +420,7 @@ mod tests {
pub struct MockExec;
impl ExecuteXcm<Call> for MockExec {
fn execute_xcm_in_credit(
_origin: MultiLocation,
_origin: impl Into<MultiLocation>,
message: Xcm,
weight_limit: Weight,
_credit: Weight,
+2 -2
View File
@@ -124,7 +124,7 @@ impl<T: Config> DmpMessageHandler for UnlimitedDmpExecution<T> {
Err(_) => Pallet::<T>::deposit_event(Event::InvalidFormat(id)),
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
Ok(Ok(x)) => {
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x, limit);
let outcome = T::XcmExecutor::execute_xcm(Parent, x, limit);
used += outcome.weight_used();
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
},
@@ -158,7 +158,7 @@ impl<T: Config> DmpMessageHandler for LimitAndDropDmpExecution<T> {
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
Ok(Ok(x)) => {
let weight_limit = limit.saturating_sub(used);
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x, weight_limit);
let outcome = T::XcmExecutor::execute_xcm(Parent, x, weight_limit);
used += outcome.weight_used();
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
},
+4 -2
View File
@@ -348,7 +348,7 @@ impl<T: Config> Pallet<T> {
let (result, event) = match Xcm::<T::Call>::try_from(xcm) {
Ok(xcm) => {
let location = (1, Parachain(sender.into()));
match T::XcmExecutor::execute_xcm(location.into(), xcm, max_weight) {
match T::XcmExecutor::execute_xcm(location, xcm, max_weight) {
Outcome::Error(e) => (Err(e.clone()), Event::Fail(Some(hash), e)),
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
// As far as the caller is concerned, this was dispatched without error, so
@@ -754,7 +754,9 @@ impl<T: Config> XcmpMessageSource for Pallet<T> {
/// Xcm sender for sending to a sibling parachain.
impl<T: Config> SendXcm for Pallet<T> {
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), SendError> {
fn send_xcm(dest: impl Into<MultiLocation>, msg: Xcm<()>) -> Result<(), SendError> {
let dest = dest.into();
match &dest {
// An HRMP message for a sibling parachain.
MultiLocation { parents: 1, interior: X1(Parachain(id)) } => {
@@ -89,7 +89,7 @@ pub mod pallet {
*seq
});
match T::XcmSender::send_xcm(
(1, Junction::Parachain(para.into())).into(),
(1, Junction::Parachain(para.into())),
Xcm(vec![Transact {
origin_type: OriginKind::Native,
require_weight_at_most: 1_000,
@@ -165,7 +165,7 @@ pub mod pallet {
Self::deposit_event(Event::Pinged(para, seq, payload.clone()));
match T::XcmSender::send_xcm(
(1, Junction::Parachain(para.into())).into(),
(1, Junction::Parachain(para.into())),
Xcm(vec![Transact {
origin_type: OriginKind::Native,
require_weight_at_most: 1_000,
+3 -1
View File
@@ -33,7 +33,9 @@ use xcm::{latest::prelude::*, WrapVersion};
/// for the `SendXcm` implementation.
pub struct ParentAsUmp<T, W>(PhantomData<(T, W)>);
impl<T: UpwardMessageSender, W: WrapVersion> SendXcm for ParentAsUmp<T, W> {
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), SendError> {
fn send_xcm(dest: impl Into<MultiLocation>, msg: Xcm<()>) -> Result<(), SendError> {
let dest = dest.into();
if dest.contains_parents_only(1) {
// An upward message for the relay chain.
let versioned_xcm =