Would it be possible to clear a pallet storage with a call on a live chain ?
Precisely I would like to remove all contracts and code hash existing on my chain (as sudo).
It may be challenging to achieve that with a call.
You will need to send numerous extrinsics to accomplish it.
I suggest performing a runtime upgrade.
Refer to this link for more information: https://paritytech.github.io/substrate/master/frame_support/storage/migration/fn.clear_storage_prefix.html
use frame_support::migration;
migration::clear_storage_prefix(b"module name", &[], &[], None, None);
If your pallet storage is extensive, it is advisable to review the documentation mentioned above and adjust the values of None
according to your specific situation.
T::DbWeights::writes(x)
.