diff --git a/Cargo.lock b/Cargo.lock index 050c69de53..3cf7a47e7a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6910,6 +6910,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "numtoa", "pallet-collective", "parity-scale-codec", diff --git a/common/primitives/src/schema.rs b/common/primitives/src/schema.rs index 0dfbe0c2b7..1d729c79c7 100644 --- a/common/primitives/src/schema.rs +++ b/common/primitives/src/schema.rs @@ -73,10 +73,27 @@ pub struct SchemaResponse { pub settings: Vec, } +/// RPC Response form for a Schema Info +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[derive(Clone, Encode, Decode, PartialEq, Debug, TypeInfo, Eq)] +pub struct SchemaInfoResponse { + /// The unique identifier for this Schema + pub schema_id: SchemaId, + /// The model format type for how the schema model is represented + pub model_type: ModelType, + /// The payload location + pub payload_location: PayloadLocation, + /// grants for the schema + pub settings: Vec, +} + /// This allows other pallets to resolve Schema information. With generic SchemaId pub trait SchemaProvider { /// Gets the Schema details associated with this `SchemaId` if any fn get_schema_by_id(schema_id: SchemaId) -> Option; + + /// Gets the Schema Info associated with this `SchemaId` if any + fn get_schema_info_by_id(schema_id: SchemaId) -> Option; } /// This allows other Pallets to check validity of schema ids. diff --git a/e2e/package-lock.json b/e2e/package-lock.json index c4a1611fdd..a858678f52 100644 --- a/e2e/package-lock.json +++ b/e2e/package-lock.json @@ -261,7 +261,7 @@ "node_modules/@frequency-chain/api-augment": { "version": "0.0.0", "resolved": "file:../js/api-augment/dist/frequency-chain-api-augment-0.0.0.tgz", - "integrity": "sha512-aKaQC7Kzg34El/fP+yhPTnOEjxWk1lTMh6JiPuzMaludLfPEb+fiVFsx77KyMKiLGWWtIeB8luXRx/EWjaWrzw==", + "integrity": "sha512-QZ07GKhcVuIKzXh3ho8Tvlu3/VenNeyGZ9i+x7n2WFRxbvM9KqR0wF08YNFd/YOuoHbBXX8jw0LCH87Jz4lxzg==", "license": "Apache-2.0", "dependencies": { "@polkadot/api": "^10.9.1", diff --git a/pallets/messages/src/lib.rs b/pallets/messages/src/lib.rs index e89010827f..8a429f6008 100644 --- a/pallets/messages/src/lib.rs +++ b/pallets/messages/src/lib.rs @@ -230,7 +230,7 @@ pub mod pallet { .try_into() .map_err(|_| Error::::ExceedsMaxMessagePayloadSizeBytes)?; - if let Some(schema) = T::SchemaProvider::get_schema_by_id(schema_id) { + if let Some(schema) = T::SchemaProvider::get_schema_info_by_id(schema_id) { ensure!( schema.payload_location == PayloadLocation::IPFS, Error::::InvalidPayloadLocation @@ -283,7 +283,7 @@ pub mod pallet { let bounded_payload: BoundedVec = payload.try_into().map_err(|_| Error::::ExceedsMaxMessagePayloadSizeBytes)?; - if let Some(schema) = T::SchemaProvider::get_schema_by_id(schema_id) { + if let Some(schema) = T::SchemaProvider::get_schema_info_by_id(schema_id) { ensure!( schema.payload_location == PayloadLocation::OnChain, Error::::InvalidPayloadLocation diff --git a/pallets/messages/src/tests/mock.rs b/pallets/messages/src/tests/mock.rs index afcafdbde5..bd10fb314c 100644 --- a/pallets/messages/src/tests/mock.rs +++ b/pallets/messages/src/tests/mock.rs @@ -213,6 +213,17 @@ impl SchemaProvider for SchemaHandler { settings: Vec::new(), }) } + + fn get_schema_info_by_id(schema_id: u16) -> Option { + Self::get_schema_by_id(schema_id).and_then(|schema| { + Some(SchemaInfoResponse { + schema_id: schema.schema_id, + settings: schema.settings, + model_type: schema.model_type, + payload_location: schema.payload_location, + }) + }) + } } impl pallet_messages::Config for Test { diff --git a/pallets/messages/src/weights.rs b/pallets/messages/src/weights.rs index ae18564f25..992a65ea87 100644 --- a/pallets/messages/src/weights.rs +++ b/pallets/messages/src/weights.rs @@ -18,10 +18,10 @@ //! Autogenerated weights for pallet_messages //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-07, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-10-25, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `benchmark-runner-qpqf8-fp5d5`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("frequency-bench"), DB CACHE: 1024 +//! HOSTNAME: `AramikMarkarianNewMacBookPro.local`, CPU: `` +//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("frequency-bench"), DB CACHE: 1024 // Executed Command: // ./scripts/../target/bench-dev/frequency @@ -56,38 +56,38 @@ pub trait WeightInfo { /// Weights for pallet_messages using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { - /// Storage: Schemas Schemas (r:1 w:0) - /// Proof: Schemas Schemas (max_values: None, max_size: Some(65518), added: 67993, mode: Measured) - /// Storage: Msa PublicKeyToMsaId (r:1 w:0) - /// Proof: Msa PublicKeyToMsaId (max_values: None, max_size: Some(48), added: 2523, mode: Measured) - /// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:0) - /// Proof: Msa DelegatorAndProviderToDelegation (max_values: None, max_size: Some(217), added: 2692, mode: Measured) - /// Storage: Messages Messages (r:1 w:1) - /// Proof: Messages Messages (max_values: None, max_size: Some(771174), added: 773649, mode: Measured) - /// The range of component `n` is `[0, 5119]`. + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `Measured`) + /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) + /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `Measured`) + /// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0) + /// Proof: `Msa::DelegatorAndProviderToDelegation` (`max_values`: None, `max_size`: Some(217), added: 2692, mode: `Measured`) + /// Storage: `Messages::Messages` (r:1 w:1) + /// Proof: `Messages::Messages` (`max_values`: None, `max_size`: Some(618624), added: 621099, mode: `Measured`) + /// The range of component `n` is `[0, 3071]`. fn add_onchain_message(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `7339` - // Estimated: `19714` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(179_112_822, 19714) - // Standard Error: 35 - .saturating_add(Weight::from_parts(459, 0).saturating_mul(n.into())) + // Measured: `9623` + // Estimated: `21998` + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(48_931_384, 21998) + // Standard Error: 358 + .saturating_add(Weight::from_parts(560, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: Schemas Schemas (r:1 w:0) - /// Proof: Schemas Schemas (max_values: None, max_size: Some(65518), added: 67993, mode: Measured) - /// Storage: Msa PublicKeyToMsaId (r:1 w:0) - /// Proof: Msa PublicKeyToMsaId (max_values: None, max_size: Some(48), added: 2523, mode: Measured) - /// Storage: Messages Messages (r:1 w:1) - /// Proof: Messages Messages (max_values: None, max_size: Some(771174), added: 773649, mode: Measured) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `Measured`) + /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) + /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `Measured`) + /// Storage: `Messages::Messages` (r:1 w:1) + /// Proof: `Messages::Messages` (`max_values`: None, `max_size`: Some(618624), added: 621099, mode: `Measured`) fn add_ipfs_message() -> Weight { // Proof Size summary in bytes: - // Measured: `6183` - // Estimated: `18558` - // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(174_485_000, 18558) + // Measured: `7833` + // Estimated: `20208` + // Minimum execution time: 44_000_000 picoseconds. + Weight::from_parts(48_000_000, 20208) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -95,38 +95,38 @@ impl WeightInfo for SubstrateWeight { // For backwards compatibility and tests impl WeightInfo for () { - /// Storage: Schemas Schemas (r:1 w:0) - /// Proof: Schemas Schemas (max_values: None, max_size: Some(65518), added: 67993, mode: Measured) - /// Storage: Msa PublicKeyToMsaId (r:1 w:0) - /// Proof: Msa PublicKeyToMsaId (max_values: None, max_size: Some(48), added: 2523, mode: Measured) - /// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:0) - /// Proof: Msa DelegatorAndProviderToDelegation (max_values: None, max_size: Some(217), added: 2692, mode: Measured) - /// Storage: Messages Messages (r:1 w:1) - /// Proof: Messages Messages (max_values: None, max_size: Some(771174), added: 773649, mode: Measured) - /// The range of component `n` is `[0, 5119]`. + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `Measured`) + /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) + /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `Measured`) + /// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0) + /// Proof: `Msa::DelegatorAndProviderToDelegation` (`max_values`: None, `max_size`: Some(217), added: 2692, mode: `Measured`) + /// Storage: `Messages::Messages` (r:1 w:1) + /// Proof: `Messages::Messages` (`max_values`: None, `max_size`: Some(618624), added: 621099, mode: `Measured`) + /// The range of component `n` is `[0, 3071]`. fn add_onchain_message(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `7339` - // Estimated: `19714` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(179_112_822, 19714) - // Standard Error: 35 - .saturating_add(Weight::from_parts(459, 0).saturating_mul(n.into())) + // Measured: `9623` + // Estimated: `21998` + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(48_931_384, 21998) + // Standard Error: 358 + .saturating_add(Weight::from_parts(560, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: Schemas Schemas (r:1 w:0) - /// Proof: Schemas Schemas (max_values: None, max_size: Some(65518), added: 67993, mode: Measured) - /// Storage: Msa PublicKeyToMsaId (r:1 w:0) - /// Proof: Msa PublicKeyToMsaId (max_values: None, max_size: Some(48), added: 2523, mode: Measured) - /// Storage: Messages Messages (r:1 w:1) - /// Proof: Messages Messages (max_values: None, max_size: Some(771174), added: 773649, mode: Measured) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `Measured`) + /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) + /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `Measured`) + /// Storage: `Messages::Messages` (r:1 w:1) + /// Proof: `Messages::Messages` (`max_values`: None, `max_size`: Some(618624), added: 621099, mode: `Measured`) fn add_ipfs_message() -> Weight { // Proof Size summary in bytes: - // Measured: `6183` - // Estimated: `18558` - // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(174_485_000, 18558) + // Measured: `7833` + // Estimated: `20208` + // Minimum execution time: 44_000_000 picoseconds. + Weight::from_parts(48_000_000, 20208) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/pallets/schemas/Cargo.toml b/pallets/schemas/Cargo.toml index 2044460967..647d80dfdd 100644 --- a/pallets/schemas/Cargo.toml +++ b/pallets/schemas/Cargo.toml @@ -17,6 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } +log = { version = "0.4.17", default-features = false } frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v1.0.0" } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } diff --git a/pallets/schemas/src/benchmarking.rs b/pallets/schemas/src/benchmarking.rs index aebf8da2a7..b968ebee9a 100644 --- a/pallets/schemas/src/benchmarking.rs +++ b/pallets/schemas/src/benchmarking.rs @@ -42,7 +42,7 @@ benchmarks! { }: _(RawOrigin::Signed(sender), schema_input, model_type, payload_location) verify { ensure!(SchemasPallet::::get_current_schema_identifier_maximum() > 0, "Created schema count should be > 0"); - ensure!(SchemasPallet::::get_schema(1).is_some(), "Created schema should exist"); + ensure!(SchemasPallet::::get_schema_info(1).is_some(), "Created schema should exist"); } create_schema_via_governance { @@ -55,7 +55,7 @@ benchmarks! { }: _(RawOrigin::Root, sender.clone(), schema_input, model_type, payload_location, BoundedVec::default()) verify { ensure!(SchemasPallet::::get_current_schema_identifier_maximum() > 0, "Created schema count should be > 0"); - ensure!(SchemasPallet::::get_schema(1).is_some(), "Created schema should exist"); + ensure!(SchemasPallet::::get_schema_info(1).is_some(), "Created schema should exist"); } propose_to_create_schema { @@ -80,7 +80,7 @@ benchmarks! { }: _(RawOrigin::Signed(sender), schema_input, model_type, payload_location, BoundedVec::default()) verify { ensure!(SchemasPallet::::get_current_schema_identifier_maximum() > 0, "Created schema count should be > 0"); - ensure!(SchemasPallet::::get_schema(1).is_some(), "Created schema should exist"); + ensure!(SchemasPallet::::get_schema_info(1).is_some(), "Created schema should exist"); } set_max_schema_model_bytes { diff --git a/pallets/schemas/src/lib.rs b/pallets/schemas/src/lib.rs index 6a2d6c6575..c7e0c03ae8 100644 --- a/pallets/schemas/src/lib.rs +++ b/pallets/schemas/src/lib.rs @@ -75,6 +75,7 @@ mod tests; mod benchmarking; #[cfg(feature = "runtime-benchmarks")] use common_primitives::benchmarks::SchemaBenchmarkHelper; +use common_primitives::schema::SchemaInfoResponse; mod types; @@ -197,13 +198,34 @@ pub mod pallet { OptionQuery, >; + /// Storage for message schema info struct data + /// - Key: Schema Id + /// - Value: [`SchemaInfo`](SchemaInfo) + #[pallet::storage] + #[pallet::getter(fn get_schema_info)] + pub(super) type SchemaInfos = + StorageMap<_, Twox64Concat, SchemaId, SchemaInfo, OptionQuery>; + + /// Storage for message schema struct data + /// - Key: Schema Id + /// - Value: [`BoundedVec`](BoundedVec) + #[pallet::storage] + #[pallet::getter(fn get_schema_payload)] + pub(super) type SchemaPayloads = StorageMap< + _, + Twox64Concat, + SchemaId, + BoundedVec, + OptionQuery, + >; + #[pallet::genesis_config] pub struct GenesisConfig { /// Maximum schema size in bytes at genesis pub initial_max_schema_model_size: u32, /// Phantom type #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: PhantomData, } impl sp_std::default::Default for GenesisConfig { @@ -398,23 +420,46 @@ pub mod pallet { set_settings.set(i); } } - let schema = Schema { model_type, model, payload_location, settings: set_settings }; + let schema_info = SchemaInfo { model_type, payload_location, settings: set_settings }; >::set(schema_id); - >::insert(schema_id, schema); + >::insert(schema_id, schema_info); + >::insert(schema_id, model); Ok(schema_id) } /// Retrieve a schema by id pub fn get_schema_by_id(schema_id: SchemaId) -> Option { - if let Some(schema) = Self::get_schema(schema_id) { - let model_vec: Vec = schema.model.into_inner(); - let saved_settings = schema.settings; + match (Self::get_schema_info(schema_id), Self::get_schema_payload(schema_id)) { + (Some(schema_info), Some(payload)) => { + let model_vec: Vec = payload.into_inner(); + let saved_settings = schema_info.settings; + let settings = saved_settings.0.iter().collect::>(); + let response = SchemaResponse { + schema_id, + model: model_vec, + model_type: schema_info.model_type, + payload_location: schema_info.payload_location, + settings, + }; + Some(response) + }, + (None, Some(_)) | (Some(_), None) => { + log::error!("Corrupted state for schema {:?}, Should never happen!", schema_id); + None + }, + (None, None) => None, + } + } + + /// Retrieve a schema info by id + pub fn get_schema_info_by_id(schema_id: SchemaId) -> Option { + if let Some(schema_info) = Self::get_schema_info(schema_id) { + let saved_settings = schema_info.settings; let settings = saved_settings.0.iter().collect::>(); - let response = SchemaResponse { + let response = SchemaInfoResponse { schema_id, - model: model_vec, - model_type: schema.model_type, - payload_location: schema.payload_location, + model_type: schema_info.model_type, + payload_location: schema_info.payload_location, settings, }; return Some(response) @@ -532,4 +577,8 @@ impl SchemaProvider for Pallet { fn get_schema_by_id(schema_id: SchemaId) -> Option { Self::get_schema_by_id(schema_id) } + + fn get_schema_info_by_id(schema_id: SchemaId) -> Option { + Self::get_schema_info_by_id(schema_id) + } } diff --git a/pallets/schemas/src/types.rs b/pallets/schemas/src/types.rs index e0a99af945..13bbff7716 100644 --- a/pallets/schemas/src/types.rs +++ b/pallets/schemas/src/types.rs @@ -28,3 +28,14 @@ where /// additional control settings for the schema pub settings: SchemaSettings, } + +#[derive(Clone, Encode, Decode, PartialEq, Debug, TypeInfo, Eq, MaxEncodedLen)] +/// A structure defining a Schema information (excluding the payload) +pub struct SchemaInfo { + /// The type of model (AvroBinary, Parquet, etc.) + pub model_type: ModelType, + /// The payload location + pub payload_location: PayloadLocation, + /// additional control settings for the schema + pub settings: SchemaSettings, +} diff --git a/pallets/schemas/src/weights.rs b/pallets/schemas/src/weights.rs index faffb78dcd..2d113d9cbf 100644 --- a/pallets/schemas/src/weights.rs +++ b/pallets/schemas/src/weights.rs @@ -18,13 +18,13 @@ //! Autogenerated weights for pallet_schemas //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-10-23, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-10-25, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `benchmark-runner-44wtw-wh5db`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! HOSTNAME: `AramikMarkarianNewMacBookPro.local`, CPU: `` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("frequency-bench"), DB CACHE: 1024 // Executed Command: -// ./scripts/../target/release/frequency +// ./scripts/../target/bench-dev/frequency // benchmark // pallet // --pallet=pallet_schemas @@ -63,37 +63,41 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Schemas::GovernanceSchemaModelMaxBytes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Schemas::CurrentSchemaIdentifierMaximum` (r:1 w:1) /// Proof: `Schemas::CurrentSchemaIdentifierMaximum` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:0 w:1) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: Some(65518), added: 67993, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaInfos` (r:0 w:1) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaPayloads` (r:0 w:1) + /// Proof: `Schemas::SchemaPayloads` (`max_values`: None, `max_size`: Some(65514), added: 67989, mode: `MaxEncodedLen`) /// The range of component `m` is `[16, 65499]`. fn create_schema(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `10399` - // Minimum execution time: 14_247_000 picoseconds. - Weight::from_parts(70_723_144, 10399) - // Standard Error: 1_141 - .saturating_add(Weight::from_parts(36_724, 0).saturating_mul(m.into())) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(19_699_735, 10399) + // Standard Error: 38 + .saturating_add(Weight::from_parts(33_567, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `Schemas::GovernanceSchemaModelMaxBytes` (r:1 w:0) /// Proof: `Schemas::GovernanceSchemaModelMaxBytes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Schemas::CurrentSchemaIdentifierMaximum` (r:1 w:1) /// Proof: `Schemas::CurrentSchemaIdentifierMaximum` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:0 w:1) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: Some(65518), added: 67993, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaInfos` (r:0 w:1) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaPayloads` (r:0 w:1) + /// Proof: `Schemas::SchemaPayloads` (`max_values`: None, `max_size`: Some(65514), added: 67989, mode: `MaxEncodedLen`) /// The range of component `m` is `[16, 65499]`. fn create_schema_via_governance(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `10399` - // Minimum execution time: 13_915_000 picoseconds. - Weight::from_parts(14_145_000, 10399) - // Standard Error: 107 - .saturating_add(Weight::from_parts(35_578, 0).saturating_mul(m.into())) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(16_019_348, 10399) + // Standard Error: 40 + .saturating_add(Weight::from_parts(33_685, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `Council::Members` (r:1 w:0) /// Proof: `Council::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -110,10 +114,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `230` // Estimated: `12605` - // Minimum execution time: 21_821_000 picoseconds. - Weight::from_parts(9_711_070, 12605) - // Standard Error: 41 - .saturating_add(Weight::from_parts(3_289, 0).saturating_mul(m.into())) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(19_576_769, 12605) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_662, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -121,19 +125,21 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Schemas::GovernanceSchemaModelMaxBytes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Schemas::CurrentSchemaIdentifierMaximum` (r:1 w:1) /// Proof: `Schemas::CurrentSchemaIdentifierMaximum` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:0 w:1) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: Some(65518), added: 67993, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaInfos` (r:0 w:1) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaPayloads` (r:0 w:1) + /// Proof: `Schemas::SchemaPayloads` (`max_values`: None, `max_size`: Some(65514), added: 67989, mode: `MaxEncodedLen`) /// The range of component `m` is `[16, 65499]`. fn create_schema_v2(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `10399` - // Minimum execution time: 14_318_000 picoseconds. - Weight::from_parts(14_442_000, 10399) - // Standard Error: 76 - .saturating_add(Weight::from_parts(35_708, 0).saturating_mul(m.into())) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(22_363_353, 10399) + // Standard Error: 61 + .saturating_add(Weight::from_parts(33_609, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `Schemas::GovernanceSchemaModelMaxBytes` (r:0 w:1) /// Proof: `Schemas::GovernanceSchemaModelMaxBytes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -141,8 +147,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_742_000 picoseconds. - Weight::from_parts(7_240_000, 0) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -153,37 +159,41 @@ impl WeightInfo for () { /// Proof: `Schemas::GovernanceSchemaModelMaxBytes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Schemas::CurrentSchemaIdentifierMaximum` (r:1 w:1) /// Proof: `Schemas::CurrentSchemaIdentifierMaximum` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:0 w:1) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: Some(65518), added: 67993, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaInfos` (r:0 w:1) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaPayloads` (r:0 w:1) + /// Proof: `Schemas::SchemaPayloads` (`max_values`: None, `max_size`: Some(65514), added: 67989, mode: `MaxEncodedLen`) /// The range of component `m` is `[16, 65499]`. fn create_schema(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `10399` - // Minimum execution time: 14_247_000 picoseconds. - Weight::from_parts(70_723_144, 10399) - // Standard Error: 1_141 - .saturating_add(Weight::from_parts(36_724, 0).saturating_mul(m.into())) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(19_699_735, 10399) + // Standard Error: 38 + .saturating_add(Weight::from_parts(33_567, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: `Schemas::GovernanceSchemaModelMaxBytes` (r:1 w:0) /// Proof: `Schemas::GovernanceSchemaModelMaxBytes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Schemas::CurrentSchemaIdentifierMaximum` (r:1 w:1) /// Proof: `Schemas::CurrentSchemaIdentifierMaximum` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:0 w:1) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: Some(65518), added: 67993, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaInfos` (r:0 w:1) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaPayloads` (r:0 w:1) + /// Proof: `Schemas::SchemaPayloads` (`max_values`: None, `max_size`: Some(65514), added: 67989, mode: `MaxEncodedLen`) /// The range of component `m` is `[16, 65499]`. fn create_schema_via_governance(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `10399` - // Minimum execution time: 13_915_000 picoseconds. - Weight::from_parts(14_145_000, 10399) - // Standard Error: 107 - .saturating_add(Weight::from_parts(35_578, 0).saturating_mul(m.into())) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(16_019_348, 10399) + // Standard Error: 40 + .saturating_add(Weight::from_parts(33_685, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: `Council::Members` (r:1 w:0) /// Proof: `Council::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -200,10 +210,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `230` // Estimated: `12605` - // Minimum execution time: 21_821_000 picoseconds. - Weight::from_parts(9_711_070, 12605) - // Standard Error: 41 - .saturating_add(Weight::from_parts(3_289, 0).saturating_mul(m.into())) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(19_576_769, 12605) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_662, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -211,19 +221,21 @@ impl WeightInfo for () { /// Proof: `Schemas::GovernanceSchemaModelMaxBytes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Schemas::CurrentSchemaIdentifierMaximum` (r:1 w:1) /// Proof: `Schemas::CurrentSchemaIdentifierMaximum` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:0 w:1) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: Some(65518), added: 67993, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaInfos` (r:0 w:1) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Schemas::SchemaPayloads` (r:0 w:1) + /// Proof: `Schemas::SchemaPayloads` (`max_values`: None, `max_size`: Some(65514), added: 67989, mode: `MaxEncodedLen`) /// The range of component `m` is `[16, 65499]`. fn create_schema_v2(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `10399` - // Minimum execution time: 14_318_000 picoseconds. - Weight::from_parts(14_442_000, 10399) - // Standard Error: 76 - .saturating_add(Weight::from_parts(35_708, 0).saturating_mul(m.into())) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(22_363_353, 10399) + // Standard Error: 61 + .saturating_add(Weight::from_parts(33_609, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: `Schemas::GovernanceSchemaModelMaxBytes` (r:0 w:1) /// Proof: `Schemas::GovernanceSchemaModelMaxBytes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -231,8 +243,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_742_000 picoseconds. - Weight::from_parts(7_240_000, 0) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/pallets/stateful-storage/src/lib.rs b/pallets/stateful-storage/src/lib.rs index 31e02a9253..4c3dd6a513 100644 --- a/pallets/stateful-storage/src/lib.rs +++ b/pallets/stateful-storage/src/lib.rs @@ -73,7 +73,7 @@ use common_primitives::{ DelegatorId, MessageSourceId, MsaLookup, MsaValidator, ProviderId, SchemaGrantValidator, }, node::Verify, - schema::{PayloadLocation, SchemaId, SchemaProvider, SchemaResponse, SchemaSetting}, + schema::{PayloadLocation, SchemaId, SchemaInfoResponse, SchemaProvider, SchemaSetting}, stateful_storage::{ ItemizedStoragePageResponse, ItemizedStorageResponse, PageHash, PageId, PaginatedStorageResponse, @@ -697,9 +697,9 @@ impl Pallet { fn check_schema_for_read( schema_id: SchemaId, expected_payload_location: PayloadLocation, - ) -> Result { - let schema = - T::SchemaProvider::get_schema_by_id(schema_id).ok_or(Error::::InvalidSchemaId)?; + ) -> Result { + let schema = T::SchemaProvider::get_schema_info_by_id(schema_id) + .ok_or(Error::::InvalidSchemaId)?; // Ensure that the schema's payload location matches the expected location. ensure!( diff --git a/pallets/stateful-storage/src/tests/mock.rs b/pallets/stateful-storage/src/tests/mock.rs index abfce4f839..aff6be3370 100644 --- a/pallets/stateful-storage/src/tests/mock.rs +++ b/pallets/stateful-storage/src/tests/mock.rs @@ -11,7 +11,10 @@ use common_primitives::{ ProviderId, ProviderLookup, SchemaGrantValidator, }, node::AccountId, - schema::{ModelType, PayloadLocation, SchemaId, SchemaProvider, SchemaResponse, SchemaSetting}, + schema::{ + ModelType, PayloadLocation, SchemaId, SchemaInfoResponse, SchemaProvider, SchemaResponse, + SchemaSetting, + }, }; use frame_support::{ dispatch::DispatchResult, @@ -251,6 +254,17 @@ impl SchemaProvider for SchemaHandler { }), } } + + fn get_schema_info_by_id(schema_id: SchemaId) -> Option { + Self::get_schema_by_id(schema_id).and_then(|schema| { + Some(SchemaInfoResponse { + schema_id: schema.schema_id, + settings: schema.settings, + model_type: schema.model_type, + payload_location: schema.payload_location, + }) + }) + } } impl Clone for MaxPaginatedPageId { diff --git a/pallets/stateful-storage/src/weights.rs b/pallets/stateful-storage/src/weights.rs index 2454332792..b89511fb3c 100644 --- a/pallets/stateful-storage/src/weights.rs +++ b/pallets/stateful-storage/src/weights.rs @@ -18,13 +18,13 @@ //! Autogenerated weights for pallet_stateful_storage //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-10-10, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-10-25, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `benchmark-runner-44wtw-4nbbq`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! HOSTNAME: `AramikMarkarianNewMacBookPro.local`, CPU: `` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("frequency-bench"), DB CACHE: 1024 // Executed Command: -// ./scripts/../target/release/frequency +// ./scripts/../target/bench-dev/frequency // benchmark // pallet // --pallet=pallet_stateful-storage @@ -60,8 +60,8 @@ pub trait WeightInfo { /// Weights for pallet_stateful_storage using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0) @@ -71,17 +71,17 @@ impl WeightInfo for SubstrateWeight { /// The range of component `s` is `[1, 5121]`. fn apply_item_actions(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `33370` - // Estimated: `45745` - // Minimum execution time: 96_061_000 picoseconds. - Weight::from_parts(94_653_993, 45745) - // Standard Error: 393 - .saturating_add(Weight::from_parts(7_470, 0).saturating_mul(s.into())) + // Measured: `33346` + // Estimated: `45721` + // Minimum execution time: 72_000_000 picoseconds. + Weight::from_parts(79_317_723, 45721) + // Standard Error: 495 + .saturating_add(Weight::from_parts(3_179, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0) @@ -91,17 +91,17 @@ impl WeightInfo for SubstrateWeight { /// The range of component `s` is `[1, 1024]`. fn upsert_page(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `416` - // Estimated: `12791` - // Minimum execution time: 30_016_000 picoseconds. - Weight::from_parts(31_656_787, 12791) - // Standard Error: 218 - .saturating_add(Weight::from_parts(12, 0).saturating_mul(s.into())) + // Measured: `392` + // Estimated: `12767` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_689_993, 12767) + // Standard Error: 240 + .saturating_add(Weight::from_parts(670, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0) @@ -110,61 +110,59 @@ impl WeightInfo for SubstrateWeight { /// Proof: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) fn delete_page() -> Weight { // Proof Size summary in bytes: - // Measured: `1575` - // Estimated: `13950` - // Minimum execution time: 37_076_000 picoseconds. - Weight::from_parts(38_198_000, 13950) + // Measured: `1551` + // Estimated: `13926` + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_000_000, 13926) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0xbd1557c8db6bd8599a811a7175fbc2fc6400` (r:1 w:1) /// Proof: UNKNOWN KEY `0xbd1557c8db6bd8599a811a7175fbc2fc6400` (r:1 w:1) /// The range of component `s` is `[1, 5121]`. fn apply_item_actions_with_signature(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `33377` - // Estimated: `45752` - // Minimum execution time: 157_055_000 picoseconds. - Weight::from_parts(158_666_683, 45752) - // Standard Error: 849 - .saturating_add(Weight::from_parts(13_079, 0).saturating_mul(s.into())) + // Measured: `33353` + // Estimated: `45728` + // Minimum execution time: 108_000_000 picoseconds. + Weight::from_parts(109_366_646, 45728) + // Standard Error: 645 + .saturating_add(Weight::from_parts(11_660, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) /// Proof: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) /// The range of component `s` is `[1, 1024]`. - fn upsert_page_with_signature(s: u32, ) -> Weight { + fn upsert_page_with_signature(_s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `349` - // Estimated: `12724` - // Minimum execution time: 84_073_000 picoseconds. - Weight::from_parts(86_255_728, 12724) - // Standard Error: 566 - .saturating_add(Weight::from_parts(7_183, 0).saturating_mul(s.into())) + // Measured: `325` + // Estimated: `12700` + // Minimum execution time: 64_000_000 picoseconds. + Weight::from_parts(73_626_300, 12700) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) /// Proof: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) fn delete_page_with_signature() -> Weight { // Proof Size summary in bytes: - // Measured: `1508` - // Estimated: `13883` - // Minimum execution time: 86_499_000 picoseconds. - Weight::from_parts(88_747_000, 13883) + // Measured: `1484` + // Estimated: `13859` + // Minimum execution time: 65_000_000 picoseconds. + Weight::from_parts(67_000_000, 13859) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -172,8 +170,8 @@ impl WeightInfo for SubstrateWeight { // For backwards compatibility and tests impl WeightInfo for () { - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0) @@ -183,17 +181,17 @@ impl WeightInfo for () { /// The range of component `s` is `[1, 5121]`. fn apply_item_actions(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `33370` - // Estimated: `45745` - // Minimum execution time: 96_061_000 picoseconds. - Weight::from_parts(94_653_993, 45745) - // Standard Error: 393 - .saturating_add(Weight::from_parts(7_470, 0).saturating_mul(s.into())) + // Measured: `33346` + // Estimated: `45721` + // Minimum execution time: 72_000_000 picoseconds. + Weight::from_parts(79_317_723, 45721) + // Standard Error: 495 + .saturating_add(Weight::from_parts(3_179, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0) @@ -203,17 +201,17 @@ impl WeightInfo for () { /// The range of component `s` is `[1, 1024]`. fn upsert_page(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `416` - // Estimated: `12791` - // Minimum execution time: 30_016_000 picoseconds. - Weight::from_parts(31_656_787, 12791) - // Standard Error: 218 - .saturating_add(Weight::from_parts(12, 0).saturating_mul(s.into())) + // Measured: `392` + // Estimated: `12767` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_689_993, 12767) + // Standard Error: 240 + .saturating_add(Weight::from_parts(670, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0) @@ -222,61 +220,59 @@ impl WeightInfo for () { /// Proof: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) fn delete_page() -> Weight { // Proof Size summary in bytes: - // Measured: `1575` - // Estimated: `13950` - // Minimum execution time: 37_076_000 picoseconds. - Weight::from_parts(38_198_000, 13950) + // Measured: `1551` + // Estimated: `13926` + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_000_000, 13926) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0xbd1557c8db6bd8599a811a7175fbc2fc6400` (r:1 w:1) /// Proof: UNKNOWN KEY `0xbd1557c8db6bd8599a811a7175fbc2fc6400` (r:1 w:1) /// The range of component `s` is `[1, 5121]`. fn apply_item_actions_with_signature(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `33377` - // Estimated: `45752` - // Minimum execution time: 157_055_000 picoseconds. - Weight::from_parts(158_666_683, 45752) - // Standard Error: 849 - .saturating_add(Weight::from_parts(13_079, 0).saturating_mul(s.into())) + // Measured: `33353` + // Estimated: `45728` + // Minimum execution time: 108_000_000 picoseconds. + Weight::from_parts(109_366_646, 45728) + // Standard Error: 645 + .saturating_add(Weight::from_parts(11_660, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) /// Proof: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) /// The range of component `s` is `[1, 1024]`. - fn upsert_page_with_signature(s: u32, ) -> Weight { + fn upsert_page_with_signature(_s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `349` - // Estimated: `12724` - // Minimum execution time: 84_073_000 picoseconds. - Weight::from_parts(86_255_728, 12724) - // Standard Error: 566 - .saturating_add(Weight::from_parts(7_183, 0).saturating_mul(s.into())) + // Measured: `325` + // Estimated: `12700` + // Minimum execution time: 64_000_000 picoseconds. + Weight::from_parts(73_626_300, 12700) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0) /// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `Schemas::Schemas` (r:1 w:0) - /// Proof: `Schemas::Schemas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Schemas::SchemaInfos` (r:1 w:0) + /// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) /// Proof: UNKNOWN KEY `0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1` (r:1 w:1) fn delete_page_with_signature() -> Weight { // Proof Size summary in bytes: - // Measured: `1508` - // Estimated: `13883` - // Minimum execution time: 86_499_000 picoseconds. - Weight::from_parts(88_747_000, 13883) + // Measured: `1484` + // Estimated: `13859` + // Minimum execution time: 65_000_000 picoseconds. + Weight::from_parts(67_000_000, 13859) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) }