diff --git a/operator/Cargo.lock b/operator/Cargo.lock index 394ad8e9..3705be6c 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -2982,6 +2982,7 @@ dependencies = [ "pallet-safe-mode", "pallet-scheduler", "pallet-session", + "pallet-session-benchmarking", "pallet-storage-providers", "pallet-storage-providers-runtime-api", "pallet-sudo", @@ -3269,6 +3270,7 @@ dependencies = [ "pallet-safe-mode", "pallet-scheduler", "pallet-session", + "pallet-session-benchmarking", "pallet-storage-providers", "pallet-storage-providers-runtime-api", "pallet-sudo", @@ -3417,6 +3419,7 @@ dependencies = [ "pallet-safe-mode", "pallet-scheduler", "pallet-session", + "pallet-session-benchmarking", "pallet-storage-providers", "pallet-storage-providers-runtime-api", "pallet-sudo", @@ -9887,6 +9890,7 @@ name = "pallet-randomness" version = "0.1.0" source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "log", @@ -9975,6 +9979,22 @@ dependencies = [ "sp-trie", ] +[[package]] +name = "pallet-session-benchmarking" +version = "39.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-session", + "pallet-staking", + "parity-scale-codec", + "rand 0.8.5", + "sp-runtime", + "sp-session", +] + [[package]] name = "pallet-staking" version = "39.1.0" diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 6502e423..17dfd655 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -137,6 +137,7 @@ pallet-referenda = { git = "https://github.com/paritytech/polkadot-sdk", tag = " pallet-safe-mode = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } +pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false } diff --git a/operator/runtime/mainnet/Cargo.toml b/operator/runtime/mainnet/Cargo.toml index 673394af..b65b736b 100644 --- a/operator/runtime/mainnet/Cargo.toml +++ b/operator/runtime/mainnet/Cargo.toml @@ -27,6 +27,7 @@ frame-metadata-hash-extension = { workspace = true } frame-support = { workspace = true, features = ["experimental"] } frame-system = { workspace = true } frame-system-benchmarking = { workspace = true, optional = true } +pallet-session-benchmarking = { workspace = true, optional = true } frame-system-rpc-runtime-api = { workspace = true } frame-try-runtime = { workspace = true, optional = true } hex = { workspace = true } @@ -188,6 +189,7 @@ std = [ "frame-metadata-hash-extension/std", "frame-support/std", "frame-system-benchmarking?/std", + "pallet-session-benchmarking?/std", "frame-system-rpc-runtime-api/std", "frame-system/std", "frame-try-runtime?/std", @@ -331,11 +333,13 @@ runtime-benchmarks = [ "pallet-referenda/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", + "pallet-session-benchmarking/runtime-benchmarks", "pallet-sudo/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-whitelist/runtime-benchmarks", + "pallet-randomness/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", "snowbridge-inbound-queue-primitives/runtime-benchmarks", diff --git a/operator/runtime/mainnet/src/benchmarks.rs b/operator/runtime/mainnet/src/benchmarks.rs index 1354295d..274a41b6 100644 --- a/operator/runtime/mainnet/src/benchmarks.rs +++ b/operator/runtime/mainnet/src/benchmarks.rs @@ -36,6 +36,9 @@ frame_benchmarking::define_benchmarks!( // Consensus pallets [pallet_mmr, Mmr] [pallet_beefy_mmr, BeefyMmrLeaf] + [pallet_babe, Babe] + [pallet_grandpa, Grandpa] + [pallet_randomness, Randomness] // Substrate pallets [pallet_balances, Balances] @@ -69,6 +72,7 @@ frame_benchmarking::define_benchmarks!( // DataHaven custom pallets [pallet_external_validators, ExternalValidators] [pallet_external_validators_rewards, ExternalValidatorsRewards] + [pallet_external_validator_slashes, ExternalValidatorsSlashes] [pallet_datahaven_native_transfer, DataHavenNativeTransfer] // Snowbridge pallets diff --git a/operator/runtime/mainnet/src/configs/mod.rs b/operator/runtime/mainnet/src/configs/mod.rs index 3f828e33..3ba0563b 100644 --- a/operator/runtime/mainnet/src/configs/mod.rs +++ b/operator/runtime/mainnet/src/configs/mod.rs @@ -323,7 +323,7 @@ impl pallet_babe::Config for Runtime { type ExpectedBlockTime = ExpectedBlockTime; type EpochChangeTrigger = pallet_babe::ExternalTrigger; type DisabledValidators = Session; - type WeightInfo = (); + type WeightInfo = mainnet_weights::pallet_babe::WeightInfo; type MaxAuthorities = MaxAuthorities; type MaxNominators = ConstU32<0>; @@ -407,7 +407,7 @@ impl pallet_session::Config for Runtime { type SessionManager = pallet_session::historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type WeightInfo = (); + type WeightInfo = pallet_session::weights::SubstrateWeight; } parameter_types! { @@ -436,7 +436,7 @@ parameter_types! { impl pallet_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = mainnet_weights::pallet_grandpa::WeightInfo; type MaxAuthorities = MaxAuthorities; type MaxNominators = ConstU32<0>; type MaxSetIdSessionEntries = MaxSetIdSessionEntries; @@ -645,7 +645,7 @@ impl pallet_identity::Config for Runtime { type PendingUsernameExpiration = PendingUsernameExpiration; type MaxSuffixLength = MaxSuffixLength; type MaxUsernameLength = MaxUsernameLength; - type WeightInfo = (); + type WeightInfo = pallet_identity::weights::SubstrateWeight; type UsernameDeposit = (); type UsernameGracePeriod = (); @@ -1633,7 +1633,7 @@ impl pallet_external_validator_slashes::Config for Runtime { type InvulnerablesProvider = ExternalValidators; type ExternalIndexProvider = ExternalValidators; type QueuedSlashesProcessedPerBlock = ConstU32<10>; - type WeightInfo = (); // TODO: calculate weights + type WeightInfo = mainnet_weights::pallet_external_validator_slashes::WeightInfo; type SendMessage = SlashesSendAdapter; } diff --git a/operator/runtime/mainnet/src/configs/storagehub/mod.rs b/operator/runtime/mainnet/src/configs/storagehub/mod.rs index 3c15214d..ff265f5d 100644 --- a/operator/runtime/mainnet/src/configs/storagehub/mod.rs +++ b/operator/runtime/mainnet/src/configs/storagehub/mod.rs @@ -105,7 +105,7 @@ impl pallet_randomness::Config for Runtime { type RuntimeEvent = RuntimeEvent; type BabeDataGetter = BabeDataGetter; type BabeBlockGetter = BlockNumberGetter; - type WeightInfo = (); + type WeightInfo = crate::weights::pallet_randomness::WeightInfo; type BabeDataGetterBlockNumber = BlockNumber; } diff --git a/operator/runtime/mainnet/src/weights/mod.rs b/operator/runtime/mainnet/src/weights/mod.rs index 434d2780..08fcf943 100644 --- a/operator/runtime/mainnet/src/weights/mod.rs +++ b/operator/runtime/mainnet/src/weights/mod.rs @@ -19,6 +19,7 @@ // DataHaven pallets pub mod pallet_datahaven_native_transfer; +pub mod pallet_external_validator_slashes; pub mod pallet_external_validators; pub mod pallet_external_validators_rewards; @@ -31,9 +32,11 @@ pub mod snowbridge_pallet_system_v2; // Substrate pallets pub mod frame_system; +pub mod pallet_babe; pub mod pallet_balances; pub mod pallet_beefy_mmr; pub mod pallet_evm; +pub mod pallet_grandpa; pub mod pallet_im_online; pub mod pallet_message_queue; pub mod pallet_migrations; @@ -42,6 +45,7 @@ pub mod pallet_multisig; pub mod pallet_parameters; pub mod pallet_preimage; pub mod pallet_proxy; +pub mod pallet_randomness; pub mod pallet_safe_mode; pub mod pallet_scheduler; pub mod pallet_sudo; diff --git a/operator/runtime/mainnet/src/weights/pallet_babe.rs b/operator/runtime/mainnet/src/weights/pallet_babe.rs new file mode 100644 index 00000000..8d022002 --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_babe.rs @@ -0,0 +1,50 @@ + + +//! Autogenerated weights for `pallet_babe` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_babe +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_babe.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_babe`. +pub struct WeightInfo(PhantomData); +impl pallet_babe::WeightInfo for WeightInfo { + fn plan_config_change() -> Weight { + // Placeholder constant; re-benchmark to refresh. + Weight::from_parts(5_000_000, 0) + } + + fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight { + // Based on previous check_equivocation_proof baseline; re-benchmark to refresh. + Weight::from_parts(89_672_355, 0) + } +} diff --git a/operator/runtime/mainnet/src/weights/pallet_external_validator_slashes.rs b/operator/runtime/mainnet/src/weights/pallet_external_validator_slashes.rs new file mode 100644 index 00000000..964a0ae0 --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_external_validator_slashes.rs @@ -0,0 +1,115 @@ + + +//! Autogenerated weights for `pallet_external_validator_slashes` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_external_validator_slashes +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_external_validator_slashes.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_external_validator_slashes`. +pub struct WeightInfo(PhantomData); +impl pallet_external_validator_slashes::weights::WeightInfo for WeightInfo { + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `s` is `[1, 1000]`. + fn cancel_deferred_slash(_s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `38528` + // Estimated: `41993` + // Minimum execution time: 76_582_000 picoseconds. + Weight::from_parts(1_422_088_660, 41993) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidators::ErasStartSessionIndex` (r:1 w:0) + /// Proof: `ExternalValidators::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::NextSlashId` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::NextSlashId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::ValidatorSlashInEra` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn force_inject_slash() -> Weight { + // Proof Size summary in bytes: + // Measured: `492` + // Estimated: `3957` + // Minimum execution time: 28_199_000 picoseconds. + Weight::from_parts(28_842_000, 3957) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Parameters::Parameters` (r:2 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:0 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32845), added: 35320, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 200]`. + fn process_slashes_queue(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `541 + s * (38 ±0)` + // Estimated: `6044 + s * (38 ±0)` + // Minimum execution time: 50_142_000 picoseconds. + Weight::from_parts(52_116_022, 6044) + // Standard Error: 857 + .saturating_add(Weight::from_parts(45_899, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 38).saturating_mul(s.into())) + } + /// Storage: `ExternalValidatorsSlashes::SlashingMode` (r:0 w:1) + /// Proof: `ExternalValidatorsSlashes::SlashingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn set_slashing_mode() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_864_000 picoseconds. + Weight::from_parts(4_014_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + + fn root_test_send_msg_to_eth() -> Weight { + Weight::from_parts(1_015_195_000, 3601) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/operator/runtime/mainnet/src/weights/pallet_grandpa.rs b/operator/runtime/mainnet/src/weights/pallet_grandpa.rs new file mode 100644 index 00000000..415ab91e --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_grandpa.rs @@ -0,0 +1,56 @@ + + +//! Autogenerated weights for `pallet_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_grandpa +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_grandpa.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_grandpa::WeightInfo for WeightInfo { + /// Storage: `Grandpa::Stalled` (r:0 w:1) + /// Proof: `Grandpa::Stalled` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn note_stalled() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_687_000 picoseconds. + Weight::from_parts(3_903_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + + fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight { + // Based on previous check_equivocation_proof baseline; re-benchmark to refresh. + Weight::from_parts(79_601_142, 0) + } +} diff --git a/operator/runtime/mainnet/src/weights/pallet_randomness.rs b/operator/runtime/mainnet/src/weights/pallet_randomness.rs new file mode 100644 index 00000000..5f7fffcd --- /dev/null +++ b/operator/runtime/mainnet/src/weights/pallet_randomness.rs @@ -0,0 +1,77 @@ + + +//! Autogenerated weights for `pallet_randomness` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm +// --pallet +// pallet_randomness +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/mainnet/src/weights/pallet_randomness.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_randomness`. +pub struct WeightInfo(PhantomData); +impl pallet_randomness::weights::WeightInfo for WeightInfo { + /// Storage: `Babe::AuthorVrfRandomness` (r:1 w:0) + /// Proof: `Babe::AuthorVrfRandomness` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `Randomness::RelayEpoch` (r:1 w:1) + /// Proof: `Randomness::RelayEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Babe::NextRandomness` (r:1 w:0) + /// Proof: `Babe::NextRandomness` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: `Babe::EpochStart` (r:1 w:0) + /// Proof: `Babe::EpochStart` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (r:1 w:1) + /// Proof: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:0 w:1) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestParentBlockRandomness` (r:0 w:1) + /// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Randomness::InherentIncluded` (r:0 w:1) + /// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn set_babe_randomness() -> Weight { + // Proof Size summary in bytes: + // Measured: `348` + // Estimated: `1518` + // Minimum execution time: 26_171_000 picoseconds. + Weight::from_parts(27_041_000, 1518) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Randomness::InherentIncluded` (r:1 w:1) + /// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn on_finalize_hook() -> Weight { + // Proof Size summary in bytes: + // Measured: `99` + // Estimated: `1485` + // Minimum execution time: 5_396_000 picoseconds. + Weight::from_parts(5_596_000, 1485) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} diff --git a/operator/runtime/stagenet/Cargo.toml b/operator/runtime/stagenet/Cargo.toml index cd5b96ab..9e31449c 100644 --- a/operator/runtime/stagenet/Cargo.toml +++ b/operator/runtime/stagenet/Cargo.toml @@ -27,6 +27,7 @@ frame-metadata-hash-extension = { workspace = true } frame-support = { workspace = true, features = ["experimental"] } frame-system = { workspace = true } frame-system-benchmarking = { workspace = true, optional = true } +pallet-session-benchmarking = { workspace = true, optional = true } frame-system-rpc-runtime-api = { workspace = true } frame-try-runtime = { workspace = true, optional = true } hex = { workspace = true } @@ -188,6 +189,7 @@ std = [ "frame-metadata-hash-extension/std", "frame-support/std", "frame-system-benchmarking?/std", + "pallet-session-benchmarking?/std", "frame-system-rpc-runtime-api/std", "frame-system/std", "frame-try-runtime?/std", @@ -328,9 +330,11 @@ runtime-benchmarks = [ "pallet-preimage/runtime-benchmarks", "pallet-safe-mode/runtime-benchmarks", "pallet-tx-pause/runtime-benchmarks", + "pallet-randomness/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", + "pallet-session-benchmarking/runtime-benchmarks", "pallet-sudo/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", diff --git a/operator/runtime/stagenet/src/benchmarks.rs b/operator/runtime/stagenet/src/benchmarks.rs index 6944df0f..aaa16218 100644 --- a/operator/runtime/stagenet/src/benchmarks.rs +++ b/operator/runtime/stagenet/src/benchmarks.rs @@ -36,6 +36,9 @@ frame_benchmarking::define_benchmarks!( // Consensus pallets [pallet_mmr, Mmr] [pallet_beefy_mmr, BeefyMmrLeaf] + [pallet_babe, Babe] + [pallet_grandpa, Grandpa] + [pallet_randomness, Randomness] // Substrate pallets [pallet_balances, Balances] @@ -69,6 +72,7 @@ frame_benchmarking::define_benchmarks!( // DataHaven custom pallets [pallet_external_validators, ExternalValidators] [pallet_external_validators_rewards, ExternalValidatorsRewards] + [pallet_external_validator_slashes, ExternalValidatorsSlashes] [pallet_datahaven_native_transfer, DataHavenNativeTransfer] // Snowbridge pallets diff --git a/operator/runtime/stagenet/src/configs/mod.rs b/operator/runtime/stagenet/src/configs/mod.rs index 9ab30486..c0281aef 100644 --- a/operator/runtime/stagenet/src/configs/mod.rs +++ b/operator/runtime/stagenet/src/configs/mod.rs @@ -323,7 +323,7 @@ impl pallet_babe::Config for Runtime { type ExpectedBlockTime = ExpectedBlockTime; type EpochChangeTrigger = pallet_babe::ExternalTrigger; type DisabledValidators = Session; - type WeightInfo = (); + type WeightInfo = stagenet_weights::pallet_babe::WeightInfo; type MaxAuthorities = MaxAuthorities; type MaxNominators = ConstU32<0>; @@ -406,7 +406,7 @@ impl pallet_session::Config for Runtime { type SessionManager = pallet_session::historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type WeightInfo = (); + type WeightInfo = pallet_session::weights::SubstrateWeight; } parameter_types! { @@ -435,7 +435,7 @@ parameter_types! { impl pallet_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = stagenet_weights::pallet_grandpa::WeightInfo; type MaxAuthorities = MaxAuthorities; type MaxNominators = ConstU32<0>; type MaxSetIdSessionEntries = MaxSetIdSessionEntries; @@ -642,7 +642,7 @@ impl pallet_identity::Config for Runtime { type PendingUsernameExpiration = PendingUsernameExpiration; type MaxSuffixLength = MaxSuffixLength; type MaxUsernameLength = MaxUsernameLength; - type WeightInfo = (); + type WeightInfo = pallet_identity::weights::SubstrateWeight; type UsernameDeposit = (); type UsernameGracePeriod = (); @@ -1632,7 +1632,7 @@ impl pallet_external_validator_slashes::Config for Runtime { type InvulnerablesProvider = ExternalValidators; type ExternalIndexProvider = ExternalValidators; type QueuedSlashesProcessedPerBlock = ConstU32<10>; - type WeightInfo = (); // TODO: calculate weights + type WeightInfo = stagenet_weights::pallet_external_validator_slashes::WeightInfo; type SendMessage = SlashesSendAdapter; } diff --git a/operator/runtime/stagenet/src/configs/storagehub/mod.rs b/operator/runtime/stagenet/src/configs/storagehub/mod.rs index 3c15214d..ff265f5d 100644 --- a/operator/runtime/stagenet/src/configs/storagehub/mod.rs +++ b/operator/runtime/stagenet/src/configs/storagehub/mod.rs @@ -105,7 +105,7 @@ impl pallet_randomness::Config for Runtime { type RuntimeEvent = RuntimeEvent; type BabeDataGetter = BabeDataGetter; type BabeBlockGetter = BlockNumberGetter; - type WeightInfo = (); + type WeightInfo = crate::weights::pallet_randomness::WeightInfo; type BabeDataGetterBlockNumber = BlockNumber; } diff --git a/operator/runtime/stagenet/src/weights/mod.rs b/operator/runtime/stagenet/src/weights/mod.rs index a836acce..65c7cce2 100644 --- a/operator/runtime/stagenet/src/weights/mod.rs +++ b/operator/runtime/stagenet/src/weights/mod.rs @@ -19,6 +19,7 @@ // DataHaven pallets pub mod pallet_datahaven_native_transfer; +pub mod pallet_external_validator_slashes; pub mod pallet_external_validators; pub mod pallet_external_validators_rewards; @@ -31,9 +32,12 @@ pub mod snowbridge_pallet_system_v2; // Substrate pallets pub mod frame_system; +pub mod pallet_babe; pub mod pallet_balances; pub mod pallet_beefy_mmr; pub mod pallet_evm; +pub mod pallet_grandpa; +pub mod pallet_randomness; // pub mod pallet_identity; pub mod pallet_im_online; pub mod pallet_message_queue; diff --git a/operator/runtime/stagenet/src/weights/pallet_babe.rs b/operator/runtime/stagenet/src/weights/pallet_babe.rs new file mode 100644 index 00000000..edbc3aa8 --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_babe.rs @@ -0,0 +1,48 @@ + + +//! Autogenerated weights for `pallet_babe` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_babe +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_babe.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_babe`. +pub struct WeightInfo(PhantomData); +impl pallet_babe::WeightInfo for WeightInfo { + fn plan_config_change() -> Weight { + Weight::from_parts(5_000_000, 0) + } + + fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight { + Weight::from_parts(89_669_734, 0) + } +} diff --git a/operator/runtime/stagenet/src/weights/pallet_external_validator_slashes.rs b/operator/runtime/stagenet/src/weights/pallet_external_validator_slashes.rs new file mode 100644 index 00000000..4c4b5139 --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_external_validator_slashes.rs @@ -0,0 +1,115 @@ + + +//! Autogenerated weights for `pallet_external_validator_slashes` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_external_validator_slashes +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_external_validator_slashes.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_external_validator_slashes`. +pub struct WeightInfo(PhantomData); +impl pallet_external_validator_slashes::WeightInfo for WeightInfo { + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `s` is `[1, 1000]`. + fn cancel_deferred_slash(_s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `38528` + // Estimated: `41993` + // Minimum execution time: 77_237_000 picoseconds. + Weight::from_parts(1_417_731_577, 41993) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidators::ErasStartSessionIndex` (r:1 w:0) + /// Proof: `ExternalValidators::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::NextSlashId` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::NextSlashId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::ValidatorSlashInEra` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn force_inject_slash() -> Weight { + // Proof Size summary in bytes: + // Measured: `492` + // Estimated: `3957` + // Minimum execution time: 27_206_000 picoseconds. + Weight::from_parts(27_858_000, 3957) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Parameters::Parameters` (r:2 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:0 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32845), added: 35320, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 200]`. + fn process_slashes_queue(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `541 + s * (38 ±0)` + // Estimated: `6044 + s * (38 ±0)` + // Minimum execution time: 49_346_000 picoseconds. + Weight::from_parts(51_048_900, 6044) + // Standard Error: 836 + .saturating_add(Weight::from_parts(47_676, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 38).saturating_mul(s.into())) + } + /// Storage: `ExternalValidatorsSlashes::SlashingMode` (r:0 w:1) + /// Proof: `ExternalValidatorsSlashes::SlashingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn set_slashing_mode() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_654_000 picoseconds. + Weight::from_parts(3_892_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + + fn root_test_send_msg_to_eth() -> Weight { + Weight::from_parts(1_015_195_000, 3601) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/operator/runtime/stagenet/src/weights/pallet_grandpa.rs b/operator/runtime/stagenet/src/weights/pallet_grandpa.rs new file mode 100644 index 00000000..212e1d18 --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_grandpa.rs @@ -0,0 +1,55 @@ + + +//! Autogenerated weights for `pallet_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_grandpa +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_grandpa.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_grandpa::WeightInfo for WeightInfo { + /// Storage: `Grandpa::Stalled` (r:0 w:1) + /// Proof: `Grandpa::Stalled` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn note_stalled() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_681_000 picoseconds. + Weight::from_parts(3_933_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + + fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight { + Weight::from_parts(79_233_438, 0) + } +} diff --git a/operator/runtime/stagenet/src/weights/pallet_randomness.rs b/operator/runtime/stagenet/src/weights/pallet_randomness.rs new file mode 100644 index 00000000..477df36c --- /dev/null +++ b/operator/runtime/stagenet/src/weights/pallet_randomness.rs @@ -0,0 +1,77 @@ + + +//! Autogenerated weights for `pallet_randomness` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm +// --pallet +// pallet_randomness +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/stagenet/src/weights/pallet_randomness.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_randomness`. +pub struct WeightInfo(PhantomData); +impl pallet_randomness::weights::WeightInfo for WeightInfo { + /// Storage: `Babe::AuthorVrfRandomness` (r:1 w:0) + /// Proof: `Babe::AuthorVrfRandomness` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `Randomness::RelayEpoch` (r:1 w:1) + /// Proof: `Randomness::RelayEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Babe::NextRandomness` (r:1 w:0) + /// Proof: `Babe::NextRandomness` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: `Babe::EpochStart` (r:1 w:0) + /// Proof: `Babe::EpochStart` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (r:1 w:1) + /// Proof: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:0 w:1) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestParentBlockRandomness` (r:0 w:1) + /// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Randomness::InherentIncluded` (r:0 w:1) + /// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn set_babe_randomness() -> Weight { + // Proof Size summary in bytes: + // Measured: `348` + // Estimated: `1518` + // Minimum execution time: 26_032_000 picoseconds. + Weight::from_parts(26_849_000, 1518) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Randomness::InherentIncluded` (r:1 w:1) + /// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn on_finalize_hook() -> Weight { + // Proof Size summary in bytes: + // Measured: `99` + // Estimated: `1485` + // Minimum execution time: 5_285_000 picoseconds. + Weight::from_parts(5_600_000, 1485) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} diff --git a/operator/runtime/testnet/Cargo.toml b/operator/runtime/testnet/Cargo.toml index 1d955dc9..f88dbd1b 100644 --- a/operator/runtime/testnet/Cargo.toml +++ b/operator/runtime/testnet/Cargo.toml @@ -27,6 +27,7 @@ frame-metadata-hash-extension = { workspace = true } frame-support = { workspace = true, features = ["experimental"] } frame-system = { workspace = true } frame-system-benchmarking = { workspace = true, optional = true } +pallet-session-benchmarking = { workspace = true, optional = true } frame-system-rpc-runtime-api = { workspace = true } frame-try-runtime = { workspace = true, optional = true } hex = { workspace = true } @@ -188,6 +189,7 @@ std = [ "frame-metadata-hash-extension/std", "frame-support/std", "frame-system-benchmarking?/std", + "pallet-session-benchmarking?/std", "frame-system-rpc-runtime-api/std", "frame-system/std", "frame-try-runtime?/std", @@ -321,12 +323,14 @@ runtime-benchmarks = [ "pallet-multisig/runtime-benchmarks", "pallet-offences/runtime-benchmarks", "pallet-parameters/runtime-benchmarks", + "pallet-randomness/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-safe-mode/runtime-benchmarks", "pallet-tx-pause/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", + "pallet-session-benchmarking/runtime-benchmarks", "pallet-sudo/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", diff --git a/operator/runtime/testnet/src/benchmarks.rs b/operator/runtime/testnet/src/benchmarks.rs index e6ec2c3d..3d0e6d55 100644 --- a/operator/runtime/testnet/src/benchmarks.rs +++ b/operator/runtime/testnet/src/benchmarks.rs @@ -28,6 +28,7 @@ use pallet_collective as pallet_collective_treasury_council; #[allow(unused_imports)] use pallet_collective as pallet_collective_technical_committee; +use pallet_external_validator_slashes as pallet_external_validators_slashes; frame_benchmarking::define_benchmarks!( // System benchmarks @@ -36,6 +37,9 @@ frame_benchmarking::define_benchmarks!( // Consensus pallets [pallet_mmr, Mmr] [pallet_beefy_mmr, BeefyMmrLeaf] + [pallet_babe, Babe] + [pallet_grandpa, Grandpa] + [pallet_randomness, Randomness] // Substrate pallets [pallet_balances, Balances] @@ -68,6 +72,7 @@ frame_benchmarking::define_benchmarks!( // DataHaven custom pallets [pallet_external_validators, ExternalValidators] [pallet_external_validators_rewards, ExternalValidatorsRewards] + [pallet_external_validator_slashes, ExternalValidatorsSlashes] [pallet_datahaven_native_transfer, DataHavenNativeTransfer] // Snowbridge pallets diff --git a/operator/runtime/testnet/src/configs/mod.rs b/operator/runtime/testnet/src/configs/mod.rs index 5915e31f..7850619f 100644 --- a/operator/runtime/testnet/src/configs/mod.rs +++ b/operator/runtime/testnet/src/configs/mod.rs @@ -323,7 +323,7 @@ impl pallet_babe::Config for Runtime { type ExpectedBlockTime = ExpectedBlockTime; type EpochChangeTrigger = pallet_babe::ExternalTrigger; type DisabledValidators = Session; - type WeightInfo = (); + type WeightInfo = testnet_weights::pallet_babe::WeightInfo; type MaxAuthorities = MaxAuthorities; type MaxNominators = ConstU32<0>; @@ -435,7 +435,7 @@ parameter_types! { impl pallet_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = testnet_weights::pallet_grandpa::WeightInfo; type MaxAuthorities = MaxAuthorities; type MaxNominators = ConstU32<0>; type MaxSetIdSessionEntries = MaxSetIdSessionEntries; @@ -645,7 +645,7 @@ impl pallet_identity::Config for Runtime { type PendingUsernameExpiration = PendingUsernameExpiration; type MaxSuffixLength = MaxSuffixLength; type MaxUsernameLength = MaxUsernameLength; - type WeightInfo = (); + type WeightInfo = pallet_identity::weights::SubstrateWeight; type UsernameDeposit = (); type UsernameGracePeriod = (); @@ -1633,7 +1633,7 @@ impl pallet_external_validator_slashes::Config for Runtime { type InvulnerablesProvider = ExternalValidators; type ExternalIndexProvider = ExternalValidators; type QueuedSlashesProcessedPerBlock = ConstU32<10>; - type WeightInfo = (); // TODO: calculate weights + type WeightInfo = testnet_weights::pallet_external_validator_slashes::WeightInfo; type SendMessage = SlashesSendAdapter; } diff --git a/operator/runtime/testnet/src/configs/storagehub/mod.rs b/operator/runtime/testnet/src/configs/storagehub/mod.rs index 3c15214d..ff265f5d 100644 --- a/operator/runtime/testnet/src/configs/storagehub/mod.rs +++ b/operator/runtime/testnet/src/configs/storagehub/mod.rs @@ -105,7 +105,7 @@ impl pallet_randomness::Config for Runtime { type RuntimeEvent = RuntimeEvent; type BabeDataGetter = BabeDataGetter; type BabeBlockGetter = BlockNumberGetter; - type WeightInfo = (); + type WeightInfo = crate::weights::pallet_randomness::WeightInfo; type BabeDataGetterBlockNumber = BlockNumber; } diff --git a/operator/runtime/testnet/src/weights/mod.rs b/operator/runtime/testnet/src/weights/mod.rs index 825aabed..042d203d 100644 --- a/operator/runtime/testnet/src/weights/mod.rs +++ b/operator/runtime/testnet/src/weights/mod.rs @@ -19,6 +19,7 @@ // DataHaven pallets pub mod pallet_datahaven_native_transfer; +pub mod pallet_external_validator_slashes; pub mod pallet_external_validators; pub mod pallet_external_validators_rewards; @@ -31,9 +32,12 @@ pub mod snowbridge_pallet_system_v2; // Substrate pallets pub mod frame_system; +pub mod pallet_babe; pub mod pallet_balances; pub mod pallet_beefy_mmr; pub mod pallet_evm; +pub mod pallet_grandpa; +pub mod pallet_randomness; //pub mod pallet_identity; pub mod pallet_im_online; pub mod pallet_message_queue; diff --git a/operator/runtime/testnet/src/weights/pallet_babe.rs b/operator/runtime/testnet/src/weights/pallet_babe.rs new file mode 100644 index 00000000..bbd5ec48 --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_babe.rs @@ -0,0 +1,48 @@ + + +//! Autogenerated weights for `pallet_babe` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_babe +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_babe.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_babe`. +pub struct WeightInfo(PhantomData); +impl pallet_babe::WeightInfo for WeightInfo { + fn plan_config_change() -> Weight { + Weight::from_parts(5_000_000, 0) + } + + fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight { + Weight::from_parts(89_841_267, 0) + } +} diff --git a/operator/runtime/testnet/src/weights/pallet_external_validator_slashes.rs b/operator/runtime/testnet/src/weights/pallet_external_validator_slashes.rs new file mode 100644 index 00000000..ae8c13e4 --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_external_validator_slashes.rs @@ -0,0 +1,115 @@ + + +//! Autogenerated weights for `pallet_external_validator_slashes` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_external_validator_slashes +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_external_validator_slashes.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_external_validator_slashes`. +pub struct WeightInfo(PhantomData); +impl pallet_external_validator_slashes::weights::WeightInfo for WeightInfo { + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `s` is `[1, 1000]`. + fn cancel_deferred_slash(_s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `38528` + // Estimated: `41993` + // Minimum execution time: 77_069_000 picoseconds. + Weight::from_parts(1_419_406_561, 41993) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidators::ErasStartSessionIndex` (r:1 w:0) + /// Proof: `ExternalValidators::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::NextSlashId` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::NextSlashId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::ValidatorSlashInEra` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn force_inject_slash() -> Weight { + // Proof Size summary in bytes: + // Measured: `492` + // Estimated: `3957` + // Minimum execution time: 27_830_000 picoseconds. + Weight::from_parts(28_371_000, 3957) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `ExternalValidators::ActiveEra` (r:1 w:0) + /// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (r:1 w:1) + /// Proof: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Parameters::Parameters` (r:2 w:0) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:0 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32845), added: 35320, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 200]`. + fn process_slashes_queue(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `541 + s * (38 ±0)` + // Estimated: `6044 + s * (38 ±0)` + // Minimum execution time: 49_704_000 picoseconds. + Weight::from_parts(51_458_451, 6044) + // Standard Error: 674 + .saturating_add(Weight::from_parts(45_427, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 38).saturating_mul(s.into())) + } + /// Storage: `ExternalValidatorsSlashes::SlashingMode` (r:0 w:1) + /// Proof: `ExternalValidatorsSlashes::SlashingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn set_slashing_mode() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_748_000 picoseconds. + Weight::from_parts(3_946_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + + fn root_test_send_msg_to_eth() -> Weight { + Weight::from_parts(1_015_195_000, 3601) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/operator/runtime/testnet/src/weights/pallet_grandpa.rs b/operator/runtime/testnet/src/weights/pallet_grandpa.rs new file mode 100644 index 00000000..58d4299d --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_grandpa.rs @@ -0,0 +1,55 @@ + + +//! Autogenerated weights for `pallet_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_grandpa +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_grandpa.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_grandpa::WeightInfo for WeightInfo { + /// Storage: `Grandpa::Stalled` (r:0 w:1) + /// Proof: `Grandpa::Stalled` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn note_stalled() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_827_000 picoseconds. + Weight::from_parts(3_954_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + + fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight { + Weight::from_parts(79_198_467, 0) + } +} diff --git a/operator/runtime/testnet/src/weights/pallet_randomness.rs b/operator/runtime/testnet/src/weights/pallet_randomness.rs new file mode 100644 index 00000000..c206ef94 --- /dev/null +++ b/operator/runtime/testnet/src/weights/pallet_randomness.rs @@ -0,0 +1,77 @@ + + +//! Autogenerated weights for `pallet_randomness` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0 +//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm +// --pallet +// pallet_randomness +// --extrinsic +// +// --template +// benchmarking/frame-weight-template.hbs +// --output +// runtime/testnet/src/weights/pallet_randomness.rs +// --steps +// 50 +// --repeat +// 20 + +#![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; + +/// Weights for `pallet_randomness`. +pub struct WeightInfo(PhantomData); +impl pallet_randomness::weights::WeightInfo for WeightInfo { + /// Storage: `Babe::AuthorVrfRandomness` (r:1 w:0) + /// Proof: `Babe::AuthorVrfRandomness` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `Randomness::RelayEpoch` (r:1 w:1) + /// Proof: `Randomness::RelayEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Babe::NextRandomness` (r:1 w:0) + /// Proof: `Babe::NextRandomness` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: `Babe::EpochStart` (r:1 w:0) + /// Proof: `Babe::EpochStart` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (r:1 w:1) + /// Proof: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:0 w:1) + /// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Randomness::LatestParentBlockRandomness` (r:0 w:1) + /// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`) + /// Storage: `Randomness::InherentIncluded` (r:0 w:1) + /// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn set_babe_randomness() -> Weight { + // Proof Size summary in bytes: + // Measured: `348` + // Estimated: `1518` + // Minimum execution time: 25_653_000 picoseconds. + Weight::from_parts(26_835_000, 1518) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: `Randomness::InherentIncluded` (r:1 w:1) + /// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + fn on_finalize_hook() -> Weight { + // Proof Size summary in bytes: + // Measured: `99` + // Estimated: `1485` + // Minimum execution time: 5_406_000 picoseconds. + Weight::from_parts(5_749_000, 1485) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +}