diff --git a/runtime/casper/Cargo.toml b/runtime/casper/Cargo.toml index 250fdbe..ec34d92 100644 --- a/runtime/casper/Cargo.toml +++ b/runtime/casper/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "casper-runtime" -version = "3.5.25" +version = "3.5.26" build = "build.rs" description = "Runtime of the Casper Network" edition.workspace = true @@ -87,6 +87,7 @@ pallet-whitelist = { workspace = true } ghost-networks = { workspace = true } ghost-claims = { workspace = true } ghost-slow-clap = { workspace = true } +ghost-sudo = { workspace = true } casper-runtime-constants = { workspace = true } runtime-common = { workspace = true } primitives = { workspace = true } @@ -205,6 +206,7 @@ std = [ "ghost-networks/std", "ghost-claims/std", "ghost-slow-clap/std", + "ghost-sudo/std", "casper-runtime-constants/std", "runtime-common/std", "primitives/std", @@ -252,6 +254,7 @@ runtime-benchmarks = [ "ghost-networks/runtime-benchmarks", "ghost-claims/runtime-benchmarks", "ghost-slow-clap/runtime-benchmarks", + "ghost-sudo/runtime-benchmarks", "runtime-common/runtime-benchmarks", ] try-runtime = [ @@ -297,5 +300,6 @@ try-runtime = [ "ghost-networks/try-runtime", "ghost-claims/try-runtime", "ghost-slow-clap/try-runtime", + "ghost-sudo/try-runtime", "runtime-common/try-runtime", ] diff --git a/runtime/casper/constants/Cargo.toml b/runtime/casper/constants/Cargo.toml index 67b6f6c..5de81eb 100644 --- a/runtime/casper/constants/Cargo.toml +++ b/runtime/casper/constants/Cargo.toml @@ -28,3 +28,6 @@ std = [ "sp-runtime/std", "sp-weights/std", ] + +# Set timing constants (e.g session period) to faster versions to speed up testing. +fast-runtime = [] diff --git a/runtime/casper/src/lib.rs b/runtime/casper/src/lib.rs index 46e792e..0f0c288 100644 --- a/runtime/casper/src/lib.rs +++ b/runtime/casper/src/lib.rs @@ -1105,6 +1105,12 @@ impl ghost_slow_clap::Config for Runtime { type WeightInfo = weights::ghost_slow_clap::WeightInfo; } +impl ghost_sudo::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type WeightInfo = weights::ghost_sudo::WeightInfo; +} + construct_runtime! { pub enum Runtime { @@ -1132,6 +1138,7 @@ construct_runtime! { Session: pallet_session = 9, Grandpa: pallet_grandpa = 11, AuthorityDiscovery: pallet_authority_discovery = 12, + GhostSudo: ghost_sudo = 13, // Governance stuff. Treasury: pallet_treasury = 19, @@ -1260,6 +1267,7 @@ mod benches { [ghost_networks, GhostNetworks] [ghost_claims, GhostClaims] [ghost_slow_clap, GhostSlowClaps] + [ghost_sudo, GhostSudo] ); } @@ -1566,6 +1574,7 @@ sp_api::impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig, ) -> Result< diff --git a/runtime/casper/src/weights/ghost_sudo.rs b/runtime/casper/src/weights/ghost_sudo.rs new file mode 100644 index 0000000..ad9d4be --- /dev/null +++ b/runtime/casper/src/weights/ghost_sudo.rs @@ -0,0 +1,97 @@ +// This file is part of Substrate. + +// Copyright (C) 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_sudo` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-09, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `runner-anb7yjbi-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` + +// Executed Command: +// ./target/production/substrate-node +// benchmark +// pallet +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_sudo +// --no-storage-info +// --no-median-slopes +// --no-min-squares +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./substrate/frame/sudo/src/weights.rs +// --header=./substrate/HEADER-APACHE2 +// --template=./substrate/.maintain/frame-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_sudo` using the Substrate node and recommended hardware. +pub struct WeightInfo(PhantomData); +impl ghost_sudo::WeightInfo for WeightInfo { + /// Storage: `Sudo::Key` (r:1 w:1) + /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn set_key() -> Weight { + // Proof Size summary in bytes: + // Measured: `165` + // Estimated: `1517` + // Minimum execution time: 9_486_000 picoseconds. + Weight::from_parts(9_663_000, 1517) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Sudo::Key` (r:1 w:0) + /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn sudo() -> Weight { + // Proof Size summary in bytes: + // Measured: `165` + // Estimated: `1517` + // Minimum execution time: 10_501_000 picoseconds. + Weight::from_parts(10_729_000, 1517) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + /// Storage: `Sudo::Key` (r:1 w:0) + /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn sudo_as() -> Weight { + // Proof Size summary in bytes: + // Measured: `165` + // Estimated: `1517` + // Minimum execution time: 10_742_000 picoseconds. + Weight::from_parts(11_003_000, 1517) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + /// Storage: `Sudo::Key` (r:1 w:1) + /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn remove_key() -> Weight { + // Proof Size summary in bytes: + // Measured: `165` + // Estimated: `1517` + // Minimum execution time: 8_837_000 picoseconds. + Weight::from_parts(9_127_000, 1517) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} diff --git a/runtime/casper/src/weights/mod.rs b/runtime/casper/src/weights/mod.rs index b45cf35..d5f0747 100644 --- a/runtime/casper/src/weights/mod.rs +++ b/runtime/casper/src/weights/mod.rs @@ -3,6 +3,7 @@ pub mod frame_system; pub mod ghost_claims; pub mod ghost_networks; pub mod ghost_slow_clap; +pub mod ghost_sudo; pub mod pallet_alliance; pub mod pallet_bags_list; pub mod pallet_balances;