Deprecate V1 Weights (#13699)

* Remove deprecated pallet calls

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

* Deprecate old weight

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

* Update Runtime API

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

* Fix tests

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

* Delete shitty code

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

* Fix doctest

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

* Update frame/alliance/src/lib.rs

Co-authored-by: Koute <koute@users.noreply.github.com>

* Add doc

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

* contracts: Use u64 as old weight type

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

* Update frame/contracts/src/lib.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Oliver Tale-Yazdi
2023-04-04 20:57:21 +02:00
committed by GitHub
parent 0766072393
commit 36957d6760
10 changed files with 107 additions and 171 deletions
+4
View File
@@ -18,6 +18,9 @@
//! # Primitives for transaction weighting.
#![cfg_attr(not(feature = "std"), no_std)]
// TODO remove once `OldWeight` is gone. I dont know why this is needed, maybe by one of the macros
// of `OldWeight`.
#![allow(deprecated)]
extern crate self as sp_weights;
@@ -68,6 +71,7 @@ pub mod constants {
)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(transparent))]
#[deprecated(note = "Will be removed soon; use `Weight` instead.")]
pub struct OldWeight(pub u64);
/// The weight of database operations that the runtime can invoke.
@@ -35,12 +35,6 @@ pub struct Weight {
proof_size: u64,
}
impl From<OldWeight> for Weight {
fn from(old: OldWeight) -> Self {
Weight::from_parts(old.0, 0)
}
}
impl Weight {
/// Set the reference time part of the weight.
pub const fn set_ref_time(mut self, c: u64) -> Self {
@@ -74,6 +68,7 @@ impl Weight {
&mut self.proof_size
}
/// The maximal weight in all dimensions.
pub const MAX: Self = Self { ref_time: u64::MAX, proof_size: u64::MAX };
/// Get the conservative min of `self` and `other` weight.