mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 00:17:56 +00:00
Same procedure as not every day (#636)
* Same procedure as not every day * Remove warning * Update
This commit is contained in:
Generated
+427
-409
File diff suppressed because it is too large
Load Diff
@@ -327,7 +327,7 @@ mod tests {
|
|||||||
use cumulus_test_runtime::{Block, Header};
|
use cumulus_test_runtime::{Block, Header};
|
||||||
use futures::{channel::mpsc, executor::block_on, StreamExt};
|
use futures::{channel::mpsc, executor::block_on, StreamExt};
|
||||||
use polkadot_node_subsystem_test_helpers::ForwardSubsystem;
|
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_consensus::BlockOrigin;
|
||||||
use sp_core::{testing::TaskExecutor, Pair};
|
use sp_core::{testing::TaskExecutor, Pair};
|
||||||
use sp_runtime::traits::BlakeTwo256;
|
use sp_runtime::traits::BlakeTwo256;
|
||||||
@@ -383,16 +383,12 @@ mod tests {
|
|||||||
|
|
||||||
let (sub_tx, sub_rx) = mpsc::channel(64);
|
let (sub_tx, sub_rx) = mpsc::channel(64);
|
||||||
|
|
||||||
let all_subsystems =
|
let (overseer, handle) =
|
||||||
AllSubsystems::<()>::dummy().replace_collation_generation(|_| ForwardSubsystem(sub_tx));
|
dummy_overseer_builder(spawner.clone(), AlwaysSupportsParachains, None)
|
||||||
let (overseer, handle) = Overseer::new(
|
.expect("Creates overseer builder")
|
||||||
Vec::new(),
|
.replace_collation_generation(|_| ForwardSubsystem(sub_tx))
|
||||||
all_subsystems,
|
.build()
|
||||||
None,
|
.expect("Builds overseer");
|
||||||
AlwaysSupportsParachains,
|
|
||||||
spawner.clone(),
|
|
||||||
)
|
|
||||||
.expect("Creates overseer");
|
|
||||||
|
|
||||||
spawner.spawn("overseer", overseer.run().then(|_| async { () }).boxed());
|
spawner.spawn("overseer", overseer.run().then(|_| async { () }).boxed());
|
||||||
|
|
||||||
@@ -400,7 +396,7 @@ mod tests {
|
|||||||
runtime_api: client.clone(),
|
runtime_api: client.clone(),
|
||||||
block_status: client.clone(),
|
block_status: client.clone(),
|
||||||
announce_block: Arc::new(announce_block),
|
announce_block: Arc::new(announce_block),
|
||||||
overseer_handle: OverseerHandle::Connected(handle),
|
overseer_handle: OverseerHandle::new(handle),
|
||||||
spawner,
|
spawner,
|
||||||
para_id,
|
para_id,
|
||||||
key: CollatorPair::generate().0,
|
key: CollatorPair::generate().0,
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ pub mod pallet {
|
|||||||
Ok(0)
|
Ok(0)
|
||||||
},
|
},
|
||||||
Ok(Ok(x)) => {
|
Ok(Ok(x)) => {
|
||||||
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x, limit);
|
let outcome = T::XcmExecutor::execute_xcm(Parent, x, limit);
|
||||||
match outcome {
|
match outcome {
|
||||||
Outcome::Error(XcmError::WeightLimitReached(required)) =>
|
Outcome::Error(XcmError::WeightLimitReached(required)) =>
|
||||||
Err((id, required)),
|
Err((id, required)),
|
||||||
@@ -420,7 +420,7 @@ mod tests {
|
|||||||
pub struct MockExec;
|
pub struct MockExec;
|
||||||
impl ExecuteXcm<Call> for MockExec {
|
impl ExecuteXcm<Call> for MockExec {
|
||||||
fn execute_xcm_in_credit(
|
fn execute_xcm_in_credit(
|
||||||
_origin: MultiLocation,
|
_origin: impl Into<MultiLocation>,
|
||||||
message: Xcm,
|
message: Xcm,
|
||||||
weight_limit: Weight,
|
weight_limit: Weight,
|
||||||
_credit: Weight,
|
_credit: Weight,
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ impl<T: Config> DmpMessageHandler for UnlimitedDmpExecution<T> {
|
|||||||
Err(_) => Pallet::<T>::deposit_event(Event::InvalidFormat(id)),
|
Err(_) => Pallet::<T>::deposit_event(Event::InvalidFormat(id)),
|
||||||
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
|
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
|
||||||
Ok(Ok(x)) => {
|
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();
|
used += outcome.weight_used();
|
||||||
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
|
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(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
|
||||||
Ok(Ok(x)) => {
|
Ok(Ok(x)) => {
|
||||||
let weight_limit = limit.saturating_sub(used);
|
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();
|
used += outcome.weight_used();
|
||||||
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
|
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ impl<T: Config> Pallet<T> {
|
|||||||
let (result, event) = match Xcm::<T::Call>::try_from(xcm) {
|
let (result, event) = match Xcm::<T::Call>::try_from(xcm) {
|
||||||
Ok(xcm) => {
|
Ok(xcm) => {
|
||||||
let location = (1, Parachain(sender.into()));
|
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::Error(e) => (Err(e.clone()), Event::Fail(Some(hash), e)),
|
||||||
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
|
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
|
||||||
// As far as the caller is concerned, this was dispatched without error, so
|
// 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.
|
/// Xcm sender for sending to a sibling parachain.
|
||||||
impl<T: Config> SendXcm for Pallet<T> {
|
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 {
|
match &dest {
|
||||||
// An HRMP message for a sibling parachain.
|
// An HRMP message for a sibling parachain.
|
||||||
MultiLocation { parents: 1, interior: X1(Parachain(id)) } => {
|
MultiLocation { parents: 1, interior: X1(Parachain(id)) } => {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ pub mod pallet {
|
|||||||
*seq
|
*seq
|
||||||
});
|
});
|
||||||
match T::XcmSender::send_xcm(
|
match T::XcmSender::send_xcm(
|
||||||
(1, Junction::Parachain(para.into())).into(),
|
(1, Junction::Parachain(para.into())),
|
||||||
Xcm(vec![Transact {
|
Xcm(vec![Transact {
|
||||||
origin_type: OriginKind::Native,
|
origin_type: OriginKind::Native,
|
||||||
require_weight_at_most: 1_000,
|
require_weight_at_most: 1_000,
|
||||||
@@ -165,7 +165,7 @@ pub mod pallet {
|
|||||||
|
|
||||||
Self::deposit_event(Event::Pinged(para, seq, payload.clone()));
|
Self::deposit_event(Event::Pinged(para, seq, payload.clone()));
|
||||||
match T::XcmSender::send_xcm(
|
match T::XcmSender::send_xcm(
|
||||||
(1, Junction::Parachain(para.into())).into(),
|
(1, Junction::Parachain(para.into())),
|
||||||
Xcm(vec![Transact {
|
Xcm(vec![Transact {
|
||||||
origin_type: OriginKind::Native,
|
origin_type: OriginKind::Native,
|
||||||
require_weight_at_most: 1_000,
|
require_weight_at_most: 1_000,
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ use xcm::{latest::prelude::*, WrapVersion};
|
|||||||
/// for the `SendXcm` implementation.
|
/// for the `SendXcm` implementation.
|
||||||
pub struct ParentAsUmp<T, W>(PhantomData<(T, W)>);
|
pub struct ParentAsUmp<T, W>(PhantomData<(T, W)>);
|
||||||
impl<T: UpwardMessageSender, W: WrapVersion> SendXcm for ParentAsUmp<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) {
|
if dest.contains_parents_only(1) {
|
||||||
// An upward message for the relay chain.
|
// An upward message for the relay chain.
|
||||||
let versioned_xcm =
|
let versioned_xcm =
|
||||||
|
|||||||
Reference in New Issue
Block a user