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

Commit 3c0018a

Browse files
Merge pull request #36 from Snowfork/alistair/parameterize-message-origin
Parameterize message origin in Tests
2 parents bcd4a6d + 57fe885 commit 3c0018a

File tree

6 files changed

+19
-11
lines changed
  • cumulus
    • parachains/integration-tests/emulated/chains/parachains
    • xcm/xcm-emulator/src

6 files changed

+19
-11
lines changed

cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ decl_test_parachains! {
3737
XcmpMessageHandler: asset_hub_rococo_runtime::XcmpQueue,
3838
LocationToAccountId: asset_hub_rococo_runtime::xcm_config::LocationToAccountId,
3939
ParachainInfo: asset_hub_rococo_runtime::ParachainInfo,
40+
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
4041
},
4142
pallets = {
4243
PolkadotXcm: asset_hub_rococo_runtime::PolkadotXcm,

cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-wococo/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ decl_test_parachains! {
3535
XcmpMessageHandler: asset_hub_rococo_runtime::XcmpQueue,
3636
LocationToAccountId: asset_hub_rococo_runtime::xcm_config::LocationToAccountId,
3737
ParachainInfo: asset_hub_rococo_runtime::ParachainInfo,
38+
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
3839
},
3940
pallets = {
4041
PolkadotXcm: asset_hub_rococo_runtime::PolkadotXcm,

cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ decl_test_parachains! {
3636
XcmpMessageHandler: bridge_hub_rococo_runtime::XcmpQueue,
3737
LocationToAccountId: bridge_hub_rococo_runtime::xcm_config::LocationToAccountId,
3838
ParachainInfo: bridge_hub_rococo_runtime::ParachainInfo,
39+
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
3940
},
4041
pallets = {
4142
PolkadotXcm: bridge_hub_rococo_runtime::PolkadotXcm,

cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-wococo/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ decl_test_parachains! {
3434
XcmpMessageHandler: bridge_hub_rococo_runtime::XcmpQueue,
3535
LocationToAccountId: bridge_hub_rococo_runtime::xcm_config::LocationToAccountId,
3636
ParachainInfo: bridge_hub_rococo_runtime::ParachainInfo,
37+
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
3738
},
3839
pallets = {
3940
PolkadotXcm: bridge_hub_rococo_runtime::PolkadotXcm,

cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ decl_test_parachains! {
3838
XcmpMessageHandler: penpal_runtime::XcmpQueue,
3939
LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId,
4040
ParachainInfo: penpal_runtime::ParachainInfo,
41+
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
4142
},
4243
pallets = {
4344
PolkadotXcm: penpal_runtime::PolkadotXcm,
@@ -56,6 +57,7 @@ decl_test_parachains! {
5657
XcmpMessageHandler: penpal_runtime::XcmpQueue,
5758
LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId,
5859
ParachainInfo: penpal_runtime::ParachainInfo,
60+
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
5961
},
6062
pallets = {
6163
PolkadotXcm: penpal_runtime::PolkadotXcm,

cumulus/xcm/xcm-emulator/src/lib.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
1616

17-
pub use codec::{Decode, Encode, EncodeLike};
17+
pub use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
1818
pub use lazy_static::lazy_static;
1919
pub use log;
2020
pub use paste;
@@ -576,7 +576,7 @@ macro_rules! decl_test_parachains {
576576
XcmpMessageHandler: $xcmp_message_handler:path,
577577
LocationToAccountId: $location_to_account:path,
578578
ParachainInfo: $parachain_info:path,
579-
// MessageProcessor: $message_processor:path,
579+
MessageOrigin: $message_origin:path,
580580
},
581581
pallets = {
582582
$($pallet_name:ident: $pallet_path:path,)*
@@ -615,7 +615,7 @@ macro_rules! decl_test_parachains {
615615
type LocationToAccountId = $location_to_account;
616616
type ParachainSystem = $crate::ParachainSystemPallet<<Self as $crate::Chain>::Runtime>;
617617
type ParachainInfo = $parachain_info;
618-
type MessageProcessor = $crate::DefaultParaMessageProcessor<$name<N>>;
618+
type MessageProcessor = $crate::DefaultParaMessageProcessor<$name<N>, $message_origin>;
619619

620620
// We run an empty block during initialisation to open HRMP channels
621621
// and have them ready for the next block
@@ -1313,17 +1313,18 @@ macro_rules! decl_test_sender_receiver_accounts_parameter_types {
13131313
};
13141314
}
13151315

1316-
pub struct DefaultParaMessageProcessor<T>(PhantomData<T>);
1316+
pub struct DefaultParaMessageProcessor<T, M>(PhantomData<(T, M)>);
13171317
// Process HRMP messages from sibling paraids
1318-
impl<T> ProcessMessage for DefaultParaMessageProcessor<T>
1318+
impl<T, M> ProcessMessage for DefaultParaMessageProcessor<T, M>
13191319
where
1320+
M: codec::FullCodec + MaxEncodedLen + Clone + Eq + PartialEq + frame_support::pallet_prelude::TypeInfo + Debug,
13201321
T: Parachain,
13211322
T::Runtime: MessageQueueConfig,
13221323
<<T::Runtime as MessageQueueConfig>::MessageProcessor as ProcessMessage>::Origin:
1323-
PartialEq<CumulusAggregateMessageOrigin>,
1324-
MessageQueuePallet<T::Runtime>: EnqueueMessage<CumulusAggregateMessageOrigin> + ServiceQueues,
1324+
PartialEq<M>,
1325+
MessageQueuePallet<T::Runtime>: EnqueueMessage<M> + ServiceQueues,
13251326
{
1326-
type Origin = CumulusAggregateMessageOrigin;
1327+
type Origin = M;
13271328

13281329
fn process_message(
13291330
msg: &[u8],
@@ -1340,13 +1341,14 @@ where
13401341
Ok(true)
13411342
}
13421343
}
1343-
impl<T> ServiceQueues for DefaultParaMessageProcessor<T>
1344+
impl<T, M> ServiceQueues for DefaultParaMessageProcessor<T, M>
13441345
where
1346+
M: MaxEncodedLen,
13451347
T: Parachain,
13461348
T::Runtime: MessageQueueConfig,
13471349
<<T::Runtime as MessageQueueConfig>::MessageProcessor as ProcessMessage>::Origin:
1348-
PartialEq<CumulusAggregateMessageOrigin>,
1349-
MessageQueuePallet<T::Runtime>: EnqueueMessage<CumulusAggregateMessageOrigin> + ServiceQueues,
1350+
PartialEq<M>,
1351+
MessageQueuePallet<T::Runtime>: EnqueueMessage<M> + ServiceQueues,
13501352
{
13511353
type OverweightMessageAddress = ();
13521354

0 commit comments

Comments
 (0)