Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
5e86294e
Commit
5e86294e
authored
3 years ago
by
Shaun Wang
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Polkadot companion (XCM-simulator) (#560)
* Use definitions from polkadot. * Remove unused imports. * Rerun CI.
parent
0f4674c0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cumulus/pallets/xcmp-queue/src/lib.rs
+1
-13
1 addition, 13 deletions
cumulus/pallets/xcmp-queue/src/lib.rs
cumulus/primitives/core/src/lib.rs
+4
-44
4 additions, 44 deletions
cumulus/primitives/core/src/lib.rs
with
5 additions
and
57 deletions
cumulus/pallets/xcmp-queue/src/lib.rs
+
1
−
13
View file @
5e86294e
...
@@ -34,7 +34,7 @@ mod tests;
...
@@ -34,7 +34,7 @@ mod tests;
use
codec
::{
Decode
,
Encode
};
use
codec
::{
Decode
,
Encode
};
use
cumulus_primitives_core
::{
use
cumulus_primitives_core
::{
relay_chain
::
BlockNumber
as
RelayBlockNumber
,
ChannelStatus
,
GetChannelInfo
,
MessageSendError
,
relay_chain
::
BlockNumber
as
RelayBlockNumber
,
ChannelStatus
,
GetChannelInfo
,
MessageSendError
,
ParaId
,
XcmpMessageHandler
,
XcmpMessageSource
,
ParaId
,
XcmpMessageHandler
,
XcmpMessageSource
,
XcmpMessageFormat
,
};
};
use
frame_support
::
weights
::
Weight
;
use
frame_support
::
weights
::
Weight
;
use
rand_chacha
::{
use
rand_chacha
::{
...
@@ -208,18 +208,6 @@ pub enum ChannelSignal {
...
@@ -208,18 +208,6 @@ pub enum ChannelSignal {
Resume
,
Resume
,
}
}
/// The aggregate XCMP message format.
#[derive(Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
RuntimeDebug)]
pub
enum
XcmpMessageFormat
{
/// Encoded `VersionedXcm` messages, all concatenated.
ConcatenatedVersionedXcm
,
/// Encoded `Vec<u8>` messages, all concatenated.
ConcatenatedEncodedBlob
,
/// One or more channel control signals; these should be interpreted immediately upon receipt
/// from the relay-chain.
Signals
,
}
impl
<
T
:
Config
>
Pallet
<
T
>
{
impl
<
T
:
Config
>
Pallet
<
T
>
{
/// Place a message `fragment` on the outgoing XCMP queue for `recipient`.
/// Place a message `fragment` on the outgoing XCMP queue for `recipient`.
///
///
...
...
This diff is collapsed.
Click to expand it.
cumulus/primitives/core/src/lib.rs
+
4
−
44
View file @
5e86294e
...
@@ -19,12 +19,14 @@
...
@@ -19,12 +19,14 @@
#![cfg_attr(not(feature
=
"std"
),
no_std)]
#![cfg_attr(not(feature
=
"std"
),
no_std)]
use
codec
::{
Decode
,
Encode
};
use
codec
::{
Decode
,
Encode
};
use
frame_support
::
weights
::
Weight
;
use
sp_runtime
::{
traits
::
Block
as
BlockT
,
RuntimeDebug
};
use
sp_runtime
::{
traits
::
Block
as
BlockT
,
RuntimeDebug
};
use
sp_std
::
prelude
::
*
;
use
sp_std
::
prelude
::
*
;
pub
use
polkadot_core_primitives
::
InboundDownwardMessage
;
pub
use
polkadot_core_primitives
::
InboundDownwardMessage
;
pub
use
polkadot_parachain
::
primitives
::{
Id
as
ParaId
,
UpwardMessage
,
ValidationParams
};
pub
use
polkadot_parachain
::
primitives
::{
DmpMessageHandler
,
Id
as
ParaId
,
UpwardMessage
,
ValidationParams
,
XcmpMessageFormat
,
XcmpMessageHandler
,
};
pub
use
polkadot_primitives
::
v1
::{
pub
use
polkadot_primitives
::
v1
::{
AbridgedHostConfiguration
,
AbridgedHrmpChannel
,
PersistedValidationData
,
AbridgedHostConfiguration
,
AbridgedHrmpChannel
,
PersistedValidationData
,
};
};
...
@@ -34,7 +36,6 @@ pub mod relay_chain {
...
@@ -34,7 +36,6 @@ pub mod relay_chain {
pub
use
polkadot_core_primitives
::
*
;
pub
use
polkadot_core_primitives
::
*
;
pub
use
polkadot_primitives
::{
v1
,
v1
::
well_known_keys
};
pub
use
polkadot_primitives
::{
v1
,
v1
::
well_known_keys
};
}
}
use
relay_chain
::
BlockNumber
as
RelayBlockNumber
;
/// An inbound HRMP message.
/// An inbound HRMP message.
pub
type
InboundHrmpMessage
=
polkadot_primitives
::
v1
::
InboundHrmpMessage
<
relay_chain
::
BlockNumber
>
;
pub
type
InboundHrmpMessage
=
polkadot_primitives
::
v1
::
InboundHrmpMessage
<
relay_chain
::
BlockNumber
>
;
...
@@ -88,47 +89,6 @@ pub trait GetChannelInfo {
...
@@ -88,47 +89,6 @@ pub trait GetChannelInfo {
fn
get_channel_max
(
id
:
ParaId
)
->
Option
<
usize
>
;
fn
get_channel_max
(
id
:
ParaId
)
->
Option
<
usize
>
;
}
}
/// Something that should be called when a downward message is received.
pub
trait
DmpMessageHandler
{
/// Handle some incoming DMP messages (note these are individual XCM messages).
///
/// Also, process messages up to some `max_weight`.
fn
handle_dmp_messages
(
iter
:
impl
Iterator
<
Item
=
(
RelayBlockNumber
,
Vec
<
u8
>
)
>
,
max_weight
:
Weight
,
)
->
Weight
;
}
impl
DmpMessageHandler
for
()
{
fn
handle_dmp_messages
(
iter
:
impl
Iterator
<
Item
=
(
RelayBlockNumber
,
Vec
<
u8
>
)
>
,
_max_weight
:
Weight
,
)
->
Weight
{
iter
.for_each
(
drop
);
0
}
}
/// Something that should be called for each batch of messages received over XCMP.
pub
trait
XcmpMessageHandler
{
/// Handle some incoming XCMP messages (note these are the big one-per-block aggregate
/// messages).
///
/// Also, process messages up to some `max_weight`.
fn
handle_xcmp_messages
<
'a
,
I
:
Iterator
<
Item
=
(
ParaId
,
RelayBlockNumber
,
&
'a
[
u8
])
>>
(
iter
:
I
,
max_weight
:
Weight
,
)
->
Weight
;
}
impl
XcmpMessageHandler
for
()
{
fn
handle_xcmp_messages
<
'a
,
I
:
Iterator
<
Item
=
(
ParaId
,
RelayBlockNumber
,
&
'a
[
u8
])
>>
(
iter
:
I
,
_max_weight
:
Weight
,
)
->
Weight
{
for
_
in
iter
{}
0
}
}
/// Something that should be called when sending an upward message.
/// Something that should be called when sending an upward message.
pub
trait
UpwardMessageSender
{
pub
trait
UpwardMessageSender
{
/// Send the given UMP message; return the expected number of blocks before the message will
/// Send the given UMP message; return the expected number of blocks before the message will
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment