Replace 'Module' with 'Pallet' in construct_runtime macro (#8372)

* Use 'Pallet' struct in construct_runtime.

* Fix genesis and metadata macro.

* Fix 'Pallet' type alias.

* Replace 'Module' with 'Pallet' for all construct_runtime use cases.

* Replace more deprecated 'Module' struct.

* Bring back AllModules and AllPalletsWithSystem type, but deprecate them.

* Replace deprecated 'Module' struct from merge master.

* Minor fix.

* Fix UI tests.

* Revert UI override in derive_no_bound.

* Fix more deprecated 'Module' use from master branch.

* Fix more deprecated 'Module' use from master branch.
This commit is contained in:
Shaun Wang
2021-03-18 21:50:08 +13:00
committed by GitHub
parent 05f24931a9
commit 2e5522444a
157 changed files with 881 additions and 864 deletions
+7 -7
View File
@@ -18,7 +18,7 @@
//! A module responsible for computing the right amount of weight and charging it.
use crate::{
AliveContractInfo, BalanceOf, ContractInfo, ContractInfoOf, Module, Event,
AliveContractInfo, BalanceOf, ContractInfo, ContractInfoOf, Pallet, Event,
TombstoneContractInfo, Config, CodeHash, Error,
storage::Storage, wasm::PrefabWasmModule, exec::Executable,
};
@@ -124,7 +124,7 @@ where
free_balance: &BalanceOf<T>,
contract: &AliveContractInfo<T>,
) -> Option<BalanceOf<T>> {
let subsistence_threshold = Module::<T>::subsistence_threshold();
let subsistence_threshold = Pallet::<T>::subsistence_threshold();
// Reserved balance contributes towards the subsistence threshold to stay consistent
// with the existential deposit where the reserved balance is also counted.
if *total_balance < subsistence_threshold {
@@ -268,7 +268,7 @@ where
let tombstone_info = ContractInfo::Tombstone(tombstone);
<ContractInfoOf<T>>::insert(account, &tombstone_info);
code.drop_from_storage();
<Module<T>>::deposit_event(Event::Evicted(account.clone()));
<Pallet<T>>::deposit_event(Event::Evicted(account.clone()));
Ok(None)
}
(Verdict::Evict { amount: _ }, None) => {
@@ -298,7 +298,7 @@ where
contract: AliveContractInfo<T>,
code_size: u32,
) -> Result<Option<AliveContractInfo<T>>, DispatchError> {
let current_block_number = <frame_system::Module<T>>::block_number();
let current_block_number = <frame_system::Pallet<T>>::block_number();
let verdict = Self::consider_case(
account,
current_block_number,
@@ -333,7 +333,7 @@ where
};
let module = PrefabWasmModule::<T>::from_storage_noinstr(contract.code_hash)?;
let code_len = module.code_len();
let current_block_number = <frame_system::Module<T>>::block_number();
let current_block_number = <frame_system::Pallet<T>>::block_number();
let verdict = Self::consider_case(
account,
current_block_number,
@@ -384,7 +384,7 @@ where
let module = PrefabWasmModule::from_storage_noinstr(alive_contract_info.code_hash)
.map_err(|_| IsTombstone)?;
let code_size = module.occupied_storage();
let current_block_number = <frame_system::Module<T>>::block_number();
let current_block_number = <frame_system::Pallet<T>>::block_number();
let verdict = Self::consider_case(
account,
current_block_number,
@@ -465,7 +465,7 @@ where
let child_trie_info = origin_contract.child_trie_info();
let current_block = <frame_system::Module<T>>::block_number();
let current_block = <frame_system::Pallet<T>>::block_number();
if origin_contract.last_write == Some(current_block) {
return Err((Error::<T>::InvalidContractOrigin.into(), 0, 0));