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

Benchmarks for pallet-bridge-assets-transfer #2316

Merged
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,30 @@ impl<T: Config> Pallet<T> {
pub fn set_custom_validation_head_data(head_data: Vec<u8>) {
CustomValidationHeadData::<T>::put(head_data);
}

/// Open HRMP channel for using it in benchmarks.
///
/// The caller assumes that the pallet will accept regular outbound message to the sibling
/// `target_parachain` after this call. No other assumptions are made.
#[cfg(feature = "runtime-benchmarks")]
pub fn open_outbound_hrmp_channel_for_benchmarks(target_parachain: ParaId) {
RelevantMessagingState::<T>::put(MessagingStateSnapshot {
dmq_mqc_head: Default::default(),
relay_dispatch_queue_size: Default::default(),
ingress_channels: Default::default(),
egress_channels: vec![(
target_parachain,
cumulus_primitives_core::AbridgedHrmpChannel {
max_capacity: 10,
max_total_size: 10_000_000_u32,
max_message_size: 10_000_000_u32,
msg_count: 10,
total_size: 10_000_000_u32,
mqc_head: None,
},
)],
})
}
}

pub struct ParachainSetCode<T>(sp_std::marker::PhantomData<T>);
Expand Down
4 changes: 3 additions & 1 deletion parachains/pallets/bridge-assets-transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ log = { version = "0.4.14", default-features = false }
# Substrate
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "master" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }

Expand Down Expand Up @@ -45,7 +46,8 @@ std = [
"xcm-executor/std",
]
runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"frame-benchmarking",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
Loading