Deprecate Weight::from_{ref_time, proof_size} (#13475)

* Deprecate Weight::from_{ref_time, proof_size}

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update templates

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use from_parts

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use from_parts

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Dont revert comment 🤦

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances

* Update weight files

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* More fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Adapt to Master changes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
This commit is contained in:
Oliver Tale-Yazdi
2023-03-02 22:28:17 +01:00
committed by GitHub
parent 7981d4aa59
commit 9e56e1acdd
101 changed files with 2695 additions and 2857 deletions
@@ -37,7 +37,7 @@ pub struct Weight {
impl From<OldWeight> for Weight {
fn from(old: OldWeight) -> Self {
Weight::from_ref_time(old.0)
Weight::from_parts(old.0, 0)
}
}
@@ -103,11 +103,13 @@ impl Weight {
}
/// Construct [`Weight`] with reference time weight and 0 storage size weight.
#[deprecated = "Will be removed soon; use `from_parts` instead."]
pub const fn from_ref_time(ref_time: u64) -> Self {
Self { ref_time, proof_size: 0 }
}
/// Construct [`Weight`] with storage size weight and 0 reference time weight.
#[deprecated = "Will be removed soon; use `from_parts` instead."]
pub const fn from_proof_size(proof_size: u64) -> Self {
Self { ref_time: 0, proof_size }
}
@@ -238,7 +240,7 @@ impl Weight {
/// of all those divisions. Returns `None` in case **all** components of `other` are zero.
///
/// This returns `Some` even if some components of `other` are zero as long as there is at least
/// one non-zero component in `other`. The devision for this particular component will then
/// one non-zero component in `other`. The division for this particular component will then
/// yield the maximum value (e.g u64::MAX). This is because we assume not every operation and
/// hence each `Weight` will necessarily use each resource.
pub const fn checked_div_per_component(self, other: &Self) -> Option<u64> {