From c00a14711a97eab457d38e65f3e57bbc3d0a6f3d Mon Sep 17 00:00:00 2001 From: lrazovic <4128940+lrazovic@users.noreply.github.com> Date: Tue, 21 May 2024 09:43:51 +0000 Subject: [PATCH] new-benches-3 --- pallets/funding/src/benchmarking.rs | 1 - pallets/funding/src/tests/misc.rs | 101 +++++++----- pallets/funding/src/weights.rs | 177 ++++++++++++-------- pallets/funding/weight-test.rs | 241 ++++++++++++++++++++++++++++ runtimes/polimec/src/lib.rs | 4 +- 5 files changed, 409 insertions(+), 115 deletions(-) create mode 100644 pallets/funding/weight-test.rs diff --git a/pallets/funding/src/benchmarking.rs b/pallets/funding/src/benchmarking.rs index ceb34fd3c..eb4e17ef9 100644 --- a/pallets/funding/src/benchmarking.rs +++ b/pallets/funding/src/benchmarking.rs @@ -2053,7 +2053,6 @@ mod benchmarks { let accepted_bids = vec![smaller_than_wap_accepted_bid, higher_than_wap_accepted_bids].into_iter().flatten().collect_vec(); - dbg!(accepted_bids.len()); let rejected_bids = (0..z) .map(|i| { BidParams::::new( diff --git a/pallets/funding/src/tests/misc.rs b/pallets/funding/src/tests/misc.rs index e1ccfa518..c78cbd227 100644 --- a/pallets/funding/src/tests/misc.rs +++ b/pallets/funding/src/tests/misc.rs @@ -638,47 +638,66 @@ mod async_tests { #[test] fn weights() { - // use crate::weights::WeightInfoTest; + use crate::weights::TestWeightInfo; - for i in 0..0 { - println!("hello"); - } - // let max_project_to_update_insertion_attempts: u32 = - // ::MaxProjectsToUpdateInsertionAttempts::get(); - // let max_bids_per_project: u32 = ::MaxBidsPerProject::get(); - // let old_community_max = weights::SubstrateWeight::::start_community_funding( - // max_project_to_update_insertion_attempts - 1, - // max_bids_per_project / 2, - // max_bids_per_project / 2, - // ) - // .max(WeightInfoOf::::start_community_funding( - // max_project_to_update_insertion_attempts - 1, - // max_bids_per_project, - // 0u32, - // )) - // .max(WeightInfoOf::::start_community_funding( - // max_project_to_update_insertion_attempts - 1, - // 0u32, - // max_bids_per_project, - // )); - // dbg!(old_community_max); - // - // let new_community_max = weights::SubstrateWeightTest::::start_community_funding( - // max_project_to_update_insertion_attempts - 1, - // max_bids_per_project, - // ); - // dbg!(new_community_max); - // - // let new_auction_end_max = weights::SubstrateWeightTest::::end_auction_closing( - // max_project_to_update_insertion_attempts - 1, - // max_bids_per_project, - // 0, - // ); - // - // dbg!(new_auction_end_max); - // - // - // let new_sum = new_community_max + new_auction_end_max; - // dbg!(new_sum); + let max_project_to_update_insertion_attempts: u32 = + ::MaxProjectsToUpdateInsertionAttempts::get(); + let max_bids_per_project: u32 = ::MaxBidsPerProject::get(); + let old_community_max_1 = weights::SubstrateWeight::::start_community_funding( + max_project_to_update_insertion_attempts - 1, + max_bids_per_project / 2, + max_bids_per_project / 2, + ); + let old_community_max_2 = WeightInfoOf::::start_community_funding( + max_project_to_update_insertion_attempts - 1, + max_bids_per_project, + 0u32, + ); + let old_community_max_3 = WeightInfoOf::::start_community_funding( + max_project_to_update_insertion_attempts - 1, + 0u32, + max_bids_per_project, + ); + dbg!(old_community_max_1); + dbg!(old_community_max_2); + dbg!(old_community_max_3); + + let end_auction_closing_max_1 = weights::TestSubstrateWeight::::end_auction_closing( + max_project_to_update_insertion_attempts - 1, + max_bids_per_project / 2, + max_bids_per_project / 2, + ); + let end_auction_closing_max_2 = weights::TestSubstrateWeight::::end_auction_closing( + max_project_to_update_insertion_attempts - 1, + max_bids_per_project, + 0u32, + ); + let end_auction_closing_max_3 = weights::TestSubstrateWeight::::end_auction_closing( + max_project_to_update_insertion_attempts - 1, + 0u32, + max_bids_per_project, + ); + dbg!(end_auction_closing_max_1); + dbg!(end_auction_closing_max_2); + dbg!(end_auction_closing_max_3); + + let new_community_max_1 = weights::TestSubstrateWeight::::start_community_funding( + max_project_to_update_insertion_attempts - 1, + max_bids_per_project / 2, + max_bids_per_project / 2, + ); + let new_community_max_2 = weights::TestSubstrateWeight::::start_community_funding( + max_project_to_update_insertion_attempts - 1, + max_bids_per_project, + 0u32, + ); + let new_community_max_3 = weights::TestSubstrateWeight::::start_community_funding( + max_project_to_update_insertion_attempts - 1, + 0u32, + max_bids_per_project, + ); + dbg!(new_community_max_1); + dbg!(new_community_max_2); + dbg!(new_community_max_3); } } diff --git a/pallets/funding/src/weights.rs b/pallets/funding/src/weights.rs index db4b80a93..ef3b0eba1 100644 --- a/pallets/funding/src/weights.rs +++ b/pallets/funding/src/weights.rs @@ -1446,9 +1446,12 @@ impl WeightInfo for () { } } + + +/// Weight functions needed for `pallet_funding`. pub trait TestWeightInfo { fn end_auction_closing(x: u32, y: u32, z: u32, ) -> Weight; - fn start_community_funding(x: u32, y: u32, ) -> Weight; + fn start_community_funding(x: u32, y: u32, z: u32, ) -> Weight; } /// Weights for `pallet_funding` using the Substrate node and recommended hardware. @@ -1462,68 +1465,84 @@ impl TestWeightInfo for TestSubstrateWeight { /// Proof: `Funding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Random::RandomMaterial` (r:1 w:0) /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) - /// Storage: `Funding::Bids` (r:513 w:512) + /// Storage: `Funding::Bids` (r:1025 w:1024) /// Proof: `Funding::Bids` (`max_values`: None, `max_size`: Some(306), added: 2781, mode: `MaxEncodedLen`) /// Storage: `Funding::DidWithWinningBids` (r:512 w:512) /// Proof: `Funding::DidWithWinningBids` (`max_values`: None, `max_size`: Some(95), added: 2570, mode: `MaxEncodedLen`) - /// Storage: `Funding::ProjectsToUpdate` (r:100 w:1) + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:513 w:513) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:512 w:512) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:512 w:512) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsToUpdate` (r:99 w:1) /// Proof: `Funding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(26), added: 2501, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. - /// The range of component `y` is `[0, 512]`. - /// The range of component `z` is `[0, 512]`. + /// The range of component `y` is `[1, 512]`. + /// The range of component `z` is `[1, 512]`. fn end_auction_closing(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1146 + x * (28 ±0) + y * (272 ±0)` - // Estimated: `4079 + x * (2501 ±0) + y * (2781 ±0)` - // Minimum execution time: 308_810_000 picoseconds. - Weight::from_parts(18_800_680, 4079) - // Standard Error: 33_795 - .saturating_add(Weight::from_parts(2_190_348, 0).saturating_mul(x.into())) - // Standard Error: 6_461 - .saturating_add(Weight::from_parts(11_358_946, 0).saturating_mul(y.into())) - // Standard Error: 6_461 - .saturating_add(Weight::from_parts(3_302, 0).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(6_u64)) + // Measured: `48274 + x * (28 ±0) + y * (225 ±0) + z * (400 ±0)` + // Estimated: `4079 + x * (2501 ±0) + y * (2781 ±0) + z * (3624 ±0)` + // Minimum execution time: 6_080_447_000 picoseconds. + Weight::from_parts(6_119_917_000, 4079) + // Standard Error: 274_194 + .saturating_add(Weight::from_parts(6_296_208, 0).saturating_mul(y.into())) + // Standard Error: 274_194 + .saturating_add(Weight::from_parts(57_480_150, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(y.into()))) - .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(z.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(z.into()))) .saturating_add(Weight::from_parts(0, 2501).saturating_mul(x.into())) .saturating_add(Weight::from_parts(0, 2781).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(z.into())) } /// Storage: `Funding::ProjectsDetails` (r:1 w:1) /// Proof: `Funding::ProjectsDetails` (`max_values`: None, `max_size`: Some(397), added: 2872, mode: `MaxEncodedLen`) /// Storage: `Funding::ProjectsMetadata` (r:1 w:0) /// Proof: `Funding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(502), added: 2977, mode: `MaxEncodedLen`) - /// Storage: `Funding::Nonce` (r:1 w:1) - /// Proof: `Funding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `Random::RandomMaterial` (r:1 w:0) - /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) - /// Storage: `Funding::Bids` (r:1025 w:1024) + /// Storage: `Funding::Bids` (r:513 w:512) /// Proof: `Funding::Bids` (`max_values`: None, `max_size`: Some(306), added: 2781, mode: `MaxEncodedLen`) - /// Storage: `Oracle::Values` (r:1 w:0) + /// Storage: `Oracle::Values` (r:2 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Metadata` (r:1 w:0) + /// Proof: `ForeignAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:513 w:513) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:512 w:512) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:512 w:512) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) /// Storage: `Funding::ProjectsToUpdate` (r:100 w:1) /// Proof: `Funding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(26), added: 2501, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. - /// The range of component `y` is `[0, 1024]`. - fn start_community_funding(x: u32, y: u32, ) -> Weight { + /// The range of component `y` is `[1, 512]`. + /// The range of component `z` is `[1, 512]`. + fn start_community_funding(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1417 + x * (28 ±0) + y * (272 ±0)` - // Estimated: `4079 + x * (2501 ±0) + y * (2781 ±0)` - // Minimum execution time: 296_110_000 picoseconds. - Weight::from_parts(16_431_395, 4079) - // Standard Error: 34_714 - .saturating_add(Weight::from_parts(2_547_873, 0).saturating_mul(x.into())) - // Standard Error: 3_320 - .saturating_add(Weight::from_parts(8_045_382, 0).saturating_mul(y.into())) + // Measured: `0 + x * (28 ±0) + y * (500 ±0) + z * (72 ±0)` + // Estimated: `5401 + x * (2501 ±0) + y * (3624 ±0)` + // Minimum execution time: 319_131_000 picoseconds. + Weight::from_parts(319_151_000, 5401) + // Standard Error: 38_904 + .saturating_add(Weight::from_parts(64_417_594, 0).saturating_mul(y.into())) + // Standard Error: 38_904 + .saturating_add(Weight::from_parts(525_372, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(y.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(y.into()))) .saturating_add(Weight::from_parts(0, 2501).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 2781).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(y.into())) } } @@ -1537,67 +1556,83 @@ impl TestWeightInfo for () { /// Proof: `Funding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Random::RandomMaterial` (r:1 w:0) /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) - /// Storage: `Funding::Bids` (r:513 w:512) + /// Storage: `Funding::Bids` (r:1025 w:1024) /// Proof: `Funding::Bids` (`max_values`: None, `max_size`: Some(306), added: 2781, mode: `MaxEncodedLen`) /// Storage: `Funding::DidWithWinningBids` (r:512 w:512) /// Proof: `Funding::DidWithWinningBids` (`max_values`: None, `max_size`: Some(95), added: 2570, mode: `MaxEncodedLen`) - /// Storage: `Funding::ProjectsToUpdate` (r:100 w:1) + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:513 w:513) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:512 w:512) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:512 w:512) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsToUpdate` (r:99 w:1) /// Proof: `Funding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(26), added: 2501, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. - /// The range of component `y` is `[0, 512]`. - /// The range of component `z` is `[0, 512]`. + /// The range of component `y` is `[1, 512]`. + /// The range of component `z` is `[1, 512]`. fn end_auction_closing(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1146 + x * (28 ±0) + y * (272 ±0)` - // Estimated: `4079 + x * (2501 ±0) + y * (2781 ±0)` - // Minimum execution time: 308_810_000 picoseconds. - Weight::from_parts(18_800_680, 4079) - // Standard Error: 33_795 - .saturating_add(Weight::from_parts(2_190_348, 0).saturating_mul(x.into())) - // Standard Error: 6_461 - .saturating_add(Weight::from_parts(11_358_946, 0).saturating_mul(y.into())) - // Standard Error: 6_461 - .saturating_add(Weight::from_parts(3_302, 0).saturating_mul(z.into())) - .saturating_add(RocksDbWeight::get().reads(6_u64)) + // Measured: `48274 + x * (28 ±0) + y * (225 ±0) + z * (400 ±0)` + // Estimated: `4079 + x * (2501 ±0) + y * (2781 ±0) + z * (3624 ±0)` + // Minimum execution time: 6_080_447_000 picoseconds. + Weight::from_parts(6_119_917_000, 4079) + // Standard Error: 274_194 + .saturating_add(Weight::from_parts(6_296_208, 0).saturating_mul(y.into())) + // Standard Error: 274_194 + .saturating_add(Weight::from_parts(57_480_150, 0).saturating_mul(z.into())) + .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(y.into()))) - .saturating_add(RocksDbWeight::get().writes(3_u64)) + .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(z.into()))) + .saturating_add(RocksDbWeight::get().writes(5_u64)) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(z.into()))) .saturating_add(Weight::from_parts(0, 2501).saturating_mul(x.into())) .saturating_add(Weight::from_parts(0, 2781).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(z.into())) } /// Storage: `Funding::ProjectsDetails` (r:1 w:1) /// Proof: `Funding::ProjectsDetails` (`max_values`: None, `max_size`: Some(397), added: 2872, mode: `MaxEncodedLen`) /// Storage: `Funding::ProjectsMetadata` (r:1 w:0) /// Proof: `Funding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(502), added: 2977, mode: `MaxEncodedLen`) - /// Storage: `Funding::Nonce` (r:1 w:1) - /// Proof: `Funding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `Random::RandomMaterial` (r:1 w:0) - /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) - /// Storage: `Funding::Bids` (r:1025 w:1024) + /// Storage: `Funding::Bids` (r:513 w:512) /// Proof: `Funding::Bids` (`max_values`: None, `max_size`: Some(306), added: 2781, mode: `MaxEncodedLen`) - /// Storage: `Oracle::Values` (r:1 w:0) + /// Storage: `Oracle::Values` (r:2 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Metadata` (r:1 w:0) + /// Proof: `ForeignAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:513 w:513) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:512 w:512) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:512 w:512) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) /// Storage: `Funding::ProjectsToUpdate` (r:100 w:1) /// Proof: `Funding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(26), added: 2501, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. - /// The range of component `y` is `[0, 1024]`. - fn start_community_funding(x: u32, y: u32, ) -> Weight { + /// The range of component `y` is `[1, 512]`. + /// The range of component `z` is `[1, 512]`. + fn start_community_funding(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1417 + x * (28 ±0) + y * (272 ±0)` - // Estimated: `4079 + x * (2501 ±0) + y * (2781 ±0)` - // Minimum execution time: 296_110_000 picoseconds. - Weight::from_parts(16_431_395, 4079) - // Standard Error: 34_714 - .saturating_add(Weight::from_parts(2_547_873, 0).saturating_mul(x.into())) - // Standard Error: 3_320 - .saturating_add(Weight::from_parts(8_045_382, 0).saturating_mul(y.into())) + // Measured: `0 + x * (28 ±0) + y * (500 ±0) + z * (72 ±0)` + // Estimated: `5401 + x * (2501 ±0) + y * (3624 ±0)` + // Minimum execution time: 319_131_000 picoseconds. + Weight::from_parts(319_151_000, 5401) + // Standard Error: 38_904 + .saturating_add(Weight::from_parts(64_417_594, 0).saturating_mul(y.into())) + // Standard Error: 38_904 + .saturating_add(Weight::from_parts(525_372, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) - .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(y.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(y.into()))) .saturating_add(Weight::from_parts(0, 2501).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 2781).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(y.into())) } } \ No newline at end of file diff --git a/pallets/funding/weight-test.rs b/pallets/funding/weight-test.rs new file mode 100644 index 000000000..047ed0eed --- /dev/null +++ b/pallets/funding/weight-test.rs @@ -0,0 +1,241 @@ +// Polimec Blockchain – https://www.polimec.org/ +// Copyright (C) Polimec 2022. All rights reserved. + +// The Polimec Blockchain is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Polimec Blockchain is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@polimec.org + + +//! Autogenerated weights for `pallet_funding` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-05-21, STEPS: `20`, REPEAT: `5`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ip-172-31-23-147`, CPU: `AMD EPYC 9R14` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("polimec-local")`, DB CACHE: `1024` + +// Executed Command: +// ./target/production/polimec-node +// benchmark +// pallet +// --chain=polimec-local +// --steps=20 +// --repeat=5 +// --pallet=pallet-funding +// --no-storage-info +// --no-median-slopes +// --no-min-squares +// --extrinsic +// end_auction_closing,start_community_funding +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=pallets/funding/weight-test.rs +// --template=./.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; + +/// Weight functions needed for `pallet_funding`. +pub trait WeightInfo { + fn end_auction_closing(x: u32, y: u32, z: u32, ) -> Weight; + fn start_community_funding(x: u32, y: u32, z: u32, ) -> Weight; +} + +/// Weights for `pallet_funding` using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: `Funding::ProjectsDetails` (r:1 w:1) + /// Proof: `Funding::ProjectsDetails` (`max_values`: None, `max_size`: Some(397), added: 2872, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsMetadata` (r:1 w:0) + /// Proof: `Funding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(502), added: 2977, mode: `MaxEncodedLen`) + /// Storage: `Funding::Nonce` (r:1 w:1) + /// Proof: `Funding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Random::RandomMaterial` (r:1 w:0) + /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) + /// Storage: `Funding::Bids` (r:1025 w:1024) + /// Proof: `Funding::Bids` (`max_values`: None, `max_size`: Some(306), added: 2781, mode: `MaxEncodedLen`) + /// Storage: `Funding::DidWithWinningBids` (r:512 w:512) + /// Proof: `Funding::DidWithWinningBids` (`max_values`: None, `max_size`: Some(95), added: 2570, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:513 w:513) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:512 w:512) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:512 w:512) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsToUpdate` (r:99 w:1) + /// Proof: `Funding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(26), added: 2501, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + /// The range of component `y` is `[1, 512]`. + /// The range of component `z` is `[1, 512]`. + fn end_auction_closing(x: u32, y: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `48274 + x * (28 ±0) + y * (225 ±0) + z * (400 ±0)` + // Estimated: `4079 + x * (2501 ±0) + y * (2781 ±0) + z * (3624 ±0)` + // Minimum execution time: 6_080_447_000 picoseconds. + Weight::from_parts(6_119_917_000, 4079) + // Standard Error: 274_194 + .saturating_add(Weight::from_parts(6_296_208, 0).saturating_mul(y.into())) + // Standard Error: 274_194 + .saturating_add(Weight::from_parts(57_480_150, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(z.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(z.into()))) + .saturating_add(Weight::from_parts(0, 2501).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2781).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(z.into())) + } + /// Storage: `Funding::ProjectsDetails` (r:1 w:1) + /// Proof: `Funding::ProjectsDetails` (`max_values`: None, `max_size`: Some(397), added: 2872, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsMetadata` (r:1 w:0) + /// Proof: `Funding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(502), added: 2977, mode: `MaxEncodedLen`) + /// Storage: `Funding::Bids` (r:513 w:512) + /// Proof: `Funding::Bids` (`max_values`: None, `max_size`: Some(306), added: 2781, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:2 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Metadata` (r:1 w:0) + /// Proof: `ForeignAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:513 w:513) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:512 w:512) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:512 w:512) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `Funding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(26), added: 2501, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + /// The range of component `y` is `[1, 512]`. + /// The range of component `z` is `[1, 512]`. + fn start_community_funding(x: u32, y: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + x * (28 ±0) + y * (500 ±0) + z * (72 ±0)` + // Estimated: `5401 + x * (2501 ±0) + y * (3624 ±0)` + // Minimum execution time: 319_131_000 picoseconds. + Weight::from_parts(319_151_000, 5401) + // Standard Error: 38_904 + .saturating_add(Weight::from_parts(64_417_594, 0).saturating_mul(y.into())) + // Standard Error: 38_904 + .saturating_add(Weight::from_parts(525_372, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(y.into()))) + .saturating_add(Weight::from_parts(0, 2501).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(y.into())) + } +} + +// For backwards compatibility and tests. +impl WeightInfo for () { + /// Storage: `Funding::ProjectsDetails` (r:1 w:1) + /// Proof: `Funding::ProjectsDetails` (`max_values`: None, `max_size`: Some(397), added: 2872, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsMetadata` (r:1 w:0) + /// Proof: `Funding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(502), added: 2977, mode: `MaxEncodedLen`) + /// Storage: `Funding::Nonce` (r:1 w:1) + /// Proof: `Funding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Random::RandomMaterial` (r:1 w:0) + /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) + /// Storage: `Funding::Bids` (r:1025 w:1024) + /// Proof: `Funding::Bids` (`max_values`: None, `max_size`: Some(306), added: 2781, mode: `MaxEncodedLen`) + /// Storage: `Funding::DidWithWinningBids` (r:512 w:512) + /// Proof: `Funding::DidWithWinningBids` (`max_values`: None, `max_size`: Some(95), added: 2570, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:513 w:513) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:512 w:512) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:512 w:512) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsToUpdate` (r:99 w:1) + /// Proof: `Funding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(26), added: 2501, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + /// The range of component `y` is `[1, 512]`. + /// The range of component `z` is `[1, 512]`. + fn end_auction_closing(x: u32, y: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `48274 + x * (28 ±0) + y * (225 ±0) + z * (400 ±0)` + // Estimated: `4079 + x * (2501 ±0) + y * (2781 ±0) + z * (3624 ±0)` + // Minimum execution time: 6_080_447_000 picoseconds. + Weight::from_parts(6_119_917_000, 4079) + // Standard Error: 274_194 + .saturating_add(Weight::from_parts(6_296_208, 0).saturating_mul(y.into())) + // Standard Error: 274_194 + .saturating_add(Weight::from_parts(57_480_150, 0).saturating_mul(z.into())) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(z.into()))) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(z.into()))) + .saturating_add(Weight::from_parts(0, 2501).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2781).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(z.into())) + } + /// Storage: `Funding::ProjectsDetails` (r:1 w:1) + /// Proof: `Funding::ProjectsDetails` (`max_values`: None, `max_size`: Some(397), added: 2872, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsMetadata` (r:1 w:0) + /// Proof: `Funding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(502), added: 2977, mode: `MaxEncodedLen`) + /// Storage: `Funding::Bids` (r:513 w:512) + /// Proof: `Funding::Bids` (`max_values`: None, `max_size`: Some(306), added: 2781, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:2 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Metadata` (r:1 w:0) + /// Proof: `ForeignAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:513 w:513) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:512 w:512) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:512 w:512) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) + /// Storage: `Funding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `Funding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(26), added: 2501, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + /// The range of component `y` is `[1, 512]`. + /// The range of component `z` is `[1, 512]`. + fn start_community_funding(x: u32, y: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + x * (28 ±0) + y * (500 ±0) + z * (72 ±0)` + // Estimated: `5401 + x * (2501 ±0) + y * (3624 ±0)` + // Minimum execution time: 319_131_000 picoseconds. + Weight::from_parts(319_151_000, 5401) + // Standard Error: 38_904 + .saturating_add(Weight::from_parts(64_417_594, 0).saturating_mul(y.into())) + // Standard Error: 38_904 + .saturating_add(Weight::from_parts(525_372, 0).saturating_mul(z.into())) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(y.into()))) + .saturating_add(Weight::from_parts(0, 2501).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(y.into())) + } +} \ No newline at end of file diff --git a/runtimes/polimec/src/lib.rs b/runtimes/polimec/src/lib.rs index d280d1d24..a601a641d 100644 --- a/runtimes/polimec/src/lib.rs +++ b/runtimes/polimec/src/lib.rs @@ -1043,11 +1043,11 @@ impl pallet_funding::Config for Runtime { type FundingCurrency = ForeignAssets; type InvestorOrigin = EnsureInvestor; type ManualAcceptanceDuration = ManualAcceptanceDuration; - type MaxBidsPerProject = ConstU32<1024>; + type MaxBidsPerProject = ConstU32<512>; type MaxBidsPerUser = ConstU32<16>; type MaxCapacityThresholds = MaxCapacityThresholds; type MaxContributionsPerUser = ConstU32<16>; - type MaxEvaluationsPerProject = ConstU32<1024>; + type MaxEvaluationsPerProject = ConstU32<512>; type MaxEvaluationsPerUser = ConstU32<16>; type MaxMessageSizeThresholds = MaxMessageSizeThresholds; type MaxProjectsToUpdateInsertionAttempts = ConstU32<100>;