From 6fd3d5db18582bb7db030956317fd445fd4314fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Mart=C3=ADnez=20Rodr=C3=ADguez?= <43847309+GabrielMartinezRodriguez@users.noreply.github.com> Date: Fri, 6 Oct 2023 17:31:03 +0200 Subject: [PATCH] Increased block weight to 8 Trillions (300 Millions gas) (#126) --- docs/PARAMETERS.md | 6 +++--- runtime/src/stability_config.rs | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/PARAMETERS.md b/docs/PARAMETERS.md index 4055f974..c3376f69 100644 --- a/docs/PARAMETERS.md +++ b/docs/PARAMETERS.md @@ -29,12 +29,12 @@ Using this value and estimating the share of the block time that is spent in com - **COMPUTATION_BLOCK_TIME_RATIO**: How much part of the block time could be spent in processing transactions. - **MAXIMUM_BLOCK_WEIGHT**: The maximum weight that could be processed given the block time and `COMPUTATION_BLOCK_TIME_RATIO` - - MAXIMUM_NORMAL_BLOCK_WEIGHT = 1_333_333_333_333 -- **Block Gas Limit**: ~50_000_000. Frontier assumes that a Gas Unit is equals to 20_000 Weight (`WEIGHT_PER_GAS`), and the blocks would allow till 75% (`NORMAL_DISPATCH_RATIO`) of `Normal` extrinsics in each one. The formula looks like: + - MAXIMUM_NORMAL_BLOCK_WEIGHT = 8_000_000_000_000 +- **Block Gas Limit**: ~300_000_000. Frontier assumes that a Gas Unit is equals to 20_000 Weight (`WEIGHT_PER_GAS`), and the blocks would allow till 75% (`NORMAL_DISPATCH_RATIO`) of `Normal` extrinsics in each one. The formula looks like: ``` Gas Limit = NORMAL_DISPATCH_RATIO * MBW / WEIGHT_PER_GAS -Gas Limit = 0.75 * 1_333_333_333_333 / 20_000 = 50_000_000 +Gas Limit = 0.75 * 8_000_000_000_000 / 20_000 = 300_000_000 ``` ## Links diff --git a/runtime/src/stability_config.rs b/runtime/src/stability_config.rs index 8b45d711..bafbbedd 100644 --- a/runtime/src/stability_config.rs +++ b/runtime/src/stability_config.rs @@ -9,11 +9,14 @@ pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// How much of time of block time is consumed (at most) in computing normal extrinsics const COMPUTATION_BLOCK_TIME_RATIO: (u64, u64) = (2, 3); // 2 third parts of the block time +const COMPUTATION_POWER_MULTIPLIER: u64 = 6; // 6 times more computation power than normal + // how much weight for normal extrinsics could be processed in a block pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_MILLIS) .mul(MILLISECS_PER_BLOCK) + .mul(COMPUTATION_POWER_MULTIPLIER) .mul(COMPUTATION_BLOCK_TIME_RATIO.0) - .div(COMPUTATION_BLOCK_TIME_RATIO.1) // 1_333_333_333_333 + .div(COMPUTATION_BLOCK_TIME_RATIO.1) // 8_000_000_000_000 .set_proof_size(u64::MAX); // `.set_proof_size`, since migration to WeightV2, we have set the proof size weight for the maximum block.