Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cumulus/pallets/parachain-system/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#![cfg(feature = "runtime-benchmarks")]

use super::*;
use cumulus_primitives_core::relay_chain::Hash as RelayHash;
use crate::parachain_inherent::InboundDownwardMessages;
use cumulus_primitives_core::{relay_chain::Hash as RelayHash, InboundDownwardMessage};
use frame_benchmarking::v2::*;
use sp_runtime::traits::BlakeTwo256;

Expand All @@ -43,7 +44,10 @@ mod benchmarks {

#[block]
{
Pallet::<T>::enqueue_inbound_downward_messages(head, msgs);
Pallet::<T>::enqueue_inbound_downward_messages(
head,
InboundDownwardMessages::new(msgs).into_abridged(&mut usize::MAX.clone()),
);
}

assert_eq!(ProcessedDownwardMessages::<T>::get(), n);
Expand Down
300 changes: 157 additions & 143 deletions cumulus/pallets/parachain-system/src/lib.rs

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions cumulus/pallets/parachain-system/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use frame_support::{
},
weights::{Weight, WeightMeter},
};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use frame_system::{limits::BlockWeights, pallet_prelude::BlockNumberFor, RawOrigin};
use sp_core::ConstU32;
use sp_runtime::{traits::BlakeTwo256, BuildStorage};
use sp_version::RuntimeVersion;
Expand Down Expand Up @@ -67,13 +67,16 @@ parameter_types! {
transaction_version: 1,
system_version: 1,
};
pub RuntimeBlockWeights: BlockWeights =
BlockWeights::simple_max(Weight::from_parts(1024, 6 * 1024 * 1024));
pub const ParachainId: ParaId = ParaId::new(200);
pub const ReservedXcmpWeight: Weight = Weight::zero();
pub const ReservedDmpWeight: Weight = Weight::zero();
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BlockWeights = RuntimeBlockWeights;
type Block = Block;
type Version = Version;
type OnSetCode = ParachainSetCode<Self>;
Expand Down Expand Up @@ -226,12 +229,12 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
}

#[allow(dead_code)]
pub fn mk_dmp(sent_at: u32) -> InboundDownwardMessage {
InboundDownwardMessage { sent_at, msg: format!("down{}", sent_at).into_bytes() }
pub fn mk_dmp(sent_at: u8, size: usize) -> InboundDownwardMessage {
InboundDownwardMessage { sent_at: sent_at as u32, msg: vec![sent_at; size] }
}

pub fn mk_hrmp(sent_at: u32) -> InboundHrmpMessage {
InboundHrmpMessage { sent_at, data: format!("{}", sent_at).into_bytes() }
pub fn mk_hrmp(sent_at: u8, size: usize) -> InboundHrmpMessage {
InboundHrmpMessage { sent_at: sent_at as u32, data: vec![sent_at; size] }
}

pub struct ReadRuntimeVersion(pub Vec<u8>);
Expand Down
Loading
Loading