mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
contracts: Remove OnKilledAccount implementation (#5397)
* contracts: Remove OnKilledAccount implementation Contracts now longer rely on this callback to tell them when they are removed. Instead, they can only self destruct using `ext_terminate`. * Fix account removal test * Fix account storage removal
This commit is contained in:
committed by
GitHub
parent
b0d2f4b173
commit
7cbadd73be
@@ -125,7 +125,7 @@ use frame_support::{
|
||||
parameter_types, IsSubType,
|
||||
weights::DispatchInfo,
|
||||
};
|
||||
use frame_support::traits::{OnKilledAccount, OnUnbalanced, Currency, Get, Time, Randomness};
|
||||
use frame_support::traits::{OnUnbalanced, Currency, Get, Time, Randomness};
|
||||
use frame_system::{self as system, ensure_signed, RawOrigin, ensure_root};
|
||||
use sp_core::storage::well_known_keys::CHILD_STORAGE_KEY_PREFIX;
|
||||
use pallet_contracts_primitives::{RentProjection, ContractAccessError};
|
||||
@@ -941,18 +941,6 @@ decl_storage! {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: this should be removed in favour of a self-destruct contract host function allowing the
|
||||
// contract to delete all storage and the `ContractInfoOf` key and transfer remaining balance to
|
||||
// some other account. As it stands, it's an economic insecurity on any smart-contract chain.
|
||||
// https://github.com/paritytech/substrate/issues/4952
|
||||
impl<T: Trait> OnKilledAccount<T::AccountId> for Module<T> {
|
||||
fn on_killed_account(who: &T::AccountId) {
|
||||
if let Some(ContractInfo::Alive(info)) = <ContractInfoOf<T>>::take(who) {
|
||||
child::kill_storage(&info.trie_id, info.child_trie_unique_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// In-memory cache of configuration values.
|
||||
///
|
||||
/// We assume that these values can't be changed in the
|
||||
|
||||
Reference in New Issue
Block a user