From 9986451f42f9d9fbb9568a0213beffad39fb7797 Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Sat, 26 Oct 2024 20:38:32 +0200 Subject: [PATCH 1/2] shiden: enable async backing --- Cargo.lock | 1 + runtime/shiden/Cargo.toml | 4 ++++ runtime/shiden/src/lib.rs | 39 ++++++++++++++++++++++----------------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0d8b6c6f..01a05a669 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14536,6 +14536,7 @@ dependencies = [ "staging-xcm-builder", "staging-xcm-executor", "substrate-wasm-builder", + "vesting-mbm", "xcm-runtime-apis", ] diff --git a/runtime/shiden/Cargo.toml b/runtime/shiden/Cargo.toml index 0d09e3177..34eaafb04 100644 --- a/runtime/shiden/Cargo.toml +++ b/runtime/shiden/Cargo.toml @@ -123,6 +123,7 @@ pallet-inflation = { workspace = true } pallet-price-aggregator = { workspace = true } pallet-xc-asset-config = { workspace = true } pallet-xcm = { workspace = true } +vesting-mbm = { workspace = true } dapp-staking-runtime-api = { workspace = true } @@ -243,6 +244,7 @@ std = [ "pallet-xcm-benchmarks?/std", "precompile-utils/std", "scale-info/std", + "vesting-mbm/std" ] runtime-benchmarks = [ "log", @@ -294,6 +296,7 @@ runtime-benchmarks = [ "pallet-message-queue/runtime-benchmarks", "parachains-common/runtime-benchmarks", "orml-oracle/runtime-benchmarks", + "vesting-mbm/runtime-benchmarks" ] try-runtime = [ "astar-primitives/try-runtime", @@ -341,6 +344,7 @@ try-runtime = [ "pallet-chain-extension-assets/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "vesting-mbm/try-runtime" ] evm-tracing = [ "moonbeam-evm-tracer", diff --git a/runtime/shiden/src/lib.rs b/runtime/shiden/src/lib.rs index 77a3ae7af..53877ef05 100644 --- a/runtime/shiden/src/lib.rs +++ b/runtime/shiden/src/lib.rs @@ -140,7 +140,7 @@ pub const fn contracts_deposit(items: u32, bytes: u32) -> Balance { } /// Change this to adjust the block time. -pub const MILLISECS_PER_BLOCK: u64 = 12000; +pub const MILLISECS_PER_BLOCK: u64 = 6000; pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; // Time is measured by number of blocks. @@ -150,7 +150,7 @@ pub const DAYS: BlockNumber = HOURS * 24; /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included into the /// relay chain. -pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; +pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; /// How many parachain blocks are processed by the relay chain per parent. Limits the number of /// blocks authored per slot. pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; @@ -205,9 +205,9 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used /// by Operational extrinsics. const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); -/// We allow for 0.5 seconds of compute with a 6 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), polkadot_primitives::MAX_POV_SIZE as u64, ); @@ -300,15 +300,10 @@ impl frame_system::Config for Runtime { type PostTransactions = (); } -parameter_types! { - pub const MinimumPeriod: u64 = MILLISECS_PER_BLOCK / 2; -} - impl pallet_timestamp::Config for Runtime { - /// A timestamp: milliseconds since the unix epoch. type Moment = u64; - type OnTimestampSet = (); - type MinimumPeriod = MinimumPeriod; + type OnTimestampSet = Aura; + type MinimumPeriod = ConstU64<0>; type WeightInfo = pallet_timestamp::weights::SubstrateWeight; } @@ -538,7 +533,7 @@ impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; type DisabledValidators = (); type MaxAuthorities = ConstU32<250>; - type AllowMultipleBlocksPerSlot = ConstBool; + type AllowMultipleBlocksPerSlot = ConstBool; type SlotDuration = ConstU64; } @@ -907,8 +902,8 @@ parameter_types! { /// max_gas_limit = max_tx_ref_time / WEIGHT_PER_GAS = max_pov_size * gas_limit_pov_size_ratio /// gas_limit_pov_size_ratio = ceil((max_tx_ref_time / WEIGHT_PER_GAS) / max_pov_size) /// - /// Equals 4 for values used by Shiden runtime. - pub const GasLimitPovSizeRatio: u64 = 4; + /// Equals 16 for values used by Shiden runtime. + pub const GasLimitPovSizeRatio: u64 = 16; } impl pallet_evm::Config for Runtime { @@ -1106,7 +1101,7 @@ impl pallet_proxy::Config for Runtime { parameter_types! { pub const NativeCurrencyId: CurrencyId = CurrencyId::SDN; // Aggregate values for one day. - pub const AggregationDuration: BlockNumber = 7200; + pub const AggregationDuration: BlockNumber = DAYS; } impl pallet_price_aggregator::Config for Runtime { @@ -1199,7 +1194,13 @@ parameter_types! { impl pallet_migrations::Config for Runtime { type RuntimeEvent = RuntimeEvent; #[cfg(not(feature = "runtime-benchmarks"))] - type Migrations = (); + type Migrations = ( + pallet_dapp_staking::migration::LazyMigration< + Runtime, + pallet_dapp_staking::weights::SubstrateWeight, + >, + vesting_mbm::LazyMigration>, + ); // Benchmarks need mocked migrations to guarantee that they succeed. #[cfg(feature = "runtime-benchmarks")] type Migrations = pallet_migrations::mock_helpers::MockedMigrations; @@ -1338,7 +1339,11 @@ parameter_types! { pub type Migrations = (Unreleased, Permanent); /// Unreleased migrations. Add new ones here: -pub type Unreleased = (cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5,); +pub type Unreleased = ( + cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5, + pallet_dapp_staking::migration::AdjustEraMigration, + pallet_inflation::migration::AdjustBlockRewardMigration, +); /// Migrations/checks that do not need to be versioned and can run on every upgrade. pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion,); From b1437b6c6840beb0e31a6222c92e54a686b63032 Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Sat, 26 Oct 2024 21:18:48 +0200 Subject: [PATCH 2/2] taplo fmt --- runtime/shiden/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/shiden/Cargo.toml b/runtime/shiden/Cargo.toml index 34eaafb04..fafad36e5 100644 --- a/runtime/shiden/Cargo.toml +++ b/runtime/shiden/Cargo.toml @@ -244,7 +244,7 @@ std = [ "pallet-xcm-benchmarks?/std", "precompile-utils/std", "scale-info/std", - "vesting-mbm/std" + "vesting-mbm/std", ] runtime-benchmarks = [ "log", @@ -296,7 +296,7 @@ runtime-benchmarks = [ "pallet-message-queue/runtime-benchmarks", "parachains-common/runtime-benchmarks", "orml-oracle/runtime-benchmarks", - "vesting-mbm/runtime-benchmarks" + "vesting-mbm/runtime-benchmarks", ] try-runtime = [ "astar-primitives/try-runtime", @@ -344,7 +344,7 @@ try-runtime = [ "pallet-chain-extension-assets/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "vesting-mbm/try-runtime" + "vesting-mbm/try-runtime", ] evm-tracing = [ "moonbeam-evm-tracer",