Use max_code_size and max_wasm_data_size from Parachains Configuration (#3329)

* use `configuration::config()` for max bytes

* Update integration_tests.rs

* Update paras_registrar.rs

* remove consts

* add asserts for non-zero

* more const clean up

* cargo run --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_common::paras_registrar --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_common_paras_registrar.rs

* cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_common::paras_registrar --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_common_paras_registrar.rs

* add checks to `MAX_CODE_SIZE`

* re-pot MAX_POV_SIZE

* check pov limit in runtime

* POV_BOMB_LIMIT multiplier

* fix compile

* Update configuration.rs

* Update node/primitives/src/lib.rs

* fix test

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Shawn Tabrizi
2021-06-21 18:24:49 +01:00
committed by GitHub
parent 45ed52a273
commit 6b1baba490
15 changed files with 131 additions and 126 deletions
-10
View File
@@ -85,16 +85,6 @@ pub mod fee {
}
}
/// Parachains-related.
pub mod paras {
/// Maximum parachain code blob size.
pub const MAX_CODE_SIZE: u32 = 10 * 1024 * 1024;
/// Maximum parachain head size.
pub const MAX_HEAD_SIZE: u32 = 20 * 1024;
/// Maximum PoV size.
pub const MAX_POV_SIZE: u32 = 5 * 1024 * 1024;
}
#[cfg(test)]
mod tests {
use frame_support::weights::WeightToFeePolynomial;
+2 -6
View File
@@ -103,7 +103,7 @@ pub use pallet_balances::Call as BalancesCall;
/// Constant values used within the runtime.
pub mod constants;
use constants::{time::*, currency::*, fee::*, paras::*};
use constants::{time::*, currency::*, fee::*};
// Weights used in the runtime.
mod weights;
@@ -1105,9 +1105,7 @@ impl parachains_initializer::Config for Runtime {
}
parameter_types! {
pub const ParaDeposit: Balance = deposit(10, MAX_CODE_SIZE + MAX_HEAD_SIZE);
pub const MaxCodeSize: u32 = MAX_CODE_SIZE;
pub const MaxHeadSize: u32 = MAX_HEAD_SIZE;
pub const ParaDeposit: Balance = 40 * UNITS;
}
impl paras_registrar::Config for Runtime {
@@ -1117,8 +1115,6 @@ impl paras_registrar::Config for Runtime {
type OnSwap = (Crowdloan, Slots);
type ParaDeposit = ParaDeposit;
type DataDepositPerByte = DataDepositPerByte;
type MaxCodeSize = MaxCodeSize;
type MaxHeadSize = MaxHeadSize;
type WeightInfo = weights::runtime_common_paras_registrar::WeightInfo<Runtime>;
}
@@ -16,7 +16,7 @@
//! Autogenerated weights for runtime_common::paras_registrar
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-06-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2021-06-21, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
// Executed Command:
@@ -31,7 +31,7 @@
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/kusama/src/weights/
// --output=./runtime/kusama/src/weights/runtime_common_paras_registrar.rs
#![allow(unused_parens)]
@@ -44,27 +44,27 @@ use sp_std::marker::PhantomData;
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> runtime_common::paras_registrar::WeightInfo for WeightInfo<T> {
fn reserve() -> Weight {
(48_482_000 as Weight)
(59_279_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn register() -> Weight {
(5_547_143_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
(4_148_907_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn force_register() -> Weight {
(5_523_892_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
(4_144_844_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn deregister() -> Weight {
(85_065_000 as Weight)
(90_495_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn swap() -> Weight {
(76_222_000 as Weight)
(80_604_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
}