From 85851603e80bcdaa2835ac2edd92aa672e802384 Mon Sep 17 00:00:00 2001 From: Andrea Giacobino Date: Fri, 30 Aug 2024 16:33:34 +0300 Subject: [PATCH] Set the block size to 60mln gas for moonbeam (#2921) * set the block size to 60mln gas for moonbeam * update mbip-5 value in test --- runtime/moonbeam/src/lib.rs | 14 +++++++------- runtime/moonbeam/src/xcm_config.rs | 2 +- runtime/moonbeam/tests/xcm_mock/parachain.rs | 4 ++-- test/helpers/constants.ts | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/runtime/moonbeam/src/lib.rs b/runtime/moonbeam/src/lib.rs index 13874c6e83..3f813b7f8a 100644 --- a/runtime/moonbeam/src/lib.rs +++ b/runtime/moonbeam/src/lib.rs @@ -156,7 +156,7 @@ pub mod currency { /// Maximum weight per block pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, u64::MAX) - .saturating_mul(1) + .saturating_mul(2) .set_proof_size(relay_chain::MAX_POV_SIZE as u64); pub const MILLISECS_PER_BLOCK: u64 = 6_000; @@ -399,8 +399,8 @@ impl pallet_evm_chain_id::Config for Runtime {} /// Current approximation of the gas/s consumption considering /// EVM execution over compiled WASM (on 4.4Ghz CPU). -/// Given the 1000ms Weight, from which 75% only are used for transactions, -/// the total EVM execution gas limit is: GAS_PER_SECOND * 1 * 0.75 ~= 30_000_000. +/// Given the 2000ms Weight, from which 75% only are used for transactions, +/// the total EVM execution gas limit is: GAS_PER_SECOND * 2 * 0.75 ~= 60_000_000. pub const GAS_PER_SECOND: u64 = 40_000_000; /// Approximate ratio of the amount of Weight per Gas. @@ -433,9 +433,9 @@ parameter_types! { /// (max_extrinsic.ref_time() / max_extrinsic.proof_size()) / WEIGHT_PER_GAS /// ) /// We should re-check `xcm_config::Erc20XcmBridgeTransferGasLimit` when changing this value - pub const GasLimitPovSizeRatio: u64 = 8; + pub const GasLimitPovSizeRatio: u64 = 16; /// The amount of gas per storage (in bytes): BLOCK_GAS_LIMIT / BLOCK_STORAGE_LIMIT - /// The current definition of BLOCK_STORAGE_LIMIT is 80 KB, resulting in a value of 366. + /// The current definition of BLOCK_STORAGE_LIMIT is 160 KB, resulting in a value of 366. pub GasLimitStorageGrowthRatio: u64 = 366; } @@ -1826,8 +1826,8 @@ mod tests { #[test] fn test_storage_growth_ratio_is_correct() { - // This is the highest amount of new storage that can be created in a block 40 KB - let block_storage_limit = 80 * 1024; + // This is the highest amount of new storage that can be created in a block 160 KB + let block_storage_limit = 160 * 1024; let expected_storage_growth_ratio = BlockGasLimit::get() .low_u64() .saturating_div(block_storage_limit); diff --git a/runtime/moonbeam/src/xcm_config.rs b/runtime/moonbeam/src/xcm_config.rs index 5245ec8646..246f2981ae 100644 --- a/runtime/moonbeam/src/xcm_config.rs +++ b/runtime/moonbeam/src/xcm_config.rs @@ -699,7 +699,7 @@ parameter_types! { // To be able to support almost all erc20 implementations, // we provide a sufficiently hight gas limit. - pub Erc20XcmBridgeTransferGasLimit: u64 = 400_000; + pub Erc20XcmBridgeTransferGasLimit: u64 = 800_000; } impl pallet_erc20_xcm_bridge::Config for Runtime { diff --git a/runtime/moonbeam/tests/xcm_mock/parachain.rs b/runtime/moonbeam/tests/xcm_mock/parachain.rs index 4bdd9f2f5c..2fe3e12459 100644 --- a/runtime/moonbeam/tests/xcm_mock/parachain.rs +++ b/runtime/moonbeam/tests/xcm_mock/parachain.rs @@ -826,8 +826,8 @@ impl pallet_timestamp::Config for Runtime { use sp_core::U256; const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; -/// Block storage limit in bytes. Set to 80 KB. -const BLOCK_STORAGE_LIMIT: u64 = 80 * 1024; +/// Block storage limit in bytes. Set to 160 KB. +const BLOCK_STORAGE_LIMIT: u64 = 160 * 1024; parameter_types! { pub BlockGasLimit: U256 = U256::from(u64::MAX); diff --git a/test/helpers/constants.ts b/test/helpers/constants.ts index 7a5200d265..7eb344a98f 100644 --- a/test/helpers/constants.ts +++ b/test/helpers/constants.ts @@ -103,16 +103,16 @@ export const RUNTIME_CONSTANTS = { MAX_BASE_FEE_IN_WEI: "12500000000000000", TARGET_FILL_PERMILL: new RuntimeConstant({ 3000: 350_000n, 2801: 500_000n, 0: 250_000n }), // Deadline for block production in miliseconds - DEADLINE_MILISECONDS: 1000n, + DEADLINE_MILISECONDS: 2000n, // Caclulated as the weight per second by the deadline in seconds - BLOCK_WEIGHT_LIMIT: 1_000_000_000_000n, + BLOCK_WEIGHT_LIMIT: 2_000_000_000_000n, // Gas limit considering the block utilization threshold (75%) - GAS_LIMIT: 30_000_000n, + GAS_LIMIT: 60_000_000n, // Maximum extrinsic weight is taken from the max allowed transaction weight per block (75%), // minus the block initialization (10%) and minus the extrinsic base cost. - EXTRINSIC_GAS_LIMIT: 26_000_000n, + EXTRINSIC_GAS_LIMIT: 52_000_000n, // Maximum Gas to PoV ratio used in the gasometer - GAS_PER_POV_BYTES: 8n, + GAS_PER_POV_BYTES: 16n, }, } as const;