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
+2 -31
View File
@@ -114,7 +114,7 @@ use frame_support::{
ChangeMembers, Currency, Get, InitializeMembers, IsSubType, OnUnbalanced,
ReservableCurrency,
},
weights::{OldWeight, Weight},
weights::Weight,
};
use pallet_identity::IdentityField;
@@ -539,36 +539,7 @@ pub mod pallet {
Ok(())
}
/// Close a vote that is either approved, disapproved, or whose voting period has ended.
///
/// Must be called by a Fellow.
#[pallet::call_index(2)]
#[pallet::weight({
let b = *length_bound;
let m = T::MaxFellows::get();
let p1 = *proposal_weight_bound;
let p2 = T::MaxProposals::get();
T::WeightInfo::close_early_approved(b, m, p2)
.max(T::WeightInfo::close_early_disapproved(m, p2))
.max(T::WeightInfo::close_approved(b, m, p2))
.max(T::WeightInfo::close_disapproved(m, p2))
.saturating_add(p1.into())
})]
#[allow(deprecated)]
#[deprecated(note = "1D weight is used in this extrinsic, please migrate to use `close`")]
pub fn close_old_weight(
origin: OriginFor<T>,
proposal_hash: T::Hash,
#[pallet::compact] index: ProposalIndex,
#[pallet::compact] proposal_weight_bound: OldWeight,
#[pallet::compact] length_bound: u32,
) -> DispatchResultWithPostInfo {
let proposal_weight_bound: Weight = proposal_weight_bound.into();
let who = ensure_signed(origin)?;
ensure!(Self::has_voting_rights(&who), Error::<T, I>::NoVotingRights);
Self::do_close(proposal_hash, index, proposal_weight_bound, length_bound)
}
// Index 2 was `close_old_weight`; it was removed due to weights v1 deprecation.
/// Initialize the Alliance, onboard fellows and allies.
///