diff --git a/pallets/networks/Cargo.toml b/pallets/networks/Cargo.toml index 1aba5a4..6b95d2c 100644 --- a/pallets/networks/Cargo.toml +++ b/pallets/networks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ghost-networks" -version = "0.1.12" +version = "0.1.13" license.workspace = true authors.workspace = true edition.workspace = true diff --git a/pallets/networks/src/lib.rs b/pallets/networks/src/lib.rs index 38ea5a8..44292be 100644 --- a/pallets/networks/src/lib.rs +++ b/pallets/networks/src/lib.rs @@ -292,7 +292,9 @@ pub mod module { network.default_endpoints .iter() .map(|endpoint| endpoint.len()) - .sum::() as u32, + .max() + .unwrap_or_default() as u32, + network.default_endpoints.len() as u32, ))] pub fn register_network( origin: OriginFor, diff --git a/pallets/networks/src/weights.rs b/pallets/networks/src/weights.rs index 889ae51..135b07d 100644 --- a/pallets/networks/src/weights.rs +++ b/pallets/networks/src/weights.rs @@ -49,7 +49,7 @@ use sp_std::marker::PhantomData; /// Weight functions needed for ghost_networks pub trait WeightInfo { - fn register_network(n: u32, m: u32, ) -> Weight; + fn register_network(i: u32, j: u32, k: u32, ) -> Weight; fn update_network_name(n: u32, ) -> Weight; fn update_network_endpoint(n: u32, ) -> Weight; fn update_network_finality_delay() -> Weight; @@ -70,15 +70,16 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[1, 20]`. /// The range of component `j` is `[1, 150]`. - fn register_network(_i: u32, j: u32, ) -> Weight { + /// The range of component `k` is `[1, 20]`. + fn register_network(_i: u32, _j: u32, k: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `3574` - // Minimum execution time: 43_753_000 picoseconds. - Weight::from_parts(45_805_520, 0) + // Minimum execution time: 46_023_000 picoseconds. + Weight::from_parts(97_871_287, 0) .saturating_add(Weight::from_parts(0, 3574)) - // Standard Error: 412 - .saturating_add(Weight::from_parts(1_586, 0).saturating_mul(j.into())) + // Standard Error: 94_524 + .saturating_add(Weight::from_parts(940_486, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +88,13 @@ impl WeightInfo for SubstrateWeight { /// The range of component `n` is `[1, 20]`. fn update_network_name(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 49_412_000 picoseconds. - Weight::from_parts(50_617_210, 0) - .saturating_add(Weight::from_parts(0, 3766)) - // Standard Error: 3_074 - .saturating_add(Weight::from_parts(6_017, 0).saturating_mul(n.into())) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_906_000 picoseconds. + Weight::from_parts(55_537_587, 0) + .saturating_add(Weight::from_parts(0, 3767)) + // Standard Error: 87_704 + .saturating_add(Weight::from_parts(92_366, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -102,13 +103,13 @@ impl WeightInfo for SubstrateWeight { /// The range of component `n` is `[1, 150]`. fn update_network_endpoint(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 49_485_000 picoseconds. - Weight::from_parts(50_716_057, 0) - .saturating_add(Weight::from_parts(0, 3766)) - // Standard Error: 453 - .saturating_add(Weight::from_parts(4_916, 0).saturating_mul(n.into())) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 50_556_000 picoseconds. + Weight::from_parts(57_726_674, 0) + .saturating_add(Weight::from_parts(0, 3767)) + // Standard Error: 12_261 + .saturating_add(Weight::from_parts(274, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -116,11 +117,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_finality_delay() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 48_061_000 picoseconds. - Weight::from_parts(49_072_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_406_000 picoseconds. + Weight::from_parts(51_256_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -128,11 +129,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_rate_limit_delay() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 49_066_000 picoseconds. - Weight::from_parts(52_137_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_572_000 picoseconds. + Weight::from_parts(52_584_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -140,11 +141,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_block_distance() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 48_085_000 picoseconds. - Weight::from_parts(48_838_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 48_880_000 picoseconds. + Weight::from_parts(50_596_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -152,11 +153,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_type() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 47_872_000 picoseconds. - Weight::from_parts(48_972_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 48_282_000 picoseconds. + Weight::from_parts(49_137_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -164,11 +165,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_gatekeeper() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 50_029_000 picoseconds. - Weight::from_parts(50_768_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 50_853_000 picoseconds. + Weight::from_parts(51_982_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -176,11 +177,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_topic_name() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 50_151_000 picoseconds. - Weight::from_parts(51_573_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 50_343_000 picoseconds. + Weight::from_parts(52_380_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -188,11 +189,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_incoming_network_fee() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 48_017_000 picoseconds. - Weight::from_parts(49_513_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_393_000 picoseconds. + Weight::from_parts(80_966_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -200,11 +201,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_outgoing_network_fee() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 48_714_000 picoseconds. - Weight::from_parts(49_777_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_579_000 picoseconds. + Weight::from_parts(51_126_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -212,11 +213,11 @@ impl WeightInfo for SubstrateWeight { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_network() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 44_583_000 picoseconds. - Weight::from_parts(45_681_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 44_634_000 picoseconds. + Weight::from_parts(45_815_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -227,15 +228,16 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[1, 20]`. /// The range of component `j` is `[1, 150]`. - fn register_network(_i: u32, j: u32, ) -> Weight { + /// The range of component `k` is `[1, 20]`. + fn register_network(_i: u32, _j: u32, k: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `3574` - // Minimum execution time: 43_753_000 picoseconds. - Weight::from_parts(45_805_520, 0) + // Minimum execution time: 46_023_000 picoseconds. + Weight::from_parts(97_871_287, 0) .saturating_add(Weight::from_parts(0, 3574)) - // Standard Error: 412 - .saturating_add(Weight::from_parts(1_586, 0).saturating_mul(j.into())) + // Standard Error: 94_524 + .saturating_add(Weight::from_parts(940_486, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -244,13 +246,13 @@ impl WeightInfo for () { /// The range of component `n` is `[1, 20]`. fn update_network_name(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 49_412_000 picoseconds. - Weight::from_parts(50_617_210, 0) - .saturating_add(Weight::from_parts(0, 3766)) - // Standard Error: 3_074 - .saturating_add(Weight::from_parts(6_017, 0).saturating_mul(n.into())) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_906_000 picoseconds. + Weight::from_parts(55_537_587, 0) + .saturating_add(Weight::from_parts(0, 3767)) + // Standard Error: 87_704 + .saturating_add(Weight::from_parts(92_366, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -259,13 +261,13 @@ impl WeightInfo for () { /// The range of component `n` is `[1, 150]`. fn update_network_endpoint(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 49_485_000 picoseconds. - Weight::from_parts(50_716_057, 0) - .saturating_add(Weight::from_parts(0, 3766)) - // Standard Error: 453 - .saturating_add(Weight::from_parts(4_916, 0).saturating_mul(n.into())) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 50_556_000 picoseconds. + Weight::from_parts(57_726_674, 0) + .saturating_add(Weight::from_parts(0, 3767)) + // Standard Error: 12_261 + .saturating_add(Weight::from_parts(274, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -273,11 +275,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_finality_delay() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 48_061_000 picoseconds. - Weight::from_parts(49_072_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_406_000 picoseconds. + Weight::from_parts(51_256_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -285,11 +287,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_rate_limit_delay() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 49_066_000 picoseconds. - Weight::from_parts(52_137_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_572_000 picoseconds. + Weight::from_parts(52_584_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -297,11 +299,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_block_distance() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 48_085_000 picoseconds. - Weight::from_parts(48_838_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 48_880_000 picoseconds. + Weight::from_parts(50_596_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -309,11 +311,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_type() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 47_872_000 picoseconds. - Weight::from_parts(48_972_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 48_282_000 picoseconds. + Weight::from_parts(49_137_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -321,11 +323,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_gatekeeper() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 50_029_000 picoseconds. - Weight::from_parts(50_768_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 50_853_000 picoseconds. + Weight::from_parts(51_982_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -333,11 +335,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_network_topic_name() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 50_151_000 picoseconds. - Weight::from_parts(51_573_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 50_343_000 picoseconds. + Weight::from_parts(52_380_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -345,11 +347,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_incoming_network_fee() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 48_017_000 picoseconds. - Weight::from_parts(49_513_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_393_000 picoseconds. + Weight::from_parts(80_966_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -357,11 +359,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_outgoing_network_fee() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 48_714_000 picoseconds. - Weight::from_parts(49_777_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 49_579_000 picoseconds. + Weight::from_parts(51_126_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -369,11 +371,11 @@ impl WeightInfo for () { /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_network() -> Weight { // Proof Size summary in bytes: - // Measured: `301` - // Estimated: `3766` - // Minimum execution time: 44_583_000 picoseconds. - Weight::from_parts(45_681_000, 0) - .saturating_add(Weight::from_parts(0, 3766)) + // Measured: `302` + // Estimated: `3767` + // Minimum execution time: 44_634_000 picoseconds. + Weight::from_parts(45_815_000, 0) + .saturating_add(Weight::from_parts(0, 3767)) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) }