Companion PR for contract deletion updates (#2409)

* Companion PR for contract deletion updates

see https://github.com/paritytech/substrate/pull/13702

* Revert "Companion PR for contract deletion updates"

This reverts commit 4fb2ca53a1bdfbd7dc0d35be52525da99547c76c.

* fix lint

* update lockfile for {"polkadot", "substrate"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
PG Herveou
2023-03-31 13:29:44 +02:00
committed by GitHub
parent 3717eb3d9e
commit 9d9b346f09
2 changed files with 258 additions and 271 deletions
+256 -256
View File
File diff suppressed because it is too large Load Diff
@@ -1,15 +1,13 @@
use crate::{
constants::currency::deposit, Balance, Balances, RandomnessCollectiveFlip, Runtime,
RuntimeBlockWeights, RuntimeCall, RuntimeEvent, Timestamp,
RuntimeCall, RuntimeEvent, Timestamp,
};
use frame_support::{
parameter_types,
traits::{ConstBool, ConstU32, Nothing},
weights::Weight,
};
use pallet_contracts::{
weights::{SubstrateWeight, WeightInfo},
Config, DefaultAddressGenerator, Frame, Schedule,
weights::SubstrateWeight, Config, DefaultAddressGenerator, Frame, Schedule,
};
pub use parachains_common::AVERAGE_ON_INITIALIZE_RATIO;
@@ -20,15 +18,6 @@ pub const CONTRACTS_DEBUG_OUTPUT: bool = true;
parameter_types! {
pub const DepositPerItem: Balance = deposit(1, 0);
pub const DepositPerByte: Balance = deposit(0, 1);
// The lazy deletion runs inside on_initialize.
pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *
RuntimeBlockWeights::get().max_block;
// The weight needed for decoding the queue should be less or equal than a fifth
// of the overall weight dedicated to the lazy deletion.
pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get().ref_time() / (
<Runtime as Config>::WeightInfo::on_initialize_per_queue_item(1).ref_time() -
<Runtime as Config>::WeightInfo::on_initialize_per_queue_item(0).ref_time()
)) / 5) as u32;
pub MySchedule: Schedule<Runtime> = Default::default();
}
@@ -50,8 +39,6 @@ impl Config for Runtime {
type WeightPrice = pallet_transaction_payment::Pallet<Self>;
type WeightInfo = SubstrateWeight<Self>;
type ChainExtension = ();
type DeletionQueueDepth = DeletionQueueDepth;
type DeletionWeightLimit = DeletionWeightLimit;
type Schedule = MySchedule;
type CallStack = [Frame<Self>; 5];
type AddressGenerator = DefaultAddressGenerator;