diff --git a/client/service-container-chain/src/service.rs b/client/service-container-chain/src/service.rs index d60edfd6b..17cbac417 100644 --- a/client/service-container-chain/src/service.rs +++ b/client/service-container-chain/src/service.rs @@ -474,8 +474,7 @@ fn start_consensus_container( relay_chain_slot_duration, proposer, collator_service, - // Very limited proposal time. - authoring_duration: Duration::from_millis(500), + authoring_duration: Duration::from_millis(2000), para_backend: backend, code_hash_provider, // This cancellation token is no-op as it is not shared outside. diff --git a/container-chains/runtime-templates/frontier/src/lib.rs b/container-chains/runtime-templates/frontier/src/lib.rs index 2a03e4b80..8e7de63b7 100644 --- a/container-chains/runtime-templates/frontier/src/lib.rs +++ b/container-chains/runtime-templates/frontier/src/lib.rs @@ -39,7 +39,6 @@ use { cumulus_primitives_core::AggregateMessageOrigin, dp_impl_tanssi_pallets_config::impl_tanssi_pallets_config, fp_account::EthereumSignature, - fp_evm::weight_per_gas, fp_rpc::TransactionStatus, frame_support::{ construct_runtime, @@ -372,14 +371,14 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); /// `Operational` extrinsics. const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); -/// We allow for 0.5 of a second of compute with a 12 second average block time. +/// We allow for 2 seconds of compute with a 6 second average block time const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, ); -/// We allow for 500ms of compute with a 12 second average block time. -pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; +/// We allow for 2 seconds of compute with a 6 second average block time +pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 2000; /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] @@ -813,9 +812,6 @@ where } } -// To match ethereum expectations -const BLOCK_GAS_LIMIT: u64 = 15_000_000; - impl pallet_evm_chain_id::Config for Runtime {} pub struct FindAuthorAdapter; @@ -831,10 +827,21 @@ impl FindAuthor for FindAuthorAdapter { } } +/// 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. +pub const GAS_PER_SECOND: u64 = 40_000_000; + +/// Approximate ratio of the amount of Weight per Gas. +/// u64 works for approximations because Weight is a very small unit compared to gas. +pub const WEIGHT_PER_GAS: u64 = WEIGHT_REF_TIME_PER_SECOND / GAS_PER_SECOND; + parameter_types! { - pub BlockGasLimit: U256 = U256::from(BLOCK_GAS_LIMIT); + pub BlockGasLimit: U256 + = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: TemplatePrecompiles = TemplatePrecompiles::<_>::new(); - pub WeightPerGas: Weight = Weight::from_parts(weight_per_gas(BLOCK_GAS_LIMIT, NORMAL_DISPATCH_RATIO, WEIGHT_MILLISECS_PER_BLOCK), 0); + pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); pub SuicideQuickClearLimit: u32 = 0; } diff --git a/container-chains/runtime-templates/simple/src/lib.rs b/container-chains/runtime-templates/simple/src/lib.rs index c472530f4..ab3d03e29 100644 --- a/container-chains/runtime-templates/simple/src/lib.rs +++ b/container-chains/runtime-templates/simple/src/lib.rs @@ -272,9 +272,9 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); /// `Operational` extrinsics. const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); -/// We allow for 0.5 of a second of compute with a 12 second average block time. +/// We allow for 2 seconds of compute with a 6 second average block time const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, ); diff --git a/node/src/service.rs b/node/src/service.rs index 2905d4d9f..d3cfb181b 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -638,8 +638,7 @@ fn start_consensus_orchestrator( force_authoring, proposer, collator_service, - // Very limited proposal time. - authoring_duration: Duration::from_millis(500), + authoring_duration: Duration::from_millis(2000), code_hash_provider, para_backend: backend, cancellation_token: cancellation_token.clone(), diff --git a/runtime/dancebox/src/lib.rs b/runtime/dancebox/src/lib.rs index a22105959..d50be43b5 100644 --- a/runtime/dancebox/src/lib.rs +++ b/runtime/dancebox/src/lib.rs @@ -288,9 +288,9 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); /// `Operational` extrinsics. const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); -/// We allow for 0.5 of a second of compute with a 12 second average block time. +/// We allow for 2 seconds of compute with a 6 second average block time const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, ); diff --git a/runtime/flashbox/src/lib.rs b/runtime/flashbox/src/lib.rs index 381d099f0..6adcf3650 100644 --- a/runtime/flashbox/src/lib.rs +++ b/runtime/flashbox/src/lib.rs @@ -263,9 +263,9 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); /// `Operational` extrinsics. const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); -/// We allow for 0.5 of a second of compute with a 12 second average block time. +/// We allow for 2 seconds of compute with a 6 second average block time const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, );