From c1506387a8f2fa6d4a3936a83467ab7f6d344230 Mon Sep 17 00:00:00 2001 From: noandrea Date: Tue, 21 May 2024 02:16:22 -0700 Subject: [PATCH] increase gas limits paramters (4x) --- runtime/moonriver/src/lib.rs | 14 +++++++------- runtime/moonriver/src/xcm_config.rs | 2 +- runtime/moonriver/tests/xcm_mock/parachain.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index 6a4071ccc6..83ce4dc4fb 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -147,7 +147,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_div(2) + .saturating_mul(2) .set_proof_size(relay_chain::MAX_POV_SIZE as u64); pub const MILLISECS_PER_BLOCK: u64 = 6_000; @@ -380,8 +380,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 500ms Weight, from which 75% only are used for transactions, -/// the total EVM execution gas limit is: GAS_PER_SECOND * 0.500 * 0.75 ~= 15_000_000. +/// Given the 2s 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. @@ -408,15 +408,15 @@ parameter_types! { pub MaximumMultiplier: Multiplier = Multiplier::from(100_000u128); pub PrecompilesValue: MoonriverPrecompiles = MoonriverPrecompiles::<_>::new(); pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); - /// The amount of gas per pov. A ratio of 4 if we convert ref_time to gas and we compare + /// The amount of gas per pov. A ratio of 16 if we convert ref_time to gas and we compare /// it with the pov_size for a block. E.g. /// ceil( /// (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 = 4; + 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 40 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; } @@ -1798,7 +1798,7 @@ 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 = 40 * 1024; + let block_storage_limit = 160 * 1024; let expected_storage_growth_ratio = BlockGasLimit::get() .low_u64() .saturating_div(block_storage_limit); diff --git a/runtime/moonriver/src/xcm_config.rs b/runtime/moonriver/src/xcm_config.rs index 8d8a52dc99..9b396a30d2 100644 --- a/runtime/moonriver/src/xcm_config.rs +++ b/runtime/moonriver/src/xcm_config.rs @@ -681,7 +681,7 @@ parameter_types! { // To be able to support almost all erc20 implementations, // we provide a sufficiently hight gas limit. - pub Erc20XcmBridgeTransferGasLimit: u64 = 200_000; + pub Erc20XcmBridgeTransferGasLimit: u64 = 800_000; } impl pallet_erc20_xcm_bridge::Config for Runtime { diff --git a/runtime/moonriver/tests/xcm_mock/parachain.rs b/runtime/moonriver/tests/xcm_mock/parachain.rs index 201b479627..911b691b52 100644 --- a/runtime/moonriver/tests/xcm_mock/parachain.rs +++ b/runtime/moonriver/tests/xcm_mock/parachain.rs @@ -822,8 +822,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 40 KB. -const BLOCK_STORAGE_LIMIT: u64 = 40 * 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);