mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 02:07:56 +00:00
More tests for message pallet weights (#1870)
* more tests for message pallet weights * move tests to ensure_weights_are_correct * removed extra tests
This commit is contained in:
committed by
Bastian Köcher
parent
47e045d55e
commit
89bb368e45
@@ -34,7 +34,7 @@ use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::ConstU64,
|
||||
weights::{RuntimeDbWeight, Weight},
|
||||
weights::{constants::RocksDbWeight, Weight},
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::H256;
|
||||
@@ -92,9 +92,10 @@ parameter_types! {
|
||||
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
|
||||
pub const MaximumBlockLength: u32 = 2 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 1, write: 2 };
|
||||
}
|
||||
|
||||
pub type DbWeight = RocksDbWeight;
|
||||
|
||||
impl frame_system::Config for TestRuntime {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Autogenerated weights for pallet_bridge_messages
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-02-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-02-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||
@@ -72,8 +72,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -87,9 +87,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
fn receive_single_message_proof() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `693`
|
||||
// Estimated: `55198`
|
||||
// Minimum execution time: 47_968 nanoseconds.
|
||||
Weight::from_parts(48_937_000, 55198)
|
||||
// Estimated: `54703`
|
||||
// Minimum execution time: 76_449 nanoseconds.
|
||||
Weight::from_parts(127_110_000, 54703)
|
||||
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -100,8 +100,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -115,9 +115,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
fn receive_two_messages_proof() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `693`
|
||||
// Estimated: `55198`
|
||||
// Minimum execution time: 63_831 nanoseconds.
|
||||
Weight::from_parts(85_093_000, 55198)
|
||||
// Estimated: `54703`
|
||||
// Minimum execution time: 102_297 nanoseconds.
|
||||
Weight::from_parts(108_619_000, 54703)
|
||||
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -128,8 +128,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -143,9 +143,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `693`
|
||||
// Estimated: `55198`
|
||||
// Minimum execution time: 53_775 nanoseconds.
|
||||
Weight::from_parts(55_113_000, 55198)
|
||||
// Estimated: `54703`
|
||||
// Minimum execution time: 84_911 nanoseconds.
|
||||
Weight::from_parts(87_518_000, 54703)
|
||||
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -156,8 +156,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -166,9 +166,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
fn receive_single_message_proof_1_kb() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `618`
|
||||
// Estimated: `54695`
|
||||
// Minimum execution time: 54_314 nanoseconds.
|
||||
Weight::from_parts(55_804_000, 54695)
|
||||
// Estimated: `54200`
|
||||
// Minimum execution time: 79_805 nanoseconds.
|
||||
Weight::from_parts(84_148_000, 54200)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
@@ -179,8 +179,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -189,9 +189,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
fn receive_single_message_proof_16_kb() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `618`
|
||||
// Estimated: `54695`
|
||||
// Minimum execution time: 103_050 nanoseconds.
|
||||
Weight::from_parts(106_715_000, 54695)
|
||||
// Estimated: `54200`
|
||||
// Minimum execution time: 141_515 nanoseconds.
|
||||
Weight::from_parts(150_421_000, 54200)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
@@ -202,8 +202,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -217,9 +217,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
fn receive_delivery_proof_for_single_message() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `579`
|
||||
// Estimated: `8094`
|
||||
// Minimum execution time: 42_111 nanoseconds.
|
||||
Weight::from_parts(43_168_000, 8094)
|
||||
// Estimated: `7599`
|
||||
// Minimum execution time: 54_740 nanoseconds.
|
||||
Weight::from_parts(56_637_000, 7599)
|
||||
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -230,8 +230,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -245,9 +245,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `596`
|
||||
// Estimated: `8094`
|
||||
// Minimum execution time: 40_094 nanoseconds.
|
||||
Weight::from_parts(41_140_000, 8094)
|
||||
// Estimated: `7599`
|
||||
// Minimum execution time: 54_583 nanoseconds.
|
||||
Weight::from_parts(56_205_000, 7599)
|
||||
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -258,8 +258,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -273,9 +273,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `596`
|
||||
// Estimated: `10629`
|
||||
// Minimum execution time: 42_498 nanoseconds.
|
||||
Weight::from_parts(43_494_000, 10629)
|
||||
// Estimated: `10134`
|
||||
// Minimum execution time: 59_426 nanoseconds.
|
||||
Weight::from_parts(61_911_000, 10134)
|
||||
.saturating_add(T::DbWeight::get().reads(5_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
@@ -290,8 +290,8 @@ impl WeightInfo for () {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -305,9 +305,9 @@ impl WeightInfo for () {
|
||||
fn receive_single_message_proof() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `693`
|
||||
// Estimated: `55198`
|
||||
// Minimum execution time: 47_968 nanoseconds.
|
||||
Weight::from_parts(48_937_000, 55198)
|
||||
// Estimated: `54703`
|
||||
// Minimum execution time: 76_449 nanoseconds.
|
||||
Weight::from_parts(127_110_000, 54703)
|
||||
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -318,8 +318,8 @@ impl WeightInfo for () {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -333,9 +333,9 @@ impl WeightInfo for () {
|
||||
fn receive_two_messages_proof() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `693`
|
||||
// Estimated: `55198`
|
||||
// Minimum execution time: 63_831 nanoseconds.
|
||||
Weight::from_parts(85_093_000, 55198)
|
||||
// Estimated: `54703`
|
||||
// Minimum execution time: 102_297 nanoseconds.
|
||||
Weight::from_parts(108_619_000, 54703)
|
||||
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -346,8 +346,8 @@ impl WeightInfo for () {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -361,9 +361,9 @@ impl WeightInfo for () {
|
||||
fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `693`
|
||||
// Estimated: `55198`
|
||||
// Minimum execution time: 53_775 nanoseconds.
|
||||
Weight::from_parts(55_113_000, 55198)
|
||||
// Estimated: `54703`
|
||||
// Minimum execution time: 84_911 nanoseconds.
|
||||
Weight::from_parts(87_518_000, 54703)
|
||||
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -374,8 +374,8 @@ impl WeightInfo for () {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -384,9 +384,9 @@ impl WeightInfo for () {
|
||||
fn receive_single_message_proof_1_kb() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `618`
|
||||
// Estimated: `54695`
|
||||
// Minimum execution time: 54_314 nanoseconds.
|
||||
Weight::from_parts(55_804_000, 54695)
|
||||
// Estimated: `54200`
|
||||
// Minimum execution time: 79_805 nanoseconds.
|
||||
Weight::from_parts(84_148_000, 54200)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
@@ -397,8 +397,8 @@ impl WeightInfo for () {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -407,9 +407,9 @@ impl WeightInfo for () {
|
||||
fn receive_single_message_proof_16_kb() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `618`
|
||||
// Estimated: `54695`
|
||||
// Minimum execution time: 103_050 nanoseconds.
|
||||
Weight::from_parts(106_715_000, 54695)
|
||||
// Estimated: `54200`
|
||||
// Minimum execution time: 141_515 nanoseconds.
|
||||
Weight::from_parts(150_421_000, 54200)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
@@ -420,8 +420,8 @@ impl WeightInfo for () {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -435,9 +435,9 @@ impl WeightInfo for () {
|
||||
fn receive_delivery_proof_for_single_message() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `579`
|
||||
// Estimated: `8094`
|
||||
// Minimum execution time: 42_111 nanoseconds.
|
||||
Weight::from_parts(43_168_000, 8094)
|
||||
// Estimated: `7599`
|
||||
// Minimum execution time: 54_740 nanoseconds.
|
||||
Weight::from_parts(56_637_000, 7599)
|
||||
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -448,8 +448,8 @@ impl WeightInfo for () {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -463,9 +463,9 @@ impl WeightInfo for () {
|
||||
fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `596`
|
||||
// Estimated: `8094`
|
||||
// Minimum execution time: 40_094 nanoseconds.
|
||||
Weight::from_parts(41_140_000, 8094)
|
||||
// Estimated: `7599`
|
||||
// Minimum execution time: 54_583 nanoseconds.
|
||||
Weight::from_parts(56_205_000, 7599)
|
||||
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
@@ -476,8 +476,8 @@ impl WeightInfo for () {
|
||||
///
|
||||
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
|
||||
///
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
|
||||
/// 2543, mode: MaxEncodedLen)
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
|
||||
///
|
||||
@@ -491,9 +491,9 @@ impl WeightInfo for () {
|
||||
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `596`
|
||||
// Estimated: `10629`
|
||||
// Minimum execution time: 42_498 nanoseconds.
|
||||
Weight::from_parts(43_494_000, 10629)
|
||||
// Estimated: `10134`
|
||||
// Minimum execution time: 59_426 nanoseconds.
|
||||
Weight::from_parts(61_911_000, 10134)
|
||||
.saturating_add(RocksDbWeight::get().reads(5_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
|
||||
@@ -36,21 +36,43 @@ pub const EXTRA_STORAGE_PROOF_SIZE: u32 = 1024;
|
||||
|
||||
/// Ensure that weights from `WeightInfoExt` implementation are looking correct.
|
||||
pub fn ensure_weights_are_correct<W: WeightInfoExt>() {
|
||||
// all components of weight formulae must have zero `proof_size`, because the `proof_size` is
|
||||
// benchmarked using `MaxEncodedLen` approach and there are no components that cause additional
|
||||
// db reads
|
||||
|
||||
// verify `receive_messages_proof` weight components
|
||||
assert_ne!(W::receive_messages_proof_overhead(), Weight::zero());
|
||||
assert_ne!(W::receive_messages_proof_messages_overhead(1), Weight::zero());
|
||||
assert_ne!(W::receive_messages_proof_outbound_lane_state_overhead(), Weight::zero());
|
||||
assert_ne!(W::storage_proof_size_overhead(1), Weight::zero());
|
||||
assert_ne!(W::receive_messages_proof_overhead().ref_time(), 0);
|
||||
assert_ne!(W::receive_messages_proof_overhead().proof_size(), 0);
|
||||
// W::receive_messages_proof_messages_overhead(1).ref_time() may be zero because:
|
||||
// the message processing code (`InboundLane::receive_message`) is minimal and may not be
|
||||
// accounted by our benchmarks
|
||||
assert_eq!(W::receive_messages_proof_messages_overhead(1).proof_size(), 0);
|
||||
// W::receive_messages_proof_outbound_lane_state_overhead().ref_time() may be zero because:
|
||||
// the outbound lane state processing code (`InboundLane::receive_state_update`) is minimal and
|
||||
// may not be accounted by our benchmarks
|
||||
assert_eq!(W::receive_messages_proof_outbound_lane_state_overhead().proof_size(), 0);
|
||||
assert_ne!(W::storage_proof_size_overhead(1).ref_time(), 0);
|
||||
assert_eq!(W::storage_proof_size_overhead(1).proof_size(), 0);
|
||||
|
||||
// verify `receive_messages_delivery_proof` weight components
|
||||
assert_ne!(W::receive_messages_delivery_proof_overhead(), Weight::zero());
|
||||
assert_ne!(W::storage_proof_size_overhead(1), Weight::zero());
|
||||
assert_ne!(W::receive_messages_delivery_proof_overhead().ref_time(), 0);
|
||||
assert_ne!(W::receive_messages_delivery_proof_overhead().proof_size(), 0);
|
||||
// W::receive_messages_delivery_proof_messages_overhead(1).ref_time() may be zero because:
|
||||
// there's no code that iterates over confirmed messages in confirmation transaction
|
||||
assert_eq!(W::receive_messages_delivery_proof_messages_overhead(1).proof_size(), 0);
|
||||
assert_ne!(W::receive_messages_delivery_proof_relayers_overhead(1).ref_time(), 0);
|
||||
// W::receive_messages_delivery_proof_relayers_overhead(1).proof_size() is an exception
|
||||
// it may or may not cause additional db reads, so proof size may vary
|
||||
assert_ne!(W::storage_proof_size_overhead(1).ref_time(), 0);
|
||||
assert_eq!(W::storage_proof_size_overhead(1).proof_size(), 0);
|
||||
|
||||
// verify `receive_message_proof` weight
|
||||
let receive_messages_proof_weight =
|
||||
W::receive_messages_proof_weight(&PreComputedSize(1), 10, Weight::zero());
|
||||
assert_ne!(receive_messages_proof_weight.ref_time(), 0);
|
||||
assert_ne!(receive_messages_proof_weight.proof_size(), 0);
|
||||
messages_proof_size_does_not_affect_proof_size::<W>();
|
||||
messages_count_does_not_affect_proof_size::<W>();
|
||||
|
||||
// verify `receive_message_proof` weight
|
||||
let receive_messages_delivery_proof_weight = W::receive_messages_delivery_proof_weight(
|
||||
@@ -59,6 +81,8 @@ pub fn ensure_weights_are_correct<W: WeightInfoExt>() {
|
||||
);
|
||||
assert_ne!(receive_messages_delivery_proof_weight.ref_time(), 0);
|
||||
assert_ne!(receive_messages_delivery_proof_weight.proof_size(), 0);
|
||||
messages_delivery_proof_size_does_not_affect_proof_size::<W>();
|
||||
total_messages_in_delivery_proof_does_not_affect_proof_size::<W>();
|
||||
}
|
||||
|
||||
/// Ensure that we're able to receive maximal (by-size and by-weight) message from other chain.
|
||||
@@ -122,6 +146,116 @@ pub fn ensure_able_to_receive_confirmation<W: WeightInfoExt>(
|
||||
);
|
||||
}
|
||||
|
||||
/// Panics if `proof_size` of message delivery call depends on the message proof size.
|
||||
fn messages_proof_size_does_not_affect_proof_size<W: WeightInfoExt>() {
|
||||
let dispatch_weight = Weight::zero();
|
||||
let weight_when_proof_size_is_8k =
|
||||
W::receive_messages_proof_weight(&PreComputedSize(8 * 1024), 1, dispatch_weight);
|
||||
let weight_when_proof_size_is_16k =
|
||||
W::receive_messages_proof_weight(&PreComputedSize(16 * 1024), 1, dispatch_weight);
|
||||
|
||||
ensure_weight_components_are_not_zero(weight_when_proof_size_is_8k);
|
||||
ensure_weight_components_are_not_zero(weight_when_proof_size_is_16k);
|
||||
ensure_proof_size_is_the_same(
|
||||
weight_when_proof_size_is_8k,
|
||||
weight_when_proof_size_is_16k,
|
||||
"Messages proof size does not affect values that we read from our storage",
|
||||
);
|
||||
}
|
||||
|
||||
/// Panics if `proof_size` of message delivery call depends on the messages count.
|
||||
///
|
||||
/// In practice, it will depend on the messages count, because most probably every
|
||||
/// message will read something from db during dispatch. But this must be accounted
|
||||
/// by the `dispatch_weight`.
|
||||
fn messages_count_does_not_affect_proof_size<W: WeightInfoExt>() {
|
||||
let messages_proof_size = PreComputedSize(8 * 1024);
|
||||
let dispatch_weight = Weight::zero();
|
||||
let weight_of_one_incoming_message =
|
||||
W::receive_messages_proof_weight(&messages_proof_size, 1, dispatch_weight);
|
||||
let weight_of_two_incoming_messages =
|
||||
W::receive_messages_proof_weight(&messages_proof_size, 2, dispatch_weight);
|
||||
|
||||
ensure_weight_components_are_not_zero(weight_of_one_incoming_message);
|
||||
ensure_weight_components_are_not_zero(weight_of_two_incoming_messages);
|
||||
ensure_proof_size_is_the_same(
|
||||
weight_of_one_incoming_message,
|
||||
weight_of_two_incoming_messages,
|
||||
"Number of same-lane incoming messages does not affect values that we read from our storage",
|
||||
);
|
||||
}
|
||||
|
||||
/// Panics if `proof_size` of delivery confirmation call depends on the delivery proof size.
|
||||
fn messages_delivery_proof_size_does_not_affect_proof_size<W: WeightInfoExt>() {
|
||||
let relayers_state = UnrewardedRelayersState {
|
||||
unrewarded_relayer_entries: 1,
|
||||
messages_in_oldest_entry: 1,
|
||||
total_messages: 1,
|
||||
last_delivered_nonce: 1,
|
||||
};
|
||||
let weight_when_proof_size_is_8k =
|
||||
W::receive_messages_delivery_proof_weight(&PreComputedSize(8 * 1024), &relayers_state);
|
||||
let weight_when_proof_size_is_16k =
|
||||
W::receive_messages_delivery_proof_weight(&PreComputedSize(16 * 1024), &relayers_state);
|
||||
|
||||
ensure_weight_components_are_not_zero(weight_when_proof_size_is_8k);
|
||||
ensure_weight_components_are_not_zero(weight_when_proof_size_is_16k);
|
||||
ensure_proof_size_is_the_same(
|
||||
weight_when_proof_size_is_8k,
|
||||
weight_when_proof_size_is_16k,
|
||||
"Messages delivery proof size does not affect values that we read from our storage",
|
||||
);
|
||||
}
|
||||
|
||||
/// Panics if `proof_size` of delivery confirmation call depends on the number of confirmed
|
||||
/// messages.
|
||||
fn total_messages_in_delivery_proof_does_not_affect_proof_size<W: WeightInfoExt>() {
|
||||
let proof_size = PreComputedSize(8 * 1024);
|
||||
let weight_when_1k_messages_confirmed = W::receive_messages_delivery_proof_weight(
|
||||
&proof_size,
|
||||
&UnrewardedRelayersState {
|
||||
unrewarded_relayer_entries: 1,
|
||||
messages_in_oldest_entry: 1,
|
||||
total_messages: 1024,
|
||||
last_delivered_nonce: 1,
|
||||
},
|
||||
);
|
||||
let weight_when_2k_messages_confirmed = W::receive_messages_delivery_proof_weight(
|
||||
&proof_size,
|
||||
&UnrewardedRelayersState {
|
||||
unrewarded_relayer_entries: 1,
|
||||
messages_in_oldest_entry: 1,
|
||||
total_messages: 2048,
|
||||
last_delivered_nonce: 1,
|
||||
},
|
||||
);
|
||||
|
||||
ensure_weight_components_are_not_zero(weight_when_1k_messages_confirmed);
|
||||
ensure_weight_components_are_not_zero(weight_when_2k_messages_confirmed);
|
||||
ensure_proof_size_is_the_same(
|
||||
weight_when_1k_messages_confirmed,
|
||||
weight_when_2k_messages_confirmed,
|
||||
"More messages in delivery proof does not affect values that we read from our storage",
|
||||
);
|
||||
}
|
||||
|
||||
/// Panics if either Weight' `proof_size` or `ref_time` are zero.
|
||||
fn ensure_weight_components_are_not_zero(weight: Weight) {
|
||||
assert_ne!(weight.ref_time(), 0);
|
||||
assert_ne!(weight.proof_size(), 0);
|
||||
}
|
||||
|
||||
/// Panics if `proof_size` of `weight1` is not equal to `proof_size` of `weight2`.
|
||||
fn ensure_proof_size_is_the_same(weight1: Weight, weight2: Weight, msg: &str) {
|
||||
assert_eq!(
|
||||
weight1.proof_size(),
|
||||
weight2.proof_size(),
|
||||
"{msg}: {} must be equal to {}",
|
||||
weight1.proof_size(),
|
||||
weight2.proof_size(),
|
||||
);
|
||||
}
|
||||
|
||||
/// Extended weight info.
|
||||
pub trait WeightInfoExt: WeightInfo {
|
||||
/// Size of proof that is already included in the single message delivery weight.
|
||||
@@ -282,3 +416,14 @@ impl<T: frame_system::Config> WeightInfoExt for crate::weights::BridgeWeight<T>
|
||||
EXTRA_STORAGE_PROOF_SIZE
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{mock::TestRuntime, weights::BridgeWeight};
|
||||
|
||||
#[test]
|
||||
fn ensure_default_weights_are_correct() {
|
||||
ensure_weights_are_correct::<BridgeWeight<TestRuntime>>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user