diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0b1464bae23e..90298297a89c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,23 +48,39 @@ variables: CARGO_INCREMENTAL: 0 DOCKER_OS: "debian:stretch" ARCH: "x86_64" - CI_IMAGE: "paritytech/ci-linux:production" + CI_IMAGE: "paritytech/ci-linux@sha256:9140bc3c843a8b12a3bcf6f5886346536092795bbadfd7f1836362cb28dfcc71" BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27" RUSTY_CACHIER_SINGLE_BRANCH: master RUSTY_CACHIER_DONT_OPERATE_ON_MAIN_BRANCH: "true" RUSTY_CACHIER_COMPRESSION_METHOD: zstd + NEXTEST_FAILURE_OUTPUT: immediate-final + NEXTEST_SUCCESS_OUTPUT: final ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.22" -default: +.shared-default: &shared-default retry: max: 2 when: - runner_system_failure - unknown_failure - api_failure - interruptible: true cache: {} +.default-pipeline-definitions: + default: + <<: *shared-default + interruptible: true + +.crate-publishing-pipeline-definitions: + default: + <<: *shared-default + # The crate-publishing pipeline defaults to `interruptible: false` so that we'll be able to + # reach and run the publishing jobs despite the "Auto-cancel redundant pipelines" CI setting. + # The setting is relevant because the crate-publishing pipeline runs on `master`, thus future + # pipelines on `master` (e.g. created for new commits or other schedules) might unintendedly + # cancel the publishing jobs or its dependencies before we get to actually publish the crates. + interruptible: false + .collect-artifacts: artifacts: name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" @@ -213,9 +229,15 @@ default: # this job runs only on nightly pipeline with the mentioned variable, against `master` branch - if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "nightly" +.crate-publishing-pipeline: + rules: + - if: $CI_COMMIT_REF_NAME != "master" + when: never + .scheduled-crate-publishing-pipeline: rules: - - if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "automatic-crate-publishing" + - !reference [.crate-publishing-pipeline, rules] + - if: $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "automatic-crate-publishing" .crates-publishing-template: stage: test @@ -263,6 +285,22 @@ include: - scripts/ci/gitlab/pipeline/publish.yml # zombienet jobs - scripts/ci/gitlab/pipeline/zombienet.yml + # The crate-publishing pipeline requires a customized `interruptible` configuration. Unfortunately + # `interruptible` can't currently be dynamically set based on variables as per: + # - https://gitlab.com/gitlab-org/gitlab/-/issues/38349 + # - https://gitlab.com/gitlab-org/gitlab/-/issues/194023 + # Thus we work around that limitation by using conditional includes. + # For crate-publishing pipelines: run it with defaults + `interruptible: false`. The WHOLE + # pipeline is made uninterruptible to ensure that test jobs also get a chance to run to + # completion, because the publishing jobs depends on them AS INTENDED: crates should not be + # published before their source code is checked. + - local: scripts/ci/gitlab/crate-publishing-pipeline.yml + rules: + - if: $PIPELINE == "automatic-crate-publishing" + # For normal pipelines: run it with defaults + `interruptible: true` + - local: scripts/ci/gitlab/default-pipeline.yml + rules: + - if: $PIPELINE != "automatic-crate-publishing" #### stage: deploy diff --git a/Cargo.lock b/Cargo.lock index d333b79c8c403..68c144b3f177e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2028,9 +2028,9 @@ dependencies = [ [[package]] name = "finality-grandpa" -version = "0.16.0" +version = "0.16.1" source = "registry+/~https://github.com/rust-lang/crates.io-index" -checksum = "b22349c6a11563a202d95772a68e0fcf56119e74ea8a2a19cf2301460fcd0df5" +checksum = "e24e6c429951433ccb7c87fd528c60084834dcd14763182c1f83291bcde24c34" dependencies = [ "either", "futures", @@ -2705,9 +2705,9 @@ checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" [[package]] name = "git2" -version = "0.14.4" +version = "0.16.0" source = "registry+/~https://github.com/rust-lang/crates.io-index" -checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c" +checksum = "be36bc9e0546df253c0cc41fd0af34f5e92845ad8509462ec76672fac6997f5b" dependencies = [ "bitflags", "libc", @@ -3570,9 +3570,9 @@ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libgit2-sys" -version = "0.13.4+1.4.2" +version = "0.14.1+1.5.0" source = "registry+/~https://github.com/rust-lang/crates.io-index" -checksum = "d0fa6563431ede25f5cc7f6d803c6afbc1c5d3ad3d4925d12c882bf2b526f5d1" +checksum = "4a07fb2692bc3593bda59de45a502bb3071659f2c515e28c71e728306b038e17" dependencies = [ "cc", "libc", @@ -11387,9 +11387,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.73" +version = "1.0.74" source = "registry+/~https://github.com/rust-lang/crates.io-index" -checksum = "ed01de3de062db82c0920b5cabe804f88d599a3f217932292597c678c903754d" +checksum = "654bfc024d30963fce210f22f98956407fe8c8365eb85a1fa530f6f8844137ed" dependencies = [ "dissimilar", "glob", diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index 1a3c5bd84223b..5dc7b03d39a81 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -51,7 +51,7 @@ frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, p pallet-template = { version = "4.0.0-dev", default-features = false, path = "../pallets/template" } [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder" } +substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder", optional = true } [features] default = ["std"] @@ -86,6 +86,7 @@ std = [ "sp-std/std", "sp-transaction-pool/std", "sp-version/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/bin/node-template/runtime/build.rs b/bin/node-template/runtime/build.rs index 9b53d2457dffd..c03d618535be0 100644 --- a/bin/node-template/runtime/build.rs +++ b/bin/node-template/runtime/build.rs @@ -1,9 +1,10 @@ -use substrate_wasm_builder::WasmBuilder; - fn main() { - WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .build() + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .build(); + } } diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 201e3a85f8941..7037be9d7c54d 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -113,7 +113,7 @@ pallet-vesting = { version = "4.0.0-dev", default-features = false, path = "../. pallet-whitelist = { version = "4.0.0-dev", default-features = false, path = "../../../frame/whitelist" } [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder" } +substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder", optional = true } [features] default = ["std"] @@ -205,6 +205,7 @@ std = [ "sp-io/std", "pallet-child-bounties/std", "pallet-alliance/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/bin/node/runtime/build.rs b/bin/node/runtime/build.rs index b773ed9cf6fb7..70f84bc00a817 100644 --- a/bin/node/runtime/build.rs +++ b/bin/node/runtime/build.rs @@ -15,12 +15,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use substrate_wasm_builder::WasmBuilder; - fn main() { - WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .build() + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .build(); + } } diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index b48dfa369eb2d..8ec1403bb32d9 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -498,7 +498,7 @@ where warn!(target: "beefy", "🥩 Buffer vote dropped for round: {:?}", block_num) } } else { - error!(target: "beefy", "🥩 Buffer justification dropped for round: {:?}.", block_num); + warn!(target: "beefy", "🥩 Buffer vote dropped for round: {:?}.", block_num); } }, RoundAction::Drop => (), @@ -528,7 +528,7 @@ where if self.pending_justifications.len() < MAX_BUFFERED_JUSTIFICATIONS { self.pending_justifications.entry(block_num).or_insert(justification); } else { - error!(target: "beefy", "🥩 Buffer justification dropped for round: {:?}.", block_num); + warn!(target: "beefy", "🥩 Buffer justification dropped for round: {:?}.", block_num); } }, RoundAction::Drop => (), diff --git a/client/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs index 41c00169e5412..c9e171dbed887 100644 --- a/client/consensus/babe/src/lib.rs +++ b/client/consensus/babe/src/lib.rs @@ -111,7 +111,7 @@ use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_application_crypto::AppKey; use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::{ - Backend as _, Error as ClientError, ForkBackend, HeaderBackend, HeaderMetadata, + Backend as _, BlockStatus, Error as ClientError, ForkBackend, HeaderBackend, HeaderMetadata, Result as ClientResult, }; use sp_consensus::{ @@ -1133,11 +1133,17 @@ where let hash = block.header.hash(); let parent_hash = *block.header.parent_hash(); - if block.with_state() { - // When importing whole state we don't calculate epoch descriptor, but rather - // read it from the state after import. We also skip all verifications - // because there's no parent state and we trust the sync module to verify - // that the state is correct and finalized. + let info = self.client.info(); + let number = *block.header.number(); + + if info.block_gap.map_or(false, |(s, e)| s <= number && number <= e) || block.with_state() { + // Verification for imported blocks is skipped in two cases: + // 1. When importing blocks below the last finalized block during network initial + // synchronization. + // 2. When importing whole state we don't calculate epoch descriptor, but rather + // read it from the state after import. We also skip all verifications + // because there's no parent state and we trust the sync module to verify + // that the state is correct and finalized. return Ok((block, Default::default())) } @@ -1399,18 +1405,24 @@ where ) -> Result { let hash = block.post_hash(); let number = *block.header.number(); + let info = self.client.info(); - // early exit if block already in chain, otherwise the check for - // epoch changes will error when trying to re-import an epoch change - match self.client.status(hash) { - Ok(sp_blockchain::BlockStatus::InChain) => { - // When re-importing existing block strip away intermediates. - let _ = block.remove_intermediate::>(INTERMEDIATE_KEY); - block.fork_choice = Some(ForkChoiceStrategy::Custom(false)); - return self.inner.import_block(block, new_cache).await.map_err(Into::into) - }, - Ok(sp_blockchain::BlockStatus::Unknown) => {}, - Err(e) => return Err(ConsensusError::ClientImport(e.to_string())), + let block_status = self + .client + .status(hash) + .map_err(|e| ConsensusError::ClientImport(e.to_string()))?; + + // Skip babe logic if block already in chain or importing blocks during initial sync, + // otherwise the check for epoch changes will error because trying to re-import an + // epoch change or because of missing epoch data in the tree, respectivelly. + if info.block_gap.map_or(false, |(s, e)| s <= number && number <= e) || + block_status == BlockStatus::InChain + { + // When re-importing existing block strip away intermediates. + // In case of initial sync intermediates should not be present... + let _ = block.remove_intermediate::>(INTERMEDIATE_KEY); + block.fork_choice = Some(ForkChoiceStrategy::Custom(false)); + return self.inner.import_block(block, new_cache).await.map_err(Into::into) } if block.with_state() { @@ -1506,8 +1518,6 @@ where )), } - let info = self.client.info(); - if let Some(next_epoch_descriptor) = next_epoch_digest { old_epoch_changes = Some((*epoch_changes).clone()); @@ -1701,9 +1711,6 @@ where Client: HeaderBackend + HeaderMetadata, { let info = client.info(); - if info.block_gap.is_none() { - epoch_changes.clear_gap(); - } let finalized_slot = { let finalized_header = client diff --git a/client/consensus/epochs/src/lib.rs b/client/consensus/epochs/src/lib.rs index c213a49b8e4e4..7784a99437626 100644 --- a/client/consensus/epochs/src/lib.rs +++ b/client/consensus/epochs/src/lib.rs @@ -320,106 +320,6 @@ impl AsRef for IncrementedEpoch { } } -/// A pair of epochs for the gap block download validation. -/// Block gap is created after the warp sync is complete. Blocks -/// are imported both at the tip of the chain and at the start of the gap. -/// This holds a pair of epochs that are required to validate headers -/// at the start of the gap. Since gap download does not allow forks we don't -/// need to keep a tree of epochs. -#[derive(Clone, Encode, Decode, Debug)] -pub struct GapEpochs { - current: (Hash, Number, PersistedEpoch), - next: Option<(Hash, Number, E)>, -} - -impl GapEpochs -where - Hash: Copy + PartialEq + std::fmt::Debug, - Number: Copy + PartialEq + std::fmt::Debug, - E: Epoch, -{ - /// Check if given slot matches one of the gap epochs. - /// Returns epoch identifier if it does. - fn matches( - &self, - slot: E::Slot, - ) -> Option<(Hash, Number, EpochHeader, EpochIdentifierPosition)> { - match &self.current { - (_, _, PersistedEpoch::Genesis(epoch_0, _)) - if slot >= epoch_0.start_slot() && slot < epoch_0.end_slot() => - return Some(( - self.current.0, - self.current.1, - epoch_0.into(), - EpochIdentifierPosition::Genesis0, - )), - (_, _, PersistedEpoch::Genesis(_, epoch_1)) - if slot >= epoch_1.start_slot() && slot < epoch_1.end_slot() => - return Some(( - self.current.0, - self.current.1, - epoch_1.into(), - EpochIdentifierPosition::Genesis1, - )), - (_, _, PersistedEpoch::Regular(epoch_n)) - if slot >= epoch_n.start_slot() && slot < epoch_n.end_slot() => - return Some(( - self.current.0, - self.current.1, - epoch_n.into(), - EpochIdentifierPosition::Regular, - )), - _ => {}, - }; - match &self.next { - Some((h, n, epoch_n)) if slot >= epoch_n.start_slot() && slot < epoch_n.end_slot() => - Some((*h, *n, epoch_n.into(), EpochIdentifierPosition::Regular)), - _ => None, - } - } - - /// Returns epoch data if it matches given identifier. - pub fn epoch(&self, id: &EpochIdentifier) -> Option<&E> { - match (&self.current, &self.next) { - ((h, n, e), _) if h == &id.hash && n == &id.number => match e { - PersistedEpoch::Genesis(ref epoch_0, _) - if id.position == EpochIdentifierPosition::Genesis0 => - Some(epoch_0), - PersistedEpoch::Genesis(_, ref epoch_1) - if id.position == EpochIdentifierPosition::Genesis1 => - Some(epoch_1), - PersistedEpoch::Regular(ref epoch_n) - if id.position == EpochIdentifierPosition::Regular => - Some(epoch_n), - _ => None, - }, - (_, Some((h, n, e))) - if h == &id.hash && - n == &id.number && id.position == EpochIdentifierPosition::Regular => - Some(e), - _ => None, - } - } - - /// Import a new gap epoch, potentially replacing an old epoch. - fn import(&mut self, slot: E::Slot, hash: Hash, number: Number, epoch: E) -> Result<(), E> { - match (&mut self.current, &mut self.next) { - ((_, _, PersistedEpoch::Genesis(_, epoch_1)), _) if slot == epoch_1.end_slot() => { - self.next = Some((hash, number, epoch)); - Ok(()) - }, - (_, Some((_, _, epoch_n))) if slot == epoch_n.end_slot() => { - let (cur_h, cur_n, cur_epoch) = - self.next.take().expect("Already matched as `Some`"); - self.current = (cur_h, cur_n, PersistedEpoch::Regular(cur_epoch)); - self.next = Some((hash, number, epoch)); - Ok(()) - }, - _ => Err(epoch), - } - } -} - /// Tree of all epoch changes across all *seen* forks. Data stored in tree is /// the hash and block number of the block signaling the epoch change, and the /// epoch that was signalled at that block. @@ -435,14 +335,10 @@ where /// same DAG entry, pinned to a specific block #1. /// /// Further epochs (epoch_2, ..., epoch_n) each get their own entry. -/// -/// Also maintains a pair of epochs for the start of the gap, -/// as long as there's an active gap download after a warp sync. #[derive(Clone, Encode, Decode, Debug)] pub struct EpochChanges { inner: ForkTree>, epochs: BTreeMap<(Hash, Number), PersistedEpoch>, - gap: Option>, } // create a fake header hash which hasn't been included in the chain. @@ -460,7 +356,7 @@ where Number: Ord, { fn default() -> Self { - EpochChanges { inner: ForkTree::new(), epochs: BTreeMap::new(), gap: None } + EpochChanges { inner: ForkTree::new(), epochs: BTreeMap::new() } } } @@ -480,11 +376,6 @@ where self.inner.rebalance() } - /// Clear gap epochs if any. - pub fn clear_gap(&mut self) { - self.gap = None; - } - /// Map the epoch changes from one storing data to a different one. pub fn map(self, mut f: F) -> EpochChanges where @@ -493,10 +384,6 @@ where { EpochChanges { inner: self.inner.map(&mut |_, _, header: PersistedEpochHeader| header.map()), - gap: self.gap.map(|GapEpochs { current: (h, n, header), next }| GapEpochs { - current: (h, n, header.map(&h, &n, &mut f)), - next: next.map(|(h, n, e)| (h, n, f(&h, &n, e))), - }), epochs: self .epochs .into_iter() @@ -536,9 +423,6 @@ where /// Get a reference to an epoch with given identifier. pub fn epoch(&self, id: &EpochIdentifier) -> Option<&E> { - if let Some(e) = &self.gap.as_ref().and_then(|gap| gap.epoch(id)) { - return Some(e) - } self.epochs.get(&(id.hash, id.number)).and_then(|v| match v { PersistedEpoch::Genesis(ref epoch_0, _) if id.position == EpochIdentifierPosition::Genesis0 => @@ -665,15 +549,6 @@ where return Ok(Some(ViableEpochDescriptor::UnimportedGenesis(slot))) } - if let Some(gap) = &self.gap { - if let Some((hash, number, hdr, position)) = gap.matches(slot) { - return Ok(Some(ViableEpochDescriptor::Signaled( - EpochIdentifier { position, hash, number }, - hdr, - ))) - } - } - // find_node_where will give you the node in the fork-tree which is an ancestor // of the `parent_hash` by default. if the last epoch was signalled at the parent_hash, // then it won't be returned. we need to create a new fake chain head hash which @@ -744,28 +619,9 @@ where ) -> Result<(), fork_tree::Error> { let is_descendent_of = descendent_of_builder.build_is_descendent_of(Some((hash, parent_hash))); - let slot = epoch.as_ref().start_slot(); - let IncrementedEpoch(mut epoch) = epoch; + let IncrementedEpoch(epoch) = epoch; let header = PersistedEpochHeader::::from(&epoch); - if let Some(gap) = &mut self.gap { - if let PersistedEpoch::Regular(e) = epoch { - epoch = match gap.import(slot, hash, number, e) { - Ok(()) => return Ok(()), - Err(e) => PersistedEpoch::Regular(e), - } - } - } else if epoch.is_genesis() && - !self.epochs.is_empty() && - !self.epochs.values().any(|e| e.is_genesis()) - { - // There's a genesis epoch imported when we already have an active epoch. - // This happens after the warp sync as the ancient blocks download start. - // We need to start tracking gap epochs here. - self.gap = Some(GapEpochs { current: (hash, number, epoch), next: None }); - return Ok(()) - } - let res = self.inner.import(hash, number, header, &is_descendent_of); match res { @@ -1278,288 +1134,4 @@ mod tests { list.sort(); assert_eq!(list, vec![b"A", b"G", b"L"]); } - - /// Test that ensures that the gap is not enabled when we import multiple genesis blocks. - #[test] - fn gap_is_not_enabled_when_multiple_genesis_epochs_are_imported() { - // X - // / - // 0 - A - // - let is_descendent_of = |base: &Hash, block: &Hash| -> Result { - match (base, *block) { - (b"0", _) => Ok(true), - _ => Ok(false), - } - }; - - let duration = 100; - - let make_genesis = |slot| Epoch { start_slot: slot, duration }; - - let mut epoch_changes = EpochChanges::new(); - let next_descriptor = (); - - // insert genesis epoch for A - { - let genesis_epoch_a_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) - .unwrap() - .unwrap(); - - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_a_descriptor, &make_genesis) - .unwrap() - .increment(next_descriptor); - - epoch_changes - .import(&is_descendent_of, *b"A", 1, *b"0", incremented_epoch) - .unwrap(); - } - - // insert genesis epoch for X - { - let genesis_epoch_x_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 1000) - .unwrap() - .unwrap(); - - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_x_descriptor, &make_genesis) - .unwrap() - .increment(next_descriptor); - - epoch_changes - .import(&is_descendent_of, *b"X", 1, *b"0", incremented_epoch) - .unwrap(); - } - - // Clearing the gap should be a no-op. - epoch_changes.clear_gap(); - - // Check that both epochs are available. - let epoch_a = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"A", 1, 101, &make_genesis) - .unwrap() - .unwrap(); - - let epoch_x = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"X", 1, 1001, &make_genesis) - .unwrap() - .unwrap(); - - assert!(epoch_a != epoch_x) - } - - #[test] - fn gap_epochs_advance() { - // 0 - 1 - 2 - 3 - .... 42 - 43 - let is_descendent_of = |base: &Hash, block: &Hash| -> Result { - match (base, *block) { - (b"0", _) => Ok(true), - (b"1", b) => Ok(b == *b"0"), - (b"2", b) => Ok(b == *b"1"), - (b"3", b) => Ok(b == *b"2"), - _ => Ok(false), - } - }; - - let duration = 100; - - let make_genesis = |slot| Epoch { start_slot: slot, duration }; - - let mut epoch_changes = EpochChanges::new(); - let next_descriptor = (); - - let epoch42 = Epoch { start_slot: 42, duration: 100 }; - let epoch43 = Epoch { start_slot: 43, duration: 100 }; - epoch_changes.reset(*b"0", *b"1", 4200, epoch42, epoch43); - assert!(epoch_changes.gap.is_none()); - - // Import a new genesis epoch, this should crate the gap. - let genesis_epoch_a_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) - .unwrap() - .unwrap(); - - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_a_descriptor, &make_genesis) - .unwrap() - .increment(next_descriptor); - - epoch_changes - .import(&is_descendent_of, *b"1", 1, *b"0", incremented_epoch) - .unwrap(); - assert!(epoch_changes.gap.is_some()); - - let genesis_epoch = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) - .unwrap() - .unwrap(); - - assert_eq!(genesis_epoch, ViableEpochDescriptor::UnimportedGenesis(100)); - - // Import more epochs and check that gap advances. - let import_epoch_1 = - epoch_changes.viable_epoch(&genesis_epoch, &make_genesis).unwrap().increment(()); - - let epoch_1 = import_epoch_1.as_ref().clone(); - epoch_changes - .import(&is_descendent_of, *b"1", 1, *b"0", import_epoch_1) - .unwrap(); - let genesis_epoch_data = epoch_changes.epoch_data(&genesis_epoch, &make_genesis).unwrap(); - let end_slot = genesis_epoch_data.end_slot(); - let x = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"1", 1, end_slot, &make_genesis) - .unwrap() - .unwrap(); - - assert_eq!(x, epoch_1); - assert_eq!(epoch_changes.gap.as_ref().unwrap().current.0, *b"1"); - assert!(epoch_changes.gap.as_ref().unwrap().next.is_none()); - - let epoch_1_desriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"1", 1, end_slot) - .unwrap() - .unwrap(); - let epoch_1 = epoch_changes.epoch_data(&epoch_1_desriptor, &make_genesis).unwrap(); - let import_epoch_2 = epoch_changes - .viable_epoch(&epoch_1_desriptor, &make_genesis) - .unwrap() - .increment(()); - let epoch_2 = import_epoch_2.as_ref().clone(); - epoch_changes - .import(&is_descendent_of, *b"2", 2, *b"1", import_epoch_2) - .unwrap(); - - let end_slot = epoch_1.end_slot(); - let x = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"2", 2, end_slot, &make_genesis) - .unwrap() - .unwrap(); - assert_eq!(epoch_changes.gap.as_ref().unwrap().current.0, *b"1"); - assert_eq!(epoch_changes.gap.as_ref().unwrap().next.as_ref().unwrap().0, *b"2"); - assert_eq!(x, epoch_2); - - let epoch_2_desriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"2", 2, end_slot) - .unwrap() - .unwrap(); - let import_epoch_3 = epoch_changes - .viable_epoch(&epoch_2_desriptor, &make_genesis) - .unwrap() - .increment(()); - epoch_changes - .import(&is_descendent_of, *b"3", 3, *b"2", import_epoch_3) - .unwrap(); - - assert_eq!(epoch_changes.gap.as_ref().unwrap().current.0, *b"2"); - - epoch_changes.clear_gap(); - assert!(epoch_changes.gap.is_none()); - } - - /// Test that ensures that the gap is not enabled when there's still genesis - /// epochs imported, regardless of whether there are already other further - /// epochs imported descending from such genesis epochs. - #[test] - fn gap_is_not_enabled_when_at_least_one_genesis_epoch_is_still_imported() { - // A (#1) - B (#201) - // / - // 0 - C (#1) - // - // The epoch duration is 100 slots, each of these blocks represents - // an epoch change block. block B starts a new epoch at #201 since the - // genesis epoch spans two epochs. - - let is_descendent_of = |base: &Hash, block: &Hash| -> Result { - match (base, block) { - (b"0", _) => Ok(true), - (b"A", b"B") => Ok(true), - _ => Ok(false), - } - }; - - let duration = 100; - let make_genesis = |slot| Epoch { start_slot: slot, duration }; - let mut epoch_changes = EpochChanges::new(); - let next_descriptor = (); - - // insert genesis epoch for A at slot 1 - { - let genesis_epoch_a_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 1) - .unwrap() - .unwrap(); - - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_a_descriptor, &make_genesis) - .unwrap() - .increment(next_descriptor); - - epoch_changes - .import(&is_descendent_of, *b"A", 1, *b"0", incremented_epoch) - .unwrap(); - } - - // insert regular epoch for B at slot 201, descending from A - { - let epoch_b_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"A", 1, 201) - .unwrap() - .unwrap(); - - let incremented_epoch = epoch_changes - .viable_epoch(&epoch_b_descriptor, &make_genesis) - .unwrap() - .increment(next_descriptor); - - epoch_changes - .import(&is_descendent_of, *b"B", 201, *b"A", incremented_epoch) - .unwrap(); - } - - // insert genesis epoch for C at slot 1000 - { - let genesis_epoch_x_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 1000) - .unwrap() - .unwrap(); - - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_x_descriptor, &make_genesis) - .unwrap() - .increment(next_descriptor); - - epoch_changes - .import(&is_descendent_of, *b"C", 1, *b"0", incremented_epoch) - .unwrap(); - } - - // Clearing the gap should be a no-op. - epoch_changes.clear_gap(); - - // Check that all three epochs are available. - let epoch_a = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"A", 1, 10, &make_genesis) - .unwrap() - .unwrap(); - - let epoch_b = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"B", 201, 201, &make_genesis) - .unwrap() - .unwrap(); - - assert!(epoch_a != epoch_b); - - // the genesis epoch A will span slots [1, 200] with epoch B starting at slot 201 - assert_eq!(epoch_b.start_slot(), 201); - - let epoch_c = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"C", 1, 1001, &make_genesis) - .unwrap() - .unwrap(); - - assert!(epoch_a != epoch_c); - } } diff --git a/client/consensus/epochs/src/migration.rs b/client/consensus/epochs/src/migration.rs index c4ed47e9c1c05..052d0b7be4a53 100644 --- a/client/consensus/epochs/src/migration.rs +++ b/client/consensus/epochs/src/migration.rs @@ -64,7 +64,7 @@ where header }); - EpochChanges { inner, epochs, gap: None } + EpochChanges { inner, epochs } } } @@ -75,6 +75,6 @@ where { /// Migrate the type into current epoch changes definition. pub fn migrate(self) -> EpochChanges { - EpochChanges { inner: self.inner, epochs: self.epochs, gap: None } + EpochChanges { inner: self.inner, epochs: self.epochs } } } diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index c8495c4a0252b..99fa786e04036 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -1291,14 +1291,13 @@ impl Backend { header: &Block::Header, last_finalized: Option, justification: Option, - finalization_displaced: &mut Option>>, ) -> ClientResult> { // TODO: ensure best chain contains this block. let number = *header.number(); self.ensure_sequential_finalization(header, last_finalized)?; let with_state = sc_client_api::Backend::have_state_at(self, hash, number); - self.note_finalized(transaction, header, hash, finalization_displaced, with_state)?; + self.note_finalized(transaction, header, hash, with_state)?; if let Some(justification) = justification { transaction.set_from_vec( @@ -1362,7 +1361,6 @@ impl Backend { fn try_commit_operation(&self, mut operation: BlockImportOperation) -> ClientResult<()> { let mut transaction = Transaction::new(); - let mut finalization_displaced_leaves = None; operation.apply_aux(&mut transaction); operation.apply_offchain(&mut transaction); @@ -1381,7 +1379,6 @@ impl Backend { &block_header, Some(last_finalized_hash), justification, - &mut finalization_displaced_leaves, )?); last_finalized_hash = block_hash; last_finalized_num = *block_header.number(); @@ -1554,13 +1551,7 @@ impl Backend { if finalized { // TODO: ensure best chain contains this block. self.ensure_sequential_finalization(header, Some(last_finalized_hash))?; - self.note_finalized( - &mut transaction, - header, - hash, - &mut finalization_displaced_leaves, - operation.commit_state, - )?; + self.note_finalized(&mut transaction, header, hash, operation.commit_state)?; } else { // canonicalize blocks which are old enough, regardless of finality. self.force_delayed_canonicalize(&mut transaction)? @@ -1692,7 +1683,6 @@ impl Backend { transaction: &mut Transaction, f_header: &Block::Header, f_hash: Block::Hash, - displaced: &mut Option>>, with_state: bool, ) -> ClientResult<()> { let f_num = *f_header.number(); @@ -1720,10 +1710,6 @@ impl Backend { let new_displaced = self.blockchain.leaves.write().finalize_height(f_num); self.prune_blocks(transaction, f_num, &new_displaced)?; - match displaced { - x @ &mut None => *x = Some(new_displaced), - &mut Some(ref mut displaced) => displaced.merge(new_displaced), - } Ok(()) } @@ -2013,7 +1999,6 @@ impl sc_client_api::backend::Backend for Backend { ) -> ClientResult<()> { let mut transaction = Transaction::new(); let header = self.blockchain.expect_header(hash)?; - let mut displaced = None; let m = self.finalize_block_with_transaction( &mut transaction, @@ -2021,8 +2006,8 @@ impl sc_client_api::backend::Backend for Backend { &header, None, justification, - &mut displaced, )?; + self.storage.db.commit(transaction)?; self.blockchain.update_meta(m); Ok(()) diff --git a/client/executor/runtime-test/Cargo.toml b/client/executor/runtime-test/Cargo.toml index eadf547823bb2..e99f3caa9447e 100644 --- a/client/executor/runtime-test/Cargo.toml +++ b/client/executor/runtime-test/Cargo.toml @@ -19,7 +19,7 @@ sp-runtime = { version = "7.0.0", default-features = false, path = "../../../pri sp-std = { version = "5.0.0", default-features = false, path = "../../../primitives/std" } [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder" } +substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder", optional = true } [features] default = ["std"] @@ -28,4 +28,5 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-std/std", + "substrate-wasm-builder", ] diff --git a/client/executor/runtime-test/build.rs b/client/executor/runtime-test/build.rs index 27f931a542d4a..d3aceedf9ed95 100644 --- a/client/executor/runtime-test/build.rs +++ b/client/executor/runtime-test/build.rs @@ -16,22 +16,26 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use substrate_wasm_builder::WasmBuilder; - fn main() { // regular build - WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .build(); + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .build(); + } // and building with tracing activated - WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .set_file_name("wasm_binary_with_tracing.rs") - .append_to_rust_flags(r#"--cfg feature="with-tracing""#) - .build(); + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .set_file_name("wasm_binary_with_tracing.rs") + .append_to_rust_flags(r#"--cfg feature="with-tracing""#) + .build(); + } } diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml index b47c8032482be..95195bfc2d946 100644 --- a/client/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -18,7 +18,7 @@ ahash = "0.7.6" array-bytes = "4.1" async-trait = "0.1.57" dyn-clone = "1.0" -finality-grandpa = { version = "0.16.0", features = ["derive-codec"] } +finality-grandpa = { version = "0.16.1", features = ["derive-codec"] } futures = "0.3.21" futures-timer = "3.0.1" log = "0.4.17" @@ -50,7 +50,7 @@ sp-runtime = { version = "7.0.0", path = "../../primitives/runtime" } [dev-dependencies] assert_matches = "1.3.0" -finality-grandpa = { version = "0.16.0", features = ["derive-codec", "test-helpers"] } +finality-grandpa = { version = "0.16.1", features = ["derive-codec", "test-helpers"] } serde = "1.0.136" tokio = "1.22.0" sc-network = { version = "0.10.0-dev", path = "../network" } diff --git a/client/finality-grandpa/rpc/Cargo.toml b/client/finality-grandpa/rpc/Cargo.toml index 15b9d3887ba95..429331e96a65f 100644 --- a/client/finality-grandpa/rpc/Cargo.toml +++ b/client/finality-grandpa/rpc/Cargo.toml @@ -10,7 +10,7 @@ readme = "README.md" homepage = "https://substrate.io" [dependencies] -finality-grandpa = { version = "0.16.0", features = ["derive-codec"] } +finality-grandpa = { version = "0.16.1", features = ["derive-codec"] } futures = "0.3.16" jsonrpsee = { version = "0.16.2", features = ["client-core", "server", "macros"] } log = "0.4.8" diff --git a/client/network/src/discovery.rs b/client/network/src/discovery.rs index 2ee043f0f366a..96cc9ec608ab0 100644 --- a/client/network/src/discovery.rs +++ b/client/network/src/discovery.rs @@ -722,6 +722,8 @@ impl NetworkBehaviour for DiscoveryBehaviour { } } + // Will be removed below when we receive + // `FinishedWithNoAdditionalRecord`. self.records_to_publish.insert(id, r.record.clone()); DiscoveryOut::ValueFound( @@ -732,13 +734,14 @@ impl NetworkBehaviour for DiscoveryBehaviour { Ok(GetRecordOk::FinishedWithNoAdditionalRecord { cache_candidates, }) => { - if cache_candidates.is_empty() { - continue - } - - // Put the record to the `cache_candidates` that are nearest to the - // record key from our point of view of the network. + // We always need to remove the record to not leak any data! if let Some(record) = self.records_to_publish.remove(&id) { + if cache_candidates.is_empty() { + continue + } + + // Put the record to the `cache_candidates` that are nearest to + // the record key from our point of view of the network. if let Some(kad) = self.kademlia.as_mut() { kad.put_record_to( record, diff --git a/client/state-db/src/noncanonical.rs b/client/state-db/src/noncanonical.rs index b7eec8ab60ee0..e950d245dcec9 100644 --- a/client/state-db/src/noncanonical.rs +++ b/client/state-db/src/noncanonical.rs @@ -323,7 +323,6 @@ impl NonCanonicalOverlay { &self, level_index: usize, discarded_journals: &mut Vec>, - discarded_blocks: &mut Vec, hash: &BlockHash, ) { if let Some(level) = self.levels.get(level_index) { @@ -335,13 +334,7 @@ impl NonCanonicalOverlay { .clone(); if parent == *hash { discarded_journals.push(overlay.journal_key.clone()); - discarded_blocks.push(overlay.hash.clone()); - self.discard_journals( - level_index + 1, - discarded_journals, - discarded_blocks, - &overlay.hash, - ); + self.discard_journals(level_index + 1, discarded_journals, &overlay.hash); } }); } @@ -393,7 +386,6 @@ impl NonCanonicalOverlay { self.pinned_canonincalized.push(hash.clone()); let mut discarded_journals = Vec::new(); - let mut discarded_blocks = Vec::new(); for (i, overlay) in level.blocks.into_iter().enumerate() { let mut pinned_children = 0; // That's the one we need to canonicalize @@ -411,12 +403,7 @@ impl NonCanonicalOverlay { commit.data.deleted.extend(overlay.deleted.clone()); } else { // Discard this overlay - self.discard_journals( - 0, - &mut discarded_journals, - &mut discarded_blocks, - &overlay.hash, - ); + self.discard_journals(0, &mut discarded_journals, &overlay.hash); pinned_children = discard_descendants( &mut self.levels.as_mut_slices(), &mut self.values, @@ -437,7 +424,6 @@ impl NonCanonicalOverlay { discard_values(&mut self.values, overlay.inserted); } discarded_journals.push(overlay.journal_key.clone()); - discarded_blocks.push(overlay.hash.clone()); } commit.meta.deleted.append(&mut discarded_journals); @@ -548,9 +534,6 @@ impl NonCanonicalOverlay { trace!(target: "state-db-pin", "Discarding unpinned non-canon block: {:?}", hash); discard_values(&mut self.values, inserted); self.parents.remove(&hash); - true - } else { - false } }, Entry::Vacant(_) => break, diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index 1853ef75f52be..93e416c3bec4c 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -175,6 +175,7 @@ pub use pallet::*; pub use weights::WeightInfo; type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; +const LOG_TARGET: &str = "runtime::assets"; /// Trait with callbacks that are executed after successfull asset creation or destruction. pub trait AssetsCallback { diff --git a/frame/assets/src/migration.rs b/frame/assets/src/migration.rs index 89f8d39a9049c..9f8905ceff6c4 100644 --- a/frame/assets/src/migration.rs +++ b/frame/assets/src/migration.rs @@ -75,10 +75,18 @@ pub mod v1 { Some(old_value.migrate_to_v1()) }); current_version.put::>(); - log::info!(target: "runtime::assets", "Upgraded {} pools, storage to version {:?}", translated, current_version); + log::info!( + target: LOG_TARGET, + "Upgraded {} pools, storage to version {:?}", + translated, + current_version + ); T::DbWeight::get().reads_writes(translated + 1, translated + 1) } else { - log::info!(target: "runtime::assets", "Migration did not execute. This probably should be removed"); + log::info!( + target: LOG_TARGET, + "Migration did not execute. This probably should be removed" + ); T::DbWeight::get().reads(1) } } diff --git a/frame/atomic-swap/src/tests.rs b/frame/atomic-swap/src/tests.rs index 5ad63dfce55b4..081a449ec9a2e 100644 --- a/frame/atomic-swap/src/tests.rs +++ b/frame/atomic-swap/src/tests.rs @@ -3,10 +3,7 @@ use super::*; use crate as pallet_atomic_swap; -use frame_support::{ - parameter_types, - traits::{ConstU32, ConstU64}, -}; +use frame_support::traits::{ConstU32, ConstU64}; use sp_core::H256; use sp_runtime::{ testing::Header, @@ -28,10 +25,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/aura/src/mock.rs b/frame/aura/src/mock.rs index 07fa9aa680e80..7a07fe99ae25d 100644 --- a/frame/aura/src/mock.rs +++ b/frame/aura/src/mock.rs @@ -46,11 +46,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/authority-discovery/src/lib.rs b/frame/authority-discovery/src/lib.rs index b642a9ac283f2..39e01dba43b2b 100644 --- a/frame/authority-discovery/src/lib.rs +++ b/frame/authority-discovery/src/lib.rs @@ -226,8 +226,6 @@ mod tests { parameter_types! { pub const Period: BlockNumber = 1; pub const Offset: BlockNumber = 0; - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); } impl frame_system::Config for Test { diff --git a/frame/authorship/src/lib.rs b/frame/authorship/src/lib.rs index a40f32d36c265..4065472d92368 100644 --- a/frame/authorship/src/lib.rs +++ b/frame/authorship/src/lib.rs @@ -434,7 +434,6 @@ mod tests { use super::*; use crate as pallet_authorship; use frame_support::{ - parameter_types, traits::{ConstU32, ConstU64, OnFinalize, OnInitialize}, ConsensusEngineId, }; @@ -459,11 +458,6 @@ mod tests { } ); - parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); - } - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index dbeb588c1830e..abae1b7e33157 100644 --- a/frame/babe/src/mock.rs +++ b/frame/babe/src/mock.rs @@ -64,11 +64,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index 57f76b1ff679d..99d77a3e73361 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -193,6 +193,8 @@ pub use weights::WeightInfo; pub use pallet::*; +const LOG_TARGET: &str = "runtime::balances"; + type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; #[frame_support::pallet] @@ -950,7 +952,7 @@ impl, I: 'static> Pallet { if locks.len() as u32 > T::MaxLocks::get() { log::warn!( - target: "runtime::balances", + target: LOG_TARGET, "Warning: A user has more currency locks than expected. \ A runtime configuration adjustment may be needed." ); @@ -985,7 +987,7 @@ impl, I: 'static> Pallet { // since the funds that are under the lock will themselves be stored in the // account and therefore will need a reference. log::warn!( - target: "runtime::balances", + target: LOG_TARGET, "Warning: Attempt to introduce lock consumer reference, yet no providers. \ This is unexpected but should be safe." ); diff --git a/frame/balances/src/migration.rs b/frame/balances/src/migration.rs index b660ec9fd3235..80d1bcd35ba9e 100644 --- a/frame/balances/src/migration.rs +++ b/frame/balances/src/migration.rs @@ -40,10 +40,13 @@ fn migrate_v0_to_v1, I: 'static>(accounts: &[T::AccountId]) -> Weig // Set storage version to `1`. StorageVersion::new(1).put::>(); - log::info!(target: "runtime::balances", "Storage to version 1"); + log::info!(target: LOG_TARGET, "Storage to version 1"); T::DbWeight::get().reads_writes(2 + accounts.len() as u64, 3) } else { - log::info!(target: "runtime::balances", "Migration did not execute. This probably should be removed"); + log::info!( + target: LOG_TARGET, + "Migration did not execute. This probably should be removed" + ); T::DbWeight::get().reads(1) } } @@ -87,10 +90,13 @@ impl, I: 'static> OnRuntimeUpgrade for ResetInactive { // Set storage version to `0`. StorageVersion::new(0).put::>(); - log::info!(target: "runtime::balances", "Storage to version 0"); + log::info!(target: LOG_TARGET, "Storage to version 0"); T::DbWeight::get().reads_writes(1, 2) } else { - log::info!(target: "runtime::balances", "Migration did not execute. This probably should be removed"); + log::info!( + target: LOG_TARGET, + "Migration did not execute. This probably should be removed" + ); T::DbWeight::get().reads(1) } } diff --git a/frame/beefy-mmr/primitives/src/lib.rs b/frame/beefy-mmr/primitives/src/lib.rs index f88fb89acaaab..e6f8acefb039a 100644 --- a/frame/beefy-mmr/primitives/src/lib.rs +++ b/frame/beefy-mmr/primitives/src/lib.rs @@ -27,7 +27,8 @@ //! Merkle Tree is constructed from arbitrary-length leaves, that are initially hashed using the //! same hasher as the inner nodes. //! Inner nodes are created by concatenating child hashes and hashing again. The implementation -//! does not perform any sorting of the input data (leaves) nor when inner nodes are created. +//! sorts each pair of hashes before every hash operation. This makes proof verification more +//! efficient by removing the need to track which side each intermediate hash is concatenated on. //! //! If the number of leaves is not even, last leaf (hash of) is promoted to the upper layer. @@ -45,7 +46,7 @@ use beefy_primitives::mmr::{BeefyAuthoritySet, BeefyNextAuthoritySet}; pub fn merkle_root(leaves: I) -> H::Output where H: HashT, - H::Output: Default + AsRef<[u8]>, + H::Output: Default + AsRef<[u8]> + PartialOrd, I: IntoIterator, I::Item: AsRef<[u8]>, { @@ -56,7 +57,7 @@ where fn merkelize(leaves: I, visitor: &mut V) -> H::Output where H: HashT, - H::Output: Default + AsRef<[u8]>, + H::Output: Default + AsRef<[u8]> + PartialOrd, V: Visitor, I: Iterator, { @@ -141,7 +142,7 @@ impl Visitor for () { pub fn merkle_proof(leaves: I, leaf_index: usize) -> MerkleProof where H: HashT, - H::Output: Default + Copy + AsRef<[u8]>, + H::Output: Default + Copy + AsRef<[u8]> + PartialOrd, I: IntoIterator, I::IntoIter: ExactSizeIterator, T: AsRef<[u8]>, @@ -241,7 +242,7 @@ pub fn verify_proof<'a, H, P, L>( ) -> bool where H: HashT, - H::Output: PartialEq + AsRef<[u8]>, + H::Output: PartialEq + AsRef<[u8]> + PartialOrd, P: IntoIterator, L: Into>, { @@ -256,15 +257,13 @@ where let hash_len = ::LENGTH; let mut combined = vec![0_u8; hash_len * 2]; - let mut position = leaf_index; - let mut width = number_of_leaves; let computed = proof.into_iter().fold(leaf_hash, |a, b| { - if position % 2 == 1 || position + 1 == width { - combined[..hash_len].copy_from_slice(&b.as_ref()); - combined[hash_len..].copy_from_slice(&a.as_ref()); - } else { + if a < b { combined[..hash_len].copy_from_slice(&a.as_ref()); combined[hash_len..].copy_from_slice(&b.as_ref()); + } else { + combined[..hash_len].copy_from_slice(&b.as_ref()); + combined[hash_len..].copy_from_slice(&a.as_ref()); } let hash = ::hash(&combined); #[cfg(feature = "debug")] @@ -275,8 +274,6 @@ where array_bytes::bytes2hex("", &hash.as_ref()), array_bytes::bytes2hex("", &combined.as_ref()) ); - position /= 2; - width = ((width - 1) / 2) + 1; hash }); @@ -295,7 +292,7 @@ fn merkelize_row( ) -> Result> where H: HashT, - H::Output: AsRef<[u8]>, + H::Output: AsRef<[u8]> + PartialOrd, V: Visitor, I: Iterator, { @@ -321,8 +318,13 @@ where index += 2; match (a, b) { (Some(a), Some(b)) => { - combined[..hash_len].copy_from_slice(a.as_ref()); - combined[hash_len..].copy_from_slice(b.as_ref()); + if a < b { + combined[..hash_len].copy_from_slice(a.as_ref()); + combined[hash_len..].copy_from_slice(b.as_ref()); + } else { + combined[..hash_len].copy_from_slice(b.as_ref()); + combined[hash_len..].copy_from_slice(a.as_ref()); + } next.push(::hash(&combined)); }, @@ -428,12 +430,12 @@ mod tests { }; test( - "aff1208e69c9e8be9b584b07ebac4e48a1ee9d15ce3afe20b77a4d29e4175aa3", + "5842148bc6ebeb52af882a317c765fccd3ae80589b21a9b8cbf21abb630e46a7", vec!["a", "b", "c"], ); test( - "b8912f7269068901f231a965adfefbc10f0eedcfa61852b103efd54dac7db3d7", + "7b84bec68b13c39798c6c50e9e40a0b268e3c1634db8f4cb97314eb243d4c514", vec!["a", "b", "a"], ); @@ -443,7 +445,7 @@ mod tests { ); test( - "fb3b3be94be9e983ba5e094c9c51a7d96a4fa2e5d8e891df00ca89ba05bb1239", + "cc50382cfd3c9a617741e9a85efee8752b8feb95a2cbecd6365fb21366ce0c8c", vec!["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"], ); } @@ -761,7 +763,7 @@ mod tests { "0xc26B34D375533fFc4c5276282Fa5D660F3d8cbcB", ]; let root: H256 = array_bytes::hex2array_unchecked( - "72b0acd7c302a84f1f6b6cefe0ba7194b7398afb440e1b44a9dbbe270394ca53", + "7b2c6eebec6e85b2e272325a11c31af71df52bc0534d2d4f903e0ced191f022e", ) .into(); @@ -806,11 +808,11 @@ mod tests { ) .into(), array_bytes::hex2array_unchecked( - "d02609d2bbdb28aa25f58b85afec937d5a4c85d37925bce6d0cf802f9d76ba79" + "1fad92ed8d0504ef6c0231bbbeeda960a40693f297c64e87b582beb92ecfb00f" ) .into(), array_bytes::hex2array_unchecked( - "ae3f8991955ed884613b0a5f40295902eea0e0abe5858fc520b72959bc016d4e" + "0b84c852cbcf839d562d826fd935e1b37975ccaa419e1def8d219df4b83dcbf4" ) .into(), ], diff --git a/frame/beefy-mmr/src/tests.rs b/frame/beefy-mmr/src/tests.rs index 1826331f59e53..0f7804e544aa4 100644 --- a/frame/beefy-mmr/src/tests.rs +++ b/frame/beefy-mmr/src/tests.rs @@ -70,7 +70,7 @@ fn should_contain_mmr_digest() { ValidatorSet::new(vec![mock_beefy_id(1), mock_beefy_id(2)], 1).unwrap() )), beefy_log(ConsensusLog::MmrRoot(array_bytes::hex_n_into_unchecked( - "95803defe6ea9f41e7ec6afa497064f21bfded027d8812efacbdf984e630cbdc" + "200e73880940ac0b66735ffb560fa0a3989292463d262deac6ad61e78a3e46a4" ))) ] ); @@ -85,13 +85,13 @@ fn should_contain_mmr_digest() { ValidatorSet::new(vec![mock_beefy_id(1), mock_beefy_id(2)], 1).unwrap() )), beefy_log(ConsensusLog::MmrRoot(array_bytes::hex_n_into_unchecked( - "95803defe6ea9f41e7ec6afa497064f21bfded027d8812efacbdf984e630cbdc" + "200e73880940ac0b66735ffb560fa0a3989292463d262deac6ad61e78a3e46a4" ))), beefy_log(ConsensusLog::AuthoritiesChange( ValidatorSet::new(vec![mock_beefy_id(3), mock_beefy_id(4)], 2).unwrap() )), beefy_log(ConsensusLog::MmrRoot(array_bytes::hex_n_into_unchecked( - "a73271a0974f1e67d6e9b8dd58e506177a2e556519a330796721e98279a753e2" + "ba37d8d5d195ac8caec391da35472f9ecf1116ff1642409148b62e08896d3884" ))), ] ); @@ -124,7 +124,7 @@ fn should_contain_valid_leaf_data() { ) }, leaf_extra: array_bytes::hex2bytes_unchecked( - "55b8e9e1cc9f0db7776fac0ca66318ef8acfb8ec26db11e373120583e07ee648" + "5572d58c82bddf323f4fc7aecab8a8f0ad6ed2f06ab2bfb8ade36a77a45fcc68" ) } ); @@ -149,7 +149,7 @@ fn should_contain_valid_leaf_data() { ) }, leaf_extra: array_bytes::hex2bytes_unchecked( - "55b8e9e1cc9f0db7776fac0ca66318ef8acfb8ec26db11e373120583e07ee648" + "5572d58c82bddf323f4fc7aecab8a8f0ad6ed2f06ab2bfb8ade36a77a45fcc68" ) } ); diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index c522b71891b3c..0fe05dbb01ac0 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -71,6 +71,8 @@ pub mod weights; pub use pallet::*; pub use weights::WeightInfo; +const LOG_TARGET: &str = "runtime::collective"; + /// Simple index type for proposal counting. pub type ProposalIndex = u32; @@ -390,7 +392,7 @@ pub mod pallet { ensure_root(origin)?; if new_members.len() > T::MaxMembers::get() as usize { log::error!( - target: "runtime::collective", + target: LOG_TARGET, "New members count ({}) exceeds maximum amount of members expected ({}).", new_members.len(), T::MaxMembers::get(), @@ -400,7 +402,7 @@ pub mod pallet { let old = Members::::get(); if old.len() > old_count as usize { log::warn!( - target: "runtime::collective", + target: LOG_TARGET, "Wrong count used to estimate set_members weight. expected ({}) vs actual ({})", old_count, old.len(), @@ -1040,7 +1042,7 @@ impl, I: 'static> ChangeMembers for Pallet { ) { if new.len() > T::MaxMembers::get() as usize { log::error!( - target: "runtime::collective", + target: LOG_TARGET, "New members count ({}) exceeds maximum amount of members expected ({}).", new.len(), T::MaxMembers::get(), diff --git a/frame/collective/src/migrations/v4.rs b/frame/collective/src/migrations/v4.rs index 483c3f9fa9e69..2756b3fd15a6b 100644 --- a/frame/collective/src/migrations/v4.rs +++ b/frame/collective/src/migrations/v4.rs @@ -17,6 +17,7 @@ use sp_io::hashing::twox_128; +use super::super::LOG_TARGET; use frame_support::{ traits::{ Get, GetStorageVersion, PalletInfoAccess, StorageVersion, @@ -42,7 +43,7 @@ pub fn migrate::on_chain_storage_version(); log::info!( - target: "runtime::collective", + target: LOG_TARGET, "Running migration to v4 for collective with storage version {:?}", on_chain_storage_version, ); @@ -66,7 +67,7 @@ pub fn migrate::BlockWeights::get().max_block } else { log::warn!( - target: "runtime::collective", + target: LOG_TARGET, "Attempted to apply migration to v4 but failed because storage version is {:?}", on_chain_storage_version, ); @@ -138,7 +139,7 @@ pub fn post_migrate>(old_ fn log_migration(stage: &str, old_pallet_name: &str, new_pallet_name: &str) { log::info!( - target: "runtime::collective", + target: LOG_TARGET, "{}, prefix: '{}' ==> '{}'", stage, old_pallet_name, diff --git a/frame/collective/src/tests.rs b/frame/collective/src/tests.rs index 648b6f88ec86c..5c90de9f91bf7 100644 --- a/frame/collective/src/tests.rs +++ b/frame/collective/src/tests.rs @@ -91,8 +91,6 @@ pub type MaxMembers = ConstU32<100>; parameter_types! { pub const MotionDuration: u64 = 3; pub const MaxProposals: u32 = 257; - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); } impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 9df790e09a1e8..9efeec65f51f5 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -816,8 +816,6 @@ pub mod pallet { RandomSubjectTooLong, /// The amount of topics passed to `seal_deposit_events` exceeds the limit. TooManyTopics, - /// The topics passed to `seal_deposit_events` contains at least one duplicate. - DuplicateTopics, /// The chain does not provide a chain extension. Calling the chain extension results /// in this error. Note that this usually shouldn't happen as deploying such contracts /// is rejected. diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index f1d0ccc7c216b..b540b3deb448d 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -1988,7 +1988,7 @@ mod tests { assert!(mock_ext.gas_meter.gas_left().ref_time() > 0); } - const CODE_DEPOSIT_EVENT_MAX_TOPICS: &str = r#" + const CODE_DEPOSIT_EVENT_DUPLICATES: &str = r#" (module (import "seal0" "seal_deposit_event" (func $seal_deposit_event (param i32 i32 i32 i32))) (import "env" "memory" (memory 1 1)) @@ -1996,7 +1996,7 @@ mod tests { (func (export "call") (call $seal_deposit_event (i32.const 32) ;; Pointer to the start of topics buffer - (i32.const 161) ;; The length of the topics buffer. + (i32.const 129) ;; The length of the topics buffer. (i32.const 8) ;; Pointer to the start of the data buffer (i32.const 13) ;; Length of the buffer ) @@ -2005,29 +2005,36 @@ mod tests { (data (i32.const 8) "\00\01\2A\00\00\00\00\00\00\00\E5\14\00") - ;; Encoded Vec>, the buffer has length of 161 bytes. - (data (i32.const 32) "\14" + ;; Encoded Vec>, the buffer has length of 129 bytes. + (data (i32.const 32) "\10" "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" "\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02" -"\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03" -"\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04" -"\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05") +"\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" +"\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04") ) "#; - /// Checks that the runtime traps if there are more than `max_topic_events` topics. + /// Checks that the runtime allows duplicate topics. #[test] - fn deposit_event_max_topics() { + fn deposit_event_duplicates_allowed() { + let mut mock_ext = MockExt::default(); + assert_ok!(execute(CODE_DEPOSIT_EVENT_DUPLICATES, vec![], &mut mock_ext,)); + assert_eq!( - execute(CODE_DEPOSIT_EVENT_MAX_TOPICS, vec![], MockExt::default(),), - Err(ExecError { - error: Error::::TooManyTopics.into(), - origin: ErrorOrigin::Caller, - }) + mock_ext.events, + vec![( + vec![ + H256::repeat_byte(0x01), + H256::repeat_byte(0x02), + H256::repeat_byte(0x01), + H256::repeat_byte(0x04) + ], + vec![0x00, 0x01, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe5, 0x14, 0x00] + )] ); } - const CODE_DEPOSIT_EVENT_DUPLICATES: &str = r#" + const CODE_DEPOSIT_EVENT_MAX_TOPICS: &str = r#" (module (import "seal0" "seal_deposit_event" (func $seal_deposit_event (param i32 i32 i32 i32))) (import "env" "memory" (memory 1 1)) @@ -2035,7 +2042,7 @@ mod tests { (func (export "call") (call $seal_deposit_event (i32.const 32) ;; Pointer to the start of topics buffer - (i32.const 129) ;; The length of the topics buffer. + (i32.const 161) ;; The length of the topics buffer. (i32.const 8) ;; Pointer to the start of the data buffer (i32.const 13) ;; Length of the buffer ) @@ -2044,22 +2051,23 @@ mod tests { (data (i32.const 8) "\00\01\2A\00\00\00\00\00\00\00\E5\14\00") - ;; Encoded Vec>, the buffer has length of 129 bytes. - (data (i32.const 32) "\10" + ;; Encoded Vec>, the buffer has length of 161 bytes. + (data (i32.const 32) "\14" "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" "\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02" -"\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" -"\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04") +"\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03" +"\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04\04" +"\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05\05") ) "#; - /// Checks that the runtime traps if there are duplicates. + /// Checks that the runtime traps if there are more than `max_topic_events` topics. #[test] - fn deposit_event_duplicates() { + fn deposit_event_max_topics() { assert_eq!( - execute(CODE_DEPOSIT_EVENT_DUPLICATES, vec![], MockExt::default(),), + execute(CODE_DEPOSIT_EVENT_MAX_TOPICS, vec![], MockExt::default(),), Err(ExecError { - error: Error::::DuplicateTopics.into(), + error: Error::::TooManyTopics.into(), origin: ErrorOrigin::Caller, }) ); diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 098f8d280e6a9..b5398bb6206c5 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -2085,15 +2085,6 @@ pub mod env { data_ptr: u32, data_len: u32, ) -> Result<(), TrapReason> { - fn has_duplicates(items: &mut Vec) -> bool { - items.sort(); - // Find any two consecutive equal elements. - items.windows(2).any(|w| match &w { - &[a, b] => a == b, - _ => false, - }) - } - let num_topic = topics_len .checked_div(sp_std::mem::size_of::>() as u32) .ok_or("Zero sized topics are not allowed")?; @@ -2102,7 +2093,7 @@ pub mod env { return Err(Error::::ValueTooLarge.into()) } - let mut topics: Vec::T>> = match topics_len { + let topics: Vec::T>> = match topics_len { 0 => Vec::new(), _ => ctx.read_sandbox_memory_as_unbounded(memory, topics_ptr, topics_len)?, }; @@ -2112,13 +2103,6 @@ pub mod env { return Err(Error::::TooManyTopics.into()) } - // Check for duplicate topics. If there are any, then trap. - // Complexity O(n * log(n)) and no additional allocations. - // This also sorts the topics. - if has_duplicates(&mut topics) { - return Err(Error::::DuplicateTopics.into()) - } - let event_data = ctx.read_sandbox_memory(memory, data_ptr, data_len)?; ctx.ext.deposit_event(topics, event_data); diff --git a/frame/contracts/src/weights.rs b/frame/contracts/src/weights.rs index 69fcbd6eec983..7ae1a9c594671 100644 --- a/frame/contracts/src/weights.rs +++ b/frame/contracts/src/weights.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -172,17 +172,17 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_process_deletion_queue_batch() -> Weight { - // Minimum execution time: 3_196 nanoseconds. - Weight::from_ref_time(3_293_000) + // Minimum execution time: 3_326 nanoseconds. + Weight::from_ref_time(3_433_000) .saturating_add(T::DbWeight::get().reads(1)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32, ) -> Weight { - // Minimum execution time: 14_857 nanoseconds. - Weight::from_ref_time(14_957_593) - // Standard Error: 1_015 - .saturating_add(Weight::from_ref_time(935_359).saturating_mul(k.into())) + // Minimum execution time: 15_703 nanoseconds. + Weight::from_ref_time(15_288_927) + // Standard Error: 951 + .saturating_add(Weight::from_ref_time(940_816).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -190,10 +190,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts DeletionQueue (r:1 w:0) /// The range of component `q` is `[0, 128]`. fn on_initialize_per_queue_item(q: u32, ) -> Weight { - // Minimum execution time: 3_231 nanoseconds. - Weight::from_ref_time(14_859_580) - // Standard Error: 3_479 - .saturating_add(Weight::from_ref_time(1_185_600).saturating_mul(q.into())) + // Minimum execution time: 3_548 nanoseconds. + Weight::from_ref_time(15_764_121) + // Standard Error: 3_339 + .saturating_add(Weight::from_ref_time(1_214_890).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -201,10 +201,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn reinstrument(c: u32, ) -> Weight { - // Minimum execution time: 34_565 nanoseconds. - Weight::from_ref_time(29_199_016) - // Standard Error: 70 - .saturating_add(Weight::from_ref_time(47_107).saturating_mul(c.into())) + // Minimum execution time: 29_801 nanoseconds. + Weight::from_ref_time(27_932_706) + // Standard Error: 49 + .saturating_add(Weight::from_ref_time(50_532).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -215,10 +215,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `c` is `[0, 131072]`. fn call_with_code_per_byte(c: u32, ) -> Weight { - // Minimum execution time: 392_074 nanoseconds. - Weight::from_ref_time(404_090_909) - // Standard Error: 24 - .saturating_add(Weight::from_ref_time(30_454).saturating_mul(c.into())) + // Minimum execution time: 307_894 nanoseconds. + Weight::from_ref_time(322_346_319) + // Standard Error: 25 + .saturating_add(Weight::from_ref_time(30_678).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -234,14 +234,14 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[0, 1048576]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, i: u32, s: u32, ) -> Weight { - // Minimum execution time: 3_785_934 nanoseconds. - Weight::from_ref_time(683_143_843) - // Standard Error: 272 - .saturating_add(Weight::from_ref_time(87_620).saturating_mul(c.into())) + // Minimum execution time: 3_610_424 nanoseconds. + Weight::from_ref_time(583_426_386) + // Standard Error: 277 + .saturating_add(Weight::from_ref_time(90_224).saturating_mul(c.into())) // Standard Error: 16 - .saturating_add(Weight::from_ref_time(1_363).saturating_mul(i.into())) + .saturating_add(Weight::from_ref_time(1_325).saturating_mul(i.into())) // Standard Error: 16 - .saturating_add(Weight::from_ref_time(1_778).saturating_mul(s.into())) + .saturating_add(Weight::from_ref_time(1_727).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(9)) } @@ -255,12 +255,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[0, 1048576]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate(i: u32, s: u32, ) -> Weight { - // Minimum execution time: 1_935_310 nanoseconds. - Weight::from_ref_time(203_531_122) + // Minimum execution time: 1_892_996 nanoseconds. + Weight::from_ref_time(202_958_196) // Standard Error: 8 - .saturating_add(Weight::from_ref_time(1_674).saturating_mul(i.into())) + .saturating_add(Weight::from_ref_time(1_627).saturating_mul(i.into())) // Standard Error: 8 - .saturating_add(Weight::from_ref_time(1_789).saturating_mul(s.into())) + .saturating_add(Weight::from_ref_time(1_755).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(7)) } @@ -270,8 +270,8 @@ impl WeightInfo for SubstrateWeight { // Storage: System Account (r:1 w:1) // Storage: System EventTopics (r:2 w:2) fn call() -> Weight { - // Minimum execution time: 151_999 nanoseconds. - Weight::from_ref_time(153_527_000) + // Minimum execution time: 157_347 nanoseconds. + Weight::from_ref_time(159_084_000) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -281,10 +281,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn upload_code(c: u32, ) -> Weight { - // Minimum execution time: 391_165 nanoseconds. - Weight::from_ref_time(394_519_487) - // Standard Error: 75 - .saturating_add(Weight::from_ref_time(89_736).saturating_mul(c.into())) + // Minimum execution time: 299_987 nanoseconds. + Weight::from_ref_time(305_274_879) + // Standard Error: 72 + .saturating_add(Weight::from_ref_time(91_916).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -293,8 +293,8 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - // Minimum execution time: 39_354 nanoseconds. - Weight::from_ref_time(39_855_000) + // Minimum execution time: 40_795 nanoseconds. + Weight::from_ref_time(41_297_000) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -302,8 +302,8 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:2 w:2) // Storage: System EventTopics (r:3 w:3) fn set_code() -> Weight { - // Minimum execution time: 40_909 nanoseconds. - Weight::from_ref_time(41_275_000) + // Minimum execution time: 41_957 nanoseconds. + Weight::from_ref_time(42_536_000) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) } @@ -314,10 +314,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_caller(r: u32, ) -> Weight { - // Minimum execution time: 380_150 nanoseconds. - Weight::from_ref_time(384_429_035) - // Standard Error: 34_740 - .saturating_add(Weight::from_ref_time(15_582_218).saturating_mul(r.into())) + // Minimum execution time: 293_544 nanoseconds. + Weight::from_ref_time(298_981_222) + // Standard Error: 39_139 + .saturating_add(Weight::from_ref_time(17_278_436).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -328,10 +328,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_is_contract(r: u32, ) -> Weight { - // Minimum execution time: 380_608 nanoseconds. - Weight::from_ref_time(326_544_805) - // Standard Error: 475_381 - .saturating_add(Weight::from_ref_time(190_717_772).saturating_mul(r.into())) + // Minimum execution time: 293_500 nanoseconds. + Weight::from_ref_time(237_825_284) + // Standard Error: 450_234 + .saturating_add(Weight::from_ref_time(198_995_806).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -343,10 +343,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_code_hash(r: u32, ) -> Weight { - // Minimum execution time: 382_780 nanoseconds. - Weight::from_ref_time(333_775_113) - // Standard Error: 446_086 - .saturating_add(Weight::from_ref_time(232_531_042).saturating_mul(r.into())) + // Minimum execution time: 295_851 nanoseconds. + Weight::from_ref_time(258_113_447) + // Standard Error: 408_747 + .saturating_add(Weight::from_ref_time(237_490_216).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -358,10 +358,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_own_code_hash(r: u32, ) -> Weight { - // Minimum execution time: 381_815 nanoseconds. - Weight::from_ref_time(390_931_793) - // Standard Error: 61_918 - .saturating_add(Weight::from_ref_time(18_798_438).saturating_mul(r.into())) + // Minimum execution time: 294_614 nanoseconds. + Weight::from_ref_time(301_528_998) + // Standard Error: 40_613 + .saturating_add(Weight::from_ref_time(20_815_088).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -372,10 +372,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_caller_is_origin(r: u32, ) -> Weight { - // Minimum execution time: 379_162 nanoseconds. - Weight::from_ref_time(383_796_363) - // Standard Error: 25_555 - .saturating_add(Weight::from_ref_time(10_843_721).saturating_mul(r.into())) + // Minimum execution time: 293_088 nanoseconds. + Weight::from_ref_time(299_120_595) + // Standard Error: 23_277 + .saturating_add(Weight::from_ref_time(11_130_334).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -386,10 +386,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_address(r: u32, ) -> Weight { - // Minimum execution time: 380_307 nanoseconds. - Weight::from_ref_time(390_211_779) - // Standard Error: 53_326 - .saturating_add(Weight::from_ref_time(15_311_171).saturating_mul(r.into())) + // Minimum execution time: 295_110 nanoseconds. + Weight::from_ref_time(305_295_787) + // Standard Error: 48_521 + .saturating_add(Weight::from_ref_time(16_610_806).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -400,10 +400,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_gas_left(r: u32, ) -> Weight { - // Minimum execution time: 380_230 nanoseconds. - Weight::from_ref_time(383_470_453) - // Standard Error: 45_007 - .saturating_add(Weight::from_ref_time(15_582_472).saturating_mul(r.into())) + // Minimum execution time: 293_414 nanoseconds. + Weight::from_ref_time(299_960_283) + // Standard Error: 32_003 + .saturating_add(Weight::from_ref_time(16_652_433).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -414,10 +414,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_balance(r: u32, ) -> Weight { - // Minimum execution time: 380_244 nanoseconds. - Weight::from_ref_time(388_092_461) - // Standard Error: 98_199 - .saturating_add(Weight::from_ref_time(97_339_528).saturating_mul(r.into())) + // Minimum execution time: 292_429 nanoseconds. + Weight::from_ref_time(301_025_128) + // Standard Error: 92_155 + .saturating_add(Weight::from_ref_time(92_731_719).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -428,10 +428,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_value_transferred(r: u32, ) -> Weight { - // Minimum execution time: 380_242 nanoseconds. - Weight::from_ref_time(384_078_258) - // Standard Error: 28_510 - .saturating_add(Weight::from_ref_time(15_423_359).saturating_mul(r.into())) + // Minimum execution time: 293_516 nanoseconds. + Weight::from_ref_time(300_071_428) + // Standard Error: 25_871 + .saturating_add(Weight::from_ref_time(16_599_369).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -442,10 +442,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_minimum_balance(r: u32, ) -> Weight { - // Minimum execution time: 379_890 nanoseconds. - Weight::from_ref_time(383_658_430) - // Standard Error: 44_976 - .saturating_add(Weight::from_ref_time(15_451_905).saturating_mul(r.into())) + // Minimum execution time: 293_666 nanoseconds. + Weight::from_ref_time(299_803_599) + // Standard Error: 24_508 + .saturating_add(Weight::from_ref_time(16_500_973).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -456,10 +456,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_block_number(r: u32, ) -> Weight { - // Minimum execution time: 380_269 nanoseconds. - Weight::from_ref_time(383_580_481) - // Standard Error: 31_862 - .saturating_add(Weight::from_ref_time(15_230_473).saturating_mul(r.into())) + // Minimum execution time: 289_193 nanoseconds. + Weight::from_ref_time(297_946_784) + // Standard Error: 43_719 + .saturating_add(Weight::from_ref_time(16_442_254).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -470,10 +470,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_now(r: u32, ) -> Weight { - // Minimum execution time: 380_308 nanoseconds. - Weight::from_ref_time(383_732_372) - // Standard Error: 38_359 - .saturating_add(Weight::from_ref_time(15_358_775).saturating_mul(r.into())) + // Minimum execution time: 288_897 nanoseconds. + Weight::from_ref_time(298_856_658) + // Standard Error: 31_003 + .saturating_add(Weight::from_ref_time(16_490_508).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -485,10 +485,10 @@ impl WeightInfo for SubstrateWeight { // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_weight_to_fee(r: u32, ) -> Weight { - // Minimum execution time: 380_834 nanoseconds. - Weight::from_ref_time(388_999_459) - // Standard Error: 96_447 - .saturating_add(Weight::from_ref_time(86_714_414).saturating_mul(r.into())) + // Minimum execution time: 289_850 nanoseconds. + Weight::from_ref_time(302_898_449) + // Standard Error: 92_822 + .saturating_add(Weight::from_ref_time(86_376_874).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -499,10 +499,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_gas(r: u32, ) -> Weight { - // Minimum execution time: 140_955 nanoseconds. - Weight::from_ref_time(144_716_423) - // Standard Error: 11_370 - .saturating_add(Weight::from_ref_time(7_858_807).saturating_mul(r.into())) + // Minimum execution time: 145_105 nanoseconds. + Weight::from_ref_time(152_388_934) + // Standard Error: 29_988 + .saturating_add(Weight::from_ref_time(7_761_947).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -513,10 +513,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_input(r: u32, ) -> Weight { - // Minimum execution time: 380_210 nanoseconds. - Weight::from_ref_time(384_185_776) - // Standard Error: 49_038 - .saturating_add(Weight::from_ref_time(13_649_793).saturating_mul(r.into())) + // Minimum execution time: 289_319 nanoseconds. + Weight::from_ref_time(298_390_911) + // Standard Error: 27_329 + .saturating_add(Weight::from_ref_time(14_225_527).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -527,10 +527,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_input_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 396_209 nanoseconds. - Weight::from_ref_time(424_522_611) - // Standard Error: 3_917 - .saturating_add(Weight::from_ref_time(9_627_216).saturating_mul(n.into())) + // Minimum execution time: 305_538 nanoseconds. + Weight::from_ref_time(339_734_596) + // Standard Error: 4_636 + .saturating_add(Weight::from_ref_time(9_592_149).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -541,10 +541,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_return(r: u32, ) -> Weight { - // Minimum execution time: 378_412 nanoseconds. - Weight::from_ref_time(380_502_085) - // Standard Error: 201_552 - .saturating_add(Weight::from_ref_time(1_434_214).saturating_mul(r.into())) + // Minimum execution time: 287_189 nanoseconds. + Weight::from_ref_time(295_472_383) + // Standard Error: 314_142 + .saturating_add(Weight::from_ref_time(214_016).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -555,10 +555,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_return_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 381_463 nanoseconds. - Weight::from_ref_time(383_955_553) - // Standard Error: 998 - .saturating_add(Weight::from_ref_time(230_512).saturating_mul(n.into())) + // Minimum execution time: 289_380 nanoseconds. + Weight::from_ref_time(296_302_404) + // Standard Error: 889 + .saturating_add(Weight::from_ref_time(190_017).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -571,10 +571,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32, ) -> Weight { - // Minimum execution time: 379_877 nanoseconds. - Weight::from_ref_time(381_729_546) - // Standard Error: 214_004 - .saturating_add(Weight::from_ref_time(52_528_353).saturating_mul(r.into())) + // Minimum execution time: 292_383 nanoseconds. + Weight::from_ref_time(297_557_691) + // Standard Error: 251_228 + .saturating_add(Weight::from_ref_time(56_688_008).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -588,10 +588,10 @@ impl WeightInfo for SubstrateWeight { // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_random(r: u32, ) -> Weight { - // Minimum execution time: 380_275 nanoseconds. - Weight::from_ref_time(386_495_777) - // Standard Error: 94_674 - .saturating_add(Weight::from_ref_time(108_432_929).saturating_mul(r.into())) + // Minimum execution time: 293_019 nanoseconds. + Weight::from_ref_time(301_747_439) + // Standard Error: 92_043 + .saturating_add(Weight::from_ref_time(109_861_144).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -602,10 +602,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_deposit_event(r: u32, ) -> Weight { - // Minimum execution time: 379_095 nanoseconds. - Weight::from_ref_time(393_997_924) - // Standard Error: 141_916 - .saturating_add(Weight::from_ref_time(212_937_170).saturating_mul(r.into())) + // Minimum execution time: 287_586 nanoseconds. + Weight::from_ref_time(304_751_302) + // Standard Error: 127_698 + .saturating_add(Weight::from_ref_time(221_525_053).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -617,12 +617,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 4]`. /// The range of component `n` is `[0, 16]`. fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - // Minimum execution time: 1_241_001 nanoseconds. - Weight::from_ref_time(548_526_917) - // Standard Error: 496_807 - .saturating_add(Weight::from_ref_time(177_087_769).saturating_mul(t.into())) - // Standard Error: 136_447 - .saturating_add(Weight::from_ref_time(71_558_402).saturating_mul(n.into())) + // Minimum execution time: 1_182_204 nanoseconds. + Weight::from_ref_time(508_607_957) + // Standard Error: 503_533 + .saturating_add(Weight::from_ref_time(173_998_655).saturating_mul(t.into())) + // Standard Error: 138_294 + .saturating_add(Weight::from_ref_time(67_991_373).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -635,20 +635,20 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_debug_message(r: u32, ) -> Weight { - // Minimum execution time: 159_158 nanoseconds. - Weight::from_ref_time(163_427_712) - // Standard Error: 22_442 - .saturating_add(Weight::from_ref_time(12_647_838).saturating_mul(r.into())) + // Minimum execution time: 157_706 nanoseconds. + Weight::from_ref_time(161_895_583) + // Standard Error: 14_952 + .saturating_add(Weight::from_ref_time(12_990_237).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_set_storage(r: u32, ) -> Weight { - // Minimum execution time: 381_068 nanoseconds. - Weight::from_ref_time(341_041_230) - // Standard Error: 464_053 - .saturating_add(Weight::from_ref_time(402_677_314).saturating_mul(r.into())) + // Minimum execution time: 290_063 nanoseconds. + Weight::from_ref_time(256_404_853) + // Standard Error: 436_195 + .saturating_add(Weight::from_ref_time(406_569_743).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -657,10 +657,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_set_storage_per_new_kb(n: u32, ) -> Weight { - // Minimum execution time: 508_695 nanoseconds. - Weight::from_ref_time(663_159_695) - // Standard Error: 1_419_342 - .saturating_add(Weight::from_ref_time(96_558_570).saturating_mul(n.into())) + // Minimum execution time: 426_295 nanoseconds. + Weight::from_ref_time(582_989_911) + // Standard Error: 1_404_141 + .saturating_add(Weight::from_ref_time(89_545_963).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(52)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(50)) @@ -669,10 +669,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_set_storage_per_old_kb(n: u32, ) -> Weight { - // Minimum execution time: 508_542 nanoseconds. - Weight::from_ref_time(634_146_978) - // Standard Error: 1_168_252 - .saturating_add(Weight::from_ref_time(64_231_947).saturating_mul(n.into())) + // Minimum execution time: 425_062 nanoseconds. + Weight::from_ref_time(552_380_900) + // Standard Error: 1_140_169 + .saturating_add(Weight::from_ref_time(64_085_108).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(51)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(49)) @@ -681,10 +681,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_clear_storage(r: u32, ) -> Weight { - // Minimum execution time: 381_743 nanoseconds. - Weight::from_ref_time(337_309_674) - // Standard Error: 527_407 - .saturating_add(Weight::from_ref_time(395_767_068).saturating_mul(r.into())) + // Minimum execution time: 294_421 nanoseconds. + Weight::from_ref_time(260_897_072) + // Standard Error: 474_135 + .saturating_add(Weight::from_ref_time(403_191_862).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -693,10 +693,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_clear_storage_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 478_283 nanoseconds. - Weight::from_ref_time(616_673_245) - // Standard Error: 1_290_784 - .saturating_add(Weight::from_ref_time(66_534_552).saturating_mul(n.into())) + // Minimum execution time: 391_743 nanoseconds. + Weight::from_ref_time(535_327_545) + // Standard Error: 1_297_157 + .saturating_add(Weight::from_ref_time(67_222_981).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(51)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(48)) @@ -705,10 +705,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_get_storage(r: u32, ) -> Weight { - // Minimum execution time: 381_916 nanoseconds. - Weight::from_ref_time(349_150_912) - // Standard Error: 443_388 - .saturating_add(Weight::from_ref_time(316_975_558).saturating_mul(r.into())) + // Minimum execution time: 294_947 nanoseconds. + Weight::from_ref_time(266_280_887) + // Standard Error: 382_477 + .saturating_add(Weight::from_ref_time(323_306_898).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -716,10 +716,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_get_storage_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 459_294 nanoseconds. - Weight::from_ref_time(579_698_524) - // Standard Error: 1_111_681 - .saturating_add(Weight::from_ref_time(159_276_087).saturating_mul(n.into())) + // Minimum execution time: 375_487 nanoseconds. + Weight::from_ref_time(497_019_365) + // Standard Error: 1_141_672 + .saturating_add(Weight::from_ref_time(152_354_482).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(51)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -727,10 +727,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_contains_storage(r: u32, ) -> Weight { - // Minimum execution time: 381_700 nanoseconds. - Weight::from_ref_time(352_544_675) - // Standard Error: 401_504 - .saturating_add(Weight::from_ref_time(304_380_106).saturating_mul(r.into())) + // Minimum execution time: 294_716 nanoseconds. + Weight::from_ref_time(266_187_186) + // Standard Error: 395_323 + .saturating_add(Weight::from_ref_time(309_907_221).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -738,10 +738,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_contains_storage_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 455_595 nanoseconds. - Weight::from_ref_time(560_428_166) - // Standard Error: 991_088 - .saturating_add(Weight::from_ref_time(61_810_610).saturating_mul(n.into())) + // Minimum execution time: 371_667 nanoseconds. + Weight::from_ref_time(478_075_482) + // Standard Error: 979_116 + .saturating_add(Weight::from_ref_time(62_075_707).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(51)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -749,10 +749,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_take_storage(r: u32, ) -> Weight { - // Minimum execution time: 382_000 nanoseconds. - Weight::from_ref_time(336_164_219) - // Standard Error: 601_744 - .saturating_add(Weight::from_ref_time(406_198_079).saturating_mul(r.into())) + // Minimum execution time: 292_147 nanoseconds. + Weight::from_ref_time(254_374_598) + // Standard Error: 442_367 + .saturating_add(Weight::from_ref_time(413_674_705).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -761,10 +761,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_take_storage_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 482_335 nanoseconds. - Weight::from_ref_time(634_245_177) - // Standard Error: 1_418_845 - .saturating_add(Weight::from_ref_time(164_352_113).saturating_mul(n.into())) + // Minimum execution time: 398_554 nanoseconds. + Weight::from_ref_time(553_715_911) + // Standard Error: 1_415_272 + .saturating_add(Weight::from_ref_time(158_254_544).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(51)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(48)) @@ -777,10 +777,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_transfer(r: u32, ) -> Weight { - // Minimum execution time: 382_142 nanoseconds. - Weight::from_ref_time(317_581_708) - // Standard Error: 682_156 - .saturating_add(Weight::from_ref_time(1_305_289_569).saturating_mul(r.into())) + // Minimum execution time: 295_081 nanoseconds. + Weight::from_ref_time(253_461_581) + // Standard Error: 740_198 + .saturating_add(Weight::from_ref_time(1_369_153_623).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4)) @@ -793,10 +793,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_call(r: u32, ) -> Weight { - // Minimum execution time: 383_580 nanoseconds. - Weight::from_ref_time(384_176_000) - // Standard Error: 6_483_482 - .saturating_add(Weight::from_ref_time(28_047_685_517).saturating_mul(r.into())) + // Minimum execution time: 296_089 nanoseconds. + Weight::from_ref_time(297_193_000) + // Standard Error: 6_571_547 + .saturating_add(Weight::from_ref_time(21_080_280_397).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().reads((160_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -809,10 +809,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_delegate_call(r: u32, ) -> Weight { - // Minimum execution time: 384_523 nanoseconds. - Weight::from_ref_time(385_105_000) - // Standard Error: 6_156_142 - .saturating_add(Weight::from_ref_time(27_780_652_513).saturating_mul(r.into())) + // Minimum execution time: 296_828 nanoseconds. + Weight::from_ref_time(297_685_000) + // Standard Error: 6_864_880 + .saturating_add(Weight::from_ref_time(20_770_321_946).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((150_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -826,12 +826,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 1]`. /// The range of component `c` is `[0, 1024]`. fn seal_call_per_transfer_clone_kb(t: u32, c: u32, ) -> Weight { - // Minimum execution time: 9_509_961 nanoseconds. - Weight::from_ref_time(8_509_991_348) - // Standard Error: 6_614_757 - .saturating_add(Weight::from_ref_time(1_244_514_376).saturating_mul(t.into())) - // Standard Error: 9_918 - .saturating_add(Weight::from_ref_time(9_856_517).saturating_mul(c.into())) + // Minimum execution time: 9_824_671 nanoseconds. + Weight::from_ref_time(8_713_861_450) + // Standard Error: 7_388_925 + .saturating_add(Weight::from_ref_time(1_327_819_806).saturating_mul(t.into())) + // Standard Error: 11_079 + .saturating_add(Weight::from_ref_time(9_789_514).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(167)) .saturating_add(T::DbWeight::get().reads((81_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(163)) @@ -846,10 +846,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:80 w:80) /// The range of component `r` is `[0, 20]`. fn seal_instantiate(r: u32, ) -> Weight { - // Minimum execution time: 384_604 nanoseconds. - Weight::from_ref_time(385_278_000) - // Standard Error: 21_140_468 - .saturating_add(Weight::from_ref_time(33_100_726_150).saturating_mul(r.into())) + // Minimum execution time: 293_374 nanoseconds. + Weight::from_ref_time(302_067_000) + // Standard Error: 20_137_097 + .saturating_add(Weight::from_ref_time(26_444_812_817).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().reads((400_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(5)) @@ -866,12 +866,14 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[0, 960]`. /// The range of component `s` is `[0, 960]`. fn seal_instantiate_per_transfer_input_salt_kb(t: u32, i: u32, s: u32, ) -> Weight { - // Minimum execution time: 129_699_480 nanoseconds. - Weight::from_ref_time(10_187_699_005) - // Standard Error: 155_040 - .saturating_add(Weight::from_ref_time(125_284_310).saturating_mul(i.into())) - // Standard Error: 155_040 - .saturating_add(Weight::from_ref_time(125_850_564).saturating_mul(s.into())) + // Minimum execution time: 126_456_770 nanoseconds. + Weight::from_ref_time(9_223_715_752) + // Standard Error: 96_040_318 + .saturating_add(Weight::from_ref_time(19_550_519).saturating_mul(t.into())) + // Standard Error: 156_614 + .saturating_add(Weight::from_ref_time(122_958_298).saturating_mul(i.into())) + // Standard Error: 156_614 + .saturating_add(Weight::from_ref_time(123_316_079).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(249)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(247)) @@ -884,10 +886,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_hash_sha2_256(r: u32, ) -> Weight { - // Minimum execution time: 380_397 nanoseconds. - Weight::from_ref_time(382_881_855) - // Standard Error: 290_948 - .saturating_add(Weight::from_ref_time(41_017_644).saturating_mul(r.into())) + // Minimum execution time: 289_275 nanoseconds. + Weight::from_ref_time(297_803_961) + // Standard Error: 303_405 + .saturating_add(Weight::from_ref_time(40_800_138).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -898,10 +900,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 422_439 nanoseconds. - Weight::from_ref_time(423_480_000) - // Standard Error: 56_072 - .saturating_add(Weight::from_ref_time(329_103_825).saturating_mul(n.into())) + // Minimum execution time: 336_077 nanoseconds. + Weight::from_ref_time(336_846_000) + // Standard Error: 51_610 + .saturating_add(Weight::from_ref_time(322_208_787).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -912,10 +914,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { - // Minimum execution time: 380_433 nanoseconds. - Weight::from_ref_time(382_325_624) - // Standard Error: 139_248 - .saturating_add(Weight::from_ref_time(53_159_175).saturating_mul(r.into())) + // Minimum execution time: 290_189 nanoseconds. + Weight::from_ref_time(298_454_259) + // Standard Error: 252_946 + .saturating_add(Weight::from_ref_time(55_034_240).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -926,10 +928,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 434_834 nanoseconds. - Weight::from_ref_time(435_383_000) - // Standard Error: 59_824 - .saturating_add(Weight::from_ref_time(251_297_967).saturating_mul(n.into())) + // Minimum execution time: 350_030 nanoseconds. + Weight::from_ref_time(351_356_000) + // Standard Error: 57_422 + .saturating_add(Weight::from_ref_time(256_912_844).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -940,10 +942,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { - // Minimum execution time: 379_088 nanoseconds. - Weight::from_ref_time(381_627_077) - // Standard Error: 152_561 - .saturating_add(Weight::from_ref_time(31_696_922).saturating_mul(r.into())) + // Minimum execution time: 288_480 nanoseconds. + Weight::from_ref_time(297_613_263) + // Standard Error: 456_736 + .saturating_add(Weight::from_ref_time(38_100_936).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -954,10 +956,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 411_630 nanoseconds. - Weight::from_ref_time(412_354_000) - // Standard Error: 50_788 - .saturating_add(Weight::from_ref_time(103_105_715).saturating_mul(n.into())) + // Minimum execution time: 321_195 nanoseconds. + Weight::from_ref_time(325_561_000) + // Standard Error: 46_289 + .saturating_add(Weight::from_ref_time(99_536_902).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -968,10 +970,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { - // Minimum execution time: 379_549 nanoseconds. - Weight::from_ref_time(382_406_346) - // Standard Error: 701_449 - .saturating_add(Weight::from_ref_time(31_066_353).saturating_mul(r.into())) + // Minimum execution time: 287_659 nanoseconds. + Weight::from_ref_time(295_963_340) + // Standard Error: 433_889 + .saturating_add(Weight::from_ref_time(30_251_859).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -982,10 +984,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 412_112 nanoseconds. - Weight::from_ref_time(412_710_000) - // Standard Error: 54_875 - .saturating_add(Weight::from_ref_time(103_169_035).saturating_mul(n.into())) + // Minimum execution time: 324_298 nanoseconds. + Weight::from_ref_time(325_738_000) + // Standard Error: 48_563 + .saturating_add(Weight::from_ref_time(99_479_838).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -996,10 +998,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { - // Minimum execution time: 381_994 nanoseconds. - Weight::from_ref_time(383_832_551) - // Standard Error: 676_656 - .saturating_add(Weight::from_ref_time(3_020_035_748).saturating_mul(r.into())) + // Minimum execution time: 294_257 nanoseconds. + Weight::from_ref_time(299_467_620) + // Standard Error: 589_749 + .saturating_add(Weight::from_ref_time(3_015_389_579).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -1010,10 +1012,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { - // Minimum execution time: 381_472 nanoseconds. - Weight::from_ref_time(383_590_834) - // Standard Error: 538_574 - .saturating_add(Weight::from_ref_time(2_077_926_265).saturating_mul(r.into())) + // Minimum execution time: 289_480 nanoseconds. + Weight::from_ref_time(298_762_412) + // Standard Error: 397_004 + .saturating_add(Weight::from_ref_time(743_937_087).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -1025,10 +1027,10 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:16 w:16) /// The range of component `r` is `[0, 20]`. fn seal_set_code_hash(r: u32, ) -> Weight { - // Minimum execution time: 381_527 nanoseconds. - Weight::from_ref_time(382_291_000) - // Standard Error: 2_760_840 - .saturating_add(Weight::from_ref_time(1_356_115_009).saturating_mul(r.into())) + // Minimum execution time: 293_494 nanoseconds. + Weight::from_ref_time(297_756_000) + // Standard Error: 2_731_227 + .saturating_add(Weight::from_ref_time(1_387_380_436).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads((225_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -1041,10 +1043,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_reentrance_count(r: u32, ) -> Weight { - // Minimum execution time: 382_722 nanoseconds. - Weight::from_ref_time(387_231_409) - // Standard Error: 28_817 - .saturating_add(Weight::from_ref_time(11_349_809).saturating_mul(r.into())) + // Minimum execution time: 295_339 nanoseconds. + Weight::from_ref_time(301_577_907) + // Standard Error: 23_836 + .saturating_add(Weight::from_ref_time(10_876_508).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -1055,10 +1057,10 @@ impl WeightInfo for SubstrateWeight { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_account_reentrance_count(r: u32, ) -> Weight { - // Minimum execution time: 383_568 nanoseconds. - Weight::from_ref_time(419_835_108) - // Standard Error: 125_982 - .saturating_add(Weight::from_ref_time(25_241_800).saturating_mul(r.into())) + // Minimum execution time: 297_096 nanoseconds. + Weight::from_ref_time(336_319_823) + // Standard Error: 128_941 + .saturating_add(Weight::from_ref_time(25_211_374).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -1070,376 +1072,376 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts Nonce (r:1 w:1) /// The range of component `r` is `[0, 20]`. fn seal_instantiation_nonce(r: u32, ) -> Weight { - // Minimum execution time: 382_084 nanoseconds. - Weight::from_ref_time(388_155_568) - // Standard Error: 29_161 - .saturating_add(Weight::from_ref_time(9_015_217).saturating_mul(r.into())) + // Minimum execution time: 293_819 nanoseconds. + Weight::from_ref_time(302_765_659) + // Standard Error: 28_518 + .saturating_add(Weight::from_ref_time(9_325_552).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(4)) } /// The range of component `r` is `[0, 50]`. fn instr_i64const(r: u32, ) -> Weight { - // Minimum execution time: 593 nanoseconds. - Weight::from_ref_time(816_706) - // Standard Error: 173 - .saturating_add(Weight::from_ref_time(344_732).saturating_mul(r.into())) + // Minimum execution time: 805 nanoseconds. + Weight::from_ref_time(1_002_066) + // Standard Error: 609 + .saturating_add(Weight::from_ref_time(346_608).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64load(r: u32, ) -> Weight { - // Minimum execution time: 705 nanoseconds. - Weight::from_ref_time(1_191_205) - // Standard Error: 600 - .saturating_add(Weight::from_ref_time(986_102).saturating_mul(r.into())) + // Minimum execution time: 917 nanoseconds. + Weight::from_ref_time(1_247_710) + // Standard Error: 1_069 + .saturating_add(Weight::from_ref_time(984_608).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64store(r: u32, ) -> Weight { - // Minimum execution time: 717 nanoseconds. - Weight::from_ref_time(1_019_448) - // Standard Error: 421 - .saturating_add(Weight::from_ref_time(882_531).saturating_mul(r.into())) + // Minimum execution time: 917 nanoseconds. + Weight::from_ref_time(1_244_315) + // Standard Error: 524 + .saturating_add(Weight::from_ref_time(882_167).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { - // Minimum execution time: 642 nanoseconds. - Weight::from_ref_time(917_880) - // Standard Error: 362 - .saturating_add(Weight::from_ref_time(957_235).saturating_mul(r.into())) + // Minimum execution time: 791 nanoseconds. + Weight::from_ref_time(1_119_053) + // Standard Error: 379 + .saturating_add(Weight::from_ref_time(956_169).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { - // Minimum execution time: 630 nanoseconds. - Weight::from_ref_time(694_427) - // Standard Error: 1_506 - .saturating_add(Weight::from_ref_time(1_298_411).saturating_mul(r.into())) + // Minimum execution time: 782 nanoseconds. + Weight::from_ref_time(773_373) + // Standard Error: 463 + .saturating_add(Weight::from_ref_time(1_299_306).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { - // Minimum execution time: 634 nanoseconds. - Weight::from_ref_time(1_101_754) - // Standard Error: 840 - .saturating_add(Weight::from_ref_time(526_433).saturating_mul(r.into())) + // Minimum execution time: 743 nanoseconds. + Weight::from_ref_time(1_273_896) + // Standard Error: 925 + .saturating_add(Weight::from_ref_time(527_015).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { - // Minimum execution time: 651 nanoseconds. - Weight::from_ref_time(790_908) - // Standard Error: 849 - .saturating_add(Weight::from_ref_time(800_188).saturating_mul(r.into())) + // Minimum execution time: 761 nanoseconds. + Weight::from_ref_time(929_565) + // Standard Error: 1_275 + .saturating_add(Weight::from_ref_time(805_592).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { - // Minimum execution time: 622 nanoseconds. - Weight::from_ref_time(416_266) - // Standard Error: 1_574 - .saturating_add(Weight::from_ref_time(1_080_225).saturating_mul(r.into())) + // Minimum execution time: 813 nanoseconds. + Weight::from_ref_time(703_802) + // Standard Error: 1_665 + .saturating_add(Weight::from_ref_time(1_074_321).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { - // Minimum execution time: 2_131 nanoseconds. - Weight::from_ref_time(2_540_446) - // Standard Error: 75 - .saturating_add(Weight::from_ref_time(4_997).saturating_mul(e.into())) + // Minimum execution time: 2_347 nanoseconds. + Weight::from_ref_time(2_752_638) + // Standard Error: 69 + .saturating_add(Weight::from_ref_time(4_771).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { - // Minimum execution time: 650 nanoseconds. - Weight::from_ref_time(1_577_978) - // Standard Error: 2_696 - .saturating_add(Weight::from_ref_time(2_204_044).saturating_mul(r.into())) + // Minimum execution time: 826 nanoseconds. + Weight::from_ref_time(1_784_596) + // Standard Error: 1_646 + .saturating_add(Weight::from_ref_time(2_189_993).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { - // Minimum execution time: 742 nanoseconds. - Weight::from_ref_time(1_947_575) - // Standard Error: 1_651 - .saturating_add(Weight::from_ref_time(2_799_445).saturating_mul(r.into())) + // Minimum execution time: 926 nanoseconds. + Weight::from_ref_time(1_898_358) + // Standard Error: 2_678 + .saturating_add(Weight::from_ref_time(2_811_379).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { - // Minimum execution time: 4_230 nanoseconds. - Weight::from_ref_time(5_079_432) - // Standard Error: 315 - .saturating_add(Weight::from_ref_time(179_278).saturating_mul(p.into())) + // Minimum execution time: 4_428 nanoseconds. + Weight::from_ref_time(5_257_445) + // Standard Error: 306 + .saturating_add(Weight::from_ref_time(178_882).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { - // Minimum execution time: 2_830 nanoseconds. - Weight::from_ref_time(3_601_633) - // Standard Error: 31 - .saturating_add(Weight::from_ref_time(92_499).saturating_mul(l.into())) + // Minimum execution time: 2_945 nanoseconds. + Weight::from_ref_time(4_240_619) + // Standard Error: 39 + .saturating_add(Weight::from_ref_time(46_640).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { - // Minimum execution time: 2_896 nanoseconds. - Weight::from_ref_time(3_137_247) - // Standard Error: 245 - .saturating_add(Weight::from_ref_time(364_431).saturating_mul(r.into())) + // Minimum execution time: 2_204 nanoseconds. + Weight::from_ref_time(2_430_272) + // Standard Error: 270 + .saturating_add(Weight::from_ref_time(365_718).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { - // Minimum execution time: 2_795 nanoseconds. - Weight::from_ref_time(3_199_878) - // Standard Error: 549 - .saturating_add(Weight::from_ref_time(380_524).saturating_mul(r.into())) + // Minimum execution time: 2_117 nanoseconds. + Weight::from_ref_time(2_429_354) + // Standard Error: 240 + .saturating_add(Weight::from_ref_time(381_830).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { - // Minimum execution time: 2_807 nanoseconds. - Weight::from_ref_time(3_130_120) - // Standard Error: 319 - .saturating_add(Weight::from_ref_time(525_857).saturating_mul(r.into())) + // Minimum execution time: 2_123 nanoseconds. + Weight::from_ref_time(2_460_016) + // Standard Error: 262 + .saturating_add(Weight::from_ref_time(526_554).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { - // Minimum execution time: 678 nanoseconds. - Weight::from_ref_time(1_013_348) - // Standard Error: 362 - .saturating_add(Weight::from_ref_time(810_232).saturating_mul(r.into())) + // Minimum execution time: 892 nanoseconds. + Weight::from_ref_time(1_234_618) + // Standard Error: 485 + .saturating_add(Weight::from_ref_time(813_721).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { - // Minimum execution time: 624 nanoseconds. - Weight::from_ref_time(973_583) - // Standard Error: 373 - .saturating_add(Weight::from_ref_time(829_360).saturating_mul(r.into())) + // Minimum execution time: 901 nanoseconds. + Weight::from_ref_time(1_182_838) + // Standard Error: 482 + .saturating_add(Weight::from_ref_time(831_308).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { - // Minimum execution time: 698 nanoseconds. - Weight::from_ref_time(904_862) - // Standard Error: 360 - .saturating_add(Weight::from_ref_time(694_614).saturating_mul(r.into())) + // Minimum execution time: 929 nanoseconds. + Weight::from_ref_time(1_221_388) + // Standard Error: 434 + .saturating_add(Weight::from_ref_time(693_301).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn instr_memory_grow(r: u32, ) -> Weight { - // Minimum execution time: 642 nanoseconds. - Weight::from_ref_time(735_085) - // Standard Error: 105_815 - .saturating_add(Weight::from_ref_time(233_816_514).saturating_mul(r.into())) + // Minimum execution time: 808 nanoseconds. + Weight::from_ref_time(906_944) + // Standard Error: 6_164 + .saturating_add(Weight::from_ref_time(187_445_255).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { - // Minimum execution time: 606 nanoseconds. - Weight::from_ref_time(850_590) - // Standard Error: 262 - .saturating_add(Weight::from_ref_time(507_721).saturating_mul(r.into())) + // Minimum execution time: 807 nanoseconds. + Weight::from_ref_time(1_064_776) + // Standard Error: 287 + .saturating_add(Weight::from_ref_time(507_278).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { - // Minimum execution time: 663 nanoseconds. - Weight::from_ref_time(853_060) - // Standard Error: 250 - .saturating_add(Weight::from_ref_time(514_225).saturating_mul(r.into())) + // Minimum execution time: 776 nanoseconds. + Weight::from_ref_time(1_033_205) + // Standard Error: 443 + .saturating_add(Weight::from_ref_time(512_445).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { - // Minimum execution time: 605 nanoseconds. - Weight::from_ref_time(849_563) - // Standard Error: 275 - .saturating_add(Weight::from_ref_time(511_494).saturating_mul(r.into())) + // Minimum execution time: 909 nanoseconds. + Weight::from_ref_time(1_089_083) + // Standard Error: 335 + .saturating_add(Weight::from_ref_time(510_392).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { - // Minimum execution time: 618 nanoseconds. - Weight::from_ref_time(839_855) - // Standard Error: 228 - .saturating_add(Weight::from_ref_time(524_614).saturating_mul(r.into())) + // Minimum execution time: 791 nanoseconds. + Weight::from_ref_time(1_063_118) + // Standard Error: 210 + .saturating_add(Weight::from_ref_time(522_817).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { - // Minimum execution time: 637 nanoseconds. - Weight::from_ref_time(860_326) + // Minimum execution time: 789 nanoseconds. + Weight::from_ref_time(1_056_006) // Standard Error: 240 - .saturating_add(Weight::from_ref_time(504_847).saturating_mul(r.into())) + .saturating_add(Weight::from_ref_time(505_198).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { - // Minimum execution time: 623 nanoseconds. - Weight::from_ref_time(844_585) - // Standard Error: 235 - .saturating_add(Weight::from_ref_time(505_821).saturating_mul(r.into())) + // Minimum execution time: 804 nanoseconds. + Weight::from_ref_time(1_087_882) + // Standard Error: 234 + .saturating_add(Weight::from_ref_time(503_830).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { - // Minimum execution time: 672 nanoseconds. - Weight::from_ref_time(826_784) - // Standard Error: 225 - .saturating_add(Weight::from_ref_time(504_632).saturating_mul(r.into())) + // Minimum execution time: 756 nanoseconds. + Weight::from_ref_time(1_050_994) + // Standard Error: 172 + .saturating_add(Weight::from_ref_time(503_343).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { - // Minimum execution time: 642 nanoseconds. - Weight::from_ref_time(867_080) - // Standard Error: 231 - .saturating_add(Weight::from_ref_time(732_430).saturating_mul(r.into())) + // Minimum execution time: 775 nanoseconds. + Weight::from_ref_time(1_061_228) + // Standard Error: 232 + .saturating_add(Weight::from_ref_time(730_751).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { - // Minimum execution time: 639 nanoseconds. - Weight::from_ref_time(866_094) - // Standard Error: 272 - .saturating_add(Weight::from_ref_time(732_560).saturating_mul(r.into())) + // Minimum execution time: 809 nanoseconds. + Weight::from_ref_time(1_080_957) + // Standard Error: 320 + .saturating_add(Weight::from_ref_time(732_246).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { - // Minimum execution time: 619 nanoseconds. - Weight::from_ref_time(928_672) - // Standard Error: 484 - .saturating_add(Weight::from_ref_time(739_523).saturating_mul(r.into())) + // Minimum execution time: 808 nanoseconds. + Weight::from_ref_time(1_055_752) + // Standard Error: 496 + .saturating_add(Weight::from_ref_time(740_084).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { - // Minimum execution time: 612 nanoseconds. - Weight::from_ref_time(863_312) - // Standard Error: 328 - .saturating_add(Weight::from_ref_time(743_687).saturating_mul(r.into())) + // Minimum execution time: 792 nanoseconds. + Weight::from_ref_time(1_111_972) + // Standard Error: 270 + .saturating_add(Weight::from_ref_time(741_581).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { - // Minimum execution time: 648 nanoseconds. - Weight::from_ref_time(931_331) - // Standard Error: 612 - .saturating_add(Weight::from_ref_time(747_653).saturating_mul(r.into())) + // Minimum execution time: 862 nanoseconds. + Weight::from_ref_time(1_111_246) + // Standard Error: 263 + .saturating_add(Weight::from_ref_time(746_026).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { - // Minimum execution time: 632 nanoseconds. - Weight::from_ref_time(868_901) - // Standard Error: 276 - .saturating_add(Weight::from_ref_time(744_778).saturating_mul(r.into())) + // Minimum execution time: 810 nanoseconds. + Weight::from_ref_time(1_094_933) + // Standard Error: 271 + .saturating_add(Weight::from_ref_time(743_645).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { - // Minimum execution time: 629 nanoseconds. - Weight::from_ref_time(898_516) - // Standard Error: 288 - .saturating_add(Weight::from_ref_time(734_393).saturating_mul(r.into())) + // Minimum execution time: 769 nanoseconds. + Weight::from_ref_time(819_933) + // Standard Error: 4_528 + .saturating_add(Weight::from_ref_time(751_599).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { - // Minimum execution time: 603 nanoseconds. - Weight::from_ref_time(853_744) - // Standard Error: 204 - .saturating_add(Weight::from_ref_time(739_499).saturating_mul(r.into())) + // Minimum execution time: 797 nanoseconds. + Weight::from_ref_time(1_107_352) + // Standard Error: 344 + .saturating_add(Weight::from_ref_time(738_684).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { - // Minimum execution time: 625 nanoseconds. - Weight::from_ref_time(885_174) - // Standard Error: 238 - .saturating_add(Weight::from_ref_time(734_010).saturating_mul(r.into())) + // Minimum execution time: 784 nanoseconds. + Weight::from_ref_time(1_068_487) + // Standard Error: 3_796 + .saturating_add(Weight::from_ref_time(741_207).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { - // Minimum execution time: 602 nanoseconds. - Weight::from_ref_time(915_329) - // Standard Error: 273 - .saturating_add(Weight::from_ref_time(738_209).saturating_mul(r.into())) + // Minimum execution time: 813 nanoseconds. + Weight::from_ref_time(1_067_278) + // Standard Error: 459 + .saturating_add(Weight::from_ref_time(737_841).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { - // Minimum execution time: 585 nanoseconds. - Weight::from_ref_time(862_239) - // Standard Error: 294 - .saturating_add(Weight::from_ref_time(719_000).saturating_mul(r.into())) + // Minimum execution time: 798 nanoseconds. + Weight::from_ref_time(1_100_254) + // Standard Error: 297 + .saturating_add(Weight::from_ref_time(717_622).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { - // Minimum execution time: 633 nanoseconds. - Weight::from_ref_time(881_696) - // Standard Error: 195 - .saturating_add(Weight::from_ref_time(713_153).saturating_mul(r.into())) + // Minimum execution time: 778 nanoseconds. + Weight::from_ref_time(1_063_748) + // Standard Error: 378 + .saturating_add(Weight::from_ref_time(713_577).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { - // Minimum execution time: 629 nanoseconds. - Weight::from_ref_time(856_238) - // Standard Error: 269 - .saturating_add(Weight::from_ref_time(715_451).saturating_mul(r.into())) + // Minimum execution time: 780 nanoseconds. + Weight::from_ref_time(1_088_755) + // Standard Error: 316 + .saturating_add(Weight::from_ref_time(714_127).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { - // Minimum execution time: 633 nanoseconds. - Weight::from_ref_time(880_804) - // Standard Error: 725 - .saturating_add(Weight::from_ref_time(1_349_577).saturating_mul(r.into())) + // Minimum execution time: 776 nanoseconds. + Weight::from_ref_time(1_062_591) + // Standard Error: 610 + .saturating_add(Weight::from_ref_time(1_355_430).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { - // Minimum execution time: 639 nanoseconds. - Weight::from_ref_time(867_528) - // Standard Error: 1_940 - .saturating_add(Weight::from_ref_time(1_287_959).saturating_mul(r.into())) + // Minimum execution time: 801 nanoseconds. + Weight::from_ref_time(1_092_395) + // Standard Error: 423 + .saturating_add(Weight::from_ref_time(1_282_356).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { - // Minimum execution time: 595 nanoseconds. - Weight::from_ref_time(851_253) - // Standard Error: 503 - .saturating_add(Weight::from_ref_time(1_398_668).saturating_mul(r.into())) + // Minimum execution time: 822 nanoseconds. + Weight::from_ref_time(1_083_079) + // Standard Error: 562 + .saturating_add(Weight::from_ref_time(1_398_522).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { - // Minimum execution time: 604 nanoseconds. - Weight::from_ref_time(804_977) - // Standard Error: 812 - .saturating_add(Weight::from_ref_time(1_288_816).saturating_mul(r.into())) + // Minimum execution time: 798 nanoseconds. + Weight::from_ref_time(1_088_997) + // Standard Error: 401 + .saturating_add(Weight::from_ref_time(1_283_442).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { - // Minimum execution time: 609 nanoseconds. - Weight::from_ref_time(890_945) - // Standard Error: 1_645 - .saturating_add(Weight::from_ref_time(719_770).saturating_mul(r.into())) + // Minimum execution time: 815 nanoseconds. + Weight::from_ref_time(1_081_903) + // Standard Error: 264 + .saturating_add(Weight::from_ref_time(718_069).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { - // Minimum execution time: 628 nanoseconds. - Weight::from_ref_time(897_973) - // Standard Error: 1_641 - .saturating_add(Weight::from_ref_time(718_838).saturating_mul(r.into())) + // Minimum execution time: 813 nanoseconds. + Weight::from_ref_time(1_091_426) + // Standard Error: 296 + .saturating_add(Weight::from_ref_time(717_894).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { - // Minimum execution time: 634 nanoseconds. - Weight::from_ref_time(848_440) - // Standard Error: 249 - .saturating_add(Weight::from_ref_time(718_206).saturating_mul(r.into())) + // Minimum execution time: 794 nanoseconds. + Weight::from_ref_time(1_040_144) + // Standard Error: 400 + .saturating_add(Weight::from_ref_time(719_886).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { - // Minimum execution time: 625 nanoseconds. - Weight::from_ref_time(881_579) - // Standard Error: 273 - .saturating_add(Weight::from_ref_time(736_934).saturating_mul(r.into())) + // Minimum execution time: 774 nanoseconds. + Weight::from_ref_time(1_092_466) + // Standard Error: 4_173 + .saturating_add(Weight::from_ref_time(739_873).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { - // Minimum execution time: 630 nanoseconds. - Weight::from_ref_time(897_813) - // Standard Error: 249 - .saturating_add(Weight::from_ref_time(734_657).saturating_mul(r.into())) + // Minimum execution time: 793 nanoseconds. + Weight::from_ref_time(1_105_611) + // Standard Error: 394 + .saturating_add(Weight::from_ref_time(735_358).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { - // Minimum execution time: 607 nanoseconds. - Weight::from_ref_time(871_660) - // Standard Error: 312 - .saturating_add(Weight::from_ref_time(735_377).saturating_mul(r.into())) + // Minimum execution time: 805 nanoseconds. + Weight::from_ref_time(1_130_462) + // Standard Error: 327 + .saturating_add(Weight::from_ref_time(734_198).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { - // Minimum execution time: 610 nanoseconds. - Weight::from_ref_time(861_640) - // Standard Error: 293 - .saturating_add(Weight::from_ref_time(735_524).saturating_mul(r.into())) + // Minimum execution time: 831 nanoseconds. + Weight::from_ref_time(1_118_894) + // Standard Error: 389 + .saturating_add(Weight::from_ref_time(733_834).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { - // Minimum execution time: 625 nanoseconds. - Weight::from_ref_time(880_203) - // Standard Error: 373 - .saturating_add(Weight::from_ref_time(737_354).saturating_mul(r.into())) + // Minimum execution time: 772 nanoseconds. + Weight::from_ref_time(1_123_733) + // Standard Error: 337 + .saturating_add(Weight::from_ref_time(733_923).saturating_mul(r.into())) } } @@ -1447,17 +1449,17 @@ impl WeightInfo for SubstrateWeight { impl WeightInfo for () { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_process_deletion_queue_batch() -> Weight { - // Minimum execution time: 3_196 nanoseconds. - Weight::from_ref_time(3_293_000) + // Minimum execution time: 3_326 nanoseconds. + Weight::from_ref_time(3_433_000) .saturating_add(RocksDbWeight::get().reads(1)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32, ) -> Weight { - // Minimum execution time: 14_857 nanoseconds. - Weight::from_ref_time(14_957_593) - // Standard Error: 1_015 - .saturating_add(Weight::from_ref_time(935_359).saturating_mul(k.into())) + // Minimum execution time: 15_703 nanoseconds. + Weight::from_ref_time(15_288_927) + // Standard Error: 951 + .saturating_add(Weight::from_ref_time(940_816).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1465,10 +1467,10 @@ impl WeightInfo for () { // Storage: Contracts DeletionQueue (r:1 w:0) /// The range of component `q` is `[0, 128]`. fn on_initialize_per_queue_item(q: u32, ) -> Weight { - // Minimum execution time: 3_231 nanoseconds. - Weight::from_ref_time(14_859_580) - // Standard Error: 3_479 - .saturating_add(Weight::from_ref_time(1_185_600).saturating_mul(q.into())) + // Minimum execution time: 3_548 nanoseconds. + Weight::from_ref_time(15_764_121) + // Standard Error: 3_339 + .saturating_add(Weight::from_ref_time(1_214_890).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -1476,10 +1478,10 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn reinstrument(c: u32, ) -> Weight { - // Minimum execution time: 34_565 nanoseconds. - Weight::from_ref_time(29_199_016) - // Standard Error: 70 - .saturating_add(Weight::from_ref_time(47_107).saturating_mul(c.into())) + // Minimum execution time: 29_801 nanoseconds. + Weight::from_ref_time(27_932_706) + // Standard Error: 49 + .saturating_add(Weight::from_ref_time(50_532).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } @@ -1490,10 +1492,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `c` is `[0, 131072]`. fn call_with_code_per_byte(c: u32, ) -> Weight { - // Minimum execution time: 392_074 nanoseconds. - Weight::from_ref_time(404_090_909) - // Standard Error: 24 - .saturating_add(Weight::from_ref_time(30_454).saturating_mul(c.into())) + // Minimum execution time: 307_894 nanoseconds. + Weight::from_ref_time(322_346_319) + // Standard Error: 25 + .saturating_add(Weight::from_ref_time(30_678).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(4)) } @@ -1509,14 +1511,14 @@ impl WeightInfo for () { /// The range of component `i` is `[0, 1048576]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, i: u32, s: u32, ) -> Weight { - // Minimum execution time: 3_785_934 nanoseconds. - Weight::from_ref_time(683_143_843) - // Standard Error: 272 - .saturating_add(Weight::from_ref_time(87_620).saturating_mul(c.into())) + // Minimum execution time: 3_610_424 nanoseconds. + Weight::from_ref_time(583_426_386) + // Standard Error: 277 + .saturating_add(Weight::from_ref_time(90_224).saturating_mul(c.into())) // Standard Error: 16 - .saturating_add(Weight::from_ref_time(1_363).saturating_mul(i.into())) + .saturating_add(Weight::from_ref_time(1_325).saturating_mul(i.into())) // Standard Error: 16 - .saturating_add(Weight::from_ref_time(1_778).saturating_mul(s.into())) + .saturating_add(Weight::from_ref_time(1_727).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8)) .saturating_add(RocksDbWeight::get().writes(9)) } @@ -1530,12 +1532,12 @@ impl WeightInfo for () { /// The range of component `i` is `[0, 1048576]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate(i: u32, s: u32, ) -> Weight { - // Minimum execution time: 1_935_310 nanoseconds. - Weight::from_ref_time(203_531_122) + // Minimum execution time: 1_892_996 nanoseconds. + Weight::from_ref_time(202_958_196) // Standard Error: 8 - .saturating_add(Weight::from_ref_time(1_674).saturating_mul(i.into())) + .saturating_add(Weight::from_ref_time(1_627).saturating_mul(i.into())) // Standard Error: 8 - .saturating_add(Weight::from_ref_time(1_789).saturating_mul(s.into())) + .saturating_add(Weight::from_ref_time(1_755).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8)) .saturating_add(RocksDbWeight::get().writes(7)) } @@ -1545,8 +1547,8 @@ impl WeightInfo for () { // Storage: System Account (r:1 w:1) // Storage: System EventTopics (r:2 w:2) fn call() -> Weight { - // Minimum execution time: 151_999 nanoseconds. - Weight::from_ref_time(153_527_000) + // Minimum execution time: 157_347 nanoseconds. + Weight::from_ref_time(159_084_000) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(4)) } @@ -1556,10 +1558,10 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn upload_code(c: u32, ) -> Weight { - // Minimum execution time: 391_165 nanoseconds. - Weight::from_ref_time(394_519_487) - // Standard Error: 75 - .saturating_add(Weight::from_ref_time(89_736).saturating_mul(c.into())) + // Minimum execution time: 299_987 nanoseconds. + Weight::from_ref_time(305_274_879) + // Standard Error: 72 + .saturating_add(Weight::from_ref_time(91_916).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2)) .saturating_add(RocksDbWeight::get().writes(4)) } @@ -1568,8 +1570,8 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - // Minimum execution time: 39_354 nanoseconds. - Weight::from_ref_time(39_855_000) + // Minimum execution time: 40_795 nanoseconds. + Weight::from_ref_time(41_297_000) .saturating_add(RocksDbWeight::get().reads(2)) .saturating_add(RocksDbWeight::get().writes(4)) } @@ -1577,8 +1579,8 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:2 w:2) // Storage: System EventTopics (r:3 w:3) fn set_code() -> Weight { - // Minimum execution time: 40_909 nanoseconds. - Weight::from_ref_time(41_275_000) + // Minimum execution time: 41_957 nanoseconds. + Weight::from_ref_time(42_536_000) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(6)) } @@ -1589,10 +1591,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_caller(r: u32, ) -> Weight { - // Minimum execution time: 380_150 nanoseconds. - Weight::from_ref_time(384_429_035) - // Standard Error: 34_740 - .saturating_add(Weight::from_ref_time(15_582_218).saturating_mul(r.into())) + // Minimum execution time: 293_544 nanoseconds. + Weight::from_ref_time(298_981_222) + // Standard Error: 39_139 + .saturating_add(Weight::from_ref_time(17_278_436).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1603,10 +1605,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_is_contract(r: u32, ) -> Weight { - // Minimum execution time: 380_608 nanoseconds. - Weight::from_ref_time(326_544_805) - // Standard Error: 475_381 - .saturating_add(Weight::from_ref_time(190_717_772).saturating_mul(r.into())) + // Minimum execution time: 293_500 nanoseconds. + Weight::from_ref_time(237_825_284) + // Standard Error: 450_234 + .saturating_add(Weight::from_ref_time(198_995_806).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -1618,10 +1620,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_code_hash(r: u32, ) -> Weight { - // Minimum execution time: 382_780 nanoseconds. - Weight::from_ref_time(333_775_113) - // Standard Error: 446_086 - .saturating_add(Weight::from_ref_time(232_531_042).saturating_mul(r.into())) + // Minimum execution time: 295_851 nanoseconds. + Weight::from_ref_time(258_113_447) + // Standard Error: 408_747 + .saturating_add(Weight::from_ref_time(237_490_216).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -1633,10 +1635,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_own_code_hash(r: u32, ) -> Weight { - // Minimum execution time: 381_815 nanoseconds. - Weight::from_ref_time(390_931_793) - // Standard Error: 61_918 - .saturating_add(Weight::from_ref_time(18_798_438).saturating_mul(r.into())) + // Minimum execution time: 294_614 nanoseconds. + Weight::from_ref_time(301_528_998) + // Standard Error: 40_613 + .saturating_add(Weight::from_ref_time(20_815_088).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1647,10 +1649,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_caller_is_origin(r: u32, ) -> Weight { - // Minimum execution time: 379_162 nanoseconds. - Weight::from_ref_time(383_796_363) - // Standard Error: 25_555 - .saturating_add(Weight::from_ref_time(10_843_721).saturating_mul(r.into())) + // Minimum execution time: 293_088 nanoseconds. + Weight::from_ref_time(299_120_595) + // Standard Error: 23_277 + .saturating_add(Weight::from_ref_time(11_130_334).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1661,10 +1663,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_address(r: u32, ) -> Weight { - // Minimum execution time: 380_307 nanoseconds. - Weight::from_ref_time(390_211_779) - // Standard Error: 53_326 - .saturating_add(Weight::from_ref_time(15_311_171).saturating_mul(r.into())) + // Minimum execution time: 295_110 nanoseconds. + Weight::from_ref_time(305_295_787) + // Standard Error: 48_521 + .saturating_add(Weight::from_ref_time(16_610_806).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1675,10 +1677,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_gas_left(r: u32, ) -> Weight { - // Minimum execution time: 380_230 nanoseconds. - Weight::from_ref_time(383_470_453) - // Standard Error: 45_007 - .saturating_add(Weight::from_ref_time(15_582_472).saturating_mul(r.into())) + // Minimum execution time: 293_414 nanoseconds. + Weight::from_ref_time(299_960_283) + // Standard Error: 32_003 + .saturating_add(Weight::from_ref_time(16_652_433).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1689,10 +1691,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_balance(r: u32, ) -> Weight { - // Minimum execution time: 380_244 nanoseconds. - Weight::from_ref_time(388_092_461) - // Standard Error: 98_199 - .saturating_add(Weight::from_ref_time(97_339_528).saturating_mul(r.into())) + // Minimum execution time: 292_429 nanoseconds. + Weight::from_ref_time(301_025_128) + // Standard Error: 92_155 + .saturating_add(Weight::from_ref_time(92_731_719).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1703,10 +1705,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_value_transferred(r: u32, ) -> Weight { - // Minimum execution time: 380_242 nanoseconds. - Weight::from_ref_time(384_078_258) - // Standard Error: 28_510 - .saturating_add(Weight::from_ref_time(15_423_359).saturating_mul(r.into())) + // Minimum execution time: 293_516 nanoseconds. + Weight::from_ref_time(300_071_428) + // Standard Error: 25_871 + .saturating_add(Weight::from_ref_time(16_599_369).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1717,10 +1719,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_minimum_balance(r: u32, ) -> Weight { - // Minimum execution time: 379_890 nanoseconds. - Weight::from_ref_time(383_658_430) - // Standard Error: 44_976 - .saturating_add(Weight::from_ref_time(15_451_905).saturating_mul(r.into())) + // Minimum execution time: 293_666 nanoseconds. + Weight::from_ref_time(299_803_599) + // Standard Error: 24_508 + .saturating_add(Weight::from_ref_time(16_500_973).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1731,10 +1733,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_block_number(r: u32, ) -> Weight { - // Minimum execution time: 380_269 nanoseconds. - Weight::from_ref_time(383_580_481) - // Standard Error: 31_862 - .saturating_add(Weight::from_ref_time(15_230_473).saturating_mul(r.into())) + // Minimum execution time: 289_193 nanoseconds. + Weight::from_ref_time(297_946_784) + // Standard Error: 43_719 + .saturating_add(Weight::from_ref_time(16_442_254).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1745,10 +1747,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_now(r: u32, ) -> Weight { - // Minimum execution time: 380_308 nanoseconds. - Weight::from_ref_time(383_732_372) - // Standard Error: 38_359 - .saturating_add(Weight::from_ref_time(15_358_775).saturating_mul(r.into())) + // Minimum execution time: 288_897 nanoseconds. + Weight::from_ref_time(298_856_658) + // Standard Error: 31_003 + .saturating_add(Weight::from_ref_time(16_490_508).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1760,10 +1762,10 @@ impl WeightInfo for () { // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_weight_to_fee(r: u32, ) -> Weight { - // Minimum execution time: 380_834 nanoseconds. - Weight::from_ref_time(388_999_459) - // Standard Error: 96_447 - .saturating_add(Weight::from_ref_time(86_714_414).saturating_mul(r.into())) + // Minimum execution time: 289_850 nanoseconds. + Weight::from_ref_time(302_898_449) + // Standard Error: 92_822 + .saturating_add(Weight::from_ref_time(86_376_874).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1774,10 +1776,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_gas(r: u32, ) -> Weight { - // Minimum execution time: 140_955 nanoseconds. - Weight::from_ref_time(144_716_423) - // Standard Error: 11_370 - .saturating_add(Weight::from_ref_time(7_858_807).saturating_mul(r.into())) + // Minimum execution time: 145_105 nanoseconds. + Weight::from_ref_time(152_388_934) + // Standard Error: 29_988 + .saturating_add(Weight::from_ref_time(7_761_947).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1788,10 +1790,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_input(r: u32, ) -> Weight { - // Minimum execution time: 380_210 nanoseconds. - Weight::from_ref_time(384_185_776) - // Standard Error: 49_038 - .saturating_add(Weight::from_ref_time(13_649_793).saturating_mul(r.into())) + // Minimum execution time: 289_319 nanoseconds. + Weight::from_ref_time(298_390_911) + // Standard Error: 27_329 + .saturating_add(Weight::from_ref_time(14_225_527).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1802,10 +1804,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_input_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 396_209 nanoseconds. - Weight::from_ref_time(424_522_611) - // Standard Error: 3_917 - .saturating_add(Weight::from_ref_time(9_627_216).saturating_mul(n.into())) + // Minimum execution time: 305_538 nanoseconds. + Weight::from_ref_time(339_734_596) + // Standard Error: 4_636 + .saturating_add(Weight::from_ref_time(9_592_149).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1816,10 +1818,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_return(r: u32, ) -> Weight { - // Minimum execution time: 378_412 nanoseconds. - Weight::from_ref_time(380_502_085) - // Standard Error: 201_552 - .saturating_add(Weight::from_ref_time(1_434_214).saturating_mul(r.into())) + // Minimum execution time: 287_189 nanoseconds. + Weight::from_ref_time(295_472_383) + // Standard Error: 314_142 + .saturating_add(Weight::from_ref_time(214_016).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1830,10 +1832,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_return_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 381_463 nanoseconds. - Weight::from_ref_time(383_955_553) - // Standard Error: 998 - .saturating_add(Weight::from_ref_time(230_512).saturating_mul(n.into())) + // Minimum execution time: 289_380 nanoseconds. + Weight::from_ref_time(296_302_404) + // Standard Error: 889 + .saturating_add(Weight::from_ref_time(190_017).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1846,10 +1848,10 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32, ) -> Weight { - // Minimum execution time: 379_877 nanoseconds. - Weight::from_ref_time(381_729_546) - // Standard Error: 214_004 - .saturating_add(Weight::from_ref_time(52_528_353).saturating_mul(r.into())) + // Minimum execution time: 292_383 nanoseconds. + Weight::from_ref_time(297_557_691) + // Standard Error: 251_228 + .saturating_add(Weight::from_ref_time(56_688_008).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -1863,10 +1865,10 @@ impl WeightInfo for () { // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_random(r: u32, ) -> Weight { - // Minimum execution time: 380_275 nanoseconds. - Weight::from_ref_time(386_495_777) - // Standard Error: 94_674 - .saturating_add(Weight::from_ref_time(108_432_929).saturating_mul(r.into())) + // Minimum execution time: 293_019 nanoseconds. + Weight::from_ref_time(301_747_439) + // Standard Error: 92_043 + .saturating_add(Weight::from_ref_time(109_861_144).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1877,10 +1879,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_deposit_event(r: u32, ) -> Weight { - // Minimum execution time: 379_095 nanoseconds. - Weight::from_ref_time(393_997_924) - // Standard Error: 141_916 - .saturating_add(Weight::from_ref_time(212_937_170).saturating_mul(r.into())) + // Minimum execution time: 287_586 nanoseconds. + Weight::from_ref_time(304_751_302) + // Standard Error: 127_698 + .saturating_add(Weight::from_ref_time(221_525_053).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -1892,12 +1894,12 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 4]`. /// The range of component `n` is `[0, 16]`. fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - // Minimum execution time: 1_241_001 nanoseconds. - Weight::from_ref_time(548_526_917) - // Standard Error: 496_807 - .saturating_add(Weight::from_ref_time(177_087_769).saturating_mul(t.into())) - // Standard Error: 136_447 - .saturating_add(Weight::from_ref_time(71_558_402).saturating_mul(n.into())) + // Minimum execution time: 1_182_204 nanoseconds. + Weight::from_ref_time(508_607_957) + // Standard Error: 503_533 + .saturating_add(Weight::from_ref_time(173_998_655).saturating_mul(t.into())) + // Standard Error: 138_294 + .saturating_add(Weight::from_ref_time(67_991_373).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -1910,20 +1912,20 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_debug_message(r: u32, ) -> Weight { - // Minimum execution time: 159_158 nanoseconds. - Weight::from_ref_time(163_427_712) - // Standard Error: 22_442 - .saturating_add(Weight::from_ref_time(12_647_838).saturating_mul(r.into())) + // Minimum execution time: 157_706 nanoseconds. + Weight::from_ref_time(161_895_583) + // Standard Error: 14_952 + .saturating_add(Weight::from_ref_time(12_990_237).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_set_storage(r: u32, ) -> Weight { - // Minimum execution time: 381_068 nanoseconds. - Weight::from_ref_time(341_041_230) - // Standard Error: 464_053 - .saturating_add(Weight::from_ref_time(402_677_314).saturating_mul(r.into())) + // Minimum execution time: 290_063 nanoseconds. + Weight::from_ref_time(256_404_853) + // Standard Error: 436_195 + .saturating_add(Weight::from_ref_time(406_569_743).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -1932,10 +1934,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_set_storage_per_new_kb(n: u32, ) -> Weight { - // Minimum execution time: 508_695 nanoseconds. - Weight::from_ref_time(663_159_695) - // Standard Error: 1_419_342 - .saturating_add(Weight::from_ref_time(96_558_570).saturating_mul(n.into())) + // Minimum execution time: 426_295 nanoseconds. + Weight::from_ref_time(582_989_911) + // Standard Error: 1_404_141 + .saturating_add(Weight::from_ref_time(89_545_963).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(52)) .saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(50)) @@ -1944,10 +1946,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_set_storage_per_old_kb(n: u32, ) -> Weight { - // Minimum execution time: 508_542 nanoseconds. - Weight::from_ref_time(634_146_978) - // Standard Error: 1_168_252 - .saturating_add(Weight::from_ref_time(64_231_947).saturating_mul(n.into())) + // Minimum execution time: 425_062 nanoseconds. + Weight::from_ref_time(552_380_900) + // Standard Error: 1_140_169 + .saturating_add(Weight::from_ref_time(64_085_108).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(51)) .saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(49)) @@ -1956,10 +1958,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_clear_storage(r: u32, ) -> Weight { - // Minimum execution time: 381_743 nanoseconds. - Weight::from_ref_time(337_309_674) - // Standard Error: 527_407 - .saturating_add(Weight::from_ref_time(395_767_068).saturating_mul(r.into())) + // Minimum execution time: 294_421 nanoseconds. + Weight::from_ref_time(260_897_072) + // Standard Error: 474_135 + .saturating_add(Weight::from_ref_time(403_191_862).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -1968,10 +1970,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_clear_storage_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 478_283 nanoseconds. - Weight::from_ref_time(616_673_245) - // Standard Error: 1_290_784 - .saturating_add(Weight::from_ref_time(66_534_552).saturating_mul(n.into())) + // Minimum execution time: 391_743 nanoseconds. + Weight::from_ref_time(535_327_545) + // Standard Error: 1_297_157 + .saturating_add(Weight::from_ref_time(67_222_981).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(51)) .saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(48)) @@ -1980,10 +1982,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_get_storage(r: u32, ) -> Weight { - // Minimum execution time: 381_916 nanoseconds. - Weight::from_ref_time(349_150_912) - // Standard Error: 443_388 - .saturating_add(Weight::from_ref_time(316_975_558).saturating_mul(r.into())) + // Minimum execution time: 294_947 nanoseconds. + Weight::from_ref_time(266_280_887) + // Standard Error: 382_477 + .saturating_add(Weight::from_ref_time(323_306_898).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -1991,10 +1993,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_get_storage_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 459_294 nanoseconds. - Weight::from_ref_time(579_698_524) - // Standard Error: 1_111_681 - .saturating_add(Weight::from_ref_time(159_276_087).saturating_mul(n.into())) + // Minimum execution time: 375_487 nanoseconds. + Weight::from_ref_time(497_019_365) + // Standard Error: 1_141_672 + .saturating_add(Weight::from_ref_time(152_354_482).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(51)) .saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -2002,10 +2004,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_contains_storage(r: u32, ) -> Weight { - // Minimum execution time: 381_700 nanoseconds. - Weight::from_ref_time(352_544_675) - // Standard Error: 401_504 - .saturating_add(Weight::from_ref_time(304_380_106).saturating_mul(r.into())) + // Minimum execution time: 294_716 nanoseconds. + Weight::from_ref_time(266_187_186) + // Standard Error: 395_323 + .saturating_add(Weight::from_ref_time(309_907_221).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -2013,10 +2015,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_contains_storage_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 455_595 nanoseconds. - Weight::from_ref_time(560_428_166) - // Standard Error: 991_088 - .saturating_add(Weight::from_ref_time(61_810_610).saturating_mul(n.into())) + // Minimum execution time: 371_667 nanoseconds. + Weight::from_ref_time(478_075_482) + // Standard Error: 979_116 + .saturating_add(Weight::from_ref_time(62_075_707).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(51)) .saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -2024,10 +2026,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 10]`. fn seal_take_storage(r: u32, ) -> Weight { - // Minimum execution time: 382_000 nanoseconds. - Weight::from_ref_time(336_164_219) - // Standard Error: 601_744 - .saturating_add(Weight::from_ref_time(406_198_079).saturating_mul(r.into())) + // Minimum execution time: 292_147 nanoseconds. + Weight::from_ref_time(254_374_598) + // Standard Error: 442_367 + .saturating_add(Weight::from_ref_time(413_674_705).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -2036,10 +2038,10 @@ impl WeightInfo for () { // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 8]`. fn seal_take_storage_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 482_335 nanoseconds. - Weight::from_ref_time(634_245_177) - // Standard Error: 1_418_845 - .saturating_add(Weight::from_ref_time(164_352_113).saturating_mul(n.into())) + // Minimum execution time: 398_554 nanoseconds. + Weight::from_ref_time(553_715_911) + // Standard Error: 1_415_272 + .saturating_add(Weight::from_ref_time(158_254_544).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(51)) .saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(48)) @@ -2052,10 +2054,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_transfer(r: u32, ) -> Weight { - // Minimum execution time: 382_142 nanoseconds. - Weight::from_ref_time(317_581_708) - // Standard Error: 682_156 - .saturating_add(Weight::from_ref_time(1_305_289_569).saturating_mul(r.into())) + // Minimum execution time: 295_081 nanoseconds. + Weight::from_ref_time(253_461_581) + // Standard Error: 740_198 + .saturating_add(Weight::from_ref_time(1_369_153_623).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7)) .saturating_add(RocksDbWeight::get().reads((80_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(4)) @@ -2068,10 +2070,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_call(r: u32, ) -> Weight { - // Minimum execution time: 383_580 nanoseconds. - Weight::from_ref_time(384_176_000) - // Standard Error: 6_483_482 - .saturating_add(Weight::from_ref_time(28_047_685_517).saturating_mul(r.into())) + // Minimum execution time: 296_089 nanoseconds. + Weight::from_ref_time(297_193_000) + // Standard Error: 6_571_547 + .saturating_add(Weight::from_ref_time(21_080_280_397).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7)) .saturating_add(RocksDbWeight::get().reads((160_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -2084,10 +2086,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_delegate_call(r: u32, ) -> Weight { - // Minimum execution time: 384_523 nanoseconds. - Weight::from_ref_time(385_105_000) - // Standard Error: 6_156_142 - .saturating_add(Weight::from_ref_time(27_780_652_513).saturating_mul(r.into())) + // Minimum execution time: 296_828 nanoseconds. + Weight::from_ref_time(297_685_000) + // Standard Error: 6_864_880 + .saturating_add(Weight::from_ref_time(20_770_321_946).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((150_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -2101,12 +2103,12 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 1]`. /// The range of component `c` is `[0, 1024]`. fn seal_call_per_transfer_clone_kb(t: u32, c: u32, ) -> Weight { - // Minimum execution time: 9_509_961 nanoseconds. - Weight::from_ref_time(8_509_991_348) - // Standard Error: 6_614_757 - .saturating_add(Weight::from_ref_time(1_244_514_376).saturating_mul(t.into())) - // Standard Error: 9_918 - .saturating_add(Weight::from_ref_time(9_856_517).saturating_mul(c.into())) + // Minimum execution time: 9_824_671 nanoseconds. + Weight::from_ref_time(8_713_861_450) + // Standard Error: 7_388_925 + .saturating_add(Weight::from_ref_time(1_327_819_806).saturating_mul(t.into())) + // Standard Error: 11_079 + .saturating_add(Weight::from_ref_time(9_789_514).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(167)) .saturating_add(RocksDbWeight::get().reads((81_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(163)) @@ -2121,10 +2123,10 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:80 w:80) /// The range of component `r` is `[0, 20]`. fn seal_instantiate(r: u32, ) -> Weight { - // Minimum execution time: 384_604 nanoseconds. - Weight::from_ref_time(385_278_000) - // Standard Error: 21_140_468 - .saturating_add(Weight::from_ref_time(33_100_726_150).saturating_mul(r.into())) + // Minimum execution time: 293_374 nanoseconds. + Weight::from_ref_time(302_067_000) + // Standard Error: 20_137_097 + .saturating_add(Weight::from_ref_time(26_444_812_817).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(8)) .saturating_add(RocksDbWeight::get().reads((400_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(5)) @@ -2141,12 +2143,14 @@ impl WeightInfo for () { /// The range of component `i` is `[0, 960]`. /// The range of component `s` is `[0, 960]`. fn seal_instantiate_per_transfer_input_salt_kb(t: u32, i: u32, s: u32, ) -> Weight { - // Minimum execution time: 129_699_480 nanoseconds. - Weight::from_ref_time(10_187_699_005) - // Standard Error: 155_040 - .saturating_add(Weight::from_ref_time(125_284_310).saturating_mul(i.into())) - // Standard Error: 155_040 - .saturating_add(Weight::from_ref_time(125_850_564).saturating_mul(s.into())) + // Minimum execution time: 126_456_770 nanoseconds. + Weight::from_ref_time(9_223_715_752) + // Standard Error: 96_040_318 + .saturating_add(Weight::from_ref_time(19_550_519).saturating_mul(t.into())) + // Standard Error: 156_614 + .saturating_add(Weight::from_ref_time(122_958_298).saturating_mul(i.into())) + // Standard Error: 156_614 + .saturating_add(Weight::from_ref_time(123_316_079).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(249)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(247)) @@ -2159,10 +2163,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_hash_sha2_256(r: u32, ) -> Weight { - // Minimum execution time: 380_397 nanoseconds. - Weight::from_ref_time(382_881_855) - // Standard Error: 290_948 - .saturating_add(Weight::from_ref_time(41_017_644).saturating_mul(r.into())) + // Minimum execution time: 289_275 nanoseconds. + Weight::from_ref_time(297_803_961) + // Standard Error: 303_405 + .saturating_add(Weight::from_ref_time(40_800_138).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2173,10 +2177,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 422_439 nanoseconds. - Weight::from_ref_time(423_480_000) - // Standard Error: 56_072 - .saturating_add(Weight::from_ref_time(329_103_825).saturating_mul(n.into())) + // Minimum execution time: 336_077 nanoseconds. + Weight::from_ref_time(336_846_000) + // Standard Error: 51_610 + .saturating_add(Weight::from_ref_time(322_208_787).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2187,10 +2191,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { - // Minimum execution time: 380_433 nanoseconds. - Weight::from_ref_time(382_325_624) - // Standard Error: 139_248 - .saturating_add(Weight::from_ref_time(53_159_175).saturating_mul(r.into())) + // Minimum execution time: 290_189 nanoseconds. + Weight::from_ref_time(298_454_259) + // Standard Error: 252_946 + .saturating_add(Weight::from_ref_time(55_034_240).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2201,10 +2205,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 434_834 nanoseconds. - Weight::from_ref_time(435_383_000) - // Standard Error: 59_824 - .saturating_add(Weight::from_ref_time(251_297_967).saturating_mul(n.into())) + // Minimum execution time: 350_030 nanoseconds. + Weight::from_ref_time(351_356_000) + // Standard Error: 57_422 + .saturating_add(Weight::from_ref_time(256_912_844).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2215,10 +2219,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { - // Minimum execution time: 379_088 nanoseconds. - Weight::from_ref_time(381_627_077) - // Standard Error: 152_561 - .saturating_add(Weight::from_ref_time(31_696_922).saturating_mul(r.into())) + // Minimum execution time: 288_480 nanoseconds. + Weight::from_ref_time(297_613_263) + // Standard Error: 456_736 + .saturating_add(Weight::from_ref_time(38_100_936).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2229,10 +2233,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 411_630 nanoseconds. - Weight::from_ref_time(412_354_000) - // Standard Error: 50_788 - .saturating_add(Weight::from_ref_time(103_105_715).saturating_mul(n.into())) + // Minimum execution time: 321_195 nanoseconds. + Weight::from_ref_time(325_561_000) + // Standard Error: 46_289 + .saturating_add(Weight::from_ref_time(99_536_902).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2243,10 +2247,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { - // Minimum execution time: 379_549 nanoseconds. - Weight::from_ref_time(382_406_346) - // Standard Error: 701_449 - .saturating_add(Weight::from_ref_time(31_066_353).saturating_mul(r.into())) + // Minimum execution time: 287_659 nanoseconds. + Weight::from_ref_time(295_963_340) + // Standard Error: 433_889 + .saturating_add(Weight::from_ref_time(30_251_859).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2257,10 +2261,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - // Minimum execution time: 412_112 nanoseconds. - Weight::from_ref_time(412_710_000) - // Standard Error: 54_875 - .saturating_add(Weight::from_ref_time(103_169_035).saturating_mul(n.into())) + // Minimum execution time: 324_298 nanoseconds. + Weight::from_ref_time(325_738_000) + // Standard Error: 48_563 + .saturating_add(Weight::from_ref_time(99_479_838).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2271,10 +2275,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { - // Minimum execution time: 381_994 nanoseconds. - Weight::from_ref_time(383_832_551) - // Standard Error: 676_656 - .saturating_add(Weight::from_ref_time(3_020_035_748).saturating_mul(r.into())) + // Minimum execution time: 294_257 nanoseconds. + Weight::from_ref_time(299_467_620) + // Standard Error: 589_749 + .saturating_add(Weight::from_ref_time(3_015_389_579).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2285,10 +2289,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 1]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { - // Minimum execution time: 381_472 nanoseconds. - Weight::from_ref_time(383_590_834) - // Standard Error: 538_574 - .saturating_add(Weight::from_ref_time(2_077_926_265).saturating_mul(r.into())) + // Minimum execution time: 289_480 nanoseconds. + Weight::from_ref_time(298_762_412) + // Standard Error: 397_004 + .saturating_add(Weight::from_ref_time(743_937_087).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2300,10 +2304,10 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:16 w:16) /// The range of component `r` is `[0, 20]`. fn seal_set_code_hash(r: u32, ) -> Weight { - // Minimum execution time: 381_527 nanoseconds. - Weight::from_ref_time(382_291_000) - // Standard Error: 2_760_840 - .saturating_add(Weight::from_ref_time(1_356_115_009).saturating_mul(r.into())) + // Minimum execution time: 293_494 nanoseconds. + Weight::from_ref_time(297_756_000) + // Standard Error: 2_731_227 + .saturating_add(Weight::from_ref_time(1_387_380_436).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads((225_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3)) @@ -2316,10 +2320,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_reentrance_count(r: u32, ) -> Weight { - // Minimum execution time: 382_722 nanoseconds. - Weight::from_ref_time(387_231_409) - // Standard Error: 28_817 - .saturating_add(Weight::from_ref_time(11_349_809).saturating_mul(r.into())) + // Minimum execution time: 295_339 nanoseconds. + Weight::from_ref_time(301_577_907) + // Standard Error: 23_836 + .saturating_add(Weight::from_ref_time(10_876_508).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2330,10 +2334,10 @@ impl WeightInfo for () { // Storage: System EventTopics (r:2 w:2) /// The range of component `r` is `[0, 20]`. fn seal_account_reentrance_count(r: u32, ) -> Weight { - // Minimum execution time: 383_568 nanoseconds. - Weight::from_ref_time(419_835_108) - // Standard Error: 125_982 - .saturating_add(Weight::from_ref_time(25_241_800).saturating_mul(r.into())) + // Minimum execution time: 297_096 nanoseconds. + Weight::from_ref_time(336_319_823) + // Standard Error: 128_941 + .saturating_add(Weight::from_ref_time(25_211_374).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(3)) } @@ -2345,375 +2349,375 @@ impl WeightInfo for () { // Storage: Contracts Nonce (r:1 w:1) /// The range of component `r` is `[0, 20]`. fn seal_instantiation_nonce(r: u32, ) -> Weight { - // Minimum execution time: 382_084 nanoseconds. - Weight::from_ref_time(388_155_568) - // Standard Error: 29_161 - .saturating_add(Weight::from_ref_time(9_015_217).saturating_mul(r.into())) + // Minimum execution time: 293_819 nanoseconds. + Weight::from_ref_time(302_765_659) + // Standard Error: 28_518 + .saturating_add(Weight::from_ref_time(9_325_552).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7)) .saturating_add(RocksDbWeight::get().writes(4)) } /// The range of component `r` is `[0, 50]`. fn instr_i64const(r: u32, ) -> Weight { - // Minimum execution time: 593 nanoseconds. - Weight::from_ref_time(816_706) - // Standard Error: 173 - .saturating_add(Weight::from_ref_time(344_732).saturating_mul(r.into())) + // Minimum execution time: 805 nanoseconds. + Weight::from_ref_time(1_002_066) + // Standard Error: 609 + .saturating_add(Weight::from_ref_time(346_608).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64load(r: u32, ) -> Weight { - // Minimum execution time: 705 nanoseconds. - Weight::from_ref_time(1_191_205) - // Standard Error: 600 - .saturating_add(Weight::from_ref_time(986_102).saturating_mul(r.into())) + // Minimum execution time: 917 nanoseconds. + Weight::from_ref_time(1_247_710) + // Standard Error: 1_069 + .saturating_add(Weight::from_ref_time(984_608).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64store(r: u32, ) -> Weight { - // Minimum execution time: 717 nanoseconds. - Weight::from_ref_time(1_019_448) - // Standard Error: 421 - .saturating_add(Weight::from_ref_time(882_531).saturating_mul(r.into())) + // Minimum execution time: 917 nanoseconds. + Weight::from_ref_time(1_244_315) + // Standard Error: 524 + .saturating_add(Weight::from_ref_time(882_167).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { - // Minimum execution time: 642 nanoseconds. - Weight::from_ref_time(917_880) - // Standard Error: 362 - .saturating_add(Weight::from_ref_time(957_235).saturating_mul(r.into())) + // Minimum execution time: 791 nanoseconds. + Weight::from_ref_time(1_119_053) + // Standard Error: 379 + .saturating_add(Weight::from_ref_time(956_169).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { - // Minimum execution time: 630 nanoseconds. - Weight::from_ref_time(694_427) - // Standard Error: 1_506 - .saturating_add(Weight::from_ref_time(1_298_411).saturating_mul(r.into())) + // Minimum execution time: 782 nanoseconds. + Weight::from_ref_time(773_373) + // Standard Error: 463 + .saturating_add(Weight::from_ref_time(1_299_306).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { - // Minimum execution time: 634 nanoseconds. - Weight::from_ref_time(1_101_754) - // Standard Error: 840 - .saturating_add(Weight::from_ref_time(526_433).saturating_mul(r.into())) + // Minimum execution time: 743 nanoseconds. + Weight::from_ref_time(1_273_896) + // Standard Error: 925 + .saturating_add(Weight::from_ref_time(527_015).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { - // Minimum execution time: 651 nanoseconds. - Weight::from_ref_time(790_908) - // Standard Error: 849 - .saturating_add(Weight::from_ref_time(800_188).saturating_mul(r.into())) + // Minimum execution time: 761 nanoseconds. + Weight::from_ref_time(929_565) + // Standard Error: 1_275 + .saturating_add(Weight::from_ref_time(805_592).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { - // Minimum execution time: 622 nanoseconds. - Weight::from_ref_time(416_266) - // Standard Error: 1_574 - .saturating_add(Weight::from_ref_time(1_080_225).saturating_mul(r.into())) + // Minimum execution time: 813 nanoseconds. + Weight::from_ref_time(703_802) + // Standard Error: 1_665 + .saturating_add(Weight::from_ref_time(1_074_321).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { - // Minimum execution time: 2_131 nanoseconds. - Weight::from_ref_time(2_540_446) - // Standard Error: 75 - .saturating_add(Weight::from_ref_time(4_997).saturating_mul(e.into())) + // Minimum execution time: 2_347 nanoseconds. + Weight::from_ref_time(2_752_638) + // Standard Error: 69 + .saturating_add(Weight::from_ref_time(4_771).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { - // Minimum execution time: 650 nanoseconds. - Weight::from_ref_time(1_577_978) - // Standard Error: 2_696 - .saturating_add(Weight::from_ref_time(2_204_044).saturating_mul(r.into())) + // Minimum execution time: 826 nanoseconds. + Weight::from_ref_time(1_784_596) + // Standard Error: 1_646 + .saturating_add(Weight::from_ref_time(2_189_993).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { - // Minimum execution time: 742 nanoseconds. - Weight::from_ref_time(1_947_575) - // Standard Error: 1_651 - .saturating_add(Weight::from_ref_time(2_799_445).saturating_mul(r.into())) + // Minimum execution time: 926 nanoseconds. + Weight::from_ref_time(1_898_358) + // Standard Error: 2_678 + .saturating_add(Weight::from_ref_time(2_811_379).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { - // Minimum execution time: 4_230 nanoseconds. - Weight::from_ref_time(5_079_432) - // Standard Error: 315 - .saturating_add(Weight::from_ref_time(179_278).saturating_mul(p.into())) + // Minimum execution time: 4_428 nanoseconds. + Weight::from_ref_time(5_257_445) + // Standard Error: 306 + .saturating_add(Weight::from_ref_time(178_882).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { - // Minimum execution time: 2_830 nanoseconds. - Weight::from_ref_time(3_601_633) - // Standard Error: 31 - .saturating_add(Weight::from_ref_time(92_499).saturating_mul(l.into())) + // Minimum execution time: 2_945 nanoseconds. + Weight::from_ref_time(4_240_619) + // Standard Error: 39 + .saturating_add(Weight::from_ref_time(46_640).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { - // Minimum execution time: 2_896 nanoseconds. - Weight::from_ref_time(3_137_247) - // Standard Error: 245 - .saturating_add(Weight::from_ref_time(364_431).saturating_mul(r.into())) + // Minimum execution time: 2_204 nanoseconds. + Weight::from_ref_time(2_430_272) + // Standard Error: 270 + .saturating_add(Weight::from_ref_time(365_718).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { - // Minimum execution time: 2_795 nanoseconds. - Weight::from_ref_time(3_199_878) - // Standard Error: 549 - .saturating_add(Weight::from_ref_time(380_524).saturating_mul(r.into())) + // Minimum execution time: 2_117 nanoseconds. + Weight::from_ref_time(2_429_354) + // Standard Error: 240 + .saturating_add(Weight::from_ref_time(381_830).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { - // Minimum execution time: 2_807 nanoseconds. - Weight::from_ref_time(3_130_120) - // Standard Error: 319 - .saturating_add(Weight::from_ref_time(525_857).saturating_mul(r.into())) + // Minimum execution time: 2_123 nanoseconds. + Weight::from_ref_time(2_460_016) + // Standard Error: 262 + .saturating_add(Weight::from_ref_time(526_554).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { - // Minimum execution time: 678 nanoseconds. - Weight::from_ref_time(1_013_348) - // Standard Error: 362 - .saturating_add(Weight::from_ref_time(810_232).saturating_mul(r.into())) + // Minimum execution time: 892 nanoseconds. + Weight::from_ref_time(1_234_618) + // Standard Error: 485 + .saturating_add(Weight::from_ref_time(813_721).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { - // Minimum execution time: 624 nanoseconds. - Weight::from_ref_time(973_583) - // Standard Error: 373 - .saturating_add(Weight::from_ref_time(829_360).saturating_mul(r.into())) + // Minimum execution time: 901 nanoseconds. + Weight::from_ref_time(1_182_838) + // Standard Error: 482 + .saturating_add(Weight::from_ref_time(831_308).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { - // Minimum execution time: 698 nanoseconds. - Weight::from_ref_time(904_862) - // Standard Error: 360 - .saturating_add(Weight::from_ref_time(694_614).saturating_mul(r.into())) + // Minimum execution time: 929 nanoseconds. + Weight::from_ref_time(1_221_388) + // Standard Error: 434 + .saturating_add(Weight::from_ref_time(693_301).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn instr_memory_grow(r: u32, ) -> Weight { - // Minimum execution time: 642 nanoseconds. - Weight::from_ref_time(735_085) - // Standard Error: 105_815 - .saturating_add(Weight::from_ref_time(233_816_514).saturating_mul(r.into())) + // Minimum execution time: 808 nanoseconds. + Weight::from_ref_time(906_944) + // Standard Error: 6_164 + .saturating_add(Weight::from_ref_time(187_445_255).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { - // Minimum execution time: 606 nanoseconds. - Weight::from_ref_time(850_590) - // Standard Error: 262 - .saturating_add(Weight::from_ref_time(507_721).saturating_mul(r.into())) + // Minimum execution time: 807 nanoseconds. + Weight::from_ref_time(1_064_776) + // Standard Error: 287 + .saturating_add(Weight::from_ref_time(507_278).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { - // Minimum execution time: 663 nanoseconds. - Weight::from_ref_time(853_060) - // Standard Error: 250 - .saturating_add(Weight::from_ref_time(514_225).saturating_mul(r.into())) + // Minimum execution time: 776 nanoseconds. + Weight::from_ref_time(1_033_205) + // Standard Error: 443 + .saturating_add(Weight::from_ref_time(512_445).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { - // Minimum execution time: 605 nanoseconds. - Weight::from_ref_time(849_563) - // Standard Error: 275 - .saturating_add(Weight::from_ref_time(511_494).saturating_mul(r.into())) + // Minimum execution time: 909 nanoseconds. + Weight::from_ref_time(1_089_083) + // Standard Error: 335 + .saturating_add(Weight::from_ref_time(510_392).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { - // Minimum execution time: 618 nanoseconds. - Weight::from_ref_time(839_855) - // Standard Error: 228 - .saturating_add(Weight::from_ref_time(524_614).saturating_mul(r.into())) + // Minimum execution time: 791 nanoseconds. + Weight::from_ref_time(1_063_118) + // Standard Error: 210 + .saturating_add(Weight::from_ref_time(522_817).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { - // Minimum execution time: 637 nanoseconds. - Weight::from_ref_time(860_326) + // Minimum execution time: 789 nanoseconds. + Weight::from_ref_time(1_056_006) // Standard Error: 240 - .saturating_add(Weight::from_ref_time(504_847).saturating_mul(r.into())) + .saturating_add(Weight::from_ref_time(505_198).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { - // Minimum execution time: 623 nanoseconds. - Weight::from_ref_time(844_585) - // Standard Error: 235 - .saturating_add(Weight::from_ref_time(505_821).saturating_mul(r.into())) + // Minimum execution time: 804 nanoseconds. + Weight::from_ref_time(1_087_882) + // Standard Error: 234 + .saturating_add(Weight::from_ref_time(503_830).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { - // Minimum execution time: 672 nanoseconds. - Weight::from_ref_time(826_784) - // Standard Error: 225 - .saturating_add(Weight::from_ref_time(504_632).saturating_mul(r.into())) + // Minimum execution time: 756 nanoseconds. + Weight::from_ref_time(1_050_994) + // Standard Error: 172 + .saturating_add(Weight::from_ref_time(503_343).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { - // Minimum execution time: 642 nanoseconds. - Weight::from_ref_time(867_080) - // Standard Error: 231 - .saturating_add(Weight::from_ref_time(732_430).saturating_mul(r.into())) + // Minimum execution time: 775 nanoseconds. + Weight::from_ref_time(1_061_228) + // Standard Error: 232 + .saturating_add(Weight::from_ref_time(730_751).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { - // Minimum execution time: 639 nanoseconds. - Weight::from_ref_time(866_094) - // Standard Error: 272 - .saturating_add(Weight::from_ref_time(732_560).saturating_mul(r.into())) + // Minimum execution time: 809 nanoseconds. + Weight::from_ref_time(1_080_957) + // Standard Error: 320 + .saturating_add(Weight::from_ref_time(732_246).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { - // Minimum execution time: 619 nanoseconds. - Weight::from_ref_time(928_672) - // Standard Error: 484 - .saturating_add(Weight::from_ref_time(739_523).saturating_mul(r.into())) + // Minimum execution time: 808 nanoseconds. + Weight::from_ref_time(1_055_752) + // Standard Error: 496 + .saturating_add(Weight::from_ref_time(740_084).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { - // Minimum execution time: 612 nanoseconds. - Weight::from_ref_time(863_312) - // Standard Error: 328 - .saturating_add(Weight::from_ref_time(743_687).saturating_mul(r.into())) + // Minimum execution time: 792 nanoseconds. + Weight::from_ref_time(1_111_972) + // Standard Error: 270 + .saturating_add(Weight::from_ref_time(741_581).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { - // Minimum execution time: 648 nanoseconds. - Weight::from_ref_time(931_331) - // Standard Error: 612 - .saturating_add(Weight::from_ref_time(747_653).saturating_mul(r.into())) + // Minimum execution time: 862 nanoseconds. + Weight::from_ref_time(1_111_246) + // Standard Error: 263 + .saturating_add(Weight::from_ref_time(746_026).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { - // Minimum execution time: 632 nanoseconds. - Weight::from_ref_time(868_901) - // Standard Error: 276 - .saturating_add(Weight::from_ref_time(744_778).saturating_mul(r.into())) + // Minimum execution time: 810 nanoseconds. + Weight::from_ref_time(1_094_933) + // Standard Error: 271 + .saturating_add(Weight::from_ref_time(743_645).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { - // Minimum execution time: 629 nanoseconds. - Weight::from_ref_time(898_516) - // Standard Error: 288 - .saturating_add(Weight::from_ref_time(734_393).saturating_mul(r.into())) + // Minimum execution time: 769 nanoseconds. + Weight::from_ref_time(819_933) + // Standard Error: 4_528 + .saturating_add(Weight::from_ref_time(751_599).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { - // Minimum execution time: 603 nanoseconds. - Weight::from_ref_time(853_744) - // Standard Error: 204 - .saturating_add(Weight::from_ref_time(739_499).saturating_mul(r.into())) + // Minimum execution time: 797 nanoseconds. + Weight::from_ref_time(1_107_352) + // Standard Error: 344 + .saturating_add(Weight::from_ref_time(738_684).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { - // Minimum execution time: 625 nanoseconds. - Weight::from_ref_time(885_174) - // Standard Error: 238 - .saturating_add(Weight::from_ref_time(734_010).saturating_mul(r.into())) + // Minimum execution time: 784 nanoseconds. + Weight::from_ref_time(1_068_487) + // Standard Error: 3_796 + .saturating_add(Weight::from_ref_time(741_207).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { - // Minimum execution time: 602 nanoseconds. - Weight::from_ref_time(915_329) - // Standard Error: 273 - .saturating_add(Weight::from_ref_time(738_209).saturating_mul(r.into())) + // Minimum execution time: 813 nanoseconds. + Weight::from_ref_time(1_067_278) + // Standard Error: 459 + .saturating_add(Weight::from_ref_time(737_841).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { - // Minimum execution time: 585 nanoseconds. - Weight::from_ref_time(862_239) - // Standard Error: 294 - .saturating_add(Weight::from_ref_time(719_000).saturating_mul(r.into())) + // Minimum execution time: 798 nanoseconds. + Weight::from_ref_time(1_100_254) + // Standard Error: 297 + .saturating_add(Weight::from_ref_time(717_622).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { - // Minimum execution time: 633 nanoseconds. - Weight::from_ref_time(881_696) - // Standard Error: 195 - .saturating_add(Weight::from_ref_time(713_153).saturating_mul(r.into())) + // Minimum execution time: 778 nanoseconds. + Weight::from_ref_time(1_063_748) + // Standard Error: 378 + .saturating_add(Weight::from_ref_time(713_577).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { - // Minimum execution time: 629 nanoseconds. - Weight::from_ref_time(856_238) - // Standard Error: 269 - .saturating_add(Weight::from_ref_time(715_451).saturating_mul(r.into())) + // Minimum execution time: 780 nanoseconds. + Weight::from_ref_time(1_088_755) + // Standard Error: 316 + .saturating_add(Weight::from_ref_time(714_127).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { - // Minimum execution time: 633 nanoseconds. - Weight::from_ref_time(880_804) - // Standard Error: 725 - .saturating_add(Weight::from_ref_time(1_349_577).saturating_mul(r.into())) + // Minimum execution time: 776 nanoseconds. + Weight::from_ref_time(1_062_591) + // Standard Error: 610 + .saturating_add(Weight::from_ref_time(1_355_430).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { - // Minimum execution time: 639 nanoseconds. - Weight::from_ref_time(867_528) - // Standard Error: 1_940 - .saturating_add(Weight::from_ref_time(1_287_959).saturating_mul(r.into())) + // Minimum execution time: 801 nanoseconds. + Weight::from_ref_time(1_092_395) + // Standard Error: 423 + .saturating_add(Weight::from_ref_time(1_282_356).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { - // Minimum execution time: 595 nanoseconds. - Weight::from_ref_time(851_253) - // Standard Error: 503 - .saturating_add(Weight::from_ref_time(1_398_668).saturating_mul(r.into())) + // Minimum execution time: 822 nanoseconds. + Weight::from_ref_time(1_083_079) + // Standard Error: 562 + .saturating_add(Weight::from_ref_time(1_398_522).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { - // Minimum execution time: 604 nanoseconds. - Weight::from_ref_time(804_977) - // Standard Error: 812 - .saturating_add(Weight::from_ref_time(1_288_816).saturating_mul(r.into())) + // Minimum execution time: 798 nanoseconds. + Weight::from_ref_time(1_088_997) + // Standard Error: 401 + .saturating_add(Weight::from_ref_time(1_283_442).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { - // Minimum execution time: 609 nanoseconds. - Weight::from_ref_time(890_945) - // Standard Error: 1_645 - .saturating_add(Weight::from_ref_time(719_770).saturating_mul(r.into())) + // Minimum execution time: 815 nanoseconds. + Weight::from_ref_time(1_081_903) + // Standard Error: 264 + .saturating_add(Weight::from_ref_time(718_069).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { - // Minimum execution time: 628 nanoseconds. - Weight::from_ref_time(897_973) - // Standard Error: 1_641 - .saturating_add(Weight::from_ref_time(718_838).saturating_mul(r.into())) + // Minimum execution time: 813 nanoseconds. + Weight::from_ref_time(1_091_426) + // Standard Error: 296 + .saturating_add(Weight::from_ref_time(717_894).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { - // Minimum execution time: 634 nanoseconds. - Weight::from_ref_time(848_440) - // Standard Error: 249 - .saturating_add(Weight::from_ref_time(718_206).saturating_mul(r.into())) + // Minimum execution time: 794 nanoseconds. + Weight::from_ref_time(1_040_144) + // Standard Error: 400 + .saturating_add(Weight::from_ref_time(719_886).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { - // Minimum execution time: 625 nanoseconds. - Weight::from_ref_time(881_579) - // Standard Error: 273 - .saturating_add(Weight::from_ref_time(736_934).saturating_mul(r.into())) + // Minimum execution time: 774 nanoseconds. + Weight::from_ref_time(1_092_466) + // Standard Error: 4_173 + .saturating_add(Weight::from_ref_time(739_873).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { - // Minimum execution time: 630 nanoseconds. - Weight::from_ref_time(897_813) - // Standard Error: 249 - .saturating_add(Weight::from_ref_time(734_657).saturating_mul(r.into())) + // Minimum execution time: 793 nanoseconds. + Weight::from_ref_time(1_105_611) + // Standard Error: 394 + .saturating_add(Weight::from_ref_time(735_358).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { - // Minimum execution time: 607 nanoseconds. - Weight::from_ref_time(871_660) - // Standard Error: 312 - .saturating_add(Weight::from_ref_time(735_377).saturating_mul(r.into())) + // Minimum execution time: 805 nanoseconds. + Weight::from_ref_time(1_130_462) + // Standard Error: 327 + .saturating_add(Weight::from_ref_time(734_198).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { - // Minimum execution time: 610 nanoseconds. - Weight::from_ref_time(861_640) - // Standard Error: 293 - .saturating_add(Weight::from_ref_time(735_524).saturating_mul(r.into())) + // Minimum execution time: 831 nanoseconds. + Weight::from_ref_time(1_118_894) + // Standard Error: 389 + .saturating_add(Weight::from_ref_time(733_834).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { - // Minimum execution time: 625 nanoseconds. - Weight::from_ref_time(880_203) - // Standard Error: 373 - .saturating_add(Weight::from_ref_time(737_354).saturating_mul(r.into())) + // Minimum execution time: 772 nanoseconds. + Weight::from_ref_time(1_123_733) + // Standard Error: 337 + .saturating_add(Weight::from_ref_time(733_923).saturating_mul(r.into())) } } diff --git a/frame/conviction-voting/src/tests.rs b/frame/conviction-voting/src/tests.rs index d20dcb66d6198..9caa451e0dae8 100644 --- a/frame/conviction-voting/src/tests.rs +++ b/frame/conviction-voting/src/tests.rs @@ -22,7 +22,6 @@ use std::collections::BTreeMap; use frame_support::{ assert_noop, assert_ok, parameter_types, traits::{ConstU32, ConstU64, Contains, Polling, VoteTally}, - weights::Weight, }; use sp_core::H256; use sp_runtime::{ @@ -56,10 +55,6 @@ impl Contains for BaseFilter { } } -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1_000_000)); -} impl frame_system::Config for Test { type BaseCallFilter = BaseFilter; type BlockWeights = (); diff --git a/frame/election-provider-multi-phase/src/benchmarking.rs b/frame/election-provider-multi-phase/src/benchmarking.rs index 10041f6aec07c..16263d97da586 100644 --- a/frame/election-provider-multi-phase/src/benchmarking.rs +++ b/frame/election-provider-multi-phase/src/benchmarking.rs @@ -200,7 +200,7 @@ frame_benchmarking::benchmarks! { assert!(>::snapshot().is_none()); assert!(>::current_phase().is_off()); }: { - >::on_initialize_open_signed(); + >::phase_transition(Phase::Signed); } verify { assert!(>::snapshot().is_none()); assert!(>::current_phase().is_signed()); @@ -210,7 +210,8 @@ frame_benchmarking::benchmarks! { assert!(>::snapshot().is_none()); assert!(>::current_phase().is_off()); }: { - >::on_initialize_open_unsigned(true, 1u32.into()) + let now = frame_system::Pallet::::block_number(); + >::phase_transition(Phase::Unsigned((true, now))); } verify { assert!(>::snapshot().is_none()); assert!(>::current_phase().is_unsigned()); @@ -318,7 +319,7 @@ frame_benchmarking::benchmarks! { submit { // the queue is full and the solution is only better than the worse. >::create_snapshot().map_err(<&str>::from)?; - MultiPhase::::on_initialize_open_signed(); + >::phase_transition(Phase::Signed); >::put(1); let mut signed_submissions = SignedSubmissions::::get(); diff --git a/frame/election-provider-multi-phase/src/lib.rs b/frame/election-provider-multi-phase/src/lib.rs index 6c4a55800f7e8..6c1b1d163d0fb 100644 --- a/frame/election-provider-multi-phase/src/lib.rs +++ b/frame/election-provider-multi-phase/src/lib.rs @@ -758,7 +758,7 @@ pub mod pallet { // NOTE: if signed-phase length is zero, second part of the if-condition fails. match Self::create_snapshot() { Ok(_) => { - Self::on_initialize_open_signed(); + Self::phase_transition(Phase::Signed); T::WeightInfo::on_initialize_open_signed() }, Err(why) => { @@ -797,7 +797,7 @@ pub mod pallet { if need_snapshot { match Self::create_snapshot() { Ok(_) => { - Self::on_initialize_open_unsigned(enabled, now); + Self::phase_transition(Phase::Unsigned((enabled, now))); T::WeightInfo::on_initialize_open_unsigned() }, Err(why) => { @@ -806,7 +806,7 @@ pub mod pallet { }, } } else { - Self::on_initialize_open_unsigned(enabled, now); + Self::phase_transition(Phase::Unsigned((enabled, now))); T::WeightInfo::on_initialize_open_unsigned() } }, @@ -931,6 +931,7 @@ pub mod pallet { >::put(ready); Self::deposit_event(Event::SolutionStored { compute: ElectionCompute::Unsigned, + origin: None, prev_ejected: ejected_a_solution, }); @@ -983,6 +984,7 @@ pub mod pallet { Self::deposit_event(Event::SolutionStored { compute: ElectionCompute::Emergency, + origin: None, prev_ejected: QueuedSolution::::exists(), }); @@ -1060,6 +1062,7 @@ pub mod pallet { signed_submissions.put(); Self::deposit_event(Event::SolutionStored { compute: ElectionCompute::Signed, + origin: Some(who), prev_ejected: ejected_a_solution, }); Ok(()) @@ -1102,6 +1105,7 @@ pub mod pallet { Self::deposit_event(Event::SolutionStored { compute: ElectionCompute::Fallback, + origin: None, prev_ejected: QueuedSolution::::exists(), }); @@ -1115,11 +1119,16 @@ pub mod pallet { pub enum Event { /// A solution was stored with the given compute. /// - /// If the solution is signed, this means that it hasn't yet been processed. If the - /// solution is unsigned, this means that it has also been processed. - /// - /// The `bool` is `true` when a previous solution was ejected to make room for this one. - SolutionStored { compute: ElectionCompute, prev_ejected: bool }, + /// The `origin` indicates the origin of the solution. If `origin` is `Some(AccountId)`, + /// the stored solution was submited in the signed phase by a miner with the `AccountId`. + /// Otherwise, the solution was stored either during the unsigned phase or by + /// `T::ForceOrigin`. The `bool` is `true` when a previous solution was ejected to make + /// room for this one. + SolutionStored { + compute: ElectionCompute, + origin: Option, + prev_ejected: bool, + }, /// The election has been finalized, with the given computation and score. ElectionFinalized { compute: ElectionCompute, score: ElectionScore }, /// An election failed. @@ -1130,10 +1139,8 @@ pub mod pallet { Rewarded { account: ::AccountId, value: BalanceOf }, /// An account has been slashed for submitting an invalid signed submission. Slashed { account: ::AccountId, value: BalanceOf }, - /// The signed phase of the given round has started. - SignedPhaseStarted { round: u32 }, - /// The unsigned phase of the given round has started. - UnsignedPhaseStarted { round: u32 }, + /// There was a phase transition in a given round. + PhaseTransitioned { from: Phase, to: Phase, round: u32 }, } /// Error of the pallet that can be returned in response to dispatches. @@ -1349,19 +1356,15 @@ impl Pallet { } } - /// Logic for `::on_initialize` when signed phase is being opened. - pub fn on_initialize_open_signed() { - log!(info, "Starting signed phase round {}.", Self::round()); - >::put(Phase::Signed); - Self::deposit_event(Event::SignedPhaseStarted { round: Self::round() }); - } - - /// Logic for `>::on_initialize` when unsigned phase is being opened. - pub fn on_initialize_open_unsigned(enabled: bool, now: T::BlockNumber) { - let round = Self::round(); - log!(info, "Starting unsigned phase round {} enabled {}.", round, enabled); - >::put(Phase::Unsigned((enabled, now))); - Self::deposit_event(Event::UnsignedPhaseStarted { round }); + /// Phase transition helper. + pub(crate) fn phase_transition(to: Phase) { + log!(info, "Starting phase {:?}, round {}.", to, Self::round()); + Self::deposit_event(Event::PhaseTransitioned { + from: >::get(), + to, + round: Self::round(), + }); + >::put(to); } /// Parts of [`create_snapshot`] that happen inside of this pallet. @@ -1571,7 +1574,7 @@ impl Pallet { >::mutate(|r| *r += 1); // Phase is off now. - >::put(Phase::Off); + Self::phase_transition(Phase::Off); // Kill snapshots. Self::kill_snapshot(); @@ -1652,7 +1655,7 @@ impl ElectionProvider for Pallet { }, Err(why) => { log!(error, "Entering emergency mode: {:?}", why); - >::put(Phase::Emergency); + Self::phase_transition(Phase::Emergency); Err(why) }, } @@ -1898,7 +1901,10 @@ mod tests { roll_to_signed(); assert_eq!(MultiPhase::current_phase(), Phase::Signed); - assert_eq!(multi_phase_events(), vec![Event::SignedPhaseStarted { round: 1 }]); + assert_eq!( + multi_phase_events(), + vec![Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }] + ); assert!(MultiPhase::snapshot().is_some()); assert_eq!(MultiPhase::round(), 1); @@ -1912,8 +1918,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::UnsignedPhaseStarted { round: 1 } + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, ], ); assert!(MultiPhase::snapshot().is_some()); @@ -1949,8 +1959,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::UnsignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, Event::ElectionFinalized { compute: ElectionCompute::Fallback, score: ElectionScore { @@ -1959,8 +1973,17 @@ mod tests { sum_stake_squared: 0 } }, - Event::SignedPhaseStarted { round: 2 }, - Event::UnsignedPhaseStarted { round: 2 } + Event::PhaseTransitioned { + from: Phase::Unsigned((true, 25)), + to: Phase::Off, + round: 2 + }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 2 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 55)), + round: 2 + }, ] ); }) @@ -1990,7 +2013,11 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::UnsignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { + from: Phase::Off, + to: Phase::Unsigned((true, 20)), + round: 1 + }, Event::ElectionFinalized { compute: ElectionCompute::Fallback, score: ElectionScore { @@ -1998,7 +2025,12 @@ mod tests { sum_stake: 0, sum_stake_squared: 0 } - } + }, + Event::PhaseTransitioned { + from: Phase::Unsigned((true, 20)), + to: Phase::Off, + round: 2 + }, ] ); }); @@ -2028,7 +2060,7 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, Event::ElectionFinalized { compute: ElectionCompute::Fallback, score: ElectionScore { @@ -2036,7 +2068,8 @@ mod tests { sum_stake: 0, sum_stake_squared: 0 } - } + }, + Event::PhaseTransitioned { from: Phase::Signed, to: Phase::Off, round: 2 }, ] ) }); @@ -2064,10 +2097,17 @@ mod tests { assert_eq!( multi_phase_events(), - vec![Event::ElectionFinalized { - compute: ElectionCompute::Fallback, - score: ElectionScore { minimal_stake: 0, sum_stake: 0, sum_stake_squared: 0 } - }] + vec![ + Event::ElectionFinalized { + compute: ElectionCompute::Fallback, + score: ElectionScore { + minimal_stake: 0, + sum_stake: 0, + sum_stake_squared: 0 + } + }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Off, round: 2 }, + ] ); }); } @@ -2079,7 +2119,10 @@ mod tests { // Signed phase started at block 15 and will end at 25. roll_to_signed(); - assert_eq!(multi_phase_events(), vec![Event::SignedPhaseStarted { round: 1 }]); + assert_eq!( + multi_phase_events(), + vec![Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }] + ); assert_eq!(MultiPhase::current_phase(), Phase::Signed); assert_eq!(MultiPhase::round(), 1); @@ -2090,11 +2133,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, Event::ElectionFinalized { compute: ElectionCompute::Fallback, score: Default::default() - } + }, + Event::PhaseTransitioned { from: Phase::Signed, to: Phase::Off, round: 2 }, ], ); // All storage items must be cleared. @@ -2114,7 +2158,10 @@ mod tests { // signed phase started at block 15 and will end at 25. roll_to_signed(); - assert_eq!(multi_phase_events(), vec![Event::SignedPhaseStarted { round: 1 }]); + assert_eq!( + multi_phase_events(), + vec![Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }] + ); assert_eq!(MultiPhase::current_phase(), Phase::Signed); assert_eq!(MultiPhase::round(), 1); @@ -2144,12 +2191,32 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, Event::Slashed { account: 99, value: 5 }, Event::Slashed { account: 99, value: 5 }, Event::Slashed { account: 99, value: 5 }, @@ -2162,7 +2229,8 @@ mod tests { sum_stake: 0, sum_stake_squared: 0 } - } + }, + Event::PhaseTransitioned { from: Phase::Signed, to: Phase::Off, round: 2 }, ] ); }) @@ -2186,10 +2254,18 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, Event::Rewarded { account: 99, value: 7 }, - Event::UnsignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, Event::ElectionFinalized { compute: ElectionCompute::Signed, score: ElectionScore { @@ -2197,7 +2273,12 @@ mod tests { sum_stake: 100, sum_stake_squared: 5200 } - } + }, + Event::PhaseTransitioned { + from: Phase::Unsigned((true, 25)), + to: Phase::Off, + round: 2 + }, ], ); }) @@ -2230,10 +2311,15 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::UnsignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, Event::SolutionStored { compute: ElectionCompute::Unsigned, + origin: None, prev_ejected: false }, Event::ElectionFinalized { @@ -2243,7 +2329,12 @@ mod tests { sum_stake: 100, sum_stake_squared: 5200 } - } + }, + Event::PhaseTransitioned { + from: Phase::Unsigned((true, 25)), + to: Phase::Off, + round: 2 + }, ], ); }) @@ -2270,8 +2361,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::UnsignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, Event::ElectionFinalized { compute: ElectionCompute::Fallback, score: ElectionScore { @@ -2279,7 +2374,12 @@ mod tests { sum_stake: 0, sum_stake_squared: 0 } - } + }, + Event::PhaseTransitioned { + from: Phase::Unsigned((true, 25)), + to: Phase::Off, + round: 2 + }, ] ); }); @@ -2299,9 +2399,18 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::UnsignedPhaseStarted { round: 1 }, - Event::ElectionFailed + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, + Event::ElectionFailed, + Event::PhaseTransitioned { + from: Phase::Unsigned((true, 25)), + to: Phase::Emergency, + round: 1 + }, ] ); }) @@ -2339,17 +2448,28 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::UnsignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, Event::ElectionFailed, + Event::PhaseTransitioned { + from: Phase::Unsigned((true, 25)), + to: Phase::Emergency, + round: 1 + }, Event::SolutionStored { compute: ElectionCompute::Fallback, + origin: None, prev_ejected: false }, Event::ElectionFinalized { compute: ElectionCompute::Fallback, score: Default::default() - } + }, + Event::PhaseTransitioned { from: Phase::Emergency, to: Phase::Off, round: 2 }, ] ); }) @@ -2375,10 +2495,17 @@ mod tests { assert_eq!( multi_phase_events(), - vec![Event::ElectionFinalized { - compute: ElectionCompute::Fallback, - score: ElectionScore { minimal_stake: 0, sum_stake: 0, sum_stake_squared: 0 } - }] + vec![ + Event::ElectionFinalized { + compute: ElectionCompute::Fallback, + score: ElectionScore { + minimal_stake: 0, + sum_stake: 0, + sum_stake_squared: 0 + } + }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Off, round: 2 }, + ] ); }); } @@ -2404,7 +2531,13 @@ mod tests { assert_eq!(err, ElectionError::Fallback("NoFallback.")); assert_eq!(MultiPhase::current_phase(), Phase::Emergency); - assert_eq!(multi_phase_events(), vec![Event::ElectionFailed]); + assert_eq!( + multi_phase_events(), + vec![ + Event::ElectionFailed, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Emergency, round: 1 } + ] + ); }); } diff --git a/frame/election-provider-multi-phase/src/signed.rs b/frame/election-provider-multi-phase/src/signed.rs index 12d39e83b6c09..895f3670a7f0d 100644 --- a/frame/election-provider-multi-phase/src/signed.rs +++ b/frame/election-provider-multi-phase/src/signed.rs @@ -620,8 +620,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false } + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + } ] ); }) @@ -645,8 +649,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, Event::Rewarded { account: 99, value: 7 } ] ); @@ -676,8 +684,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, Event::Slashed { account: 99, value: 5 } ] ); @@ -713,9 +725,17 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(999), + prev_ejected: false + }, Event::Rewarded { account: 99, value: 7 } ] ); @@ -788,12 +808,32 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(100), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(101), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(102), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(103), + prev_ejected: false + }, Event::Rewarded { account: 99, value: 7 }, Event::ElectionFinalized { compute: ElectionCompute::Signed, @@ -856,13 +896,15 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, Event::SolutionStored { compute: ElectionCompute::Signed, + origin: Some(99), prev_ejected: false }, Event::SolutionStored { compute: ElectionCompute::Signed, + origin: Some(99), prev_ejected: true } ] @@ -1112,12 +1154,28 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(100), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(101), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(102), + prev_ejected: false + }, Event::Rewarded { account: 100, value: 7 }, - Event::UnsignedPhaseStarted { round: 1 } + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, ] ); }) @@ -1170,10 +1228,22 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(999), + prev_ejected: false + }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(9999), + prev_ejected: false + }, Event::Slashed { account: 999, value: 5 }, Event::Rewarded { account: 99, value: 7 } ] @@ -1304,8 +1374,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::SolutionStored { compute: ElectionCompute::Signed, prev_ejected: false }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::SolutionStored { + compute: ElectionCompute::Signed, + origin: Some(99), + prev_ejected: false + }, Event::Rewarded { account: 99, value: 7 } ] ); diff --git a/frame/election-provider-multi-phase/src/unsigned.rs b/frame/election-provider-multi-phase/src/unsigned.rs index 7340605dfe621..cdc71f7bf5bf0 100644 --- a/frame/election-provider-multi-phase/src/unsigned.rs +++ b/frame/election-provider-multi-phase/src/unsigned.rs @@ -1055,7 +1055,7 @@ mod tests { Runtime, RuntimeCall, RuntimeOrigin, System, TestNposSolution, TrimHelpers, UnsignedPhase, }, - CurrentPhase, Event, InvalidTransaction, Phase, QueuedSolution, TransactionSource, + Event, InvalidTransaction, Phase, QueuedSolution, TransactionSource, TransactionValidityError, }; use codec::Decode; @@ -1128,7 +1128,7 @@ mod tests { assert!(::pre_dispatch(&call).is_ok()); // unsigned -- but not enabled. - >::put(Phase::Unsigned((false, 25))); + MultiPhase::phase_transition(Phase::Unsigned((false, 25))); assert!(MultiPhase::current_phase().is_unsigned()); assert!(matches!( ::validate_unsigned( @@ -1321,10 +1321,15 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::UnsignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, Event::SolutionStored { compute: ElectionCompute::Unsigned, + origin: None, prev_ejected: false } ] @@ -1661,7 +1666,7 @@ mod tests { let current_block = block_plus(offchain_repeat * 2 + 2); // force the unsigned phase to start on the current block. - CurrentPhase::::set(Phase::Unsigned((true, current_block))); + MultiPhase::phase_transition(Phase::Unsigned((true, current_block))); // clear the cache and create a solution since we are on the first block of the unsigned // phase. @@ -1673,8 +1678,12 @@ mod tests { assert_eq!( multi_phase_events(), vec![ - Event::SignedPhaseStarted { round: 1 }, - Event::UnsignedPhaseStarted { round: 1 }, + Event::PhaseTransitioned { from: Phase::Off, to: Phase::Signed, round: 1 }, + Event::PhaseTransitioned { + from: Phase::Signed, + to: Phase::Unsigned((true, 25)), + round: 1 + }, Event::ElectionFinalized { compute: ElectionCompute::Fallback, score: ElectionScore { @@ -1682,7 +1691,12 @@ mod tests { sum_stake: 0, sum_stake_squared: 0 } - } + }, + Event::PhaseTransitioned { + from: Phase::Unsigned((true, 25)), + to: Phase::Unsigned((true, 37)), + round: 1 + }, ] ); }) diff --git a/frame/election-provider-support/solution-type/Cargo.toml b/frame/election-provider-support/solution-type/Cargo.toml index 5a0c46cb83a0d..50c39c547fb9b 100644 --- a/frame/election-provider-support/solution-type/Cargo.toml +++ b/frame/election-provider-support/solution-type/Cargo.toml @@ -27,4 +27,4 @@ sp-arithmetic = { version = "6.0.0", path = "../../../primitives/arithmetic" } # used by generate_solution_type: frame-election-provider-support = { version = "4.0.0-dev", path = ".." } frame-support = { version = "4.0.0-dev", path = "../../support" } -trybuild = "1.0.60" +trybuild = "1.0.74" diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index 1cfdc25fd9b47..1a020adb28632 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -122,6 +122,8 @@ pub use weights::WeightInfo; /// All migrations. pub mod migrations; +const LOG_TARGET: &str = "runtime::elections-phragmen"; + /// The maximum votes allowed per voter. pub const MAXIMUM_VOTE: usize = 16; @@ -789,10 +791,7 @@ impl Pallet { } else { // overlap. This can never happen. If so, it seems like our intended replacement // is already a member, so not much more to do. - log::error!( - target: "runtime::elections-phragmen", - "A member seems to also be a runner-up.", - ); + log::error!(target: LOG_TARGET, "A member seems to also be a runner-up."); } next_best }); @@ -939,7 +938,7 @@ impl Pallet { Ok(_) => (), Err(_) => { log::error!( - target: "runtime::elections-phragmen", + target: LOG_TARGET, "Failed to run election. Number of voters exceeded", ); Self::deposit_event(Event::ElectionError); @@ -1103,11 +1102,7 @@ impl Pallet { >::mutate(|v| *v += 1); }) .map_err(|e| { - log::error!( - target: "runtime::elections-phragmen", - "Failed to run election [{:?}].", - e, - ); + log::error!(target: LOG_TARGET, "Failed to run election [{:?}].", e,); Self::deposit_event(Event::ElectionError); }); diff --git a/frame/elections-phragmen/src/migrations/v3.rs b/frame/elections-phragmen/src/migrations/v3.rs index 9ec9c6e7eea6c..e48cd6c1a8056 100644 --- a/frame/elections-phragmen/src/migrations/v3.rs +++ b/frame/elections-phragmen/src/migrations/v3.rs @@ -17,6 +17,7 @@ //! Migrations to version [`3.0.0`], as denoted by the changelog. +use super::super::LOG_TARGET; use crate::{Config, Pallet}; use codec::{Decode, Encode, FullCodec}; use frame_support::{ @@ -88,7 +89,7 @@ pub fn apply( ) -> Weight { let storage_version = StorageVersion::get::>(); log::info!( - target: "runtime::elections-phragmen", + target: LOG_TARGET, "Running migration for elections-phragmen with storage version {:?}", storage_version, ); @@ -104,7 +105,7 @@ pub fn apply( Weight::MAX } else { log::warn!( - target: "runtime::elections-phragmen", + target: LOG_TARGET, "Attempted to apply migration to V3 but failed because storage version is {:?}", storage_version, ); @@ -118,22 +119,14 @@ pub fn migrate_voters_to_recorded_deposit(old_deposit: V:: Some(Voter { votes, stake, deposit: old_deposit }) }); - log::info!( - target: "runtime::elections-phragmen", - "migrated {} voter accounts.", - >::iter().count(), - ); + log::info!(target: LOG_TARGET, "migrated {} voter accounts.", >::iter().count()); } /// Migrate all candidates to recorded deposit. pub fn migrate_candidates_to_recorded_deposit(old_deposit: V::Balance) { let _ = >::translate::, _>(|maybe_old_candidates| { maybe_old_candidates.map(|old_candidates| { - log::info!( - target: "runtime::elections-phragmen", - "migrated {} candidate accounts.", - old_candidates.len(), - ); + log::info!(target: LOG_TARGET, "migrated {} candidate accounts.", old_candidates.len()); old_candidates.into_iter().map(|c| (c, old_deposit)).collect::>() }) }); @@ -143,11 +136,7 @@ pub fn migrate_candidates_to_recorded_deposit(old_deposit: pub fn migrate_members_to_recorded_deposit(old_deposit: V::Balance) { let _ = >::translate::, _>(|maybe_old_members| { maybe_old_members.map(|old_members| { - log::info!( - target: "runtime::elections-phragmen", - "migrated {} member accounts.", - old_members.len(), - ); + log::info!(target: LOG_TARGET, "migrated {} member accounts.", old_members.len()); old_members .into_iter() .map(|(who, stake)| SeatHolder { who, stake, deposit: old_deposit }) @@ -162,7 +151,7 @@ pub fn migrate_runners_up_to_recorded_deposit(old_deposit: |maybe_old_runners_up| { maybe_old_runners_up.map(|old_runners_up| { log::info!( - target: "runtime::elections-phragmen", + target: LOG_TARGET, "migrated {} runner-up accounts.", old_runners_up.len(), ); diff --git a/frame/elections-phragmen/src/migrations/v4.rs b/frame/elections-phragmen/src/migrations/v4.rs index 76ef630706c50..535a9fb8201d7 100644 --- a/frame/elections-phragmen/src/migrations/v4.rs +++ b/frame/elections-phragmen/src/migrations/v4.rs @@ -17,6 +17,7 @@ //! Migrations to version [`4.0.0`], as denoted by the changelog. +use super::super::LOG_TARGET; use frame_support::{ traits::{Get, StorageVersion}, weights::Weight, @@ -35,14 +36,14 @@ pub const OLD_PREFIX: &[u8] = b"PhragmenElection"; pub fn migrate>(new_pallet_name: N) -> Weight { if new_pallet_name.as_ref().as_bytes() == OLD_PREFIX { log::info!( - target: "runtime::elections-phragmen", + target: LOG_TARGET, "New pallet name is equal to the old prefix. No migration needs to be done.", ); return Weight::zero() } let storage_version = StorageVersion::get::>(); log::info!( - target: "runtime::elections-phragmen", + target: LOG_TARGET, "Running migration to v4 for elections-phragmen with storage version {:?}", storage_version, ); @@ -59,7 +60,7 @@ pub fn migrate>(new_pallet_name: N) -> Weight { ::BlockWeights::get().max_block } else { log::warn!( - target: "runtime::elections-phragmen", + target: LOG_TARGET, "Attempted to apply migration to v4 but failed because storage version is {:?}", storage_version, ); diff --git a/frame/examples/basic/src/tests.rs b/frame/examples/basic/src/tests.rs index 97fbddfbc41e0..891c7c78628a1 100644 --- a/frame/examples/basic/src/tests.rs +++ b/frame/examples/basic/src/tests.rs @@ -21,7 +21,6 @@ use crate::*; use frame_support::{ assert_ok, dispatch::{DispatchInfo, GetDispatchInfo}, - parameter_types, traits::{ConstU64, OnInitialize}, }; use sp_core::H256; @@ -51,10 +50,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/examples/offchain-worker/src/tests.rs b/frame/examples/offchain-worker/src/tests.rs index 72c001fd6e6cc..2050d76a241ff 100644 --- a/frame/examples/offchain-worker/src/tests.rs +++ b/frame/examples/offchain-worker/src/tests.rs @@ -51,10 +51,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/fast-unstake/src/lib.rs b/frame/fast-unstake/src/lib.rs index f2faeebc13478..c0bffc4427a11 100644 --- a/frame/fast-unstake/src/lib.rs +++ b/frame/fast-unstake/src/lib.rs @@ -147,6 +147,8 @@ pub mod pallet { /// The map of all accounts wishing to be unstaked. /// /// Keeps track of `AccountId` wishing to unstake and it's corresponding deposit. + /// + /// TWOX-NOTE: SAFE since `AccountId` is a secure hash. #[pallet::storage] pub type Queue = CountedStorageMap<_, Twox64Concat, T::AccountId, BalanceOf>; diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 5a85a3682db82..93dd4143af2d7 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -31,7 +31,7 @@ sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../pr sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" } [dev-dependencies] -grandpa = { package = "finality-grandpa", version = "0.16.0", features = ["derive-codec"] } +grandpa = { package = "finality-grandpa", version = "0.16.1", features = ["derive-codec"] } frame-benchmarking = { version = "4.0.0-dev", path = "../benchmarking" } frame-election-provider-support = { version = "4.0.0-dev", path = "../election-provider-support" } pallet-balances = { version = "4.0.0-dev", path = "../balances" } diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index 131f6cafcd179..c618705af0651 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -69,11 +69,6 @@ impl_opaque_keys! { } } -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/identity/src/tests.rs b/frame/identity/src/tests.rs index 6b0006971f0e6..baca70e2795fc 100644 --- a/frame/identity/src/tests.rs +++ b/frame/identity/src/tests.rs @@ -48,10 +48,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/im-online/src/mock.rs b/frame/im-online/src/mock.rs index 5782e1a615b8e..bcb13fa1be837 100644 --- a/frame/im-online/src/mock.rs +++ b/frame/im-online/src/mock.rs @@ -117,11 +117,6 @@ pub fn new_test_ext() -> sp_io::TestExternalities { result } -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} - impl frame_system::Config for Runtime { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/indices/src/mock.rs b/frame/indices/src/mock.rs index fd2e9fff16885..6b5373bb43b5a 100644 --- a/frame/indices/src/mock.rs +++ b/frame/indices/src/mock.rs @@ -20,10 +20,7 @@ #![cfg(test)] use crate::{self as pallet_indices, Config}; -use frame_support::{ - parameter_types, - traits::{ConstU32, ConstU64}, -}; +use frame_support::traits::{ConstU32, ConstU64}; use sp_core::H256; use sp_runtime::testing::Header; @@ -42,11 +39,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index 77b53aa72dad8..934abb996df80 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -36,6 +36,8 @@ pub mod weights; pub use pallet::*; pub use weights::WeightInfo; +const LOG_TARGET: &str = "runtime::membership"; + type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; #[frame_support::pallet] @@ -539,8 +541,6 @@ mod tests { ); parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); pub static Members: Vec = vec![]; pub static Prime: Option = None; } diff --git a/frame/membership/src/migrations/v4.rs b/frame/membership/src/migrations/v4.rs index 5b8735aa2bac9..cbc58cd6ae917 100644 --- a/frame/membership/src/migrations/v4.rs +++ b/frame/membership/src/migrations/v4.rs @@ -15,6 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use super::super::LOG_TARGET; use sp_io::hashing::twox_128; use frame_support::{ @@ -43,7 +44,7 @@ pub fn migrate::on_chain_storage_version(); log::info!( - target: "runtime::membership", + target: LOG_TARGET, "Running migration to v4 for membership with storage version {:?}", on_chain_storage_version, ); @@ -67,7 +68,7 @@ pub fn migrate::BlockWeights::get().max_block } else { log::warn!( - target: "runtime::membership", + target: LOG_TARGET, "Attempted to apply migration to v4 but failed because storage version is {:?}", on_chain_storage_version, ); @@ -139,7 +140,7 @@ pub fn post_migrate>(old_pallet_name: N, new fn log_migration(stage: &str, old_pallet_name: &str, new_pallet_name: &str) { log::info!( - target: "runtime::membership", + target: LOG_TARGET, "{}, prefix: '{}' ==> '{}'", stage, old_pallet_name, diff --git a/frame/merkle-mountain-range/src/lib.rs b/frame/merkle-mountain-range/src/lib.rs index 46af84d218247..170c1d724f3a2 100644 --- a/frame/merkle-mountain-range/src/lib.rs +++ b/frame/merkle-mountain-range/src/lib.rs @@ -164,7 +164,8 @@ pub mod pallet { + codec::Codec + codec::EncodeLike + scale_info::TypeInfo - + MaxEncodedLen; + + MaxEncodedLen + + PartialOrd; /// Data stored in the leaf nodes. /// diff --git a/frame/message-queue/src/integration_test.rs b/frame/message-queue/src/integration_test.rs index f4b1b7a125449..c9e3b2e870fd8 100644 --- a/frame/message-queue/src/integration_test.rs +++ b/frame/message-queue/src/integration_test.rs @@ -54,10 +54,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/message-queue/src/mock.rs b/frame/message-queue/src/mock.rs index 7159840d1c01b..37e504ac50033 100644 --- a/frame/message-queue/src/mock.rs +++ b/frame/message-queue/src/mock.rs @@ -47,10 +47,6 @@ frame_support::construct_runtime!( MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event}, } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/multisig/src/tests.rs b/frame/multisig/src/tests.rs index 206e566cf4cb6..13493587caa2b 100644 --- a/frame/multisig/src/tests.rs +++ b/frame/multisig/src/tests.rs @@ -23,7 +23,7 @@ use super::*; use crate as pallet_multisig; use frame_support::{ - assert_noop, assert_ok, parameter_types, + assert_noop, assert_ok, traits::{ConstU32, ConstU64, Contains}, }; use sp_core::H256; @@ -47,10 +47,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = TestBaseCallFilter; type BlockWeights = (); diff --git a/frame/nfts/src/features/attributes.rs b/frame/nfts/src/features/attributes.rs index da663d39a4ef5..b25f2a60cd62d 100644 --- a/frame/nfts/src/features/attributes.rs +++ b/frame/nfts/src/features/attributes.rs @@ -152,65 +152,68 @@ impl, I: 'static> Pallet { namespace: AttributeNamespace, key: BoundedVec, ) -> DispatchResult { - if let Some((_, deposit)) = - Attribute::::take((collection, maybe_item, &namespace, &key)) - { - let mut collection_details = - Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - - if let Some(check_owner) = &maybe_check_owner { - if deposit.account != maybe_check_owner { - ensure!( - Self::is_valid_namespace( - &check_owner, - &namespace, - &collection, - &collection_details.owner, - &maybe_item, - )?, - Error::::NoPermission - ); - } + let (_, deposit) = Attribute::::take((collection, maybe_item, &namespace, &key)) + .ok_or(Error::::AttributeNotFound)?; + let mut collection_details = + Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; - // can't clear `CollectionOwner` type attributes if the collection/item is locked - match namespace { - AttributeNamespace::CollectionOwner => match maybe_item { - None => { - let collection_config = Self::get_collection_config(&collection)?; - ensure!( - collection_config - .is_setting_enabled(CollectionSetting::UnlockedAttributes), - Error::::LockedCollectionAttributes - ) - }, - Some(item) => { - // NOTE: if the item was previously burned, the ItemConfigOf record - // might not exist. In that case, we allow to clear the attribute. - let maybe_is_locked = Self::get_item_config(&collection, &item) - .map_or(false, |c| { - c.has_disabled_setting(ItemSetting::UnlockedAttributes) - }); - ensure!(!maybe_is_locked, Error::::LockedItemAttributes); - }, - }, - _ => (), - }; + if let Some(check_owner) = &maybe_check_owner { + // validate the provided namespace when it's not a root call and the caller is not + // the same as the `deposit.account` (e.g. the deposit was paid by different account) + if deposit.account != maybe_check_owner { + ensure!( + Self::is_valid_namespace( + &check_owner, + &namespace, + &collection, + &collection_details.owner, + &maybe_item, + )?, + Error::::NoPermission + ); } - collection_details.attributes.saturating_dec(); + // can't clear `CollectionOwner` type attributes if the collection/item is locked match namespace { - AttributeNamespace::CollectionOwner => { - collection_details.owner_deposit.saturating_reduce(deposit.amount); - T::Currency::unreserve(&collection_details.owner, deposit.amount); + AttributeNamespace::CollectionOwner => match maybe_item { + None => { + let collection_config = Self::get_collection_config(&collection)?; + ensure!( + collection_config + .is_setting_enabled(CollectionSetting::UnlockedAttributes), + Error::::LockedCollectionAttributes + ) + }, + Some(item) => { + // NOTE: if the item was previously burned, the ItemConfigOf record + // might not exist. In that case, we allow to clear the attribute. + let maybe_is_locked = Self::get_item_config(&collection, &item) + .map_or(false, |c| { + c.has_disabled_setting(ItemSetting::UnlockedAttributes) + }); + ensure!(!maybe_is_locked, Error::::LockedItemAttributes); + }, }, _ => (), }; - if let Some(deposit_account) = deposit.account { - T::Currency::unreserve(&deposit_account, deposit.amount); - } - Collection::::insert(collection, &collection_details); - Self::deposit_event(Event::AttributeCleared { collection, maybe_item, key, namespace }); } + + collection_details.attributes.saturating_dec(); + match namespace { + AttributeNamespace::CollectionOwner => { + collection_details.owner_deposit.saturating_reduce(deposit.amount); + T::Currency::unreserve(&collection_details.owner, deposit.amount); + }, + _ => (), + }; + + if let Some(deposit_account) = deposit.account { + T::Currency::unreserve(&deposit_account, deposit.amount); + } + + Collection::::insert(collection, &collection_details); + Self::deposit_event(Event::AttributeCleared { collection, maybe_item, key, namespace }); + Ok(()) } diff --git a/frame/nfts/src/features/create_delete_collection.rs b/frame/nfts/src/features/create_delete_collection.rs index 86625bf49efb2..a2caa04bc8dc3 100644 --- a/frame/nfts/src/features/create_delete_collection.rs +++ b/frame/nfts/src/features/create_delete_collection.rs @@ -82,12 +82,13 @@ impl, I: 'static> Pallet { Account::::remove((&details.owner, &collection, &item)); T::Currency::unreserve(&details.deposit.account, details.deposit.amount); } - #[allow(deprecated)] - ItemMetadataOf::::remove_prefix(&collection, None); - #[allow(deprecated)] - ItemPriceOf::::remove_prefix(&collection, None); - #[allow(deprecated)] - PendingSwapOf::::remove_prefix(&collection, None); + for (_, metadata) in ItemMetadataOf::::drain_prefix(&collection) { + if let Some(depositor) = metadata.deposit.account { + T::Currency::unreserve(&depositor, metadata.deposit.amount); + } + } + let _ = ItemPriceOf::::clear_prefix(&collection, witness.items, None); + let _ = PendingSwapOf::::clear_prefix(&collection, witness.items, None); CollectionMetadataOf::::remove(&collection); Self::clear_roles(&collection)?; diff --git a/frame/nfts/src/features/create_delete_item.rs b/frame/nfts/src/features/create_delete_item.rs index 8d6c8a280956c..f724fe5c63b43 100644 --- a/frame/nfts/src/features/create_delete_item.rs +++ b/frame/nfts/src/features/create_delete_item.rs @@ -22,10 +22,9 @@ impl, I: 'static> Pallet { pub fn do_mint( collection: T::CollectionId, item: T::ItemId, - depositor: T::AccountId, + maybe_depositor: Option, mint_to: T::AccountId, item_config: ItemConfig, - deposit_collection_owner: bool, with_details_and_config: impl FnOnce( &CollectionDetailsFor, &CollectionConfigFor, @@ -55,9 +54,9 @@ impl, I: 'static> Pallet { true => T::ItemDeposit::get(), false => Zero::zero(), }; - let deposit_account = match deposit_collection_owner { - true => collection_details.owner.clone(), - false => depositor, + let deposit_account = match maybe_depositor { + None => collection_details.owner.clone(), + Some(depositor) => depositor, }; let item_owner = mint_to.clone(); @@ -92,6 +91,7 @@ impl, I: 'static> Pallet { with_details: impl FnOnce(&ItemDetailsFor) -> DispatchResult, ) -> DispatchResult { ensure!(!T::Locker::is_locked(collection, item), Error::::ItemLocked); + let item_config = Self::get_item_config(&collection, &item)?; let owner = Collection::::try_mutate( &collection, |maybe_collection_details| -> Result { @@ -104,6 +104,24 @@ impl, I: 'static> Pallet { // Return the deposit. T::Currency::unreserve(&details.deposit.account, details.deposit.amount); collection_details.items.saturating_dec(); + + // Clear the metadata if it's not locked. + if item_config.is_setting_enabled(ItemSetting::UnlockedMetadata) { + if let Some(metadata) = ItemMetadataOf::::take(&collection, &item) { + let depositor_account = + metadata.deposit.account.unwrap_or(collection_details.owner.clone()); + + T::Currency::unreserve(&depositor_account, metadata.deposit.amount); + collection_details.item_metadatas.saturating_dec(); + + if depositor_account == collection_details.owner { + collection_details + .owner_deposit + .saturating_reduce(metadata.deposit.amount); + } + } + } + Ok(details.owner) }, )?; @@ -116,8 +134,7 @@ impl, I: 'static> Pallet { // NOTE: if item's settings are not empty (e.g. item's metadata is locked) // then we keep the record and don't remove it - let config = Self::get_item_config(&collection, &item)?; - if !config.has_disabled_settings() { + if !item_config.has_disabled_settings() { ItemConfigOf::::remove(&collection, &item); } diff --git a/frame/nfts/src/features/metadata.rs b/frame/nfts/src/features/metadata.rs index 942f377141a33..272b2247426d6 100644 --- a/frame/nfts/src/features/metadata.rs +++ b/frame/nfts/src/features/metadata.rs @@ -19,19 +19,21 @@ use crate::*; use frame_support::pallet_prelude::*; impl, I: 'static> Pallet { + /// Note: if `maybe_depositor` is None, that means the depositor will be a collection's owner pub(crate) fn do_set_item_metadata( maybe_check_owner: Option, collection: T::CollectionId, item: T::ItemId, data: BoundedVec, + maybe_depositor: Option, ) -> DispatchResult { + let is_root = maybe_check_owner.is_none(); let mut collection_details = Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; let item_config = Self::get_item_config(&collection, &item)?; ensure!( - maybe_check_owner.is_none() || - item_config.is_setting_enabled(ItemSetting::UnlockedMetadata), + is_root || item_config.is_setting_enabled(ItemSetting::UnlockedMetadata), Error::::LockedItemMetadata ); @@ -45,24 +47,38 @@ impl, I: 'static> Pallet { if metadata.is_none() { collection_details.item_metadatas.saturating_inc(); } - let old_deposit = metadata.take().map_or(Zero::zero(), |m| m.deposit); - collection_details.owner_deposit.saturating_reduce(old_deposit); + + let old_deposit = metadata + .take() + .map_or(ItemMetadataDeposit { account: None, amount: Zero::zero() }, |m| m.deposit); + let mut deposit = Zero::zero(); - if collection_config.is_setting_enabled(CollectionSetting::DepositRequired) && - maybe_check_owner.is_some() + if collection_config.is_setting_enabled(CollectionSetting::DepositRequired) && !is_root { deposit = T::DepositPerByte::get() .saturating_mul(((data.len()) as u32).into()) .saturating_add(T::MetadataDepositBase::get()); } - if deposit > old_deposit { - T::Currency::reserve(&collection_details.owner, deposit - old_deposit)?; - } else if deposit < old_deposit { - T::Currency::unreserve(&collection_details.owner, old_deposit - deposit); + + // the previous deposit was taken from the item's owner + if old_deposit.account.is_some() && maybe_depositor.is_none() { + T::Currency::unreserve(&old_deposit.account.unwrap(), old_deposit.amount); + T::Currency::reserve(&collection_details.owner, deposit)?; + } else if deposit > old_deposit.amount { + T::Currency::reserve(&collection_details.owner, deposit - old_deposit.amount)?; + } else if deposit < old_deposit.amount { + T::Currency::unreserve(&collection_details.owner, old_deposit.amount - deposit); + } + + if maybe_depositor.is_none() { + collection_details.owner_deposit.saturating_accrue(deposit); + collection_details.owner_deposit.saturating_reduce(old_deposit.amount); } - collection_details.owner_deposit.saturating_accrue(deposit); - *metadata = Some(ItemMetadata { deposit, data: data.clone() }); + *metadata = Some(ItemMetadata { + deposit: ItemMetadataDeposit { account: maybe_depositor, amount: deposit }, + data: data.clone(), + }); Collection::::insert(&collection, &collection_details); Self::deposit_event(Event::ItemMetadataSet { collection, item, data }); @@ -75,8 +91,14 @@ impl, I: 'static> Pallet { collection: T::CollectionId, item: T::ItemId, ) -> DispatchResult { + let is_root = maybe_check_owner.is_none(); + let metadata = ItemMetadataOf::::take(collection, item) + .ok_or(Error::::MetadataNotFound)?; let mut collection_details = Collection::::get(&collection).ok_or(Error::::UnknownCollection)?; + let depositor_account = + metadata.deposit.account.unwrap_or(collection_details.owner.clone()); + if let Some(check_owner) = &maybe_check_owner { ensure!(check_owner == &collection_details.owner, Error::::NoPermission); } @@ -85,20 +107,19 @@ impl, I: 'static> Pallet { let is_locked = Self::get_item_config(&collection, &item) .map_or(false, |c| c.has_disabled_setting(ItemSetting::UnlockedMetadata)); - ensure!(maybe_check_owner.is_none() || !is_locked, Error::::LockedItemMetadata); + ensure!(is_root || !is_locked, Error::::LockedItemMetadata); - ItemMetadataOf::::try_mutate_exists(collection, item, |metadata| { - if metadata.is_some() { - collection_details.item_metadatas.saturating_dec(); - } - let deposit = metadata.take().ok_or(Error::::UnknownItem)?.deposit; - T::Currency::unreserve(&collection_details.owner, deposit); - collection_details.owner_deposit.saturating_reduce(deposit); + collection_details.item_metadatas.saturating_dec(); + T::Currency::unreserve(&depositor_account, metadata.deposit.amount); - Collection::::insert(&collection, &collection_details); - Self::deposit_event(Event::ItemMetadataCleared { collection, item }); - Ok(()) - }) + if depositor_account == collection_details.owner { + collection_details.owner_deposit.saturating_reduce(metadata.deposit.amount); + } + + Collection::::insert(&collection, &collection_details); + Self::deposit_event(Event::ItemMetadataCleared { collection, item }); + + Ok(()) } pub(crate) fn do_set_collection_metadata( diff --git a/frame/nfts/src/impl_nonfungibles.rs b/frame/nfts/src/impl_nonfungibles.rs index ab4d7a16ec215..86d82b4021517 100644 --- a/frame/nfts/src/impl_nonfungibles.rs +++ b/frame/nfts/src/impl_nonfungibles.rs @@ -157,10 +157,12 @@ impl, I: 'static> Mutate<::AccountId, ItemConfig Self::do_mint( *collection, *item, - who.clone(), + match deposit_collection_owner { + true => None, + false => Some(who.clone()), + }, who.clone(), *item_config, - deposit_collection_owner, |_, _| Ok(()), ) } diff --git a/frame/nfts/src/lib.rs b/frame/nfts/src/lib.rs index 9a6242143aedb..8f24c8dcd6e98 100644 --- a/frame/nfts/src/lib.rs +++ b/frame/nfts/src/lib.rs @@ -263,7 +263,7 @@ pub mod pallet { T::CollectionId, Blake2_128Concat, T::ItemId, - ItemMetadata, T::StringLimit>, + ItemMetadata, T::StringLimit>, OptionQuery, >; @@ -559,6 +559,10 @@ pub mod pallet { UnknownItem, /// Swap doesn't exist. UnknownSwap, + /// The given item has no metadata set. + MetadataNotFound, + /// The provided attribute can't be found. + AttributeNotFound, /// Item is not for sale. NotForSale, /// The provided bid is too low. @@ -746,10 +750,9 @@ pub mod pallet { Self::do_mint( collection, item, - caller.clone(), + Some(caller.clone()), mint_to.clone(), item_config, - false, |collection_details, collection_config| { // Issuer can mint regardless of mint settings if Self::has_role(&collection, &caller, CollectionRole::Issuer) { @@ -849,9 +852,7 @@ pub mod pallet { Error::::NoPermission ); } - Self::do_mint(collection, item, mint_to.clone(), mint_to, item_config, true, |_, _| { - Ok(()) - }) + Self::do_mint(collection, item, None, mint_to, item_config, |_, _| Ok(())) } /// Destroy a single item. @@ -1362,7 +1363,7 @@ pub mod pallet { /// Clear an attribute for a collection or item. /// /// Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the - /// `collection`. + /// attribute. /// /// Any deposit is freed for the collection's owner. /// @@ -1464,7 +1465,7 @@ pub mod pallet { let maybe_check_owner = T::ForceOrigin::try_origin(origin) .map(|_| None) .or_else(|origin| ensure_signed(origin).map(Some).map_err(DispatchError::from))?; - Self::do_set_item_metadata(maybe_check_owner, collection, item, data) + Self::do_set_item_metadata(maybe_check_owner, collection, item, data, None) } /// Clear the metadata for an item. diff --git a/frame/nfts/src/tests.rs b/frame/nfts/src/tests.rs index f8187b3777ebd..ebbba33b04fa2 100644 --- a/frame/nfts/src/tests.rs +++ b/frame/nfts/src/tests.rs @@ -608,7 +608,7 @@ fn set_item_metadata_should_work() { ); assert_noop!( Nfts::clear_metadata(RuntimeOrigin::signed(1), 1, 42), - Error::::UnknownCollection, + Error::::MetadataNotFound, ); assert_ok!(Nfts::clear_metadata(RuntimeOrigin::root(), 0, 42)); assert!(!ItemMetadataOf::::contains_key(0, 42)); @@ -1267,7 +1267,7 @@ fn burn_works() { assert_noop!( Nfts::burn(RuntimeOrigin::signed(5), 0, 42, Some(5)), - Error::::UnknownCollection + Error::::UnknownItem ); assert_ok!(Nfts::force_mint(RuntimeOrigin::signed(2), 0, 42, 5, default_item_config())); diff --git a/frame/nfts/src/types.rs b/frame/nfts/src/types.rs index 9b89fb964b316..d8938aab4377a 100644 --- a/frame/nfts/src/types.rs +++ b/frame/nfts/src/types.rs @@ -43,6 +43,8 @@ pub(super) type ItemDepositOf = ItemDeposit, ::AccountId>; pub(super) type AttributeDepositOf = AttributeDeposit, ::AccountId>; +pub(super) type ItemMetadataDepositOf = + ItemMetadataDeposit, ::AccountId>; pub(super) type ItemDetailsFor = ItemDetails<::AccountId, ItemDepositOf, ApprovalsOf>; pub(super) type BalanceOf = @@ -137,12 +139,12 @@ pub struct ItemDeposit { /// Information about the collection's metadata. #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo, MaxEncodedLen)] #[scale_info(skip_type_params(StringLimit))] -#[codec(mel_bound(DepositBalance: MaxEncodedLen))] -pub struct CollectionMetadata> { +#[codec(mel_bound(Deposit: MaxEncodedLen))] +pub struct CollectionMetadata> { /// The balance deposited for this metadata. /// /// This pays for the data stored in this struct. - pub(super) deposit: DepositBalance, + pub(super) deposit: Deposit, /// General information concerning this collection. Limited in length by `StringLimit`. This /// will generally be either a JSON dump or the hash of some JSON which can be found on a /// hash-addressable global publication system such as IPFS. @@ -152,12 +154,11 @@ pub struct CollectionMetadata> { /// Information about the item's metadata. #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo, MaxEncodedLen)] #[scale_info(skip_type_params(StringLimit))] -#[codec(mel_bound(DepositBalance: MaxEncodedLen))] -pub struct ItemMetadata> { +pub struct ItemMetadata> { /// The balance deposited for this metadata. /// /// This pays for the data stored in this struct. - pub(super) deposit: DepositBalance, + pub(super) deposit: Deposit, /// General information concerning this item. Limited in length by `StringLimit`. This will /// generally be either a JSON dump or the hash of some JSON which can be found on a /// hash-addressable global publication system such as IPFS. @@ -199,6 +200,15 @@ pub struct AttributeDeposit { pub(super) amount: DepositBalance, } +/// Information about the reserved item's metadata deposit. +#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)] +pub struct ItemMetadataDeposit { + /// A depositor account, None means the deposit is collection's owner. + pub(super) account: Option, + /// An amount that gets reserved. + pub(super) amount: DepositBalance, +} + /// Specifies whether the tokens will be sent or received. #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)] pub enum PriceDirection { diff --git a/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index 79daeb9bdb9a8..3d8307c434107 100644 --- a/frame/nicks/src/lib.rs +++ b/frame/nicks/src/lib.rs @@ -250,7 +250,7 @@ mod tests { use crate as pallet_nicks; use frame_support::{ - assert_noop, assert_ok, ord_parameter_types, parameter_types, + assert_noop, assert_ok, ord_parameter_types, traits::{ConstU32, ConstU64}, }; use frame_system::EnsureSignedBy; @@ -275,10 +275,6 @@ mod tests { } ); - parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); - } impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/nomination-pools/src/lib.rs b/frame/nomination-pools/src/lib.rs index 99bfc8b8c36a5..3cb8abedda2fb 100644 --- a/frame/nomination-pools/src/lib.rs +++ b/frame/nomination-pools/src/lib.rs @@ -1277,6 +1277,8 @@ pub mod pallet { pub type MaxPoolMembersPerPool = StorageValue<_, u32, OptionQuery>; /// Active members. + /// + /// TWOX-NOTE: SAFE since `AccountId` is a secure hash. #[pallet::storage] pub type PoolMembers = CountedStorageMap<_, Twox64Concat, T::AccountId, PoolMember>; diff --git a/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index 223f551a6e5c1..592e821a81d8c 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/frame/offences/benchmarking/src/mock.rs @@ -24,7 +24,6 @@ use frame_election_provider_support::{onchain, SequentialPhragmen}; use frame_support::{ parameter_types, traits::{ConstU32, ConstU64}, - weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, }; use frame_system as system; use pallet_session::historical as pallet_session_historical; @@ -38,13 +37,6 @@ type AccountIndex = u32; type BlockNumber = u64; type Balance = u64; -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max( - Weight::from_parts(2u64 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX) - ); -} - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index 8e4256ec3d3e6..63d2b0de34780 100644 --- a/frame/offences/src/mock.rs +++ b/frame/offences/src/mock.rs @@ -25,10 +25,7 @@ use codec::Encode; use frame_support::{ parameter_types, traits::{ConstU32, ConstU64}, - weights::{ - constants::{RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND}, - Weight, - }, + weights::{constants::RocksDbWeight, Weight}, }; use sp_core::H256; use sp_runtime::{ @@ -83,12 +80,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max( - Weight::from_parts(2u64 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX), - ); -} impl frame_system::Config for Runtime { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/preimage/src/mock.rs b/frame/preimage/src/mock.rs index ce74ea65bd8aa..d81f5a9c3232c 100644 --- a/frame/preimage/src/mock.rs +++ b/frame/preimage/src/mock.rs @@ -15,13 +15,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # Scheduler test environment. +//! # Preimage test environment. use super::*; use crate as pallet_preimage; use frame_support::{ - ord_parameter_types, parameter_types, + ord_parameter_types, traits::{ConstU32, ConstU64, Everything}, weights::constants::RocksDbWeight, }; @@ -30,7 +30,6 @@ use sp_core::H256; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, - Perbill, }; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; @@ -48,10 +47,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(2_000_000_000_000)); -} impl frame_system::Config for Test { type BaseCallFilter = Everything; type BlockWeights = (); @@ -91,11 +86,6 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = [u8; 8]; } -parameter_types! { - pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; - pub const MaxScheduledPerBlock: u32 = 10; -} - ord_parameter_types! { pub const One: u64 = 1; } diff --git a/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs index 17bc7bcb92ee1..3eb3ab3705332 100644 --- a/frame/proxy/src/tests.rs +++ b/frame/proxy/src/tests.rs @@ -26,7 +26,6 @@ use codec::{Decode, Encode}; use frame_support::{ assert_noop, assert_ok, dispatch::DispatchError, - parameter_types, traits::{ConstU32, ConstU64, Contains}, RuntimeDebug, }; @@ -52,10 +51,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = BaseFilter; type BlockWeights = (); diff --git a/frame/randomness-collective-flip/src/lib.rs b/frame/randomness-collective-flip/src/lib.rs index be970ba2a8422..d92b053655dc9 100644 --- a/frame/randomness-collective-flip/src/lib.rs +++ b/frame/randomness-collective-flip/src/lib.rs @@ -186,8 +186,6 @@ mod tests { ); parameter_types! { - pub BlockWeights: limits::BlockWeights = limits::BlockWeights - ::simple_max(Weight::from_ref_time(1024)); pub BlockLength: limits::BlockLength = limits::BlockLength ::max(2 * 1024); } diff --git a/frame/ranked-collective/src/tests.rs b/frame/ranked-collective/src/tests.rs index 68bb79f3d07f7..c11d4877d3577 100644 --- a/frame/ranked-collective/src/tests.rs +++ b/frame/ranked-collective/src/tests.rs @@ -22,7 +22,6 @@ use std::collections::BTreeMap; use frame_support::{ assert_noop, assert_ok, error::BadOrigin, - pallet_prelude::Weight, parameter_types, traits::{ConstU16, ConstU32, ConstU64, EitherOf, Everything, MapSuccess, Polling}, }; @@ -49,10 +48,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1_000_000)); -} impl frame_system::Config for Test { type BaseCallFilter = Everything; type BlockWeights = (); diff --git a/frame/recovery/src/mock.rs b/frame/recovery/src/mock.rs index 2a29390fdd20f..05ca8e6a30a0e 100644 --- a/frame/recovery/src/mock.rs +++ b/frame/recovery/src/mock.rs @@ -45,11 +45,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/referenda/src/migration.rs b/frame/referenda/src/migration.rs index e495090c13754..39575556e4096 100644 --- a/frame/referenda/src/migration.rs +++ b/frame/referenda/src/migration.rs @@ -88,7 +88,7 @@ pub mod v1 { use super::*; /// The log target. - const TARGET: &'static str = "runtime::democracy::migration::v1"; + const TARGET: &'static str = "runtime::referenda::migration::v1"; /// Transforms a submission deposit of ReferendumInfo(Approved|Rejected|Cancelled|TimedOut) to /// optional value, making it refundable. diff --git a/frame/referenda/src/mock.rs b/frame/referenda/src/mock.rs index c98fbf9a676b1..e957027e561ab 100644 --- a/frame/referenda/src/mock.rs +++ b/frame/referenda/src/mock.rs @@ -63,8 +63,6 @@ impl Contains for BaseFilter { parameter_types! { pub MaxWeight: Weight = Weight::from_ref_time(2_000_000_000_000); - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(MaxWeight::get()); } impl frame_system::Config for Test { type BaseCallFilter = BaseFilter; diff --git a/frame/root-offences/src/mock.rs b/frame/root-offences/src/mock.rs index e1d9ee14ee2fc..273fbf614169d 100644 --- a/frame/root-offences/src/mock.rs +++ b/frame/root-offences/src/mock.rs @@ -84,11 +84,6 @@ impl sp_runtime::BoundToRuntimeAppPublic for OtherSessionHandler { type Public = UintAuthorityId; } -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 20e14206767aa..afc4fd66e76cb 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -169,7 +169,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(3); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(4); #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] diff --git a/frame/scheduler/src/tests.rs b/frame/scheduler/src/tests.rs index 7c261fdd74bfd..e5467fc8db55f 100644 --- a/frame/scheduler/src/tests.rs +++ b/frame/scheduler/src/tests.rs @@ -973,7 +973,7 @@ fn migration_to_v4_works() { } assert_eq_uvec!(x, expected); - assert_eq!(Scheduler::current_storage_version(), 3); + assert_eq!(Scheduler::on_chain_storage_version(), 4); }); } diff --git a/frame/scored-pool/src/mock.rs b/frame/scored-pool/src/mock.rs index d6f653b32ad2d..951871dd83c5c 100644 --- a/frame/scored-pool/src/mock.rs +++ b/frame/scored-pool/src/mock.rs @@ -48,8 +48,6 @@ construct_runtime!( parameter_types! { pub const CandidateDeposit: u64 = 25; - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); } ord_parameter_types! { pub const KickOrigin: u64 = 2; diff --git a/frame/session/src/migrations/v1.rs b/frame/session/src/migrations/v1.rs index c0dce422fe8b5..6689ca7299f1e 100644 --- a/frame/session/src/migrations/v1.rs +++ b/frame/session/src/migrations/v1.rs @@ -29,6 +29,8 @@ use frame_support::{ use crate::historical as pallet_session_historical; +const LOG_TARGET: &str = "runtime::session_historical"; + const OLD_PREFIX: &str = "Session"; /// Migrate the entire storage of this pallet to a new prefix. @@ -44,7 +46,7 @@ pub fn migrate::on_chain_storage_version(); log::info!( - target: "runtime::session_historical", + target: LOG_TARGET, "Running migration to v1 for session_historical with storage version {:?}", on_chain_storage_version, ); @@ -78,7 +80,7 @@ pub fn migrate::BlockWeights::get().max_block } else { log::warn!( - target: "runtime::session_historical", + target: LOG_TARGET, "Attempted to apply migration to v1 but failed because storage version is {:?}", on_chain_storage_version, ); @@ -184,7 +186,7 @@ pub fn post_migrate< fn log_migration(stage: &str, storage_prefix: &[u8], old_pallet_name: &str, new_pallet_name: &str) { log::info!( - target: "runtime::session_historical", + target: LOG_TARGET, "{} prefix of storage '{}': '{}' ==> '{}'", stage, str::from_utf8(storage_prefix).unwrap_or(""), diff --git a/frame/session/src/mock.rs b/frame/session/src/mock.rs index aa13eacba9564..1138bd9543989 100644 --- a/frame/session/src/mock.rs +++ b/frame/session/src/mock.rs @@ -238,11 +238,6 @@ pub fn new_test_ext() -> sp_io::TestExternalities { sp_io::TestExternalities::new(t) } -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} - impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/society/src/mock.rs b/frame/society/src/mock.rs index 0b1b93aeae761..24544bf9e82dd 100644 --- a/frame/society/src/mock.rs +++ b/frame/society/src/mock.rs @@ -49,8 +49,6 @@ frame_support::construct_runtime!( parameter_types! { pub const SocietyPalletId: PalletId = PalletId(*b"py/socie"); - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); } ord_parameter_types! { diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index 843e452125a6e..ad27a82910a6f 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -114,10 +114,6 @@ impl FindAuthor for Author11 { } parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max( - Weight::from_parts(frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND * 2, u64::MAX), - ); pub static SessionsPerEra: SessionIndex = 3; pub static ExistentialDeposit: Balance = 1; pub static SlashDeferDuration: EraIndex = 0; diff --git a/frame/staking/src/pallet/impls.rs b/frame/staking/src/pallet/impls.rs index db9aeba6fb58e..7af9b0aaaa04a 100644 --- a/frame/staking/src/pallet/impls.rs +++ b/frame/staking/src/pallet/impls.rs @@ -339,7 +339,7 @@ impl Pallet { if maybe_new_era_validators.is_some() && matches!(ForceEra::::get(), Forcing::ForceNew) { - ForceEra::::put(Forcing::NotForcing); + Self::set_force_era(Forcing::NotForcing); } maybe_new_era_validators @@ -717,11 +717,18 @@ impl Pallet { } } + /// Helper to set a new `ForceEra` mode. + pub(crate) fn set_force_era(mode: Forcing) { + log!(info, "Setting force era mode {:?}.", mode); + ForceEra::::put(mode); + Self::deposit_event(Event::::ForceEra { mode }); + } + /// Ensures that at the end of the current session there will be a new era. pub(crate) fn ensure_new_era() { match ForceEra::::get() { Forcing::ForceAlways | Forcing::ForceNew => (), - _ => ForceEra::::put(Forcing::ForceNew), + _ => Self::set_force_era(Forcing::ForceNew), } } diff --git a/frame/staking/src/pallet/mod.rs b/frame/staking/src/pallet/mod.rs index 92502949ef1a0..c0c18b40cf02f 100644 --- a/frame/staking/src/pallet/mod.rs +++ b/frame/staking/src/pallet/mod.rs @@ -292,6 +292,8 @@ pub mod pallet { pub type Invulnerables = StorageValue<_, Vec, ValueQuery>; /// Map from all locked "stash" accounts to the controller account. + /// + /// TWOX-NOTE: SAFE since `AccountId` is a secure hash. #[pallet::storage] #[pallet::getter(fn bonded)] pub type Bonded = StorageMap<_, Twox64Concat, T::AccountId, T::AccountId>; @@ -320,12 +322,16 @@ pub mod pallet { pub type Ledger = StorageMap<_, Blake2_128Concat, T::AccountId, StakingLedger>; /// Where the reward payment should be made. Keyed by stash. + /// + /// TWOX-NOTE: SAFE since `AccountId` is a secure hash. #[pallet::storage] #[pallet::getter(fn payee)] pub type Payee = StorageMap<_, Twox64Concat, T::AccountId, RewardDestination, ValueQuery>; /// The map from (wannabe) validator stash key to the preferences of that validator. + /// + /// TWOX-NOTE: SAFE since `AccountId` is a secure hash. #[pallet::storage] #[pallet::getter(fn validators)] pub type Validators = @@ -353,6 +359,8 @@ pub mod pallet { /// /// Lastly, if any of the nominators become non-decodable, they can be chilled immediately via /// [`Call::chill_other`] dispatchable by anyone. + /// + /// TWOX-NOTE: SAFE since `AccountId` is a secure hash. #[pallet::storage] #[pallet::getter(fn nominators)] pub type Nominators = @@ -706,6 +714,8 @@ pub mod pallet { PayoutStarted { era_index: EraIndex, validator_stash: T::AccountId }, /// A validator has set their preferences. ValidatorPrefsSet { stash: T::AccountId, prefs: ValidatorPrefs }, + /// A new force era mode was set. + ForceEra { mode: Forcing }, } #[pallet::error] @@ -1369,7 +1379,7 @@ pub mod pallet { #[pallet::weight(T::WeightInfo::force_no_eras())] pub fn force_no_eras(origin: OriginFor) -> DispatchResult { ensure_root(origin)?; - ForceEra::::put(Forcing::ForceNone); + Self::set_force_era(Forcing::ForceNone); Ok(()) } @@ -1393,7 +1403,7 @@ pub mod pallet { #[pallet::weight(T::WeightInfo::force_new_era())] pub fn force_new_era(origin: OriginFor) -> DispatchResult { ensure_root(origin)?; - ForceEra::::put(Forcing::ForceNew); + Self::set_force_era(Forcing::ForceNew); Ok(()) } @@ -1444,7 +1454,7 @@ pub mod pallet { #[pallet::weight(T::WeightInfo::force_new_era_always())] pub fn force_new_era_always(origin: OriginFor) -> DispatchResult { ensure_root(origin)?; - ForceEra::::put(Forcing::ForceAlways); + Self::set_force_era(Forcing::ForceAlways); Ok(()) } diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index 46c3c97441938..acd41895287c5 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -899,7 +899,7 @@ fn forcing_new_era_works() { assert_eq!(active_era(), 1); // no era change. - ForceEra::::put(Forcing::ForceNone); + Staking::set_force_era(Forcing::ForceNone); start_session(4); assert_eq!(active_era(), 1); @@ -915,7 +915,7 @@ fn forcing_new_era_works() { // back to normal. // this immediately starts a new session. - ForceEra::::put(Forcing::NotForcing); + Staking::set_force_era(Forcing::NotForcing); start_session(8); assert_eq!(active_era(), 1); @@ -923,7 +923,7 @@ fn forcing_new_era_works() { start_session(9); assert_eq!(active_era(), 2); // forceful change - ForceEra::::put(Forcing::ForceAlways); + Staking::set_force_era(Forcing::ForceAlways); start_session(10); assert_eq!(active_era(), 2); @@ -935,7 +935,7 @@ fn forcing_new_era_works() { assert_eq!(active_era(), 4); // just one forceful change - ForceEra::::put(Forcing::ForceNew); + Staking::set_force_era(Forcing::ForceNew); start_session(13); assert_eq!(active_era(), 5); assert_eq!(ForceEra::::get(), Forcing::NotForcing); @@ -2303,7 +2303,7 @@ fn era_is_always_same_length() { ); let session = Session::current_index(); - ForceEra::::put(Forcing::ForceNew); + Staking::set_force_era(Forcing::ForceNew); advance_session(); advance_session(); assert_eq!(current_era(), 3); @@ -2914,7 +2914,10 @@ fn deferred_slashes_are_deferred() { staking_events_since_last_call().as_slice(), &[ Event::Chilled { stash: 11 }, + Event::ForceEra { mode: Forcing::ForceNew }, Event::SlashReported { validator: 11, slash_era: 1, .. }, + Event::StakersElected, + Event::ForceEra { mode: Forcing::NotForcing }, .., Event::Slashed { staker: 11, amount: 100 }, Event::Slashed { staker: 101, amount: 12 } @@ -2949,6 +2952,7 @@ fn retroactive_deferred_slashes_two_eras_before() { staking_events_since_last_call().as_slice(), &[ Event::Chilled { stash: 11 }, + Event::ForceEra { mode: Forcing::ForceNew }, Event::SlashReported { validator: 11, slash_era: 1, .. }, .., Event::Slashed { staker: 11, amount: 100 }, @@ -3251,6 +3255,7 @@ fn slash_kicks_validators_not_nominators_and_disables_nominator_for_kicked_valid Event::StakersElected, Event::EraPaid { era_index: 0, validator_payout: 11075, remainder: 33225 }, Event::Chilled { stash: 11 }, + Event::ForceEra { mode: Forcing::ForceNew }, Event::SlashReported { validator: 11, fraction: Perbill::from_percent(10), @@ -3318,6 +3323,7 @@ fn non_slashable_offence_doesnt_disable_validator() { Event::StakersElected, Event::EraPaid { era_index: 0, validator_payout: 11075, remainder: 33225 }, Event::Chilled { stash: 11 }, + Event::ForceEra { mode: Forcing::ForceNew }, Event::SlashReported { validator: 11, fraction: Perbill::from_percent(0), @@ -3380,6 +3386,7 @@ fn slashing_independent_of_disabling_validator() { Event::StakersElected, Event::EraPaid { era_index: 0, validator_payout: 11075, remainder: 33225 }, Event::Chilled { stash: 11 }, + Event::ForceEra { mode: Forcing::ForceNew }, Event::SlashReported { validator: 11, fraction: Perbill::from_percent(0), @@ -4662,8 +4669,15 @@ mod election_data_provider { MinimumValidatorCount::::put(2); run_to_block(55); assert_eq!(Staking::next_election_prediction(System::block_number()), 55 + 25); - assert_eq!(staking_events().len(), 6); - assert_eq!(*staking_events().last().unwrap(), Event::StakersElected); + assert_eq!(staking_events().len(), 10); + assert_eq!( + *staking_events().last().unwrap(), + Event::ForceEra { mode: Forcing::NotForcing } + ); + assert_eq!( + *staking_events().get(staking_events().len() - 2).unwrap(), + Event::StakersElected + ); // The new era has been planned, forcing is changed from `ForceNew` to `NotForcing`. assert_eq!(ForceEra::::get(), Forcing::NotForcing); }) diff --git a/frame/sudo/src/mock.rs b/frame/sudo/src/mock.rs index 639e81ceaa308..f8a03836f8f0f 100644 --- a/frame/sudo/src/mock.rs +++ b/frame/sudo/src/mock.rs @@ -19,12 +19,7 @@ use super::*; use crate as sudo; -use frame_support::{ - parameter_types, - traits::{ConstU32, ConstU64, Contains, GenesisBuild}, - weights::Weight, -}; -use frame_system::limits; +use frame_support::traits::{ConstU32, ConstU64, Contains, GenesisBuild}; use sp_core::H256; use sp_io; use sp_runtime::{ @@ -111,10 +106,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: limits::BlockWeights = limits::BlockWeights::simple_max(Weight::from_ref_time(1024)); -} - pub struct BlockEverything; impl Contains for BlockEverything { fn contains(_: &RuntimeCall) -> bool { diff --git a/frame/support/procedural/src/pallet/expand/hooks.rs b/frame/support/procedural/src/pallet/expand/hooks.rs index 0aa7c1e7aaf06..c41a65b57b57a 100644 --- a/frame/support/procedural/src/pallet/expand/hooks.rs +++ b/frame/support/procedural/src/pallet/expand/hooks.rs @@ -63,7 +63,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream { ::PalletInfo as #frame_support::traits::PalletInfo - >::name::().expect("Every active pallet has a name in the runtime; qed"); + >::name::().expect("No name found for the pallet! This usually means that the pallet wasn't added to `construct_runtime!`."); #frame_support::log::debug!( target: #frame_support::LOG_TARGET, "🩺 try-state pallet {:?}", @@ -191,16 +191,19 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream { } } - impl<#type_impl_gen> - #frame_support::traits::IntegrityTest + // Integrity tests are only required for when `std` is enabled. + #frame_support::std_enabled! { + impl<#type_impl_gen> + #frame_support::traits::IntegrityTest for #pallet_ident<#type_use_gen> #where_clause - { - fn integrity_test() { - < - Self as #frame_support::traits::Hooks< + { + fn integrity_test() { + < + Self as #frame_support::traits::Hooks< ::BlockNumber - > - >::integrity_test() + > + >::integrity_test() + } } } diff --git a/frame/support/procedural/src/pallet/expand/storage.rs b/frame/support/procedural/src/pallet/expand/storage.rs index 181f35b545496..195a62431f279 100644 --- a/frame/support/procedural/src/pallet/expand/storage.rs +++ b/frame/support/procedural/src/pallet/expand/storage.rs @@ -535,7 +535,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { ::PalletInfo as #frame_support::traits::PalletInfo >::name::>() - .expect("Every active pallet has a name in the runtime; qed") + .expect("No name found for the pallet in the runtime! This usually means that the pallet wasn't added to `construct_runtime!`.") } const STORAGE_PREFIX: &'static str = #counter_prefix_struct_const; } @@ -569,7 +569,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { ::PalletInfo as #frame_support::traits::PalletInfo >::name::>() - .expect("Every active pallet has a name in the runtime; qed") + .expect("No name found for the pallet in the runtime! This usually means that the pallet wasn't added to `construct_runtime!`.") } const STORAGE_PREFIX: &'static str = #prefix_struct_const; } @@ -648,7 +648,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { ::PalletInfo as #frame_support::traits::PalletInfo >::name::<#pallet_ident<#type_use_gen>>() - .expect("Every active pallet has a name in the runtime; qed"), + .expect("No name found for the pallet in the runtime! This usually means that the pallet wasn't added to `construct_runtime!`."), entries: { #[allow(unused_mut)] let mut entries = #frame_support::sp_std::vec![]; diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index efecbb75f9c62..902893972f0b1 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -2744,3 +2744,6 @@ pub mod pallet_macros { type_value, unbounded, validate_unsigned, weight, whitelist_storage, }; } + +// Generate a macro that will enable/disable code based on `std` feature being active. +sp_core::generate_feature_enabled_macro!(std_enabled, feature = "std", $); diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index 0ac3d90f59e07..7fe1bcb5674bb 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -23,7 +23,7 @@ sp-runtime = { version = "7.0.0", default-features = false, path = "../../../pri sp-core = { version = "7.0.0", default-features = false, path = "../../../primitives/core" } sp-std = { version = "5.0.0", default-features = false, path = "../../../primitives/std" } sp-version = { version = "5.0.0", default-features = false, path = "../../../primitives/version" } -trybuild = { version = "1.0.60", features = [ "diff" ] } +trybuild = { version = "1.0.74", features = [ "diff" ] } pretty_assertions = "1.2.1" rustversion = "1.0.6" frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" } diff --git a/frame/support/test/tests/construct_runtime_ui/invalid_module_details.stderr b/frame/support/test/tests/construct_runtime_ui/invalid_module_details.stderr index db96b8749ca11..0a20cf4e39a88 100644 --- a/frame/support/test/tests/construct_runtime_ui/invalid_module_details.stderr +++ b/frame/support/test/tests/construct_runtime_ui/invalid_module_details.stderr @@ -1,5 +1,5 @@ error: Unexpected tokens, expected one of `::$ident` `::{`, `exclude_parts`, `use_parts`, `=`, `,` - --> $DIR/invalid_module_details.rs:9:17 + --> tests/construct_runtime_ui/invalid_module_details.rs:9:17 | 9 | system: System::(), - | ^^ + | ^ diff --git a/frame/support/test/tests/derive_no_bound.rs b/frame/support/test/tests/derive_no_bound.rs index f891b3a2d2db8..9162b5013bcdc 100644 --- a/frame/support/test/tests/derive_no_bound.rs +++ b/frame/support/test/tests/derive_no_bound.rs @@ -72,7 +72,7 @@ fn test_struct_named() { assert_eq!(a_2, a_1); assert_eq!( format!("{:?}", a_1), - String::from("StructNamed { a: 1, b: 2, c: 3, phantom: PhantomData }") + String::from("StructNamed { a: 1, b: 2, c: 3, phantom: PhantomData<(derive_no_bound::ImplNone, derive_no_bound::ImplNone)> }") ); let b = StructNamed:: { @@ -103,7 +103,7 @@ fn test_struct_unnamed() { assert_eq!(a_2.1, 2); assert_eq!(a_2.2, 3); assert_eq!(a_2, a_1); - assert_eq!(format!("{:?}", a_1), String::from("StructUnnamed(1, 2, 3, PhantomData)")); + assert_eq!(format!("{:?}", a_1), String::from("StructUnnamed(1, 2, 3, PhantomData<(derive_no_bound::ImplNone, derive_no_bound::ImplNone)>)")); let b = StructUnnamed::(1, 2, 4, Default::default()); @@ -211,11 +211,11 @@ fn test_enum() { assert_eq!( format!("{:?}", variant_0), - String::from("Enum::VariantUnnamed(1, 2, 3, PhantomData)"), + String::from("Enum::VariantUnnamed(1, 2, 3, PhantomData<(derive_no_bound::ImplNone, derive_no_bound::ImplNone)>)"), ); assert_eq!( format!("{:?}", variant_1), - String::from("Enum::VariantNamed { a: 1, b: 2, c: 3, phantom: PhantomData }"), + String::from("Enum::VariantNamed { a: 1, b: 2, c: 3, phantom: PhantomData<(derive_no_bound::ImplNone, derive_no_bound::ImplNone)> }"), ); assert_eq!(format!("{:?}", variant_2), String::from("Enum::VariantUnit")); assert_eq!(format!("{:?}", variant_3), String::from("Enum::VariantUnit2")); diff --git a/frame/support/test/tests/pallet_ui/call_invalid_return.stderr b/frame/support/test/tests/pallet_ui/call_invalid_return.stderr index 6a851ed3fc283..8803bbba01326 100644 --- a/frame/support/test/tests/pallet_ui/call_invalid_return.stderr +++ b/frame/support/test/tests/pallet_ui/call_invalid_return.stderr @@ -1,5 +1,5 @@ error: expected `DispatchResultWithPostInfo` or `DispatchResult` - --> $DIR/call_invalid_return.rs:17:39 + --> tests/pallet_ui/call_invalid_return.rs:17:39 | 17 | pub fn foo(origin: OriginFor) -> ::DispatchResult { todo!() } - | ^^ + | ^ diff --git a/frame/system/benches/bench.rs b/frame/system/benches/bench.rs index 0881b81eaca7d..f2acc319d3f5d 100644 --- a/frame/system/benches/bench.rs +++ b/frame/system/benches/bench.rs @@ -16,10 +16,7 @@ // limitations under the License. use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use frame_support::{ - traits::{ConstU32, ConstU64}, - weights::Weight, -}; +use frame_support::traits::{ConstU32, ConstU64}; use sp_core::H256; use sp_runtime::{ testing::Header, @@ -62,10 +59,6 @@ frame_support::construct_runtime!( ); frame_support::parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::with_sensible_defaults( - Weight::from_ref_time(4 * 1024 * 1024), Perbill::from_percent(75), - ); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength::max_with_normal_ratio( 4 * 1024 * 1024, Perbill::from_percent(75), diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index a77d1ca31b50f..3909b1e9c5257 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -129,6 +129,8 @@ pub use extensions::check_mortality::CheckMortality as CheckEra; pub use frame_support::dispatch::RawOrigin; pub use weights::WeightInfo; +const LOG_TARGET: &str = "runtime::system"; + /// Compute the trie root of a list of extrinsics. /// /// The merkle proof is using the same trie as runtime state with @@ -360,8 +362,11 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { + #[cfg(feature = "std")] fn integrity_test() { - T::BlockWeights::get().validate().expect("The weights are invalid."); + sp_io::TestExternalities::default().execute_with(|| { + T::BlockWeights::get().validate().expect("The weights are invalid."); + }); } } @@ -1072,7 +1077,7 @@ impl Pallet { if account.providers == 0 { // Logic error - cannot decrement beyond zero. log::error!( - target: "runtime::system", + target: LOG_TARGET, "Logic error: Unexpected underflow in reducing provider", ); account.providers = 1; @@ -1098,7 +1103,7 @@ impl Pallet { } } else { log::error!( - target: "runtime::system", + target: LOG_TARGET, "Logic error: Account already dead when reducing provider", ); Ok(DecRefStatus::Reaped) @@ -1130,7 +1135,7 @@ impl Pallet { if account.sufficients == 0 { // Logic error - cannot decrement beyond zero. log::error!( - target: "runtime::system", + target: LOG_TARGET, "Logic error: Unexpected underflow in reducing sufficients", ); } @@ -1147,7 +1152,7 @@ impl Pallet { } } else { log::error!( - target: "runtime::system", + target: LOG_TARGET, "Logic error: Account already dead when reducing provider", ); DecRefStatus::Reaped @@ -1212,7 +1217,7 @@ impl Pallet { a.consumers -= 1; } else { log::error!( - target: "runtime::system", + target: LOG_TARGET, "Logic error: Unexpected underflow in reducing consumer", ); } @@ -1334,7 +1339,7 @@ impl Pallet { /// resulting header for this block. pub fn finalize() -> T::Header { log::debug!( - target: "runtime::system", + target: LOG_TARGET, "[{:?}] {} extrinsics, length: {} (normal {}%, op: {}%, mandatory {}%) / normal weight:\ {} ({}%) op weight {} ({}%) / mandatory weight {} ({}%)", Self::block_number(), @@ -1544,7 +1549,7 @@ impl Pallet { Ok(_) => Event::ExtrinsicSuccess { dispatch_info: info }, Err(err) => { log::trace!( - target: "runtime::system", + target: LOG_TARGET, "Extrinsic failed at block({:?}): {:?}", Self::block_number(), err, diff --git a/frame/system/src/migrations/mod.rs b/frame/system/src/migrations/mod.rs index 15746d7376ac5..90b88de1ab11c 100644 --- a/frame/system/src/migrations/mod.rs +++ b/frame/system/src/migrations/mod.rs @@ -17,6 +17,7 @@ //! Migrate the reference counting state. +use super::LOG_TARGET; use crate::{Config, Pallet}; use codec::{Decode, Encode, FullCodec}; use frame_support::{ @@ -75,7 +76,7 @@ pub fn migrate_from_single_u8_to_triple_ref_count() -> Wei Some(AccountInfo { nonce, consumers: rc as RefCount, providers: 1, sufficients: 0, data }) }); log::info!( - target: "runtime::system", + target: LOG_TARGET, "Applied migration from single u8 to triple reference counting to {:?} elements.", translated ); @@ -94,7 +95,7 @@ pub fn migrate_from_single_to_triple_ref_count() -> Weight }, ); log::info!( - target: "runtime::system", + target: LOG_TARGET, "Applied migration from single to triple reference counting to {:?} elements.", translated ); @@ -112,7 +113,7 @@ pub fn migrate_from_dual_to_triple_ref_count() -> Weight { }, ); log::info!( - target: "runtime::system", + target: LOG_TARGET, "Applied migration from dual to triple reference counting to {:?} elements.", translated ); diff --git a/frame/timestamp/src/mock.rs b/frame/timestamp/src/mock.rs index 2208510f24fe5..e1ba5cd11e615 100644 --- a/frame/timestamp/src/mock.rs +++ b/frame/timestamp/src/mock.rs @@ -46,10 +46,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/tips/src/lib.rs b/frame/tips/src/lib.rs index dd9ebc9813233..43002c7b5f196 100644 --- a/frame/tips/src/lib.rs +++ b/frame/tips/src/lib.rs @@ -78,6 +78,8 @@ use frame_support::{ pub use pallet::*; pub use weights::WeightInfo; +const LOG_TARGET: &str = "runtime::tips"; + pub type BalanceOf = pallet_treasury::BalanceOf; pub type NegativeImbalanceOf = pallet_treasury::NegativeImbalanceOf; type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; diff --git a/frame/tips/src/migrations/v4.rs b/frame/tips/src/migrations/v4.rs index 5e10fa7dd2c6d..0107e96a41168 100644 --- a/frame/tips/src/migrations/v4.rs +++ b/frame/tips/src/migrations/v4.rs @@ -18,6 +18,7 @@ use sp_io::hashing::twox_128; use sp_std::str; +use super::super::LOG_TARGET; use frame_support::{ storage::StoragePrefixedMap, traits::{ @@ -46,7 +47,7 @@ pub fn migrate::on_chain_storage_version(); log::info!( - target: "runtime::tips", + target: LOG_TARGET, "Running migration to v4 for tips with storage version {:?}", on_chain_storage_version, ); @@ -80,7 +81,7 @@ pub fn migrate::BlockWeights::get().max_block } else { log::warn!( - target: "runtime::tips", + target: LOG_TARGET, "Attempted to apply migration to v4 but failed because storage version is {:?}", on_chain_storage_version, ); @@ -185,7 +186,7 @@ pub fn post_migrate< fn log_migration(stage: &str, storage_prefix: &[u8], old_pallet_name: &str, new_pallet_name: &str) { log::info!( - target: "runtime::tips", + target: LOG_TARGET, "{} prefix of storage '{}': '{}' ==> '{}'", stage, str::from_utf8(storage_prefix).unwrap_or(""), diff --git a/frame/treasury/src/tests.rs b/frame/treasury/src/tests.rs index 9cfe147ec4ce4..e6a1ea0f543fe 100644 --- a/frame/treasury/src/tests.rs +++ b/frame/treasury/src/tests.rs @@ -51,10 +51,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); diff --git a/frame/uniques/src/lib.rs b/frame/uniques/src/lib.rs index 6b21477be4340..da0f0e0560674 100644 --- a/frame/uniques/src/lib.rs +++ b/frame/uniques/src/lib.rs @@ -60,6 +60,8 @@ pub use pallet::*; pub use types::*; pub use weights::WeightInfo; +const LOG_TARGET: &str = "runtime::uniques"; + type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; #[frame_support::pallet] diff --git a/frame/uniques/src/migration.rs b/frame/uniques/src/migration.rs index 8a2a0ef808d90..fd98c030d7f1b 100644 --- a/frame/uniques/src/migration.rs +++ b/frame/uniques/src/migration.rs @@ -24,7 +24,7 @@ pub fn migrate_to_v1, I: 'static, P: GetStorageVersion + PalletInfo ) -> frame_support::weights::Weight { let on_chain_storage_version =

::on_chain_storage_version(); log::info!( - target: "runtime::uniques", + target: LOG_TARGET, "Running migration storage v1 for uniques with storage version {:?}", on_chain_storage_version, ); @@ -37,7 +37,7 @@ pub fn migrate_to_v1, I: 'static, P: GetStorageVersion + PalletInfo } StorageVersion::new(1).put::

(); log::info!( - target: "runtime::uniques", + target: LOG_TARGET, "Running migration storage v1 for uniques with storage version {:?} was complete", on_chain_storage_version, ); @@ -45,7 +45,7 @@ pub fn migrate_to_v1, I: 'static, P: GetStorageVersion + PalletInfo T::DbWeight::get().reads_writes(count as u64 + 1, count as u64 + 1) } else { log::warn!( - target: "runtime::uniques", + target: LOG_TARGET, "Attempted to apply migration to v1 but failed because storage version is {:?}", on_chain_storage_version, ); diff --git a/frame/vesting/src/mock.rs b/frame/vesting/src/mock.rs index 0bd371a0353f1..da9490bea66c0 100644 --- a/frame/vesting/src/mock.rs +++ b/frame/vesting/src/mock.rs @@ -43,10 +43,6 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type AccountData = pallet_balances::AccountData; type AccountId = u64; diff --git a/frame/whitelist/src/mock.rs b/frame/whitelist/src/mock.rs index ef5d3d4fb4d34..e08c2875aec51 100644 --- a/frame/whitelist/src/mock.rs +++ b/frame/whitelist/src/mock.rs @@ -22,7 +22,7 @@ use crate as pallet_whitelist; use frame_support::{ - construct_runtime, parameter_types, + construct_runtime, traits::{ConstU32, ConstU64, Nothing}, }; use frame_system::EnsureRoot; @@ -49,10 +49,6 @@ construct_runtime!( } ); -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024)); -} impl frame_system::Config for Test { type BaseCallFilter = Nothing; type BlockWeights = (); diff --git a/primitives/api/test/Cargo.toml b/primitives/api/test/Cargo.toml index edc0d43e91437..7f15287cf36d6 100644 --- a/primitives/api/test/Cargo.toml +++ b/primitives/api/test/Cargo.toml @@ -21,7 +21,7 @@ sp-consensus = { version = "0.10.0-dev", path = "../../consensus/common" } sc-block-builder = { version = "0.10.0-dev", path = "../../../client/block-builder" } codec = { package = "parity-scale-codec", version = "3.0.0" } sp-state-machine = { version = "0.13.0", path = "../../state-machine" } -trybuild = "1.0.60" +trybuild = "1.0.74" rustversion = "1.0.6" [dev-dependencies] diff --git a/primitives/arithmetic/src/traits.rs b/primitives/arithmetic/src/traits.rs index 9e9dff8e6f9ea..dfba046754373 100644 --- a/primitives/arithmetic/src/traits.rs +++ b/primitives/arithmetic/src/traits.rs @@ -19,9 +19,9 @@ use codec::HasCompact; pub use ensure::{ - Ensure, EnsureAdd, EnsureAddAssign, EnsureDiv, EnsureDivAssign, EnsureFixedPointNumber, - EnsureFrom, EnsureInto, EnsureMul, EnsureMulAssign, EnsureOp, EnsureOpAssign, EnsureSub, - EnsureSubAssign, + ensure_pow, Ensure, EnsureAdd, EnsureAddAssign, EnsureDiv, EnsureDivAssign, + EnsureFixedPointNumber, EnsureFrom, EnsureInto, EnsureMul, EnsureMulAssign, EnsureOp, + EnsureOpAssign, EnsureSub, EnsureSubAssign, }; pub use integer_sqrt::IntegerSquareRoot; pub use num_traits::{ @@ -342,7 +342,7 @@ impl SaturatedConversion for T {} /// The *EnsureOps* family functions follows the same behavior as *CheckedOps* but /// returning an [`ArithmeticError`](crate::ArithmeticError) instead of `None`. mod ensure { - use super::{CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; + use super::{checked_pow, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, One, Zero}; use crate::{ArithmeticError, FixedPointNumber, FixedPointOperand}; /// Performs addition that returns [`ArithmeticError`] instead of wrapping around on overflow. @@ -511,6 +511,27 @@ mod ensure { } } + /// Raises a value to the power of exp, returning `ArithmeticError` if an overflow occurred. + /// + /// Check [`checked_pow`] for more info about border cases. + /// + /// ``` + /// use sp_arithmetic::{traits::ensure_pow, ArithmeticError}; + /// + /// fn overflow() -> Result<(), ArithmeticError> { + /// ensure_pow(2u64, 64)?; + /// Ok(()) + /// } + /// + /// assert_eq!(overflow(), Err(ArithmeticError::Overflow)); + /// ``` + pub fn ensure_pow( + base: T, + exp: usize, + ) -> Result { + checked_pow(base, exp).ok_or(ArithmeticError::Overflow) + } + impl EnsureAdd for T {} impl EnsureSub for T {} impl EnsureMul for T {} @@ -953,6 +974,15 @@ mod tests { test_ensure(values(), &EnsureDiv::ensure_div, &CheckedDiv::checked_div); } + #[test] + fn ensure_pow_works() { + test_ensure( + values().into_iter().map(|(base, exp)| (base, exp as usize)).collect(), + ensure_pow, + |&a, &b| checked_pow(a, b), + ); + } + #[test] fn ensure_add_assign_works() { test_ensure_assign(values(), &EnsureAddAssign::ensure_add_assign, &EnsureAdd::ensure_add); @@ -974,11 +1004,12 @@ mod tests { } /// Test that the ensured function returns the expected un-ensured value. - fn test_ensure(pairs: Vec<(V, V)>, ensured: E, unensured: P) + fn test_ensure(pairs: Vec<(V, W)>, ensured: E, unensured: P) where V: Ensure + core::fmt::Debug + Copy, - E: Fn(V, V) -> Result, - P: Fn(&V, &V) -> Option, + W: Ensure + core::fmt::Debug + Copy, + E: Fn(V, W) -> Result, + P: Fn(&V, &W) -> Option, { for (a, b) in pairs.into_iter() { match ensured(a, b) { @@ -993,11 +1024,12 @@ mod tests { } /// Test that the ensured function modifies `self` to the expected un-ensured value. - fn test_ensure_assign(pairs: Vec<(V, V)>, ensured: E, unensured: P) + fn test_ensure_assign(pairs: Vec<(V, W)>, ensured: E, unensured: P) where V: Ensure + std::panic::RefUnwindSafe + std::panic::UnwindSafe + core::fmt::Debug + Copy, - E: Fn(&mut V, V) -> Result<(), ArithmeticError>, - P: Fn(V, V) -> Result + std::panic::RefUnwindSafe, + W: Ensure + std::panic::RefUnwindSafe + std::panic::UnwindSafe + core::fmt::Debug + Copy, + E: Fn(&mut V, W) -> Result<(), ArithmeticError>, + P: Fn(V, W) -> Result + std::panic::RefUnwindSafe, { for (mut a, b) in pairs.into_iter() { let old_a = a; diff --git a/primitives/finality-grandpa/Cargo.toml b/primitives/finality-grandpa/Cargo.toml index de8de99eed891..c33646e3cd2b8 100644 --- a/primitives/finality-grandpa/Cargo.toml +++ b/primitives/finality-grandpa/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -grandpa = { package = "finality-grandpa", version = "0.16.0", default-features = false, features = ["derive-codec"] } +grandpa = { package = "finality-grandpa", version = "0.16.1", default-features = false, features = ["derive-codec"] } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } diff --git a/primitives/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml index 09f4b83d68b34..da746179e281d 100644 --- a/primitives/runtime-interface/Cargo.toml +++ b/primitives/runtime-interface/Cargo.toml @@ -32,7 +32,7 @@ sp-state-machine = { version = "0.13.0", path = "../state-machine" } sp-core = { version = "7.0.0", path = "../core" } sp-io = { version = "7.0.0", path = "../io" } rustversion = "1.0.6" -trybuild = "1.0.60" +trybuild = "1.0.74" [features] default = [ "std" ] diff --git a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml index 32d78ec2cee41..ec07481234e91 100644 --- a/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml +++ b/primitives/runtime-interface/test-wasm-deprecated/Cargo.toml @@ -19,8 +19,14 @@ sp-runtime-interface = { version = "7.0.0", default-features = false, path = ".. sp-std = { version = "5.0.0", default-features = false, path = "../../std" } [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder" } +substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder", optional = true } [features] default = [ "std" ] -std = [ "sp-core/std", "sp-io/std", "sp-runtime-interface/std", "sp-std/std" ] +std = [ + "sp-core/std", + "sp-io/std", + "sp-runtime-interface/std", + "sp-std/std", + "substrate-wasm-builder", +] diff --git a/primitives/runtime-interface/test-wasm-deprecated/build.rs b/primitives/runtime-interface/test-wasm-deprecated/build.rs index b773ed9cf6fb7..70f84bc00a817 100644 --- a/primitives/runtime-interface/test-wasm-deprecated/build.rs +++ b/primitives/runtime-interface/test-wasm-deprecated/build.rs @@ -15,12 +15,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use substrate_wasm_builder::WasmBuilder; - fn main() { - WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .build() + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .build(); + } } diff --git a/primitives/runtime-interface/test-wasm/Cargo.toml b/primitives/runtime-interface/test-wasm/Cargo.toml index 5fb4850af8d9b..1061a54d7f1b8 100644 --- a/primitives/runtime-interface/test-wasm/Cargo.toml +++ b/primitives/runtime-interface/test-wasm/Cargo.toml @@ -20,8 +20,14 @@ sp-runtime-interface = { version = "7.0.0", default-features = false, path = ".. sp-std = { version = "5.0.0", default-features = false, path = "../../std" } [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder" } +substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder", optional = true } [features] default = [ "std" ] -std = [ "sp-core/std", "sp-io/std", "sp-runtime-interface/std", "sp-std/std" ] +std = [ + "sp-core/std", + "sp-io/std", + "sp-runtime-interface/std", + "sp-std/std", + "substrate-wasm-builder", +] diff --git a/primitives/runtime-interface/test-wasm/build.rs b/primitives/runtime-interface/test-wasm/build.rs index b773ed9cf6fb7..70f84bc00a817 100644 --- a/primitives/runtime-interface/test-wasm/build.rs +++ b/primitives/runtime-interface/test-wasm/build.rs @@ -15,12 +15,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use substrate_wasm_builder::WasmBuilder; - fn main() { - WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .build() + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .build(); + } } diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs index 8978cdb11c0c6..6eb19683b4439 100644 --- a/primitives/runtime/src/traits.rs +++ b/primitives/runtime/src/traits.rs @@ -32,11 +32,11 @@ use impl_trait_for_tuples::impl_for_tuples; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use sp_application_crypto::AppKey; pub use sp_arithmetic::traits::{ - AtLeast32Bit, AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedDiv, CheckedMul, CheckedShl, - CheckedShr, CheckedSub, Ensure, EnsureAdd, EnsureAddAssign, EnsureDiv, EnsureDivAssign, - EnsureFixedPointNumber, EnsureFrom, EnsureInto, EnsureMul, EnsureMulAssign, EnsureOp, - EnsureOpAssign, EnsureSub, EnsureSubAssign, IntegerSquareRoot, One, SaturatedConversion, - Saturating, UniqueSaturatedFrom, UniqueSaturatedInto, Zero, + checked_pow, ensure_pow, AtLeast32Bit, AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedDiv, + CheckedMul, CheckedShl, CheckedShr, CheckedSub, Ensure, EnsureAdd, EnsureAddAssign, EnsureDiv, + EnsureDivAssign, EnsureFixedPointNumber, EnsureFrom, EnsureInto, EnsureMul, EnsureMulAssign, + EnsureOp, EnsureOpAssign, EnsureSub, EnsureSubAssign, IntegerSquareRoot, One, + SaturatedConversion, Saturating, UniqueSaturatedFrom, UniqueSaturatedInto, Zero, }; use sp_core::{self, storage::StateVersion, Hasher, RuntimeDebug, TypeId}; #[doc(hidden)] diff --git a/scripts/ci/gitlab/crate-publishing-pipeline.yml b/scripts/ci/gitlab/crate-publishing-pipeline.yml new file mode 100644 index 0000000000000..9d5303952e6ef --- /dev/null +++ b/scripts/ci/gitlab/crate-publishing-pipeline.yml @@ -0,0 +1 @@ +default: !reference [.crate-publishing-pipeline-definitions, default] diff --git a/scripts/ci/gitlab/default-pipeline.yml b/scripts/ci/gitlab/default-pipeline.yml new file mode 100644 index 0000000000000..19f6c320c3c24 --- /dev/null +++ b/scripts/ci/gitlab/default-pipeline.yml @@ -0,0 +1 @@ +default: !reference [.default-pipeline-definitions, default] diff --git a/scripts/ci/gitlab/pipeline/publish.yml b/scripts/ci/gitlab/pipeline/publish.yml index cc7451a9fbb22..d1a7514d1707b 100644 --- a/scripts/ci/gitlab/pipeline/publish.yml +++ b/scripts/ci/gitlab/pipeline/publish.yml @@ -182,20 +182,6 @@ publish-draft-release: - ./scripts/ci/gitlab/publish_draft_release.sh allow_failure: true -# Ref: /~https://github.com/paritytech/opstooling/issues/111 -update-node-template: - stage: publish - extends: .kubernetes-env - rules: - - if: $CI_COMMIT_REF_NAME =~ /^polkadot-v[0-9]+\.[0-9]+.*$/ # i.e. polkadot-v1.0.99, polkadot-v2.1rc1 - script: - - git clone --depth=1 --branch="$PIPELINE_SCRIPTS_TAG" /~https://github.com/paritytech/pipeline-scripts - - ./pipeline-scripts/update_substrate_template.sh - --repo-name "substrate-node-template" - --template-path "bin/node-template" - --github-api-token "$GITHUB_TOKEN" - --polkadot-branch "$CI_COMMIT_REF_NAME" - .publish-crates-template: stage: publish extends: .crates-publishing-template @@ -214,7 +200,7 @@ update-node-template: timeout: 9h # A custom publishing environment is used for us to be able to set up protected secrets # specifically for it - environment: publish-crates + environment: publish-crates script: - rusty-cachier snapshot create - git clone @@ -234,5 +220,6 @@ publish-crates: publish-crates-manual: extends: .publish-crates-template + rules: !reference [.crate-publishing-pipeline, rules] when: manual allow_failure: true diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index cd4839fa1cbd7..1b98b23e0b254 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -18,5 +18,5 @@ tokio = { version = "1.22.0", features = ["macros", "time"] } substrate-test-utils-derive = { version = "0.10.0-dev", path = "./derive" } [dev-dependencies] -trybuild = { version = "1.0.53", features = [ "diff" ] } +trybuild = { version = "1.0.74", features = [ "diff" ] } sc-service = { version = "0.10.0-dev", path = "../client/service" } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index 7576a63ac3eb1..cff0227d03184 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -59,7 +59,7 @@ substrate-test-runtime-client = { version = "2.0.0", path = "./client" } futures = "0.3.21" [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", path = "../../utils/wasm-builder" } +substrate-wasm-builder = { version = "5.0.0-dev", path = "../../utils/wasm-builder", optional = true } [features] default = [ @@ -101,6 +101,7 @@ std = [ "sp-trie/std", "sp-transaction-pool/std", "trie-db/std", + "substrate-wasm-builder", ] # Special feature to disable logging disable-logging = [ "sp-api/disable-logging" ] diff --git a/test-utils/runtime/build.rs b/test-utils/runtime/build.rs index 5a7b518d0bd75..870d8ac43825b 100644 --- a/test-utils/runtime/build.rs +++ b/test-utils/runtime/build.rs @@ -15,24 +15,28 @@ // See the License for the specific language governing permissions and // limitations under the License. -use substrate_wasm_builder::WasmBuilder; - fn main() { - WasmBuilder::new() - .with_current_project() - .export_heap_base() - // Note that we set the stack-size to 1MB explicitly even though it is set - // to this value by default. This is because some of our tests (`restoration_of_globals`) - // depend on the stack-size. - .append_to_rust_flags("-Clink-arg=-zstack-size=1048576") - .import_memory() - .build(); + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + // Note that we set the stack-size to 1MB explicitly even though it is set + // to this value by default. This is because some of our tests + // (`restoration_of_globals`) depend on the stack-size. + .append_to_rust_flags("-Clink-arg=-zstack-size=1048576") + .import_memory() + .build(); + } - WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() - .set_file_name("wasm_binary_logging_disabled.rs") - .enable_feature("disable-logging") - .build(); + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .set_file_name("wasm_binary_logging_disabled.rs") + .enable_feature("disable-logging") + .build(); + } } diff --git a/utils/frame/generate-bags/Cargo.toml b/utils/frame/generate-bags/Cargo.toml index 6006cdb5da0e5..a24af6a2704ae 100644 --- a/utils/frame/generate-bags/Cargo.toml +++ b/utils/frame/generate-bags/Cargo.toml @@ -17,5 +17,5 @@ pallet-staking = { version = "4.0.0-dev", path = "../../../frame/staking" } # third party chrono = { version = "0.4.19" } -git2 = { version = "0.14.2", default-features = false } +git2 = { version = "0.16.0", default-features = false } num-format = "0.4.3" diff --git a/utils/wasm-builder/README.md b/utils/wasm-builder/README.md index 547468c7ca11d..a10611cc26a00 100644 --- a/utils/wasm-builder/README.md +++ b/utils/wasm-builder/README.md @@ -8,23 +8,24 @@ The Wasm builder is a tool that integrates the process of building the WASM bina A project that should be compiled as a Wasm binary needs to: 1. Add a `build.rs` file. -2. Add `wasm-builder` as dependency into `build-dependencies`. +2. Add `wasm-builder` as dependency into `build-dependencies` (can be made optional and only enabled when `std` feature is used). The `build.rs` file needs to contain the following code: ```rust -use substrate_wasm_builder::WasmBuilder; - fn main() { - WasmBuilder::new() - // Tell the builder to build the project (crate) this `build.rs` is part of. - .with_current_project() - // Make sure to export the `heap_base` global, this is required by Substrate - .export_heap_base() - // Build the Wasm file so that it imports the memory (need to be provided by at instantiation) - .import_memory() - // Build it. - .build() + #[cfg(feature = "std")] + { + substrate_wasm_builder::WasmBuilder::new() + // Tell the builder to build the project (crate) this `build.rs` is part of. + .with_current_project() + // Make sure to export the `heap_base` global, this is required by Substrate + .export_heap_base() + // Build the Wasm file so that it imports the memory (need to be provided by at instantiation) + .import_memory() + // Build it. + .build(); + } } ```