Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 47b368e

Browse files
authored
Polkadot companion (XCM-simulator) (#560)
* Use definitions from polkadot. * Remove unused imports. * Rerun CI.
1 parent 53c5340 commit 47b368e

File tree

2 files changed

+5
-57
lines changed

2 files changed

+5
-57
lines changed

pallets/xcmp-queue/src/lib.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mod tests;
3434
use codec::{Decode, Encode};
3535
use cumulus_primitives_core::{
3636
relay_chain::BlockNumber as RelayBlockNumber, ChannelStatus, GetChannelInfo, MessageSendError,
37-
ParaId, XcmpMessageHandler, XcmpMessageSource,
37+
ParaId, XcmpMessageHandler, XcmpMessageSource, XcmpMessageFormat,
3838
};
3939
use frame_support::weights::Weight;
4040
use rand_chacha::{
@@ -208,18 +208,6 @@ pub enum ChannelSignal {
208208
Resume,
209209
}
210210

211-
/// The aggregate XCMP message format.
212-
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)]
213-
pub enum XcmpMessageFormat {
214-
/// Encoded `VersionedXcm` messages, all concatenated.
215-
ConcatenatedVersionedXcm,
216-
/// Encoded `Vec<u8>` messages, all concatenated.
217-
ConcatenatedEncodedBlob,
218-
/// One or more channel control signals; these should be interpreted immediately upon receipt
219-
/// from the relay-chain.
220-
Signals,
221-
}
222-
223211
impl<T: Config> Pallet<T> {
224212
/// Place a message `fragment` on the outgoing XCMP queue for `recipient`.
225213
///

primitives/core/src/lib.rs

+4-44
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
#![cfg_attr(not(feature = "std"), no_std)]
2020

2121
use codec::{Decode, Encode};
22-
use frame_support::weights::Weight;
2322
use sp_runtime::{traits::Block as BlockT, RuntimeDebug};
2423
use sp_std::prelude::*;
2524

2625
pub use polkadot_core_primitives::InboundDownwardMessage;
27-
pub use polkadot_parachain::primitives::{Id as ParaId, UpwardMessage, ValidationParams};
26+
pub use polkadot_parachain::primitives::{
27+
DmpMessageHandler, Id as ParaId, UpwardMessage, ValidationParams, XcmpMessageFormat,
28+
XcmpMessageHandler,
29+
};
2830
pub use polkadot_primitives::v1::{
2931
AbridgedHostConfiguration, AbridgedHrmpChannel, PersistedValidationData,
3032
};
@@ -34,7 +36,6 @@ pub mod relay_chain {
3436
pub use polkadot_core_primitives::*;
3537
pub use polkadot_primitives::{v1, v1::well_known_keys};
3638
}
37-
use relay_chain::BlockNumber as RelayBlockNumber;
3839

3940
/// An inbound HRMP message.
4041
pub type InboundHrmpMessage = polkadot_primitives::v1::InboundHrmpMessage<relay_chain::BlockNumber>;
@@ -88,47 +89,6 @@ pub trait GetChannelInfo {
8889
fn get_channel_max(id: ParaId) -> Option<usize>;
8990
}
9091

91-
/// Something that should be called when a downward message is received.
92-
pub trait DmpMessageHandler {
93-
/// Handle some incoming DMP messages (note these are individual XCM messages).
94-
///
95-
/// Also, process messages up to some `max_weight`.
96-
fn handle_dmp_messages(
97-
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
98-
max_weight: Weight,
99-
) -> Weight;
100-
}
101-
impl DmpMessageHandler for () {
102-
fn handle_dmp_messages(
103-
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
104-
_max_weight: Weight,
105-
) -> Weight {
106-
iter.for_each(drop);
107-
0
108-
}
109-
}
110-
111-
/// Something that should be called for each batch of messages received over XCMP.
112-
pub trait XcmpMessageHandler {
113-
/// Handle some incoming XCMP messages (note these are the big one-per-block aggregate
114-
/// messages).
115-
///
116-
/// Also, process messages up to some `max_weight`.
117-
fn handle_xcmp_messages<'a, I: Iterator<Item = (ParaId, RelayBlockNumber, &'a [u8])>>(
118-
iter: I,
119-
max_weight: Weight,
120-
) -> Weight;
121-
}
122-
impl XcmpMessageHandler for () {
123-
fn handle_xcmp_messages<'a, I: Iterator<Item = (ParaId, RelayBlockNumber, &'a [u8])>>(
124-
iter: I,
125-
_max_weight: Weight,
126-
) -> Weight {
127-
for _ in iter {}
128-
0
129-
}
130-
}
131-
13292
/// Something that should be called when sending an upward message.
13393
pub trait UpwardMessageSender {
13494
/// Send the given UMP message; return the expected number of blocks before the message will

0 commit comments

Comments
 (0)