mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 09:17:58 +00:00
6f3d1a8143
* The message queue * Make fully generic * Refactor * Docs * Refactor * Use iter not slice * Per-origin queues * Multi-queue processing * Introduce MaxReady * Remove MaxReady in favour of ready ring * Cleanups * ReadyRing and tests * Stale page reaping * from_components -> from_parts Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Move WeightCounter to sp_weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add MockedWeightInfo Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Deploy to kitchensink Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use WeightCounter Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Small fixes and logging Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add service_page Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Typo Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Move service_page below service_queue Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add service_message Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use correct weight function Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Overweight execution * Refactor * Missing file * Fix WeightCounter usage in scheduler Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix peek_index Take into account that decoding from a mutable slice modifies it. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add tests and bench service_page_item Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add debug_info Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add no-progress check to service_queues Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add more benches Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Bound from_message and try_append_message Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add PageReaped event Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Rename BookStateOf and BookStateFor Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update tests and remove logging Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Remove redundant per-message origins; add footprint() and sweep_queue() * Move testing stuff to mock.rs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add integration test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix no-progress check Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix debug_info Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fixup merge and tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix footprint tracking * Introduce * Formatting * OverweightEnqueued event, auto-servicing config item * Update tests and benchmarks Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Clippy Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Provide change handler * Add missing BookStateFor::insert and call QueueChangeHandler Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update benchmarks and weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * More tests... Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use weight metering functions Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * weightInfo::process_message_payload is gone Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add defensive_saturating_accrue Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Rename WeightCounter to WeightMeter Ctr+Shift+H should do the trick. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test on_initialize Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add module docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Remove origin from MaxMessageLen The message origin is not encoded into the heap and does therefore not influence the max message length anymore. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add BoundedVec::as_slice Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test Page::{from_message, try_append_message} Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fixup docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Docs * Do nothing in sweep_queue if the queue does not exist ... otherwise it inserts default values into the storage. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test ring (un)knitting Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Upgrade stress-test Change the test to not assume that all queued messages will be processed in the next block but split it over multiple. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * More tests... Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Beauty fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * clippy Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Rename BoundedVec::as_slice to as_bounded_slice Conflicts with deref().as_slice() otherwise. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix imports Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Remove ReadyRing struct Was used for testing only. Instead use 'fn assert_ring' which also check the service head and backlinks. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Beauty fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix stale page watermark Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix test feature and clippy Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * QueueChanged handler is called correctly Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update benches Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Abstract testing functions Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * More tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Clippy Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Simplify tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Make stuff compile Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Extend overweight execution benchmark Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Remove TODOs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test service queue with faulty MessageProcessor Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update pallet ui tests to 1.65 Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * More docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review doc fixes Co-authored-by: Robert Klotzner <eskimor@users.noreply.github.com> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add weight_limit to extrinsic weight of execute_overweight * Correctly return unused weight * Return actual weight consumed in do_execute_overweight * Review fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Set version 7.0.0-dev Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Make it compile Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Switch message_size to u64 Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Switch message_count to u64 Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix benchmarks Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Make CI green Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Docs * Update tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * ".git/.scripts/bench-bot.sh" pallet dev pallet_message_queue * Dont mention README.md in the Cargo.toml Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Remove reference to readme Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <> Co-authored-by: Robert Klotzner <eskimor@users.noreply.github.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
217 lines
8.0 KiB
Rust
217 lines
8.0 KiB
Rust
// This file is part of Substrate.
|
|
|
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
//! Autogenerated weights for pallet_message_queue
|
|
//!
|
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
|
//! DATE: 2022-12-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
|
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
|
|
|
// Executed Command:
|
|
// /home/benchbot/cargo_target_dir/production/substrate
|
|
// benchmark
|
|
// pallet
|
|
// --steps=50
|
|
// --repeat=20
|
|
// --extrinsic=*
|
|
// --execution=wasm
|
|
// --wasm-execution=compiled
|
|
// --heap-pages=4096
|
|
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
|
|
// --pallet=pallet_message_queue
|
|
// --chain=dev
|
|
// --header=./HEADER-APACHE2
|
|
// --output=./frame/message-queue/src/weights.rs
|
|
// --template=./.maintain/frame-weight-template.hbs
|
|
|
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
|
#![allow(unused_parens)]
|
|
#![allow(unused_imports)]
|
|
|
|
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
|
use sp_std::marker::PhantomData;
|
|
|
|
/// Weight functions needed for pallet_message_queue.
|
|
pub trait WeightInfo {
|
|
fn ready_ring_knit() -> Weight;
|
|
fn ready_ring_unknit() -> Weight;
|
|
fn service_queue_base() -> Weight;
|
|
fn service_page_base_completion() -> Weight;
|
|
fn service_page_base_no_completion() -> Weight;
|
|
fn service_page_item() -> Weight;
|
|
fn bump_service_head() -> Weight;
|
|
fn reap_page() -> Weight;
|
|
fn execute_overweight_page_removed() -> Weight;
|
|
fn execute_overweight_page_updated() -> Weight;
|
|
}
|
|
|
|
/// Weights for pallet_message_queue using the Substrate node and recommended hardware.
|
|
pub struct SubstrateWeight<T>(PhantomData<T>);
|
|
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
|
// Storage: MessageQueue ServiceHead (r:1 w:0)
|
|
// Storage: MessageQueue BookStateFor (r:2 w:2)
|
|
fn ready_ring_knit() -> Weight {
|
|
// Minimum execution time: 12_330 nanoseconds.
|
|
Weight::from_ref_time(12_711_000)
|
|
.saturating_add(T::DbWeight::get().reads(3))
|
|
.saturating_add(T::DbWeight::get().writes(2))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:2 w:2)
|
|
// Storage: MessageQueue ServiceHead (r:1 w:1)
|
|
fn ready_ring_unknit() -> Weight {
|
|
// Minimum execution time: 12_322 nanoseconds.
|
|
Weight::from_ref_time(12_560_000)
|
|
.saturating_add(T::DbWeight::get().reads(3))
|
|
.saturating_add(T::DbWeight::get().writes(3))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:1 w:1)
|
|
fn service_queue_base() -> Weight {
|
|
// Minimum execution time: 4_652 nanoseconds.
|
|
Weight::from_ref_time(4_848_000)
|
|
.saturating_add(T::DbWeight::get().reads(1))
|
|
.saturating_add(T::DbWeight::get().writes(1))
|
|
}
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn service_page_base_completion() -> Weight {
|
|
// Minimum execution time: 7_115 nanoseconds.
|
|
Weight::from_ref_time(7_407_000)
|
|
.saturating_add(T::DbWeight::get().reads(1))
|
|
.saturating_add(T::DbWeight::get().writes(1))
|
|
}
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn service_page_base_no_completion() -> Weight {
|
|
// Minimum execution time: 6_974 nanoseconds.
|
|
Weight::from_ref_time(7_200_000)
|
|
.saturating_add(T::DbWeight::get().reads(1))
|
|
.saturating_add(T::DbWeight::get().writes(1))
|
|
}
|
|
fn service_page_item() -> Weight {
|
|
// Minimum execution time: 79_657 nanoseconds.
|
|
Weight::from_ref_time(80_050_000)
|
|
}
|
|
// Storage: MessageQueue ServiceHead (r:1 w:1)
|
|
// Storage: MessageQueue BookStateFor (r:1 w:0)
|
|
fn bump_service_head() -> Weight {
|
|
// Minimum execution time: 7_598 nanoseconds.
|
|
Weight::from_ref_time(8_118_000)
|
|
.saturating_add(T::DbWeight::get().reads(2))
|
|
.saturating_add(T::DbWeight::get().writes(1))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:1 w:1)
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn reap_page() -> Weight {
|
|
// Minimum execution time: 60_562 nanoseconds.
|
|
Weight::from_ref_time(61_430_000)
|
|
.saturating_add(T::DbWeight::get().reads(2))
|
|
.saturating_add(T::DbWeight::get().writes(2))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:1 w:1)
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn execute_overweight_page_removed() -> Weight {
|
|
// Minimum execution time: 74_582 nanoseconds.
|
|
Weight::from_ref_time(75_445_000)
|
|
.saturating_add(T::DbWeight::get().reads(2))
|
|
.saturating_add(T::DbWeight::get().writes(2))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:1 w:1)
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn execute_overweight_page_updated() -> Weight {
|
|
// Minimum execution time: 87_526 nanoseconds.
|
|
Weight::from_ref_time(88_055_000)
|
|
.saturating_add(T::DbWeight::get().reads(2))
|
|
.saturating_add(T::DbWeight::get().writes(2))
|
|
}
|
|
}
|
|
|
|
// For backwards compatibility and tests
|
|
impl WeightInfo for () {
|
|
// Storage: MessageQueue ServiceHead (r:1 w:0)
|
|
// Storage: MessageQueue BookStateFor (r:2 w:2)
|
|
fn ready_ring_knit() -> Weight {
|
|
// Minimum execution time: 12_330 nanoseconds.
|
|
Weight::from_ref_time(12_711_000)
|
|
.saturating_add(RocksDbWeight::get().reads(3))
|
|
.saturating_add(RocksDbWeight::get().writes(2))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:2 w:2)
|
|
// Storage: MessageQueue ServiceHead (r:1 w:1)
|
|
fn ready_ring_unknit() -> Weight {
|
|
// Minimum execution time: 12_322 nanoseconds.
|
|
Weight::from_ref_time(12_560_000)
|
|
.saturating_add(RocksDbWeight::get().reads(3))
|
|
.saturating_add(RocksDbWeight::get().writes(3))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:1 w:1)
|
|
fn service_queue_base() -> Weight {
|
|
// Minimum execution time: 4_652 nanoseconds.
|
|
Weight::from_ref_time(4_848_000)
|
|
.saturating_add(RocksDbWeight::get().reads(1))
|
|
.saturating_add(RocksDbWeight::get().writes(1))
|
|
}
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn service_page_base_completion() -> Weight {
|
|
// Minimum execution time: 7_115 nanoseconds.
|
|
Weight::from_ref_time(7_407_000)
|
|
.saturating_add(RocksDbWeight::get().reads(1))
|
|
.saturating_add(RocksDbWeight::get().writes(1))
|
|
}
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn service_page_base_no_completion() -> Weight {
|
|
// Minimum execution time: 6_974 nanoseconds.
|
|
Weight::from_ref_time(7_200_000)
|
|
.saturating_add(RocksDbWeight::get().reads(1))
|
|
.saturating_add(RocksDbWeight::get().writes(1))
|
|
}
|
|
fn service_page_item() -> Weight {
|
|
// Minimum execution time: 79_657 nanoseconds.
|
|
Weight::from_ref_time(80_050_000)
|
|
}
|
|
// Storage: MessageQueue ServiceHead (r:1 w:1)
|
|
// Storage: MessageQueue BookStateFor (r:1 w:0)
|
|
fn bump_service_head() -> Weight {
|
|
// Minimum execution time: 7_598 nanoseconds.
|
|
Weight::from_ref_time(8_118_000)
|
|
.saturating_add(RocksDbWeight::get().reads(2))
|
|
.saturating_add(RocksDbWeight::get().writes(1))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:1 w:1)
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn reap_page() -> Weight {
|
|
// Minimum execution time: 60_562 nanoseconds.
|
|
Weight::from_ref_time(61_430_000)
|
|
.saturating_add(RocksDbWeight::get().reads(2))
|
|
.saturating_add(RocksDbWeight::get().writes(2))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:1 w:1)
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn execute_overweight_page_removed() -> Weight {
|
|
// Minimum execution time: 74_582 nanoseconds.
|
|
Weight::from_ref_time(75_445_000)
|
|
.saturating_add(RocksDbWeight::get().reads(2))
|
|
.saturating_add(RocksDbWeight::get().writes(2))
|
|
}
|
|
// Storage: MessageQueue BookStateFor (r:1 w:1)
|
|
// Storage: MessageQueue Pages (r:1 w:1)
|
|
fn execute_overweight_page_updated() -> Weight {
|
|
// Minimum execution time: 87_526 nanoseconds.
|
|
Weight::from_ref_time(88_055_000)
|
|
.saturating_add(RocksDbWeight::get().reads(2))
|
|
.saturating_add(RocksDbWeight::get().writes(2))
|
|
}
|
|
}
|