Skip to content

Commit

Permalink
Delete 1D weight ctors and set explicit deprecation dates (paritytech…
Browse files Browse the repository at this point in the history
…#14397)

* Delete old weight functions

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

* Add explicit removal dates

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

* Upate UI tests

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

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez authored and nathanwhit committed Jul 19, 2023
1 parent 0774eae commit 8d0c92b
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 34 deletions.
2 changes: 1 addition & 1 deletion frame/support/procedural/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ fn counter_prefix(prefix: &str) -> String {
/// }
/// ```
#[proc_macro]
#[deprecated(note = "Will be removed soon; use the attribute `#[pallet]` macro instead.
#[deprecated(note = "Will be removed after July 2023; use the attribute `#[pallet]` macro instead.
For more info, see: <https://github.com/paritytech/substrate/pull/13705>")]
pub fn decl_storage(input: TokenStream) -> TokenStream {
storage::decl_storage_impl(input)
Expand Down
2 changes: 1 addition & 1 deletion frame/support/procedural/src/pallet/expand/store_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn expand_store_trait(def: &mut Def) -> proc_macro2::TokenStream {
let warnig_struct_name = syn::Ident::new("Store", *attribute_span);
let warning: syn::ItemStruct = syn::parse_quote!(
#[deprecated(note = r"
Use of `#[pallet::generate_store(pub(super) trait Store)]` will be removed soon.
Use of `#[pallet::generate_store(pub(super) trait Store)]` will be removed after July 2023.
Check https://github.com/paritytech/substrate/pull/13535 for more details.")]
struct #warnig_struct_name;
);
Expand Down
2 changes: 1 addition & 1 deletion frame/support/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ impl<T> PaysFee<T> for (u64, Pays) {
/// in an externalities-provided environment. Implement
/// [`IntegrityTest`](./trait.IntegrityTest.html) trait.
#[macro_export]
#[deprecated(note = "Will be removed soon; use the attribute `#[pallet]` macro instead.
#[deprecated(note = "Will be removed after July 2023; use the attribute `#[pallet]` macro instead.
For more info, see: <https://github.com/paritytech/substrate/pull/13705>")]
macro_rules! decl_module {
// Entry point #1.
Expand Down
2 changes: 1 addition & 1 deletion frame/support/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub use sp_runtime::traits::{BadOrigin, LookupError};
/// For instantiable modules you also need to give the instance generic type and bound to the
/// error declaration.
#[macro_export]
#[deprecated(note = "Will be removed soon; use the attribute `#[pallet]` macro instead.
#[deprecated(note = "Will be removed after July 2023; use the attribute `#[pallet]` macro instead.
For more info, see: <https://github.com/paritytech/substrate/pull/13705>")]
macro_rules! decl_error {
(
Expand Down
2 changes: 1 addition & 1 deletion frame/support/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/// # fn main() {}
/// ```
#[macro_export]
#[deprecated(note = "Will be removed soon; use the attribute `#[pallet]` macro instead.
#[deprecated(note = "Will be removed after July 2023; use the attribute `#[pallet]` macro instead.
For more info, see: <https://github.com/paritytech/substrate/pull/13705>")]
macro_rules! decl_event {
(
Expand Down
20 changes: 8 additions & 12 deletions frame/support/src/storage/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,16 @@ pub struct StorageIterator<T> {

impl<T> StorageIterator<T> {
/// Construct iterator to iterate over map items in `module` for the map called `item`.
#[deprecated(
note = "Please use the storage_iter or storage_iter_with_suffix functions instead"
)]
#[deprecated(note = "Will be removed after July 2023; Please use the storage_iter or \
storage_iter_with_suffix functions instead")]
pub fn new(module: &[u8], item: &[u8]) -> Self {
#[allow(deprecated)]
Self::with_suffix(module, item, &[][..])
}

/// Construct iterator to iterate over map items in `module` for the map called `item`.
#[deprecated(
note = "Please use the storage_iter or storage_iter_with_suffix functions instead"
)]
#[deprecated(note = "Will be removed after July 2023; Please use the storage_iter or \
storage_iter_with_suffix functions instead")]
pub fn with_suffix(module: &[u8], item: &[u8], suffix: &[u8]) -> Self {
let mut prefix = Vec::new();
let storage_prefix = storage_prefix(module, item);
Expand Down Expand Up @@ -102,18 +100,16 @@ pub struct StorageKeyIterator<K, T, H: ReversibleStorageHasher> {

impl<K, T, H: ReversibleStorageHasher> StorageKeyIterator<K, T, H> {
/// Construct iterator to iterate over map items in `module` for the map called `item`.
#[deprecated(
note = "Please use the storage_key_iter or storage_key_iter_with_suffix functions instead"
)]
#[deprecated(note = "Will be removed after July 2023; Please use the storage_key_iter or \
storage_key_iter_with_suffix functions instead")]
pub fn new(module: &[u8], item: &[u8]) -> Self {
#[allow(deprecated)]
Self::with_suffix(module, item, &[][..])
}

/// Construct iterator to iterate over map items in `module` for the map called `item`.
#[deprecated(
note = "Please use the storage_key_iter or storage_key_iter_with_suffix functions instead"
)]
#[deprecated(note = "Will be removed after July 2023; Please use the storage_key_iter or \
storage_key_iter_with_suffix functions instead")]
pub fn with_suffix(module: &[u8], item: &[u8], suffix: &[u8]) -> Self {
let mut prefix = Vec::new();
let storage_prefix = storage_prefix(module, item);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: use of deprecated struct `pallet::_::Store`:
Use of `#[pallet::generate_store(pub(super) trait Store)]` will be removed soon.
Use of `#[pallet::generate_store(pub(super) trait Store)]` will be removed after July 2023.
Check https://github.com/paritytech/substrate/pull/13535 for more details.
--> tests/pallet_ui/deprecated_store_attr.rs:7:3
|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: use of deprecated struct `pallet::_::Store`:
Use of `#[pallet::generate_store(pub(super) trait Store)]` will be removed soon.
Use of `#[pallet::generate_store(pub(super) trait Store)]` will be removed after July 2023.
Check https://github.com/paritytech/substrate/pull/13535 for more details.
--> tests/pallet_ui/store_trait_leak_private.rs:11:3
|
Expand Down
5 changes: 2 additions & 3 deletions frame/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,8 @@ pub mod pallet {
#[cfg(feature = "std")]
impl GenesisConfig {
/// Direct implementation of `GenesisBuild::assimilate_storage`.
#[deprecated(
note = "use `<GensisConfig<T, I> as GenesisBuild<T, I>>::assimilate_storage` instead"
)]
#[deprecated(note = "Will be removed after July 2023; use \
`<GensisConfig<T, I> as GenesisBuild<T, I>>::assimilate_storage` instead")]
pub fn assimilate_storage<T: Config<I>, I: 'static>(
&self,
storage: &mut sp_runtime::Storage,
Expand Down
12 changes: 0 additions & 12 deletions primitives/weights/src/weight_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ 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 }
}

/// Construct [`Weight`] from weight parts, namely reference time and proof size weights.
pub const fn from_parts(ref_time: u64, proof_size: u64) -> Self {
Self { ref_time, proof_size }
Expand Down

0 comments on commit 8d0c92b

Please sign in to comment.