Skip to content

Commit 4fb2ca5

Browse files
committed
Companion PR for contract deletion updates
see paritytech/substrate#13702
1 parent 693e973 commit 4fb2ca5

File tree

6 files changed

+0
-136
lines changed
  • parachain-template/runtime/src
  • parachains/runtimes

6 files changed

+0
-136
lines changed

parachain-template/runtime/src/lib.rs

-25
Original file line numberDiff line numberDiff line change
@@ -231,31 +231,6 @@ pub fn native_version() -> NativeVersion {
231231

232232
parameter_types! {
233233
pub const Version: RuntimeVersion = VERSION;
234-
235-
// This part is copied from Substrate's `bin/node/runtime/src/lib.rs`.
236-
// The `RuntimeBlockLength` and `RuntimeBlockWeights` exist here because the
237-
// `DeletionWeightLimit` and `DeletionQueueDepth` depend on those to parameterize
238-
// the lazy contract deletion.
239-
pub RuntimeBlockLength: BlockLength =
240-
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
241-
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
242-
.base_block(BlockExecutionWeight::get())
243-
.for_class(DispatchClass::all(), |weights| {
244-
weights.base_extrinsic = ExtrinsicBaseWeight::get();
245-
})
246-
.for_class(DispatchClass::Normal, |weights| {
247-
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
248-
})
249-
.for_class(DispatchClass::Operational, |weights| {
250-
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
251-
// Operational transactions have some extra reserved space, so that they
252-
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
253-
weights.reserved = Some(
254-
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
255-
);
256-
})
257-
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
258-
.build_or_panic();
259234
pub const SS58Prefix: u16 = 42;
260235
}
261236

parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs

-25
Original file line numberDiff line numberDiff line change
@@ -143,31 +143,6 @@ pub fn native_version() -> NativeVersion {
143143

144144
parameter_types! {
145145
pub const Version: RuntimeVersion = VERSION;
146-
147-
// This part is copied from Substrate's `bin/node/runtime/src/lib.rs`.
148-
// The `RuntimeBlockLength` and `RuntimeBlockWeights` exist here because the
149-
// `DeletionWeightLimit` and `DeletionQueueDepth` depend on those to parameterize
150-
// the lazy contract deletion.
151-
pub RuntimeBlockLength: BlockLength =
152-
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
153-
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
154-
.base_block(BlockExecutionWeight::get())
155-
.for_class(DispatchClass::all(), |weights| {
156-
weights.base_extrinsic = ExtrinsicBaseWeight::get();
157-
})
158-
.for_class(DispatchClass::Normal, |weights| {
159-
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
160-
})
161-
.for_class(DispatchClass::Operational, |weights| {
162-
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
163-
// Operational transactions have some extra reserved space, so that they
164-
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
165-
weights.reserved = Some(
166-
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
167-
);
168-
})
169-
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
170-
.build_or_panic();
171146
pub const SS58Prefix: u8 = 2;
172147
}
173148

parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs

-25
Original file line numberDiff line numberDiff line change
@@ -143,31 +143,6 @@ pub fn native_version() -> NativeVersion {
143143

144144
parameter_types! {
145145
pub const Version: RuntimeVersion = VERSION;
146-
147-
// This part is copied from Substrate's `bin/node/runtime/src/lib.rs`.
148-
// The `RuntimeBlockLength` and `RuntimeBlockWeights` exist here because the
149-
// `DeletionWeightLimit` and `DeletionQueueDepth` depend on those to parameterize
150-
// the lazy contract deletion.
151-
pub RuntimeBlockLength: BlockLength =
152-
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
153-
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
154-
.base_block(BlockExecutionWeight::get())
155-
.for_class(DispatchClass::all(), |weights| {
156-
weights.base_extrinsic = ExtrinsicBaseWeight::get();
157-
})
158-
.for_class(DispatchClass::Normal, |weights| {
159-
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
160-
})
161-
.for_class(DispatchClass::Operational, |weights| {
162-
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
163-
// Operational transactions have some extra reserved space, so that they
164-
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
165-
weights.reserved = Some(
166-
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
167-
);
168-
})
169-
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
170-
.build_or_panic();
171146
pub const SS58Prefix: u8 = 0;
172147
}
173148

parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs

-25
Original file line numberDiff line numberDiff line change
@@ -209,31 +209,6 @@ pub fn native_version() -> NativeVersion {
209209

210210
parameter_types! {
211211
pub const Version: RuntimeVersion = VERSION;
212-
213-
// This part is copied from Substrate's `bin/node/runtime/src/lib.rs`.
214-
// The `RuntimeBlockLength` and `RuntimeBlockWeights` exist here because the
215-
// `DeletionWeightLimit` and `DeletionQueueDepth` depend on those to parameterize
216-
// the lazy contract deletion.
217-
pub RuntimeBlockLength: BlockLength =
218-
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
219-
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
220-
.base_block(BlockExecutionWeight::get())
221-
.for_class(DispatchClass::all(), |weights| {
222-
weights.base_extrinsic = ExtrinsicBaseWeight::get();
223-
})
224-
.for_class(DispatchClass::Normal, |weights| {
225-
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
226-
})
227-
.for_class(DispatchClass::Operational, |weights| {
228-
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
229-
// Operational transactions have some extra reserved space, so that they
230-
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
231-
weights.reserved = Some(
232-
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
233-
);
234-
})
235-
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
236-
.build_or_panic();
237212
pub const SS58Prefix: u16 = 42;
238213
}
239214

parachains/runtimes/contracts/contracts-rococo/src/contracts.rs

-11
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ pub const CONTRACTS_DEBUG_OUTPUT: bool = true;
2020
parameter_types! {
2121
pub const DepositPerItem: Balance = deposit(1, 0);
2222
pub const DepositPerByte: Balance = deposit(0, 1);
23-
// The lazy deletion runs inside on_initialize.
24-
pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *
25-
RuntimeBlockWeights::get().max_block;
26-
// The weight needed for decoding the queue should be less or equal than a fifth
27-
// of the overall weight dedicated to the lazy deletion.
28-
pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get().ref_time() / (
29-
<Runtime as Config>::WeightInfo::on_initialize_per_queue_item(1).ref_time() -
30-
<Runtime as Config>::WeightInfo::on_initialize_per_queue_item(0).ref_time()
31-
)) / 5) as u32;
3223
pub MySchedule: Schedule<Runtime> = Default::default();
3324
}
3425

@@ -50,8 +41,6 @@ impl Config for Runtime {
5041
type WeightPrice = pallet_transaction_payment::Pallet<Self>;
5142
type WeightInfo = SubstrateWeight<Self>;
5243
type ChainExtension = ();
53-
type DeletionQueueDepth = DeletionQueueDepth;
54-
type DeletionWeightLimit = DeletionWeightLimit;
5544
type Schedule = MySchedule;
5645
type CallStack = [Frame<Self>; 5];
5746
type AddressGenerator = DefaultAddressGenerator;

parachains/runtimes/testing/penpal/src/lib.rs

-25
Original file line numberDiff line numberDiff line change
@@ -278,31 +278,6 @@ pub fn native_version() -> NativeVersion {
278278

279279
parameter_types! {
280280
pub const Version: RuntimeVersion = VERSION;
281-
282-
// This part is copied from Substrate's `bin/node/runtime/src/lib.rs`.
283-
// The `RuntimeBlockLength` and `RuntimeBlockWeights` exist here because the
284-
// `DeletionWeightLimit` and `DeletionQueueDepth` depend on those to parameterize
285-
// the lazy contract deletion.
286-
pub RuntimeBlockLength: BlockLength =
287-
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
288-
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
289-
.base_block(BlockExecutionWeight::get())
290-
.for_class(DispatchClass::all(), |weights| {
291-
weights.base_extrinsic = ExtrinsicBaseWeight::get();
292-
})
293-
.for_class(DispatchClass::Normal, |weights| {
294-
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
295-
})
296-
.for_class(DispatchClass::Operational, |weights| {
297-
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
298-
// Operational transactions have some extra reserved space, so that they
299-
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
300-
weights.reserved = Some(
301-
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
302-
);
303-
})
304-
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
305-
.build_or_panic();
306281
pub const SS58Prefix: u16 = 42;
307282
}
308283

0 commit comments

Comments
 (0)