diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index 2d50a17c3f1c..95709117578d 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -121,7 +121,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("coretime-rococo"), impl_name: create_runtime_str!("coretime-rococo"), authoring_version: 1, - spec_version: 1_005_003, + spec_version: 1_005_004, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 0, diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_broker.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_broker.rs index 3cc51a247f7b..665b84e32ccc 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_broker.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_broker.rs @@ -17,22 +17,23 @@ //! Autogenerated weights for `pallet_broker` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-07, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `dagda.local`, CPU: `` +//! HOSTNAME: `runner-q7z7ruxr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-rococo-dev")`, DB CACHE: 1024 // Executed Command: -// target/release/polkadot-parachain +// target/production/polkadot-parachain // benchmark // pallet -// --chain=coretime-rococo-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json // --pallet=pallet_broker -// --extrinsic=* -// --steps=2 -// --repeat=1 -// --json +// --chain=coretime-rococo-dev // --header=./cumulus/file_header.txt // --output=./cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/ @@ -53,71 +54,77 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(4_000_000, 0) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(2_504_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Broker::Reservations` (r:1 w:1) - /// Proof: `Broker::Reservations` (`max_values`: Some(1), `max_size`: Some(6011), added: 6506, mode: `MaxEncodedLen`) + /// Proof: `Broker::Reservations` (`max_values`: Some(1), `max_size`: Some(12021), added: 12516, mode: `MaxEncodedLen`) fn reserve() -> Weight { // Proof Size summary in bytes: - // Measured: `4878` - // Estimated: `7496` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(31_000_000, 0) - .saturating_add(Weight::from_parts(0, 7496)) + // Measured: `10888` + // Estimated: `13506` + // Minimum execution time: 22_025_000 picoseconds. + Weight::from_parts(22_799_000, 0) + .saturating_add(Weight::from_parts(0, 13506)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Broker::Reservations` (r:1 w:1) - /// Proof: `Broker::Reservations` (`max_values`: Some(1), `max_size`: Some(6011), added: 6506, mode: `MaxEncodedLen`) + /// Proof: `Broker::Reservations` (`max_values`: Some(1), `max_size`: Some(12021), added: 12516, mode: `MaxEncodedLen`) fn unreserve() -> Weight { // Proof Size summary in bytes: - // Measured: `6080` - // Estimated: `7496` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(24_000_000, 0) - .saturating_add(Weight::from_parts(0, 7496)) + // Measured: `12090` + // Estimated: `13506` + // Minimum execution time: 21_012_000 picoseconds. + Weight::from_parts(21_567_000, 0) + .saturating_add(Weight::from_parts(0, 13506)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Broker::Leases` (r:1 w:1) - /// Proof: `Broker::Leases` (`max_values`: Some(1), `max_size`: Some(41), added: 536, mode: `MaxEncodedLen`) + /// Proof: `Broker::Leases` (`max_values`: Some(1), `max_size`: Some(401), added: 896, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_lease() -> Weight { // Proof Size summary in bytes: - // Measured: `101` - // Estimated: `1526` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) - .saturating_add(Weight::from_parts(0, 1526)) - .saturating_add(T::DbWeight::get().reads(1)) + // Measured: `466` + // Estimated: `1951` + // Minimum execution time: 10_767_000 picoseconds. + Weight::from_parts(11_364_000, 0) + .saturating_add(Weight::from_parts(0, 1951)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Broker::Configuration` (r:1 w:0) /// Proof: `Broker::Configuration` (`max_values`: Some(1), `max_size`: Some(31), added: 526, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Broker::InstaPoolIo` (r:3 w:3) /// Proof: `Broker::InstaPoolIo` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) /// Storage: `Broker::Reservations` (r:1 w:0) - /// Proof: `Broker::Reservations` (`max_values`: Some(1), `max_size`: Some(6011), added: 6506, mode: `MaxEncodedLen`) + /// Proof: `Broker::Reservations` (`max_values`: Some(1), `max_size`: Some(12021), added: 12516, mode: `MaxEncodedLen`) /// Storage: `Broker::Leases` (r:1 w:1) - /// Proof: `Broker::Leases` (`max_values`: Some(1), `max_size`: Some(41), added: 536, mode: `MaxEncodedLen`) + /// Proof: `Broker::Leases` (`max_values`: Some(1), `max_size`: Some(401), added: 896, mode: `MaxEncodedLen`) /// Storage: `Broker::SaleInfo` (r:0 w:1) /// Proof: `Broker::SaleInfo` (`max_values`: Some(1), `max_size`: Some(57), added: 552, mode: `MaxEncodedLen`) /// Storage: `Broker::Status` (r:0 w:1) /// Proof: `Broker::Status` (`max_values`: Some(1), `max_size`: Some(18), added: 513, mode: `MaxEncodedLen`) - /// Storage: `Broker::Workplan` (r:0 w:10) + /// Storage: `Broker::Workplan` (r:0 w:60) /// Proof: `Broker::Workplan` (`max_values`: None, `max_size`: Some(1216), added: 3691, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 1000]`. - fn start_sales(_n: u32, ) -> Weight { + fn start_sales(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `6192` - // Estimated: `8499` - // Minimum execution time: 55_000_000 picoseconds. - Weight::from_parts(57_000_000, 0) - .saturating_add(Weight::from_parts(0, 8499)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(16)) + // Measured: `12567` + // Estimated: `14052` + // Minimum execution time: 112_187_000 picoseconds. + Weight::from_parts(115_233_014, 0) + .saturating_add(Weight::from_parts(0, 14052)) + // Standard Error: 162 + .saturating_add(Weight::from_parts(539, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(66)) } /// Storage: `Broker::Status` (r:1 w:0) /// Proof: `Broker::Status` (`max_values`: Some(1), `max_size`: Some(18), added: 513, mode: `MaxEncodedLen`) @@ -131,8 +138,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `316` // Estimated: `3593` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(40_000_000, 0) + // Minimum execution time: 32_469_000 picoseconds. + Weight::from_parts(33_443_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -153,8 +160,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `434` // Estimated: `4698` - // Minimum execution time: 58_000_000 picoseconds. - Weight::from_parts(58_000_000, 0) + // Minimum execution time: 59_488_000 picoseconds. + Weight::from_parts(64_711_000, 0) .saturating_add(Weight::from_parts(0, 4698)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -165,8 +172,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `357` // Estimated: `3550` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + // Minimum execution time: 13_370_000 picoseconds. + Weight::from_parts(13_938_000, 0) .saturating_add(Weight::from_parts(0, 3550)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -177,8 +184,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `357` // Estimated: `3550` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + // Minimum execution time: 14_592_000 picoseconds. + Weight::from_parts(15_235_000, 0) .saturating_add(Weight::from_parts(0, 3550)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -189,8 +196,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `357` // Estimated: `3550` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + // Minimum execution time: 14_880_000 picoseconds. + Weight::from_parts(15_274_000, 0) .saturating_add(Weight::from_parts(0, 3550)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -205,10 +212,10 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Proof: `Broker::Workplan` (`max_values`: None, `max_size`: Some(1216), added: 3691, mode: `MaxEncodedLen`) fn assign() -> Weight { // Proof Size summary in bytes: - // Measured: `602` + // Measured: `936` // Estimated: `4681` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + // Minimum execution time: 24_786_000 picoseconds. + Weight::from_parts(26_047_000, 0) .saturating_add(Weight::from_parts(0, 4681)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -225,10 +232,10 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Proof: `Broker::InstaPoolContribution` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn pool() -> Weight { // Proof Size summary in bytes: - // Measured: `637` + // Measured: `1002` // Estimated: `5996` - // Minimum execution time: 38_000_000 picoseconds. - Weight::from_parts(38_000_000, 0) + // Minimum execution time: 31_159_000 picoseconds. + Weight::from_parts(31_770_000, 0) .saturating_add(Weight::from_parts(0, 5996)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -240,15 +247,19 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `m` is `[1, 3]`. - fn claim_revenue(_m: u32, ) -> Weight { + fn claim_revenue(m: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `721` - // Estimated: `8550` - // Minimum execution time: 65_000_000 picoseconds. - Weight::from_parts(67_000_000, 0) - .saturating_add(Weight::from_parts(0, 8550)) - .saturating_add(T::DbWeight::get().reads(6)) + // Measured: `652` + // Estimated: `6196 + m * (2520 ±0)` + // Minimum execution time: 56_524_000 picoseconds. + Weight::from_parts(58_065_019, 0) + .saturating_add(Weight::from_parts(0, 6196)) + // Standard Error: 41_840 + .saturating_add(Weight::from_parts(1_322_201, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(m.into())) } /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) @@ -264,11 +275,11 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn purchase_credit() -> Weight { // Proof Size summary in bytes: - // Measured: `284` - // Estimated: `3749` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(64_000_000, 0) - .saturating_add(Weight::from_parts(0, 3749)) + // Measured: `215` + // Estimated: `3680` + // Minimum execution time: 60_923_000 picoseconds. + Weight::from_parts(62_721_000, 0) + .saturating_add(Weight::from_parts(0, 3680)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -280,8 +291,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `465` // Estimated: `3550` - // Minimum execution time: 34_000_000 picoseconds. - Weight::from_parts(34_000_000, 0) + // Minimum execution time: 39_683_000 picoseconds. + Weight::from_parts(55_799_000, 0) .saturating_add(Weight::from_parts(0, 3550)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -296,8 +307,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `463` // Estimated: `3533` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(47_000_000, 0) + // Minimum execution time: 90_833_000 picoseconds. + Weight::from_parts(97_249_000, 0) .saturating_add(Weight::from_parts(0, 3533)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -312,10 +323,10 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn drop_history() -> Weight { // Proof Size summary in bytes: - // Measured: `692` + // Measured: `857` // Estimated: `3593` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(40_000_000, 0) + // Minimum execution time: 93_311_000 picoseconds. + Weight::from_parts(105_496_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) @@ -326,10 +337,10 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Proof: `Broker::AllowedRenewals` (`max_values`: None, `max_size`: Some(1233), added: 3708, mode: `MaxEncodedLen`) fn drop_renewal() -> Weight { // Proof Size summary in bytes: - // Measured: `387` + // Measured: `957` // Estimated: `4698` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(24_000_000, 0) + // Minimum execution time: 44_597_000 picoseconds. + Weight::from_parts(48_739_000, 0) .saturating_add(Weight::from_parts(0, 4698)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -345,26 +356,28 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// The range of component `n` is `[0, 1000]`. - fn request_core_count(_n: u32, ) -> Weight { + fn request_core_count(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `74` // Estimated: `3539` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 22_114_000 picoseconds. + Weight::from_parts(23_031_633, 0) .saturating_add(Weight::from_parts(0, 3539)) + // Standard Error: 60 + .saturating_add(Weight::from_parts(60, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1) - /// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1) + /// Storage: `Broker::CoreCountInbox` (r:1 w:1) + /// Proof: `Broker::CoreCountInbox` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 1000]`. fn process_core_count(_n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `26` - // Estimated: `3491` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) - .saturating_add(Weight::from_parts(0, 3491)) + // Measured: `266` + // Estimated: `1487` + // Minimum execution time: 6_020_000 picoseconds. + Weight::from_parts(6_540_421, 0) + .saturating_add(Weight::from_parts(0, 1487)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -376,10 +389,10 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn process_revenue() -> Weight { // Proof Size summary in bytes: - // Measured: `515` + // Measured: `447` // Estimated: `6196` - // Minimum execution time: 49_000_000 picoseconds. - Weight::from_parts(49_000_000, 0) + // Minimum execution time: 38_744_000 picoseconds. + Weight::from_parts(40_572_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -387,23 +400,23 @@ impl pallet_broker::WeightInfo for WeightInfo { /// Storage: `Broker::InstaPoolIo` (r:3 w:3) /// Proof: `Broker::InstaPoolIo` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) /// Storage: `Broker::Reservations` (r:1 w:0) - /// Proof: `Broker::Reservations` (`max_values`: Some(1), `max_size`: Some(6011), added: 6506, mode: `MaxEncodedLen`) + /// Proof: `Broker::Reservations` (`max_values`: Some(1), `max_size`: Some(12021), added: 12516, mode: `MaxEncodedLen`) /// Storage: `Broker::Leases` (r:1 w:1) - /// Proof: `Broker::Leases` (`max_values`: Some(1), `max_size`: Some(41), added: 536, mode: `MaxEncodedLen`) + /// Proof: `Broker::Leases` (`max_values`: Some(1), `max_size`: Some(401), added: 896, mode: `MaxEncodedLen`) /// Storage: `Broker::SaleInfo` (r:0 w:1) /// Proof: `Broker::SaleInfo` (`max_values`: Some(1), `max_size`: Some(57), added: 552, mode: `MaxEncodedLen`) - /// Storage: `Broker::Workplan` (r:0 w:10) + /// Storage: `Broker::Workplan` (r:0 w:60) /// Proof: `Broker::Workplan` (`max_values`: None, `max_size`: Some(1216), added: 3691, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 1000]`. fn rotate_sale(_n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `6143` - // Estimated: `8499` - // Minimum execution time: 44_000_000 picoseconds. - Weight::from_parts(47_000_000, 0) - .saturating_add(Weight::from_parts(0, 8499)) + // Measured: `12514` + // Estimated: `13506` + // Minimum execution time: 94_727_000 picoseconds. + Weight::from_parts(97_766_746, 0) + .saturating_add(Weight::from_parts(0, 13506)) .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(15)) + .saturating_add(T::DbWeight::get().writes(65)) } /// Storage: `Broker::InstaPoolIo` (r:1 w:0) /// Proof: `Broker::InstaPoolIo` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) @@ -413,8 +426,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3493` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(7_000_000, 0) + // Minimum execution time: 6_496_000 picoseconds. + Weight::from_parts(6_757_000, 0) .saturating_add(Weight::from_parts(0, 3493)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -437,8 +450,8 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `1321` // Estimated: `4786` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(40_000_000, 0) + // Minimum execution time: 33_164_000 picoseconds. + Weight::from_parts(33_800_000, 0) .saturating_add(Weight::from_parts(0, 4786)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(4)) @@ -457,31 +470,42 @@ impl pallet_broker::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `74` // Estimated: `3539` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + // Minimum execution time: 16_884_000 picoseconds. + Weight::from_parts(17_315_000, 0) .saturating_add(Weight::from_parts(0, 3539)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: `Broker::CoreCountInbox` (r:0 w:1) + /// Proof: `Broker::CoreCountInbox` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 1000]`. fn notify_core_count() -> Weight { - T::DbWeight::get().reads_writes(1, 1) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_017_000 picoseconds. + Weight::from_parts(2_210_693, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Broker::Status` (r:1 w:1) /// Proof: `Broker::Status` (`max_values`: Some(1), `max_size`: Some(18), added: 513, mode: `MaxEncodedLen`) /// Storage: `Broker::Configuration` (r:1 w:0) /// Proof: `Broker::Configuration` (`max_values`: Some(1), `max_size`: Some(31), added: 526, mode: `MaxEncodedLen`) - /// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1) - /// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1) + /// Storage: `Broker::CoreCountInbox` (r:1 w:0) + /// Proof: `Broker::CoreCountInbox` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1) /// Proof: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn do_tick_base() -> Weight { // Proof Size summary in bytes: - // Measured: `351` - // Estimated: `3816` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) - .saturating_add(Weight::from_parts(0, 3816)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `398` + // Estimated: `3863` + // Minimum execution time: 12_118_000 picoseconds. + Weight::from_parts(12_541_000, 0) + .saturating_add(Weight::from_parts(0, 3863)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/polkadot/runtime/common/src/slots/mod.rs b/polkadot/runtime/common/src/slots/mod.rs index 6a8cddd8d914..58bd1d53aed6 100644 --- a/polkadot/runtime/common/src/slots/mod.rs +++ b/polkadot/runtime/common/src/slots/mod.rs @@ -326,18 +326,6 @@ impl Pallet { tracker.into_iter().collect() } - - /// Current lease index and how many blocks we are already in. - pub fn lease_period_index_plus_progress( - b: BlockNumberFor, - ) -> Option<(>>::LeasePeriod, BlockNumberFor)> { - // Note that blocks before `LeaseOffset` do not count as any lease period. - let offset_block_now = b.checked_sub(&T::LeaseOffset::get())?; - let lease_period = offset_block_now / T::LeasePeriod::get(); - let in_lease = offset_block_now % T::LeasePeriod::get(); - - Some((lease_period, in_lease)) - } } impl crate::traits::OnSwap for Pallet { @@ -461,8 +449,12 @@ impl Leaser> for Pallet { } fn lease_period_index(b: BlockNumberFor) -> Option<(Self::LeasePeriod, bool)> { - Self::lease_period_index_plus_progress(b) - .map(|(period, progress)| (period, progress.is_zero())) + // Note that blocks before `LeaseOffset` do not count as any lease period. + let offset_block_now = b.checked_sub(&T::LeaseOffset::get())?; + let lease_period = offset_block_now / T::LeasePeriod::get(); + let at_begin = (offset_block_now % T::LeasePeriod::get()).is_zero(); + + Some((lease_period, at_begin)) } fn already_leased( diff --git a/polkadot/runtime/parachains/src/coretime/mod.rs b/polkadot/runtime/parachains/src/coretime/mod.rs index b0e40a132335..8da6ccf07ca7 100644 --- a/polkadot/runtime/parachains/src/coretime/mod.rs +++ b/polkadot/runtime/parachains/src/coretime/mod.rs @@ -245,7 +245,9 @@ impl OnNewSession> for Pallet { fn mk_coretime_call(call: crate::coretime::CoretimeCalls) -> Instruction<()> { Instruction::Transact { origin_kind: OriginKind::Superuser, - require_weight_at_most: Weight::from_parts(1000000000, 200000), + // Largest call is set_lease with 1526 byte: + // Longest call is reserve() with 31_000_000 + require_weight_at_most: Weight::from_parts(100_000_000, 20_000), call: BrokerRuntimePallets::Broker(call).encode().into(), } } diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index a15911c21f65..4d0e537f6dbd 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -37,8 +37,9 @@ use runtime_common::{ impls::{ LocatableAssetConverter, ToAuthor, VersionedLocatableAsset, VersionedMultiLocationConverter, }, - paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BlockHashCount, BlockLength, - SlowAdjustingFeeUpdate, + paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, + traits::Leaser, + BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, }; use scale_info::TypeInfo; use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*}; @@ -1494,7 +1495,6 @@ pub mod migrations { use frame_support::traits::LockIdentifier; use frame_system::pallet_prelude::BlockNumberFor; - use sp_arithmetic::traits::Zero; #[cfg(feature = "try-runtime")] use sp_core::crypto::ByteArray; @@ -1502,28 +1502,17 @@ pub mod migrations { impl coretime::migration::GetLegacyLease for GetLegacyLeaseImpl { fn get_parachain_lease_in_blocks(para: ParaId) -> Option { let now = frame_system::Pallet::::block_number(); - let mut leases = slots::Pallet::::lease(para).into_iter(); - let initial_sum = if let Some(Some(_)) = leases.next() { - let (_, progress) = - slots::Pallet::::lease_period_index_plus_progress(now)?; - LeasePeriod::get().saturating_sub(progress) - } else { - // The parachain lease did not yet start - Zero::zero() - }; - log::trace!( - target: "coretime-migration", - "Getting lease info for para {:?}:\n LEASE_PERIOD: {:?}, initial_sum: {:?}, number of leases: {:?}", - para, - LeasePeriod::get(), - initial_sum, - slots::Pallet::::lease(para).len(), - ); - - Some(leases.into_iter().fold(initial_sum, |sum, lease| { - // If the parachain lease did not yet start, we ignore them by multiplying by `0`. - sum + LeasePeriod::get() * lease.map_or(0, |_| 1) - })) + let lease = slots::Pallet::::lease(para); + if lease.is_empty() { + return None + } + // Lease not yet started, ignore: + if lease.iter().any(Option::is_none) { + return None + } + let (index, _) = + as Leaser>::lease_period_index(now)?; + Some(index.saturating_add(lease.len() as u32).saturating_mul(LeasePeriod::get())) } } diff --git a/substrate/frame/broker/src/benchmarking.rs b/substrate/frame/broker/src/benchmarking.rs index c57c4ccb8ce4..70f488e998cc 100644 --- a/substrate/frame/broker/src/benchmarking.rs +++ b/substrate/frame/broker/src/benchmarking.rs @@ -885,6 +885,17 @@ mod benches { T::Coretime::request_revenue_info_at(rc_block); } } + #[benchmark] + fn notify_core_count() -> Result<(), BenchmarkError> { + let admin_origin = + T::AdminOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; + + #[extrinsic_call] + _(admin_origin as T::RuntimeOrigin, 100); + + assert!(CoreCountInbox::::take().is_some()); + Ok(()) + } #[benchmark] fn do_tick_base() -> Result<(), BenchmarkError> {