Skip to content
Snippets Groups Projects
Unverified Commit 935eeb52 authored by Alin Dima's avatar Alin Dima Committed by GitHub
Browse files

fix experimental-ump-signals tests (#6214)

Resolves https://github.com/paritytech/polkadot-sdk/issues/6200

Also sets the feature on the rococo-parachain. Will be useful for
zombienet testing
parent df66d76f
No related merge requests found
Pipeline #503134 waiting for manual action with stages
in 46 minutes and 12 seconds
...@@ -25,6 +25,8 @@ use frame_support::{assert_ok, parameter_types, weights::Weight}; ...@@ -25,6 +25,8 @@ use frame_support::{assert_ok, parameter_types, weights::Weight};
use frame_system::RawOrigin; use frame_system::RawOrigin;
use hex_literal::hex; use hex_literal::hex;
use rand::Rng; use rand::Rng;
#[cfg(feature = "experimental-ump-signals")]
use relay_chain::vstaging::{UMPSignal, UMP_SEPARATOR};
use relay_chain::HrmpChannelId; use relay_chain::HrmpChannelId;
use sp_core::H256; use sp_core::H256;
...@@ -583,7 +585,25 @@ fn send_upward_message_num_per_candidate() { ...@@ -583,7 +585,25 @@ fn send_upward_message_num_per_candidate() {
}, },
|| { || {
let v = UpwardMessages::<Test>::get(); let v = UpwardMessages::<Test>::get();
assert_eq!(v, vec![b"Mr F was here".to_vec()]); #[cfg(feature = "experimental-ump-signals")]
{
assert_eq!(
v,
vec![
b"Mr F was here".to_vec(),
UMP_SEPARATOR,
UMPSignal::SelectCore(
CoreSelector(1),
ClaimQueueOffset(DEFAULT_CLAIM_QUEUE_OFFSET)
)
.encode()
]
);
}
#[cfg(not(feature = "experimental-ump-signals"))]
{
assert_eq!(v, vec![b"Mr F was here".to_vec()]);
}
}, },
) )
.add_with_post_test( .add_with_post_test(
...@@ -594,7 +614,25 @@ fn send_upward_message_num_per_candidate() { ...@@ -594,7 +614,25 @@ fn send_upward_message_num_per_candidate() {
}, },
|| { || {
let v = UpwardMessages::<Test>::get(); let v = UpwardMessages::<Test>::get();
assert_eq!(v, vec![b"message 2".to_vec()]); #[cfg(feature = "experimental-ump-signals")]
{
assert_eq!(
v,
vec![
b"message 2".to_vec(),
UMP_SEPARATOR,
UMPSignal::SelectCore(
CoreSelector(2),
ClaimQueueOffset(DEFAULT_CLAIM_QUEUE_OFFSET)
)
.encode()
]
);
}
#[cfg(not(feature = "experimental-ump-signals"))]
{
assert_eq!(v, vec![b"message 2".to_vec()]);
}
}, },
); );
} }
...@@ -620,7 +658,24 @@ fn send_upward_message_relay_bottleneck() { ...@@ -620,7 +658,24 @@ fn send_upward_message_relay_bottleneck() {
|| { || {
// The message won't be sent because there is already one message in queue. // The message won't be sent because there is already one message in queue.
let v = UpwardMessages::<Test>::get(); let v = UpwardMessages::<Test>::get();
assert!(v.is_empty()); #[cfg(feature = "experimental-ump-signals")]
{
assert_eq!(
v,
vec![
UMP_SEPARATOR,
UMPSignal::SelectCore(
CoreSelector(1),
ClaimQueueOffset(DEFAULT_CLAIM_QUEUE_OFFSET)
)
.encode()
]
);
}
#[cfg(not(feature = "experimental-ump-signals"))]
{
assert!(v.is_empty());
}
}, },
) )
.add_with_post_test( .add_with_post_test(
...@@ -628,7 +683,25 @@ fn send_upward_message_relay_bottleneck() { ...@@ -628,7 +683,25 @@ fn send_upward_message_relay_bottleneck() {
|| { /* do nothing within block */ }, || { /* do nothing within block */ },
|| { || {
let v = UpwardMessages::<Test>::get(); let v = UpwardMessages::<Test>::get();
assert_eq!(v, vec![vec![0u8; 8]]); #[cfg(feature = "experimental-ump-signals")]
{
assert_eq!(
v,
vec![
vec![0u8; 8],
UMP_SEPARATOR,
UMPSignal::SelectCore(
CoreSelector(2),
ClaimQueueOffset(DEFAULT_CLAIM_QUEUE_OFFSET)
)
.encode()
]
);
}
#[cfg(not(feature = "experimental-ump-signals"))]
{
assert_eq!(v, vec![vec![0u8; 8]]);
}
}, },
); );
} }
...@@ -1172,7 +1245,25 @@ fn ump_fee_factor_increases_and_decreases() { ...@@ -1172,7 +1245,25 @@ fn ump_fee_factor_increases_and_decreases() {
|| { || {
// Factor decreases in `on_finalize`, but only if we are below the threshold // Factor decreases in `on_finalize`, but only if we are below the threshold
let messages = UpwardMessages::<Test>::get(); let messages = UpwardMessages::<Test>::get();
assert_eq!(messages, vec![b"Test".to_vec()]); #[cfg(feature = "experimental-ump-signals")]
{
assert_eq!(
messages,
vec![
b"Test".to_vec(),
UMP_SEPARATOR,
UMPSignal::SelectCore(
CoreSelector(1),
ClaimQueueOffset(DEFAULT_CLAIM_QUEUE_OFFSET)
)
.encode()
]
);
}
#[cfg(not(feature = "experimental-ump-signals"))]
{
assert_eq!(messages, vec![b"Test".to_vec()]);
}
assert_eq!( assert_eq!(
UpwardDeliveryFeeFactor::<Test>::get(), UpwardDeliveryFeeFactor::<Test>::get(),
FixedU128::from_rational(105, 100) FixedU128::from_rational(105, 100)
...@@ -1186,10 +1277,28 @@ fn ump_fee_factor_increases_and_decreases() { ...@@ -1186,10 +1277,28 @@ fn ump_fee_factor_increases_and_decreases() {
}, },
|| { || {
let messages = UpwardMessages::<Test>::get(); let messages = UpwardMessages::<Test>::get();
assert_eq!( #[cfg(feature = "experimental-ump-signals")]
messages, {
vec![b"This message will be enough to increase the fee factor".to_vec(),] assert_eq!(
); messages,
vec![
b"This message will be enough to increase the fee factor".to_vec(),
UMP_SEPARATOR,
UMPSignal::SelectCore(
CoreSelector(2),
ClaimQueueOffset(DEFAULT_CLAIM_QUEUE_OFFSET)
)
.encode()
]
);
}
#[cfg(not(feature = "experimental-ump-signals"))]
{
assert_eq!(
messages,
vec![b"This message will be enough to increase the fee factor".to_vec()]
);
}
// Now the delivery fee factor is decreased, since we are below the threshold // Now the delivery fee factor is decreased, since we are below the threshold
assert_eq!(UpwardDeliveryFeeFactor::<Test>::get(), FixedU128::from_u32(1)); assert_eq!(UpwardDeliveryFeeFactor::<Test>::get(), FixedU128::from_u32(1));
}, },
......
...@@ -49,7 +49,7 @@ polkadot-runtime-common = { workspace = true } ...@@ -49,7 +49,7 @@ polkadot-runtime-common = { workspace = true }
# Cumulus # Cumulus
cumulus-pallet-aura-ext = { workspace = true } cumulus-pallet-aura-ext = { workspace = true }
pallet-message-queue = { workspace = true } pallet-message-queue = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true } cumulus-pallet-parachain-system = { workspace = true, features = ["experimental-ump-signals"] }
cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true } cumulus-pallet-xcmp-queue = { workspace = true }
cumulus-ping = { workspace = true } cumulus-ping = { workspace = true }
......
crates:
- name: cumulus-pallet-parachain-system
bump: none
- name: rococo-parachain-runtime
bump: none
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment