From 4916490dd3fd5ef34dc60d2b56485e526c12df3a Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Thu, 14 Nov 2024 14:22:51 +0100 Subject: [PATCH 1/5] Set Maximum Members for Council and Technical Committee in Configurations (#872) * set max memebrs * set Committee max members to 10 * refactoring --- runtime/laos/src/configs/collective.rs | 7 ++++--- runtime/laos/src/configs/election_phragmen.rs | 3 +-- runtime/laos/src/configs/membership.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runtime/laos/src/configs/collective.rs b/runtime/laos/src/configs/collective.rs index 7519def19..275bd0b89 100644 --- a/runtime/laos/src/configs/collective.rs +++ b/runtime/laos/src/configs/collective.rs @@ -11,7 +11,8 @@ use sp_runtime::Perbill; parameter_types! { pub const MotionDuration: BlockNumber = prod_or_fast!(7 * DAYS, 5 * MINUTES); pub const MaxProposals: u32 = 7; - pub const MaxMembers: u32 = 20; + pub const MaxMembersCouncil: u32 = 7; + pub const MaxMembersTechnicalCommittee: u32 = 5; pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; } @@ -31,7 +32,7 @@ pub type AllOfTechnicalCommittee = pub type CouncilCollective = pallet_collective::Instance1; impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; - type MaxMembers = MaxMembers; + type MaxMembers = MaxMembersCouncil; type MaxProposalWeight = MaxProposalWeight; type MaxProposals = MaxProposals; type MotionDuration = MotionDuration; @@ -45,7 +46,7 @@ impl pallet_collective::Config for Runtime { pub type TechnicalCommittee = pallet_collective::Instance2; impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; - type MaxMembers = MaxMembers; + type MaxMembers = MaxMembersTechnicalCommittee; type MaxProposalWeight = MaxProposalWeight; type MaxProposals = MaxProposals; type MotionDuration = MotionDuration; diff --git a/runtime/laos/src/configs/election_phragmen.rs b/runtime/laos/src/configs/election_phragmen.rs index 0f74e4d8d..c5d50dee1 100644 --- a/runtime/laos/src/configs/election_phragmen.rs +++ b/runtime/laos/src/configs/election_phragmen.rs @@ -8,7 +8,6 @@ use polkadot_runtime_common::{prod_or_fast, CurrencyToVote}; parameter_types! { pub const CandidacyBond: Balance = 1000 * UNIT; pub TermDuration: BlockNumber = prod_or_fast!(28 * DAYS, 10 * MINUTES); - pub const DesiredMembers: u32 = 7; pub const DesiredRunnersUp: u32 = 20; pub const MaxCandidates: u32 = 30; pub const MaxVoters: u32 = 200; @@ -25,7 +24,7 @@ impl pallet_elections_phragmen::Config for Runtime { type Currency = Balances; type CurrencyToVote = CurrencyToVote; /// Number of members to elect. - type DesiredMembers = DesiredMembers; + type DesiredMembers = super::collective::MaxMembersCouncil; /// Number of runners_up to keep. type DesiredRunnersUp = DesiredRunnersUp; type InitializeMembers = Council; diff --git a/runtime/laos/src/configs/membership.rs b/runtime/laos/src/configs/membership.rs index d6f56c301..df458f905 100644 --- a/runtime/laos/src/configs/membership.rs +++ b/runtime/laos/src/configs/membership.rs @@ -15,6 +15,6 @@ impl pallet_membership::Config for Runtime { type PrimeOrigin = EitherOfDiverse, CouncilMajority>; type MembershipInitialized = TechnicalCommittee; type MembershipChanged = TechnicalCommittee; - type MaxMembers = super::collective::MaxMembers; + type MaxMembers = super::collective::MaxMembersTechnicalCommittee; type WeightInfo = weights::pallet_membership::WeightInfo; } From 7621cf4d243b4cb396496d603b94b88fb7158dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Senovilla=20Polo?= <117524919+tsenovilla@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:13:54 +0100 Subject: [PATCH 2/5] Enable logs (#876) --- e2e-tests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/package.json b/e2e-tests/package.json index 64986c725..c076a74c2 100644 --- a/e2e-tests/package.json +++ b/e2e-tests/package.json @@ -7,7 +7,7 @@ "fmt-check": "prettier ./tests --check", "fmt": "prettier ./tests --write", "build": "./compile_contracts.sh", - "test": "mocha -r ts-node/register -t 900000 'tests/**/*.ts'", + "test": "DEBUG=transaction mocha -r ts-node/register -t 900000 'tests/**/*.ts'", "test-sql": "FRONTIER_BACKEND_TYPE='sql' mocha -r ts-node/register 'tests/**/*.ts'" }, "author": "", From 107fd2890f1862ee8d5b6be98b91efea14454066 Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Mon, 18 Nov 2024 12:27:10 +0100 Subject: [PATCH 3/5] Refactor and Remove Warnings in async_backing.rs (#879) * remove warning * fix compialtion error --- runtime/laos/src/migrations/async_backing.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/runtime/laos/src/migrations/async_backing.rs b/runtime/laos/src/migrations/async_backing.rs index 4301de7b9..995ae83f2 100644 --- a/runtime/laos/src/migrations/async_backing.rs +++ b/runtime/laos/src/migrations/async_backing.rs @@ -1,14 +1,15 @@ -use crate::{AccountId, Runtime, RuntimeOrigin, Weight}; +use crate::{Runtime, RuntimeOrigin, Weight}; use frame_support::{ traits::{Currency, OnRuntimeUpgrade}, BoundedVec, }; use frame_system::pallet_prelude::BlockNumberFor; use pallet_vesting::MaxVestingSchedulesGet; -use parity_scale_codec::{Decode, Encode}; use sp_core::{ConstU32, Get}; +use sp_std::vec::Vec; + +#[cfg(feature = "try-runtime")] use sp_runtime::DispatchError; -use sp_std::{vec, vec::Vec}; pub struct Migration; @@ -28,12 +29,14 @@ impl OnRuntimeUpgrade for Migration { /// Logs the total number of accounts with vesting schedules, the count of schedules per /// account, and the maximum schedule count per account before migration. fn pre_upgrade() -> Result, DispatchError> { + use parity_scale_codec::Encode; + let vesting_accounts_count = pallet_vesting::Vesting::::iter().count(); - let mut schedules_per_account = vec![]; + let mut schedules_per_account = sp_std::vec![]; let mut max_schedule_count = 0; if sp_io::storage::exists(LAOS_VESTING_MIGRATION_6S) { - return Ok(vec![]); + return Ok(sp_std::vec![]); } for (account_id, schedules) in pallet_vesting::Vesting::::iter() { @@ -119,6 +122,9 @@ impl OnRuntimeUpgrade for Migration { /// Verifies migration by checking the vesting data has been migrated, allows for possible /// splits in schedules. fn post_upgrade(encoded_data: Vec) -> Result<(), DispatchError> { + use crate::AccountId; + use parity_scale_codec::Decode; + if encoded_data.is_empty() { return Ok(()); } From 7305a5e1285138a2bf387fd87a6e6094673067ca Mon Sep 17 00:00:00 2001 From: Luigi di Girolamo <17044119+luispdm@users.noreply.github.com> Date: Mon, 18 Nov 2024 12:30:18 +0100 Subject: [PATCH 4/5] increase maximum number of council and tech committee proposals (#873) --- runtime/laos/src/configs/collective.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/laos/src/configs/collective.rs b/runtime/laos/src/configs/collective.rs index 275bd0b89..2ecfeb36c 100644 --- a/runtime/laos/src/configs/collective.rs +++ b/runtime/laos/src/configs/collective.rs @@ -10,7 +10,7 @@ use sp_runtime::Perbill; parameter_types! { pub const MotionDuration: BlockNumber = prod_or_fast!(7 * DAYS, 5 * MINUTES); - pub const MaxProposals: u32 = 7; + pub const MaxProposals: u32 = 20; pub const MaxMembersCouncil: u32 = 7; pub const MaxMembersTechnicalCommittee: u32 = 5; pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; From 744ee4488036d3e4b23850f4204a3062a988c9ce Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Mon, 18 Nov 2024 15:50:17 +0100 Subject: [PATCH 5/5] =?UTF-8?q?Revert=20"Enhance=20Node=20Service=20and=20?= =?UTF-8?q?Runtime=20with=20Async=20Backing=20and=20Updat=E2=80=A6=20(#881?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "Enhance Node Service and Runtime with Async Backing and Updated Configurations (#853)" This reverts commit ef832172b2a40da8dd3406b954df6aa09c92881e. * missing info --- Cargo.lock | 27 - Cargo.toml | 4 - e2e-tests/package-lock.json | 2 +- node/Cargo.toml | 3 - node/src/service.rs | 70 +- primitives/src/lib.rs | 22 +- runtime/laos/Cargo.toml | 2 - runtime/laos/src/configs/aura.rs | 6 +- runtime/laos/src/configs/collective.rs | 6 +- .../src/configs/cumulus_parachain_system.rs | 7 +- runtime/laos/src/configs/democracy.rs | 5 +- runtime/laos/src/configs/election_phragmen.rs | 3 +- runtime/laos/src/configs/evm.rs | 2 +- runtime/laos/src/configs/identity.rs | 3 +- runtime/laos/src/configs/mod.rs | 2 +- runtime/laos/src/configs/parachain_staking.rs | 2 +- runtime/laos/src/configs/scheduler.rs | 3 +- runtime/laos/src/configs/timestamp.rs | 4 +- runtime/laos/src/configs/treasury.rs | 3 +- runtime/laos/src/configs/vesting.rs | 2 +- runtime/laos/src/lib.rs | 17 +- .../src/{migrations/mod.rs => migrations.rs} | 5 +- runtime/laos/src/migrations/async_backing.rs | 772 ------------------ runtime/laos/src/tests/metadata15.golden | 221 ++--- runtime/laos/src/tests/mod.rs | 6 +- zombienet/download_polkadot.sh | 2 +- 26 files changed, 143 insertions(+), 1058 deletions(-) rename runtime/laos/src/{migrations/mod.rs => migrations.rs} (83%) delete mode 100644 runtime/laos/src/migrations/async_backing.rs diff --git a/Cargo.lock b/Cargo.lock index 49d184422..55cb83b22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2032,29 +2032,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cumulus-client-consensus-relay-chain" -version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0#8c8edacf8942298c3807a2e192860da9e7e4996a" -dependencies = [ - "async-trait", - "cumulus-client-consensus-common", - "cumulus-primitives-core", - "cumulus-relay-chain-interface", - "futures", - "parking_lot 0.12.3", - "sc-consensus", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "substrate-prometheus-endpoint", - "tracing", -] - [[package]] name = "cumulus-client-network" version = "0.7.0" @@ -5243,12 +5220,9 @@ dependencies = [ "cumulus-client-consensus-aura", "cumulus-client-consensus-common", "cumulus-client-consensus-proposer", - "cumulus-client-consensus-relay-chain", "cumulus-client-service", "cumulus-primitives-core", - "cumulus-primitives-parachain-inherent", "cumulus-relay-chain-interface", - "cumulus-test-relay-sproof-builder", "fc-api", "fc-cli", "fc-consensus", @@ -5329,7 +5303,6 @@ dependencies = [ "cumulus-pallet-session-benchmarking", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", - "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", diff --git a/Cargo.toml b/Cargo.toml index cfd99b17c..de15dba6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -183,9 +183,6 @@ cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/pol cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } -cumulus-primitives-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } -cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } parachain-info = { package = "staging-parachain-info", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } @@ -194,7 +191,6 @@ cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branc cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" } cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" } cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" } -cumulus-client-consensus-relay-chain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" } cumulus-client-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" } cumulus-client-consensus-proposer = {git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0"} cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" } diff --git a/e2e-tests/package-lock.json b/e2e-tests/package-lock.json index 4c20d104a..7dd4ebbb5 100644 --- a/e2e-tests/package-lock.json +++ b/e2e-tests/package-lock.json @@ -21,7 +21,7 @@ "mocha": "^10.2.0", "mocha-steps": "^1.3.0", "solc": "^0.8.3", - "truffle": "^5.11.5", + "truffle": "^5.10.2", "ts-node": "^10.9.1", "typescript": "^4.9.5", "wait-on": "^7.0.1", diff --git a/node/Cargo.toml b/node/Cargo.toml index 980e98b2d..ed144e1ad 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -63,11 +63,8 @@ cumulus-client-collator = { workspace = true } cumulus-client-consensus-aura = { workspace = true } cumulus-client-consensus-common = { workspace = true } cumulus-client-consensus-proposer = { workspace = true } -cumulus-client-consensus-relay-chain = { workspace = true } cumulus-client-service = { workspace = true } cumulus-primitives-core = { workspace = true } -cumulus-primitives-parachain-inherent = { workspace = true } -cumulus-test-relay-sproof-builder = { workspace = true } cumulus-relay-chain-interface = { workspace = true } # Frontier diff --git a/node/src/service.rs b/node/src/service.rs index 34d6db57e..1614b3990 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -32,20 +32,14 @@ use cumulus_client_service::{ BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, ParachainHostFunctions, StartRelayChainTasksParams, }; -use cumulus_primitives_core::{ - relay_chain::{CollatorPair, ValidationCode}, - ParaId, -}; +use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId}; use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface}; // Substrate Imports -use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams}; use fc_rpc::{StorageOverride, StorageOverrideHandler}; use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; use futures::FutureExt; -use laos_runtime::{ - configs::cumulus_parachain_system::RELAY_CHAIN_SLOT_DURATION_MILLIS, RuntimeApi, -}; +use laos_runtime::RuntimeApi; use sc_client_api::Backend; use sc_consensus::ImportQueue; use sc_executor::{ @@ -56,11 +50,9 @@ use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; -use sp_consensus_aura::{Slot, SlotDuration}; use sp_core::U256; use sp_keystore::KeystorePtr; use substrate_prometheus_endpoint::Registry; - // Frontier use crate::eth::{ db_config_dir, new_frontier_partial, spawn_frontier_tasks, BackendType, EthConfiguration, @@ -318,6 +310,8 @@ async fn start_node_impl( fc_mapping_sync::EthereumBlockNotification, > = Default::default(); let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks); + let slot_duration = sc_consensus_aura::slot_duration(&*client)?; + let target_gas_price = eth_config.target_gas_price; // for ethereum-compatibility rpc. parachain_config.rpc_id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider)); @@ -350,33 +344,15 @@ async fn start_node_impl( execute_gas_limit_multiplier: eth_config.execute_gas_limit_multiplier, forced_parent_hashes: None, pending_create_inherent_data_providers: move |_, ()| async move { - // Patch from https://github.com/darwinia-network/darwinia/pull/1608 - let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); - let relay_chain_slot = Slot::from_timestamp( - timestamp.timestamp(), - SlotDuration::from_millis(RELAY_CHAIN_SLOT_DURATION_MILLIS.into()), + let current = sp_timestamp::InherentDataProvider::from_system_time(); + let next_slot = current.timestamp().as_millis() + slot_duration.as_millis(); + let timestamp = sp_timestamp::InherentDataProvider::new(next_slot.into()); + let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, ); - - let state_proof_builder = cumulus_test_relay_sproof_builder::RelayStateSproofBuilder { - para_id, - current_slot: relay_chain_slot, - included_para_head: Some(polkadot_primitives::HeadData(vec![])), - ..Default::default() - }; - let (relay_parent_storage_root, relay_chain_state) = - state_proof_builder.into_state_root_and_proof(); - let parachain_inherent_data = - cumulus_primitives_parachain_inherent::ParachainInherentData { - validation_data: cumulus_primitives_core::PersistedValidationData { - relay_parent_number: u32::MAX, - relay_parent_storage_root, - ..Default::default() - }, - relay_chain_state, - downward_messages: Default::default(), - horizontal_messages: Default::default(), - }; - Ok((timestamp, parachain_inherent_data)) + let dynamic_fee = fp_dynamic_fee::InherentDataProvider(U256::from(target_gas_price)); + Ok((slot, timestamp, dynamic_fee)) }, }; @@ -420,7 +396,7 @@ async fn start_node_impl( spawn_frontier_tasks( &task_manager, client.clone(), - backend.clone(), + backend, frontier_backend, filter_pool, overrides, @@ -487,7 +463,6 @@ async fn start_node_impl( if validator { start_consensus( client.clone(), - backend.clone(), block_import, prometheus_registry.as_ref(), telemetry.as_ref().map(|t| t.handle()), @@ -549,7 +524,6 @@ fn build_import_queue( #[allow(clippy::too_many_arguments)] fn start_consensus( client: Arc, - backend: Arc, block_import: ParachainBlockImport, prometheus_registry: Option<&Registry>, telemetry: Option, @@ -564,6 +538,10 @@ fn start_consensus( overseer_handle: OverseerHandle, announce_block: Arc>) + Send + Sync>, ) -> Result<(), sc_service::Error> { + use cumulus_client_consensus_aura::collators::basic::{ + self as basic_aura, Params as BasicAuraParams, + }; + // NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant` // when starting the network. @@ -584,15 +562,11 @@ fn start_consensus( client.clone(), ); - let params = AuraParams { + let params = BasicAuraParams { create_inherent_data_providers: move |_, ()| async move { Ok(()) }, block_import, - para_client: client.clone(), - para_backend: backend.clone(), + para_client: client, relay_client: relay_chain_interface, - code_hash_provider: move |block_hash| { - client.code_at(block_hash).ok().map(|c| ValidationCode::from(c).hash()) - }, sync_oracle, keystore, collator_key, @@ -602,12 +576,12 @@ fn start_consensus( proposer, collator_service, // Very limited proposal time. - authoring_duration: Duration::from_millis(1500), - reinitialize: false, + authoring_duration: Duration::from_millis(500), + collation_request_receiver: None, }; let fut = - aura::run::( + basic_aura::run::( params, ); task_manager.spawn_essential_handle().spawn("aura", None, fut); diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 8562769fe..0e0b28a59 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -19,18 +19,12 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] -use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, IdentityFee, Weight}; +use frame_support::weights::IdentityFee; use frame_system::limits; -pub use parachains_common::NORMAL_DISPATCH_RATIO; +pub use parachains_common::{MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO}; use sp_core::Hasher as HasherT; use sp_runtime::traits::{BlakeTwo256, IdentifyAccount, Verify}; -/// We allow for 2 seconds of compute with a 6 second average block. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), - cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, -); - /// Authority ID used in parachain. pub type AuraId = sp_consensus_aura::sr25519::AuthorityId; @@ -84,12 +78,12 @@ mod tests { let weights = RuntimeBlockWeights::get(); assert_eq!(weights.base_block, Weight::from_parts(453383000, 0)); - assert_eq!(weights.max_block, Weight::from_parts(2000000000000, 5242880)); + assert_eq!(weights.max_block, Weight::from_parts(500000000000, 5242880)); let normal = weights.per_class.get(DispatchClass::Normal); assert_eq!(normal.base_extrinsic, Weight::from_parts(107074000, 0)); - assert_eq!(normal.max_extrinsic, Some(Weight::from_parts(1299892926000, 3407872))); - assert_eq!(normal.max_total, Some(Weight::from_parts(1500000000000, 3932160))); + assert_eq!(normal.max_extrinsic, Some(Weight::from_parts(324892926000, 3407872))); + assert_eq!(normal.max_total, Some(Weight::from_parts(375000000000, 3932160))); assert_eq!(normal.reserved, Some(Weight::from_parts(0, 0))); let mandatory = weights.per_class.get(DispatchClass::Mandatory); @@ -100,8 +94,8 @@ mod tests { let operational = weights.per_class.get(DispatchClass::Operational); assert_eq!(operational.base_extrinsic, Weight::from_parts(107074000, 0)); - assert_eq!(operational.max_extrinsic, Some(Weight::from_parts(1799892926000, 4718592))); - assert_eq!(operational.max_total, Some(Weight::from_parts(2000000000000, 5242880))); - assert_eq!(operational.reserved, Some(Weight::from_parts(500000000000, 1310720))); + assert_eq!(operational.max_extrinsic, Some(Weight::from_parts(449892926000, 4718592))); + assert_eq!(operational.max_total, Some(Weight::from_parts(500000000000, 5242880))); + assert_eq!(operational.reserved, Some(Weight::from_parts(125000000000, 1310720))); } } diff --git a/runtime/laos/Cargo.toml b/runtime/laos/Cargo.toml index 8f2987c17..d065e45c0 100644 --- a/runtime/laos/Cargo.toml +++ b/runtime/laos/Cargo.toml @@ -90,7 +90,6 @@ cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-timestamp = { workspace = true } cumulus-primitives-utility = { workspace = true } -cumulus-primitives-aura = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } @@ -139,7 +138,6 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", - "cumulus-primitives-aura/std", "parachains-common/std", "frame-executive/std", "frame-support/std", diff --git a/runtime/laos/src/configs/aura.rs b/runtime/laos/src/configs/aura.rs index 7a741988d..878f12af1 100644 --- a/runtime/laos/src/configs/aura.rs +++ b/runtime/laos/src/configs/aura.rs @@ -14,13 +14,13 @@ // You should have received a copy of the GNU General Public License // along with LAOS. If not, see . -use crate::{AuraId, Runtime, SLOT_DURATION}; +use crate::{AuraId, Runtime, MILLISECS_PER_BLOCK}; use frame_support::parameter_types; use sp_core::ConstU64; parameter_types! { pub const MaxAuthorities : u32 = 100_000; - pub const AllowMultipleBlocksPerSlot: bool = true; + pub const AllowMultipleBlocksPerSlot: bool = false; } impl pallet_aura::Config for Runtime { @@ -28,5 +28,5 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = MaxAuthorities; type AllowMultipleBlocksPerSlot = AllowMultipleBlocksPerSlot; - type SlotDuration = ConstU64; + type SlotDuration = ConstU64; } diff --git a/runtime/laos/src/configs/collective.rs b/runtime/laos/src/configs/collective.rs index 2ecfeb36c..9eb1e96d1 100644 --- a/runtime/laos/src/configs/collective.rs +++ b/runtime/laos/src/configs/collective.rs @@ -1,10 +1,8 @@ -use crate::{ - weights, AccountId, BlockNumber, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, DAYS, - MINUTES, -}; +use crate::{weights, AccountId, BlockNumber, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin}; use frame_support::{pallet_prelude::Weight, parameter_types}; use frame_system::EnsureRoot; use laos_primitives::RuntimeBlockWeights; +use parachains_common::{DAYS, MINUTES}; use polkadot_runtime_common::prod_or_fast; use sp_runtime::Perbill; diff --git a/runtime/laos/src/configs/cumulus_parachain_system.rs b/runtime/laos/src/configs/cumulus_parachain_system.rs index 9d0664799..33b13fb2d 100644 --- a/runtime/laos/src/configs/cumulus_parachain_system.rs +++ b/runtime/laos/src/configs/cumulus_parachain_system.rs @@ -38,8 +38,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type ReservedDmpWeight = ReservedDmpWeight; type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; - type CheckAssociatedRelayNumber = - cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; + type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; type ConsensusHook = ConsensusHook; type DmpQueue = frame_support::traits::EnqueueWithOrigin; type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo; @@ -52,9 +51,9 @@ const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; /// number of blocks authored per slot. const BLOCK_PROCESSING_VELOCITY: u32 = 1; /// Relay chain slot duration, in milliseconds. -pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; +const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; -pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< +type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< Runtime, RELAY_CHAIN_SLOT_DURATION_MILLIS, BLOCK_PROCESSING_VELOCITY, diff --git a/runtime/laos/src/configs/democracy.rs b/runtime/laos/src/configs/democracy.rs index 938512143..ab611a75f 100644 --- a/runtime/laos/src/configs/democracy.rs +++ b/runtime/laos/src/configs/democracy.rs @@ -4,10 +4,11 @@ use super::collective::{ }; use crate::{ currency::UNIT, weights, AccountId, Balance, Balances, BlockNumber, OriginCaller, Preimage, - Runtime, RuntimeEvent, Scheduler, TechnicalCommitteeMembership, Treasury, DAYS, HOURS, MINUTES, + Runtime, RuntimeEvent, Scheduler, TechnicalCommitteeMembership, Treasury, }; use frame_support::{parameter_types, traits::EitherOfDiverse}; use frame_system::{EnsureRoot, EnsureSigned, EnsureSignedBy}; +use parachains_common::{DAYS, HOURS, MINUTES}; use polkadot_runtime_common::prod_or_fast; parameter_types! { @@ -147,7 +148,7 @@ mod tests { ); // the same preimage can be re-proposed as the cooloff period is over - frame_system::Pallet::::set_block_number(100804); + frame_system::Pallet::::set_block_number(50402); assert_ok!(pallet_democracy::Pallet::::external_propose( OriginCaller::Council(pallet_collective::RawOrigin::Members(1, 1)).into(), preimage diff --git a/runtime/laos/src/configs/election_phragmen.rs b/runtime/laos/src/configs/election_phragmen.rs index c5d50dee1..36bbf8b00 100644 --- a/runtime/laos/src/configs/election_phragmen.rs +++ b/runtime/laos/src/configs/election_phragmen.rs @@ -1,8 +1,9 @@ use crate::{ currency::UNIT, weights, Balance, Balances, BlockNumber, Council, Runtime, RuntimeEvent, - Treasury, DAYS, MINUTES, + Treasury, }; use frame_support::{parameter_types, traits::LockIdentifier}; +use parachains_common::{DAYS, MINUTES}; use polkadot_runtime_common::{prod_or_fast, CurrencyToVote}; parameter_types! { diff --git a/runtime/laos/src/configs/evm.rs b/runtime/laos/src/configs/evm.rs index 96a9ffc45..c6919f837 100644 --- a/runtime/laos/src/configs/evm.rs +++ b/runtime/laos/src/configs/evm.rs @@ -131,7 +131,7 @@ mod tests { #[test] fn check_block_gas_limit() { - assert_eq!(BlockGasLimit::get(), 60000000.into()); + assert_eq!(BlockGasLimit::get(), 15000000.into()); } #[test] diff --git a/runtime/laos/src/configs/identity.rs b/runtime/laos/src/configs/identity.rs index 129e9908d..91dc91bd6 100644 --- a/runtime/laos/src/configs/identity.rs +++ b/runtime/laos/src/configs/identity.rs @@ -1,9 +1,10 @@ use crate::{ currency::calculate_deposit, AccountId, Balance, Balances, Runtime, RuntimeEvent, Signature, - Treasury, DAYS, + Treasury, }; use frame_support::parameter_types; use frame_system::EnsureRoot; +use parachains_common::DAYS; parameter_types! { pub const MaxSubAccounts: u32 = 100; diff --git a/runtime/laos/src/configs/mod.rs b/runtime/laos/src/configs/mod.rs index 7c4a929ff..8f2550feb 100644 --- a/runtime/laos/src/configs/mod.rs +++ b/runtime/laos/src/configs/mod.rs @@ -21,7 +21,7 @@ mod balances; mod base_fee; mod benchmark; mod collective; -pub mod cumulus_parachain_system; +mod cumulus_parachain_system; mod cumulus_xcmp_queue; mod democracy; mod election_phragmen; diff --git a/runtime/laos/src/configs/parachain_staking.rs b/runtime/laos/src/configs/parachain_staking.rs index 35e61f0c2..6f4fa8b4c 100644 --- a/runtime/laos/src/configs/parachain_staking.rs +++ b/runtime/laos/src/configs/parachain_staking.rs @@ -343,6 +343,6 @@ mod tests { #[test] fn test_slot_per_year() { - assert_eq!(SlotsPerYear::get(), 31_557_600 / 6); + assert_eq!(SlotsPerYear::get(), 31_557_600 / 12); } } diff --git a/runtime/laos/src/configs/scheduler.rs b/runtime/laos/src/configs/scheduler.rs index 5db526091..1f7d97bbf 100644 --- a/runtime/laos/src/configs/scheduler.rs +++ b/runtime/laos/src/configs/scheduler.rs @@ -7,7 +7,8 @@ use frame_support::{ weights::Weight, }; use frame_system::EnsureRoot; -use laos_primitives::{RuntimeBlockWeights, NORMAL_DISPATCH_RATIO}; +use laos_primitives::RuntimeBlockWeights; +pub use parachains_common::NORMAL_DISPATCH_RATIO; parameter_types! { pub MaximumSchedulerWeight: Weight = NORMAL_DISPATCH_RATIO * RuntimeBlockWeights::get().max_block; diff --git a/runtime/laos/src/configs/timestamp.rs b/runtime/laos/src/configs/timestamp.rs index 8b448299c..a1d52a99a 100644 --- a/runtime/laos/src/configs/timestamp.rs +++ b/runtime/laos/src/configs/timestamp.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with LAOS. If not, see . -use crate::{weights, Aura, Runtime}; +use crate::{weights, Aura, Runtime, MILLISECS_PER_BLOCK}; use frame_support::parameter_types; parameter_types! { - pub const MinimumPeriod: u64 = 0; + pub const MinimumPeriod: u64 = MILLISECS_PER_BLOCK / 2; } impl pallet_timestamp::Config for Runtime { diff --git a/runtime/laos/src/configs/treasury.rs b/runtime/laos/src/configs/treasury.rs index d35b4a39d..86bd840d3 100644 --- a/runtime/laos/src/configs/treasury.rs +++ b/runtime/laos/src/configs/treasury.rs @@ -1,7 +1,7 @@ use super::collective::CouncilMajority; use crate::{ currency::UNIT, weights, AccountId, Balance, Balances, BlockNumber, Permill, Runtime, - RuntimeEvent, Treasury, DAYS, MINUTES, + RuntimeEvent, Treasury, }; use frame_support::{ parameter_types, @@ -12,6 +12,7 @@ use frame_support::{ PalletId, }; use frame_system::EnsureRoot; +use parachains_common::{DAYS, MINUTES}; use polkadot_runtime_common::prod_or_fast; use sp_runtime::traits::IdentityLookup; diff --git a/runtime/laos/src/configs/vesting.rs b/runtime/laos/src/configs/vesting.rs index 2b914ba50..d7a7f5383 100644 --- a/runtime/laos/src/configs/vesting.rs +++ b/runtime/laos/src/configs/vesting.rs @@ -25,7 +25,7 @@ parameter_types! { } impl pallet_vesting::Config for Runtime { - const MAX_VESTING_SCHEDULES: u32 = 56; + const MAX_VESTING_SCHEDULES: u32 = 28; type RuntimeEvent = RuntimeEvent; type Currency = Balances; diff --git a/runtime/laos/src/lib.rs b/runtime/laos/src/lib.rs index 3a676febc..1955a76e1 100644 --- a/runtime/laos/src/lib.rs +++ b/runtime/laos/src/lib.rs @@ -91,11 +91,7 @@ impl_opaque_keys! { } /// This determines the average expected block time that we are targeting. -pub const MILLISECS_PER_BLOCK: u64 = 6000; -pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; -pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); -pub const HOURS: BlockNumber = MINUTES * 60; -pub const DAYS: BlockNumber = HOURS * 24; +pub const MILLISECS_PER_BLOCK: u64 = 12000; /// Version of the runtime #[sp_version::runtime_version] @@ -106,7 +102,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_version: 2390, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 2, + transaction_version: 1, state_version: 1, }; @@ -206,15 +202,6 @@ mod tests; mod benchmarks; impl_runtime_apis! { - impl cumulus_primitives_aura::AuraUnincludedSegmentApi for Runtime { - fn can_build_upon( - included_hash: ::Hash, - slot: cumulus_primitives_aura::Slot, - ) -> bool { - configs::cumulus_parachain_system::ConsensusHook::can_build_upon(included_hash, slot) - } - } - impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) diff --git a/runtime/laos/src/migrations/mod.rs b/runtime/laos/src/migrations.rs similarity index 83% rename from runtime/laos/src/migrations/mod.rs rename to runtime/laos/src/migrations.rs index 3962db861..82e8ff1ae 100644 --- a/runtime/laos/src/migrations/mod.rs +++ b/runtime/laos/src/migrations.rs @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with LAOS. If not, see . -mod async_backing; - use crate::Runtime; -pub type Migrations = - (cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, async_backing::Migration); +pub type Migrations = (cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4,); diff --git a/runtime/laos/src/migrations/async_backing.rs b/runtime/laos/src/migrations/async_backing.rs deleted file mode 100644 index 995ae83f2..000000000 --- a/runtime/laos/src/migrations/async_backing.rs +++ /dev/null @@ -1,772 +0,0 @@ -use crate::{Runtime, RuntimeOrigin, Weight}; -use frame_support::{ - traits::{Currency, OnRuntimeUpgrade}, - BoundedVec, -}; -use frame_system::pallet_prelude::BlockNumberFor; -use pallet_vesting::MaxVestingSchedulesGet; -use sp_core::{ConstU32, Get}; -use sp_std::vec::Vec; - -#[cfg(feature = "try-runtime")] -use sp_runtime::DispatchError; - -pub struct Migration; - -const LAOS_VESTING_MIGRATION_6S: &[u8] = b":laos:vesting_migration_6s:"; -// The old maximum number of vesting schedules per account -const OLD_MAX_VESTING_SCHEDULES: u32 = 28; - -// Type alias for Balance to improve readability in function signatures and types -type BalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; - -type VestingSchedule = pallet_vesting::VestingInfo, BlockNumberFor>; - -impl OnRuntimeUpgrade for Migration { - #[cfg(feature = "try-runtime")] - /// Logs the total number of accounts with vesting schedules, the count of schedules per - /// account, and the maximum schedule count per account before migration. - fn pre_upgrade() -> Result, DispatchError> { - use parity_scale_codec::Encode; - - let vesting_accounts_count = pallet_vesting::Vesting::::iter().count(); - let mut schedules_per_account = sp_std::vec![]; - let mut max_schedule_count = 0; - - if sp_io::storage::exists(LAOS_VESTING_MIGRATION_6S) { - return Ok(sp_std::vec![]); - } - - for (account_id, schedules) in pallet_vesting::Vesting::::iter() { - let schedule_count = schedules.len(); - schedules_per_account.push((account_id, schedule_count as u32)); - if schedule_count > max_schedule_count { - max_schedule_count = schedule_count; - } - // Logging account vesting schedule details - log::debug!( - target: "runtime::migration", - "Pre-migration: Account {:?} has {} vesting schedules", - account_id, - schedule_count - ); - } - - // Logging summary information before migration - log::info!( - target: "runtime::migration", - "Migration::pre_upgrade - Found {} accounts with vesting schedules, \ - maximum schedules per account: {}", - vesting_accounts_count, - max_schedule_count - ); - - let blocks_per_round = pallet_parachain_staking::Pallet::::round().length; - - log::info!( - target: "runtime::migration", - "Migration::pre_upgrade - Current blocks per round: {}", - blocks_per_round - ); - - // Encode the number of accounts, schedule counts per account, max schedule count, and - // blocks per round - Ok(( - vesting_accounts_count as u32, - schedules_per_account, - max_schedule_count as u32, - blocks_per_round, - ) - .encode()) - } - - fn on_runtime_upgrade() -> Weight { - let mut read_count = 0u64; - let mut write_count = 0u64; - let mut weight: Weight = Weight::zero(); - - if sp_io::storage::exists(LAOS_VESTING_MIGRATION_6S) { - log::info!( - target: "runtime::migration", - "Migration::on_runtime_upgrade - Migration already applied ... skipping" - ); - read_count += 1; - } else { - log::info!( - target: "runtime::migration", - "Migration::on_runtime_upgrade - Starting migration" - ); - - weight = weight.saturating_add(migrate_vesting_pallet_max_schedules()); - weight = weight.saturating_add(migrate_schedules()); - weight = weight.saturating_add(double_parachain_staking_blocks_per_round()); - - sp_io::storage::set(LAOS_VESTING_MIGRATION_6S, &[]); - write_count += 1; - - log::info!( - target: "runtime::migration", - "Migration::on_runtime_upgrade - Migration ended" - ); - } - - weight.saturating_add( - ::DbWeight::get() - .reads_writes(read_count, write_count), - ) - } - - #[cfg(feature = "try-runtime")] - /// Verifies migration by checking the vesting data has been migrated, allows for possible - /// splits in schedules. - fn post_upgrade(encoded_data: Vec) -> Result<(), DispatchError> { - use crate::AccountId; - use parity_scale_codec::Decode; - - if encoded_data.is_empty() { - return Ok(()); - } - - let ( - old_account_count, - schedules_per_account, - old_max_schedule_count, - old_blocks_per_round, - ): (u32, Vec<(AccountId, u32)>, u32, u32) = Decode::decode(&mut &encoded_data[..]) - .map_err(|_| DispatchError::Other("Failed to decode migration data"))?; - - let new_account_count = pallet_vesting::Vesting::::iter().count(); - let mut max_schedule_count_post_migration = 0; - - // Assert that the number of accounts has not changed after migration - assert_eq!( - new_account_count, old_account_count as usize, - "Mismatch in vesting account count after migration: expected {}, got {}", - old_account_count, new_account_count - ); - - // Logging successful migration - log::info!( - target: "runtime::migration", - "Migration::post_upgrade - Migration successful. \ - Account count before: {}, after: {}", - old_account_count, - new_account_count - ); - - // Verify each account's schedule count - for (account_id, expected_schedule_count) in schedules_per_account { - let new_schedule_count = pallet_vesting::Vesting::::get(account_id) - .map(|schedules| schedules.len()) - .unwrap_or(0); - - // Update max schedule count after migration - if new_schedule_count > max_schedule_count_post_migration { - max_schedule_count_post_migration = new_schedule_count; - } - - // Log any increase in schedule count due to migration adjustments - if new_schedule_count > expected_schedule_count as usize { - log::debug!( - target: "runtime::migration", - "Post-migration: Account {:?} had {} schedules pre-migration, now has {} schedules due to splits", - account_id, - expected_schedule_count, - new_schedule_count - ); - } else { - assert_eq!( - new_schedule_count, expected_schedule_count as usize, - "Account {:?} schedule count mismatch: expected {} schedules after migration, found {}", - account_id, expected_schedule_count, new_schedule_count - ); - } - } - - // Logging the maximum schedule count comparison - log::info!( - target: "runtime::migration", - "Migration::post_upgrade - Max schedules per account pre-migration: {}, \ - max schedules per account post-migration: {}", - old_max_schedule_count, - max_schedule_count_post_migration - ); - - let new_blocks_per_round = pallet_parachain_staking::Pallet::::round().length; - assert_eq!(old_blocks_per_round * 2, new_blocks_per_round); - log::info!( - target: "runtime::migration", - "Migration::post_upgrade - Blocks per round pre-migration: {}, \ - blocks per round post-migration: {}", - old_blocks_per_round, - new_blocks_per_round - ); - - Ok(()) - } -} - -/// The actual migration code that doubles the round length. -fn double_parachain_staking_blocks_per_round() -> Weight { - let mut reads_count = 0; - let mut writes_count = 0; - - // Get the current round length - let round_length = pallet_parachain_staking::Pallet::::round().length; - reads_count += 1; - - // Calculate the new round length - let new_round_length = match round_length.checked_mul(2) { - Some(value) => value, - None => { - log::warn!( - target: "runtime::migration", - "Migration::double_parachain_staking_blocks_per_round - Failed to double round length: overflow" - ); - return ::DbWeight::get() - .reads_writes(reads_count, writes_count); - }, - }; - - // Set the new round length - if let Err(e) = pallet_parachain_staking::Pallet::::set_blocks_per_round( - RuntimeOrigin::root(), - new_round_length, - ) { - log::warn!( - target: "runtime::migration", - "Migration::double_parachain_staking_blocks_per_round - Failed to set new round length: {:?}", - e - ); - } else { - log::info!( - target: "runtime::migration", - "Migration::double_parachain_staking_blocks_per_round - Round length doubled from {} to {}", - round_length, - new_round_length - ); - } - writes_count += 1; - - ::DbWeight::get().reads_writes(reads_count, writes_count) -} - -/// Migrates vesting schedules to conform to the new `MaxVestingSchedulesGet` limit. -/// This ensures that no account has more vesting schedules than the allowed maximum. -fn migrate_vesting_pallet_max_schedules() -> Weight { - let mut reads_count = 0; - let mut writes_count = 0; - - // Logging the maximum schedule count comparison - log::info!( - target: "runtime::migration", - "Migration::migrate_vesting_pallet_max_schedules from {} to {} max vested", - OLD_MAX_VESTING_SCHEDULES, - MaxVestingSchedulesGet::::get() - ); - - // Translate the old vesting schedules to fit the new maximum limit - pallet_vesting::Vesting::::translate::< - BoundedVec< - pallet_vesting::VestingInfo, BlockNumberFor>, - ConstU32, - >, - _, - >(|_key, vesting_info| { - reads_count += 1; - - // Create a new bounded vector with the updated maximum limit - let mut new_vesting_infos: BoundedVec< - pallet_vesting::VestingInfo, BlockNumberFor>, - MaxVestingSchedulesGet, - > = BoundedVec::new(); - - // Attempt to migrate each vesting schedule to the new bounded vector - for v_info in vesting_info { - new_vesting_infos.try_push(v_info).ok(); - } - - writes_count += 1; - - // Return the new bounded vector to update the storage - new_vesting_infos.into() - }); - - // Calculate the total weight based on reads and writes performed - ::DbWeight::get().reads_writes(reads_count, writes_count) -} - -/// Migrates all vesting schedules to adjust for the new 6-second block time. -fn migrate_schedules() -> Weight { - let mut read_count = 0u64; - let mut write_count = 0u64; - - log::info!( - target: "runtime::migration", - "Migration::migrate_schedules - Starting migration" - ); - - for (account_id, schedules) in pallet_vesting::Vesting::::drain() { - read_count += 1; - - // Adjust vesting schedules for the new block time - let adjusted_schedules = - adjust_schedule(frame_system::Pallet::::block_number(), schedules.to_vec()); - - // Insert the adjusted schedules back into storage - pallet_vesting::Vesting::::insert(account_id, adjusted_schedules); - write_count += 1; - } - - // Logging completion of the runtime upgrade - log::info!( - target: "runtime::migration", - "Migration::migrate_schedules - Migration completed with {} reads and {} writes", - read_count, - write_count - ); - - ::DbWeight::get().reads_writes(read_count, write_count) -} - -/// Adjusts vesting schedules for a new 6-second block time and handles various cases like schedule -/// splitting. -/// -/// # Parameters -/// - `current_block`: The current block number at which the migration is taking place. -/// - `schedules`: A vector of vesting schedules to be adjusted. -/// -/// # Returns -/// A bounded vector of updated vesting schedules that respect the new 6-second block time. -fn adjust_schedule( - current_block: BlockNumberFor, - schedules: Vec, -) -> BoundedVec> { - let mut adjusted_schedules = BoundedVec::new(); - - for schedule in schedules { - if current_block <= schedule.starting_block() { - // Case 1: Current block is before or at the starting block, so adjust the schedule for - // 6-second block time. - let new_schedule = adjust_future_schedule(schedule, current_block); - try_push_schedule(&mut adjusted_schedules, new_schedule); - } else if remaining_vesting(schedule, current_block) > 0 { - // Case 2: Current block is within the schedule range, so split it into past and new - // vesting schedules. - let (past_schedule, new_schedule) = split_schedule(schedule, current_block); - try_push_schedule(&mut adjusted_schedules, past_schedule); - try_push_schedule(&mut adjusted_schedules, new_schedule); - } else { - // Case 3: Current block is beyond the end of the schedule; add the schedule as-is. - try_push_schedule(&mut adjusted_schedules, schedule); - } - } - adjusted_schedules -} - -/// Adjusts a vesting schedule when the current block is before or at the schedule's start, -/// halving the per-block rate for 6-second block time and recalculating the starting block. -/// -/// # Parameters -/// - `schedule`: The original vesting schedule. -/// - `current_block`: The current block number. -/// -/// # Returns -/// A new vesting schedule with adjusted starting block and per-block rate. -fn adjust_future_schedule( - schedule: VestingSchedule, - current_block: BlockNumberFor, -) -> VestingSchedule { - let adjusted_starting_block = 2 * schedule.starting_block() - current_block; - let adjusted_per_block = schedule.per_block().saturating_div(2u32.into()); - pallet_vesting::VestingInfo::new(schedule.locked(), adjusted_per_block, adjusted_starting_block) -} - -/// Splits a vesting schedule into two parts: a past vesting schedule covering blocks -/// before `current_block`, and a new vesting schedule starting at `current_block`. -/// -/// # Parameters -/// - `schedule`: The original vesting schedule to be split. -/// - `current_block`: The current block number, marking the split point. -/// -/// # Returns -/// A tuple with: -/// - `past_schedule`: Covers vesting before `current_block`. -/// - `new_schedule`: Covers vesting from `current_block`. -fn split_schedule( - schedule: VestingSchedule, - current_block: BlockNumberFor, -) -> (VestingSchedule, VestingSchedule) { - let vested_amount = - schedule.per_block() * (current_block as u128 - schedule.starting_block() as u128); - let remaining_amount = schedule.locked() - vested_amount; - - let past_schedule = pallet_vesting::VestingInfo::new( - vested_amount, - schedule.per_block(), - schedule.starting_block(), - ); - - let new_per_block = schedule.per_block().saturating_div(2u32.into()); - let new_schedule = - pallet_vesting::VestingInfo::new(remaining_amount, new_per_block, current_block); - - (past_schedule, new_schedule) -} - -/// Calculates the remaining vesting amount for a schedule from the current block -/// -/// # Parameters -/// - `schedule`: The vesting schedule to check. -/// - `current_block`: The current block number. -/// -/// # Returns -/// The remaining amount of tokens to vest after the current block. -fn remaining_vesting( - schedule: VestingSchedule, - current_block: BlockNumberFor, -) -> BalanceOf { - if current_block > schedule.starting_block() { - let elapsed_blocks = current_block as u128 - schedule.starting_block() as u128; - schedule.locked().saturating_sub(schedule.per_block() * elapsed_blocks) - } else { - schedule.locked() - } -} - -/// Attempts to push a schedule to the bounded vector and logs a warning if unsuccessful. -/// -/// # Parameters -/// - `schedules`: The bounded vector to which the schedule should be added. -/// - `schedule`: The vesting schedule to add. -fn try_push_schedule( - schedules: &mut BoundedVec>, - schedule: VestingSchedule, -) { - if schedules.try_push(schedule).is_err() { - log::warn!("Failed to push vesting schedule due to bounded vector limit"); - } -} -#[cfg(test)] -mod tests { - use super::*; - use crate::{currency::UNIT, tests::ExtBuilder, AccountId, RuntimeOrigin}; - use frame_support::assert_ok; - use sp_core::Get; - use std::str::FromStr; - - pub(crate) const ALICE: &str = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; - pub(crate) const BOB: &str = "0x6c2b9c9b5007740e52d80dddb8e197b0c844f239"; - - /// Test new MAx is double of old max - #[test] - fn test_new_max_is_double_of_old_max() { - ExtBuilder::default().build().execute_with(|| { - assert_eq!(MaxVestingSchedulesGet::::get(), 2 * OLD_MAX_VESTING_SCHEDULES); - }); - } - - /// Tests that migration correctly updates vesting schedule - /// when `current_block` is at block 0 and the schedule requires full adjustment. - #[test] - fn migrate_updates_schedule_with_adjusted_starting_block_and_per_block_rate() { - ExtBuilder::default().build().execute_with(|| { - let alice = setup_account(ALICE, 10000 * UNIT); - let bob = setup_account(BOB, 0); - - assert_eq!(frame_system::Pallet::::block_number(), 0); - - let vesting_schedule = pallet_vesting::VestingInfo::new(1000 * UNIT, 2 * UNIT, 10); - assert_ok!(pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - vesting_schedule - )); - - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(475000000, 0)); - - let schedules = pallet_vesting::Vesting::::get(bob).unwrap(); - assert_eq!(schedules.len(), 1); - assert_eq!(schedules[0].starting_block(), 20); - assert_eq!(schedules[0].locked(), 1000 * UNIT); - assert_eq!(schedules[0].per_block(), UNIT); - }); - } - - /// Tests that migration adjusts future schedules when `current_block` is before the starting - /// block. - #[test] - fn migrate_adjusts_future_schedule_when_current_block_is_before_starting_block() { - ExtBuilder::default().build().execute_with(|| { - let alice = setup_account(ALICE, 10000 * UNIT); - let bob = setup_account(BOB, 0); - - let vesting_schedule = pallet_vesting::VestingInfo::new(1000 * UNIT, 2 * UNIT, 10); - assert_ok!(pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - vesting_schedule - )); - - frame_system::Pallet::::set_block_number(5); - - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(475000000, 0)); - - let schedules = pallet_vesting::Vesting::::get(bob).unwrap(); - assert_eq!(schedules.len(), 1); - assert_eq!(schedules[0].starting_block(), 15); - assert_eq!(schedules[0].locked(), 1000 * UNIT); - assert_eq!(schedules[0].per_block(), UNIT); - }); - } - - /// Tests that no adjustment is made when `current_block` equals the schedule's starting block. - #[test] - fn migrate_keeps_schedule_unchanged_when_current_block_matches_starting_block() { - ExtBuilder::default().build().execute_with(|| { - let alice = setup_account(ALICE, 10000 * UNIT); - let bob = setup_account(BOB, 0); - - let vesting_schedule = pallet_vesting::VestingInfo::new(1000 * UNIT, 2 * UNIT, 10); - assert_ok!(pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - vesting_schedule - )); - - frame_system::Pallet::::set_block_number(10); - - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(475000000, 0)); - - let schedules = pallet_vesting::Vesting::::get(bob).unwrap(); - assert_eq!(schedules.len(), 1); - assert_eq!(schedules[0].starting_block(), 10); - assert_eq!(schedules[0].locked(), 1000 * UNIT); - assert_eq!(schedules[0].per_block(), UNIT); - }); - } - - /// Tests that the schedule is split into two parts if `current_block` is within vesting range. - #[test] - fn migrate_splits_schedule_when_current_block_is_within_schedule_range() { - ExtBuilder::default().build().execute_with(|| { - let alice = setup_account(ALICE, 10000 * UNIT); - let bob = setup_account(BOB, 0); - - let vesting_schedule = pallet_vesting::VestingInfo::new(1000 * UNIT, 2 * UNIT, 10); - assert_ok!(pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - vesting_schedule - )); - - frame_system::Pallet::::set_block_number(15); - - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(475000000, 0)); - - let schedules = pallet_vesting::Vesting::::get(bob).unwrap(); - assert_eq!(schedules.len(), 2); - assert_eq!(schedules[0].starting_block(), 10); - assert_eq!(schedules[0].locked(), 10 * UNIT); - assert_eq!(schedules[0].per_block(), 2 * UNIT); - assert_eq!(schedules[1].starting_block(), 15); - assert_eq!(schedules[1].locked(), 990 * UNIT); - assert_eq!(schedules[1].per_block(), UNIT); - }); - } - - /// Tests that no migration changes are made to schedules already completed by `current_block`. - #[test] - fn migrate_keeps_expired_schedule_unchanged() { - ExtBuilder::default().build().execute_with(|| { - let alice = setup_account(ALICE, 10000 * UNIT); - let bob = setup_account(BOB, 0); - - let vesting_schedule = pallet_vesting::VestingInfo::new(1000 * UNIT, 2 * UNIT, 10); - assert_ok!(pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - vesting_schedule - )); - - frame_system::Pallet::::set_block_number(5000); - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(475000000, 0)); - - let schedules = pallet_vesting::Vesting::::get(bob).unwrap(); - assert_eq!(schedules.len(), 1); - assert_eq!(schedules[0].starting_block(), 10); - assert_eq!(schedules[0].locked(), 1000 * UNIT); - assert_eq!(schedules[0].per_block(), 2 * UNIT); - }); - } - - /// Tests that the migration properly adjusts multiple schedules for a single account. - #[test] - fn migrate_adjusts_multiple_schedules_for_single_account() { - ExtBuilder::default().build().execute_with(|| { - let alice = setup_account(ALICE, 20000 * UNIT); - let bob = AccountId::from_str(BOB).unwrap(); - - let schedule1 = pallet_vesting::VestingInfo::new(1000 * UNIT, UNIT, 10); - let schedule2 = pallet_vesting::VestingInfo::new(2000 * UNIT, 2 * UNIT, 15); - - assert_ok!(pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - schedule1 - )); - assert_ok!(pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - schedule2 - )); - - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(475000000, 0)); - - let schedules = pallet_vesting::Vesting::::get(bob).unwrap(); - assert_eq!(schedules.len(), 2); - assert_eq!(schedules[0].starting_block(), 20); - assert_eq!(schedules[1].starting_block(), 30); - }); - } - - /// Tests migration behavior when no schedules are present for an account. - #[test] - fn migrate_handles_no_schedules_gracefully() { - ExtBuilder::default().build().execute_with(|| { - let bob = AccountId::from_str(BOB).unwrap(); - - assert!(pallet_vesting::Vesting::::get(bob).is_none()); - - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(225000000, 0)); - - assert!(pallet_vesting::Vesting::::get(bob).is_none()); - }); - } - - /// Tests that the migration does not exceed the allowed maximum number of vesting schedules - /// (`MaxVestingSchedulesGet`), even when all schedules are split during migration. - #[test] - fn migrate_max_schedule_limit_with_all_splitting() { - ExtBuilder::default().build().execute_with(|| { - // Setup Alice's account with a large balance - let alice = setup_account(ALICE, 5_000_000_000 * UNIT); - // Setup Bob's account - let bob = AccountId::from_str(BOB).unwrap(); - - // Define a vesting schedule with total amount, per period amount, and number of periods - let vesting_schedule = pallet_vesting::VestingInfo::new(1_000 * UNIT, UNIT, 10); - - // Calculate half of the maximum number of vesting schedules allowed - let half_max_schedules = MaxVestingSchedulesGet::::get() / 2; - - // Alice transfers multiple vesting schedules to Bob - for _ in 0..half_max_schedules { - let _ = pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - vesting_schedule, - ); - } - - // Advance the block number to a point where vesting schedules may split during - // migration - frame_system::Pallet::::set_block_number(15); - - // Execute the migration and verify the expected weight is consumed - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(475000000, 0)); - - // Retrieve Bob's vesting schedules after migration - let schedules = pallet_vesting::Vesting::::get(bob).unwrap(); - - // Calculate the expected number of schedules after migration - // Each original schedule may split into two due to the migration logic, - // but the total should not exceed the maximum allowed - let expected_schedules = MaxVestingSchedulesGet::::get(); - - // Assert that the number of schedules does not exceed the maximum allowed - assert_eq!(schedules.len(), expected_schedules as usize); - }); - } - - // check if the migration of a vesting that is in course and with already vested amount is - // correct - #[test] - fn migrate_vesting_in_course() { - ExtBuilder::default().build().execute_with(|| { - let alice = setup_account(ALICE, 10000 * UNIT); - let bob = setup_account(BOB, 0); - - let vesting_schedule = pallet_vesting::VestingInfo::new(1000 * UNIT, 2 * UNIT, 10); - assert_ok!(pallet_vesting::Pallet::::vested_transfer( - RuntimeOrigin::signed(alice), - bob, - vesting_schedule - )); - - frame_system::Pallet::::set_block_number(14); - - assert_ok!(pallet_vesting::Pallet::::vest(RuntimeOrigin::signed(bob))); - - // check the balance of bob - assert_eq!(frame_system::Pallet::::account(bob).data.free, 1000 * UNIT); - assert_eq!(frame_system::Pallet::::account(bob).data.frozen, 992 * UNIT); - - frame_system::Pallet::::set_block_number(15); - - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(475000000, 0)); - - let schedules = pallet_vesting::Vesting::::get(bob).unwrap(); - assert_eq!(schedules.len(), 2); - assert_eq!(schedules[0].starting_block(), 10); - assert_eq!(schedules[0].locked(), 10 * UNIT); - assert_eq!(schedules[0].per_block(), 2 * UNIT); - assert_eq!(schedules[1].starting_block(), 15); - assert_eq!(schedules[1].locked(), 990 * UNIT); - assert_eq!(schedules[1].per_block(), UNIT); - - frame_system::Pallet::::set_block_number(16); - - assert_ok!(pallet_vesting::Pallet::::vest(RuntimeOrigin::signed(bob))); - // check the balance of bob - assert_eq!(frame_system::Pallet::::account(bob).data.free, 1000 * UNIT); - assert_eq!(frame_system::Pallet::::account(bob).data.frozen, 989 * UNIT); - - frame_system::Pallet::::set_block_number(1200); - assert_ok!(pallet_vesting::Pallet::::vest(RuntimeOrigin::signed(bob))); - // check the balance of bob - assert_eq!(frame_system::Pallet::::account(bob).data.free, 1000 * UNIT); - assert_eq!(frame_system::Pallet::::account(bob).data.frozen, 0); - }); - } - - /// Helper function to set up an account with a given balance. - fn setup_account(account_str: &str, balance: u128) -> AccountId { - let account = AccountId::from_str(account_str).unwrap(); - assert_ok!(pallet_balances::Pallet::::force_set_balance( - RuntimeOrigin::root(), - account, - balance - )); - account - } - - /// Tests that the migration correctly doubles the round length. - #[test] - fn test_migration_doubles_round_length() { - ExtBuilder::default().build().execute_with(|| { - // Set initial round length - let initial_round_length = pallet_parachain_staking::Pallet::::round().length; - assert_eq!(initial_round_length, 10); - - // Execute the migration and verify the expected weight is consumed - assert_eq!(Migration::on_runtime_upgrade(), Weight::from_parts(225_000_000, 0)); - - // Verify the new round length - let new_round_length = pallet_parachain_staking::Pallet::::round().length; - assert_eq!(new_round_length, initial_round_length * 2); - }); - } -} diff --git a/runtime/laos/src/tests/metadata15.golden b/runtime/laos/src/tests/metadata15.golden index 0704a2d44..93d9564e3 100644 --- a/runtime/laos/src/tests/metadata15.golden +++ b/runtime/laos/src/tests/metadata15.golden @@ -37660,13 +37660,12 @@ 24, 108, 0, - 11, + 7, 0, - 32, - 74, - 169, - 209, - 1, + 136, + 82, + 106, + 116, 2, 0, 64, @@ -37677,25 +37676,23 @@ 25, 0, 1, - 11, + 7, 48, - 246, - 167, - 167, - 46, - 1, + 160, + 32, + 165, + 75, 2, 0, 208, 0, 1, - 11, + 7, 0, - 152, - 247, - 62, - 93, - 1, + 230, + 189, + 79, + 87, 2, 0, 240, @@ -37709,25 +37706,23 @@ 25, 0, 1, - 11, + 7, 48, - 126, - 250, - 17, - 163, - 1, + 66, + 181, + 191, + 104, 2, 0, 32, 1, 1, - 11, + 7, 0, - 32, - 74, - 169, - 209, - 1, + 136, + 82, + 106, + 116, 2, 0, 64, @@ -37735,10 +37730,10 @@ 1, 7, 0, - 136, - 82, - 106, - 116, + 162, + 148, + 26, + 29, 2, 0, 80, @@ -37841,19 +37836,7 @@ 0, 0, 0, - 60, - 215, - 189, - 216, - 162, - 114, - 202, - 13, - 101, - 1, - 0, - 0, - 0, + 56, 221, 113, 141, @@ -38022,7 +38005,7 @@ 0, 0, 0, - 2, + 1, 0, 0, 0, @@ -38575,8 +38558,8 @@ "name": "MinimumPeriod", "ty": 12, "value": [ - 0, - 0, + 112, + 23, 0, 0, 0, @@ -39318,9 +39301,9 @@ "name": "PendingUsernameExpiration", "ty": 4, "value": [ - 192, - 137, - 1, + 224, + 196, + 0, 0 ], "docs": [ @@ -39860,7 +39843,7 @@ "name": "MaxVestingSchedules", "ty": 4, "value": [ - 56, + 28, 0, 0, 0 @@ -40082,8 +40065,8 @@ "name": "SlotDuration", "ty": 12, "value": [ - 112, - 23, + 224, + 46, 0, 0, 0, @@ -41452,10 +41435,10 @@ 1, 7, 0, - 136, - 82, - 106, - 116, + 162, + 148, + 26, + 29, 2, 0, 80, @@ -41604,10 +41587,10 @@ "value": [ 7, 0, - 16, - 165, - 212, - 232, + 68, + 41, + 53, + 58, 2, 0, 160, @@ -41802,9 +41785,9 @@ "name": "SpendPeriod", "ty": 4, "value": [ - 192, - 137, - 1, + 224, + 196, + 0, 0 ], "docs": [ @@ -41860,9 +41843,9 @@ "name": "PayoutPeriod", "ty": 4, "value": [ - 0, - 39, - 6, + 128, + 19, + 3, 0 ], "docs": [ @@ -42133,9 +42116,9 @@ "name": "TermDuration", "ty": 4, "value": [ - 0, - 39, - 6, + 128, + 19, + 3, 0 ], "docs": [ @@ -42391,10 +42374,10 @@ "value": [ 7, 0, - 16, - 165, - 212, - 232, + 68, + 41, + 53, + 58, 2, 0, 160, @@ -42500,13 +42483,12 @@ "name": "MaximumWeight", "ty": 10, "value": [ - 11, + 7, 0, - 152, - 247, - 62, - 93, - 1, + 230, + 189, + 79, + 87, 2, 0, 240, @@ -42831,8 +42813,8 @@ "ty": 4, "value": [ 0, - 194, - 1, + 225, + 0, 0 ], "docs": [ @@ -42847,9 +42829,9 @@ "name": "LaunchPeriod", "ty": 4, "value": [ - 192, - 137, - 1, + 224, + 196, + 0, 0 ], "docs": [ @@ -42860,9 +42842,9 @@ "name": "VotingPeriod", "ty": 4, "value": [ - 192, - 137, - 1, + 224, + 196, + 0, 0 ], "docs": [ @@ -42874,8 +42856,8 @@ "ty": 4, "value": [ 0, - 194, - 1, + 225, + 0, 0 ], "docs": [ @@ -42926,8 +42908,8 @@ "name": "FastTrackVotingPeriod", "ty": 4, "value": [ - 8, - 7, + 132, + 3, 0, 0 ], @@ -42939,9 +42921,9 @@ "name": "CooloffPeriod", "ty": 4, "value": [ - 192, - 137, - 1, + 224, + 196, + 0, 0 ], "docs": [ @@ -43667,49 +43649,6 @@ }, "ty": 592, "apis": [ - { - "name": "AuraUnincludedSegmentApi", - "methods": [ - { - "name": "can_build_upon", - "inputs": [ - { - "name": "included_hash", - "ty": 13 - }, - { - "name": "slot", - "ty": 439 - } - ], - "output": 8, - "docs": [ - " Whether it is legal to extend the chain, assuming the given block is the most", - " recently included one as-of the relay parent that will be built against, and", - " the given slot.", - "", - " This should be consistent with the logic the runtime uses when validating blocks to", - " avoid issues.", - "", - " When the unincluded segment is empty, i.e. `included_hash == at`, where at is the block", - " whose state we are querying against, this must always return `true` as long as the slot", - " is more recent than the included block itself." - ] - } - ], - "docs": [ - " This runtime API is used to inform potential block authors whether they will", - " have the right to author at a slot, assuming they have claimed the slot.", - "", - " In particular, this API allows Aura-based parachains to regulate their \"unincluded segment\",", - " which is the section of the head of the chain which has not yet been made available in the", - " relay chain.", - "", - " When the unincluded segment is short, Aura chains will allow authors to create multiple", - " blocks per slot in order to build a backlog. When it is saturated, this API will limit", - " the amount of blocks that can be created." - ] - }, { "name": "AuraApi", "methods": [ diff --git a/runtime/laos/src/tests/mod.rs b/runtime/laos/src/tests/mod.rs index c384007a6..ad9ae35aa 100644 --- a/runtime/laos/src/tests/mod.rs +++ b/runtime/laos/src/tests/mod.rs @@ -105,13 +105,13 @@ fn test_block_and_gas_limit_constants() { assert_ok!(system_block_weights.clone().validate()); // 0.5s of block time - assert_eq!(system_block_weights.max_block.ref_time(), 2_000_000_000_000); + assert_eq!(system_block_weights.max_block.ref_time(), 500_000_000_000); // EVM constants let block_gas_limit = ::BlockGasLimit::get(); // 15M gas - assert_eq!(block_gas_limit, U256::from(60_000_000)); + assert_eq!(block_gas_limit, U256::from(15_000_000)); } #[test] @@ -135,7 +135,7 @@ fn check_pallet_vesting_configuration() { ::UnvestedFundsAllowedWithdrawReasons::get(), WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE) ); - assert_eq!(::MAX_VESTING_SCHEDULES, 56); + assert_eq!(::MAX_VESTING_SCHEDULES, 28); } #[test] diff --git a/zombienet/download_polkadot.sh b/zombienet/download_polkadot.sh index be0a3a0f9..a365d8cc3 100755 --- a/zombienet/download_polkadot.sh +++ b/zombienet/download_polkadot.sh @@ -2,7 +2,7 @@ # Default version and download directory VERSION=${1:-"v1.11.0"} -DOWNLOAD_DIR=${2:-"./tmp"} # Default is tmp +DOWNLOAD_DIR=${2:-"./tmp"} # Default is the current directory BASE_URL="https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-$VERSION"