From a1ed285ddec0d4e5739ffa5ba3ebac034dc4afce Mon Sep 17 00:00:00 2001 From: Valery Gantchev Date: Fri, 30 Aug 2024 16:27:07 +0200 Subject: [PATCH] fmt and versions --- Cargo.lock | 4 +- node/Cargo.toml | 2 +- node/src/chain_spec/local.rs | 19 ++-- node/src/chain_spec/mod.rs | 178 +++++++++++++++++----------------- node/src/chain_spec/rococo.rs | 41 +++++--- runtime/basilisk/Cargo.toml | 2 +- runtime/basilisk/src/lib.rs | 15 ++- 7 files changed, 137 insertions(+), 124 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a605559966..58cdc5f718 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -871,7 +871,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basilisk" -version = "13.0.0" +version = "14.0.0" dependencies = [ "basilisk-runtime", "clap", @@ -953,7 +953,7 @@ dependencies = [ [[package]] name = "basilisk-runtime" -version = "117.0.0" +version = "118.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", diff --git a/node/Cargo.toml b/node/Cargo.toml index f7805d93f7..b7675c6791 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "basilisk" -version = "13.0.0" +version = "14.0.0" description = "Basilisk node" authors = ["GalacticCouncil"] edition = "2021" diff --git a/node/src/chain_spec/local.rs b/node/src/chain_spec/local.rs index 121406454d..0313397719 100644 --- a/node/src/chain_spec/local.rs +++ b/node/src/chain_spec/local.rs @@ -69,13 +69,13 @@ pub fn parachain_config() -> Result { ], // registered_assets vec![ - (b"KSM".to_vec(), 1_000u128, Some(1u32)), - (b"KUSD".to_vec(), 1_000u128, Some(2u32)), - ], + (b"KSM".to_vec(), 1_000u128, Some(1u32)), + (b"KUSD".to_vec(), 1_000u128, Some(2u32)), + ], // accepted_assets - vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], - // token_balances - vec![ + vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], + // token_balances + vec![ ( get_account_id_from_seed::("Alice"), vec![(1, INITIAL_TOKEN_BALANCE), (2, INITIAL_TOKEN_BALANCE)], @@ -85,8 +85,11 @@ pub fn parachain_config() -> Result { vec![(1, INITIAL_TOKEN_BALANCE), (2, INITIAL_TOKEN_BALANCE)], ), ], - // elections - vec![(get_account_id_from_seed::("Alice"), INITIAL_TOKEN_BALANCE),], + // elections + vec![( + get_account_id_from_seed::("Alice"), + INITIAL_TOKEN_BALANCE, + )], // parachain ID PARA_ID.into(), ); diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 442ef9a934..b6617f9a15 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -28,23 +28,19 @@ const TOKEN_DECIMALS: u8 = 12; const TOKEN_SYMBOL: &str = "BSX"; const PROTOCOL_ID: &str = "bsx"; -use basilisk_runtime::{ - AccountId, AuraId, Balance, RuntimeGenesisConfig, Signature, WASM_BINARY, -}; +use basilisk_runtime::{AccountId, AuraId, Balance, RuntimeGenesisConfig, Signature, WASM_BINARY}; use cumulus_primitives_core::ParaId; use hex_literal::hex; use primitives::{ constants::currency::{NATIVE_EXISTENTIAL_DEPOSIT, UNITS}, AssetId, Price, }; -use serde::{Deserialize, Serialize}; -use serde_json::map::Map; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; +use serde::{Deserialize, Serialize}; +use serde_json::map::Map; use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public}; -use sp_runtime::{ - traits::{IdentifyAccount, Verify}, -}; +use sp_runtime::traits::{IdentifyAccount, Verify}; /// The extensions for the [`ChainSpec`]. #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] @@ -96,90 +92,90 @@ pub fn parachain_genesis( parachain_id: ParaId, ) -> serde_json::Value { serde_json::json!({ - "system": {}, - "session": { - "keys": initial_authorities - .0 - .iter() - .cloned() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - basilisk_runtime::opaque::SessionKeys { aura }, // session keys - ) - }) - .collect::>(), - }, - "assetRegistry": { - "registeredAssets": registered_assets.clone(), - "nativeAssetName": TOKEN_SYMBOL.as_bytes().to_vec(), - "nativeExistentialDeposit": NATIVE_EXISTENTIAL_DEPOSIT, - }, - "aura": { - "authorities": Vec::::new() - }, - "auraExt": { - }, - "balances": { - "balances": endowed_accounts - .iter() - .cloned() - .map(|k| (k.0.clone(), k.1 * UNITS)) - .collect::>(), - }, - "collatorSelection": { - "invulnerables": initial_authorities.0.iter().cloned().map(|(acc, _)| acc).collect::>(), - "candidacyBond": initial_authorities.1, - "desiredCandidates": 0u32, - }, - "council": { - "members": council_members, - }, - "duster": { - "accountBlacklist": vec![get_account_id_from_seed::("Duster")], - "rewardAccount": Some(get_account_id_from_seed::("Duster")), - "dustAccount": Some(get_account_id_from_seed::("Duster")) - }, - "elections": { - "members": elections, - }, - "emaOracle": { - }, - "multiTransactionPayment": { - "currencies": accepted_assets, - "accountCurrencies": Vec::<(AccountId, AssetId)>::new(), - }, - "parachainInfo": { - "parachainId": parachain_id, - }, - "polkadotXcm": { - }, - "technicalCommittee": { - "members": tech_committee_members, - }, - "tokens": { - "balances": if registered_assets.is_empty() { - vec![] - } else { - token_balances + "system": {}, + "session": { + "keys": initial_authorities + .0 .iter() - .flat_map(|x| { - x.1.clone() - .into_iter() - .map(|(asset_id, amount)| (x.0.clone(), asset_id, amount)) + .cloned() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + basilisk_runtime::opaque::SessionKeys { aura }, // session keys + ) }) - .collect::>() + .collect::>(), + }, + "assetRegistry": { + "registeredAssets": registered_assets.clone(), + "nativeAssetName": TOKEN_SYMBOL.as_bytes().to_vec(), + "nativeExistentialDeposit": NATIVE_EXISTENTIAL_DEPOSIT, + }, + "aura": { + "authorities": Vec::::new() + }, + "auraExt": { + }, + "balances": { + "balances": endowed_accounts + .iter() + .cloned() + .map(|k| (k.0.clone(), k.1 * UNITS)) + .collect::>(), + }, + "collatorSelection": { + "invulnerables": initial_authorities.0.iter().cloned().map(|(acc, _)| acc).collect::>(), + "candidacyBond": initial_authorities.1, + "desiredCandidates": 0u32, }, - }, - "treasury": { - }, - "vesting": { - }, - "xykWarehouseLm": { - }, - "xykLiquidityMining": { - }, + "council": { + "members": council_members, + }, + "duster": { + "accountBlacklist": vec![get_account_id_from_seed::("Duster")], + "rewardAccount": Some(get_account_id_from_seed::("Duster")), + "dustAccount": Some(get_account_id_from_seed::("Duster")) + }, + "elections": { + "members": elections, + }, + "emaOracle": { + }, + "multiTransactionPayment": { + "currencies": accepted_assets, + "accountCurrencies": Vec::<(AccountId, AssetId)>::new(), + }, + "parachainInfo": { + "parachainId": parachain_id, + }, + "polkadotXcm": { + }, + "technicalCommittee": { + "members": tech_committee_members, + }, + "tokens": { + "balances": if registered_assets.is_empty() { + vec![] + } else { + token_balances + .iter() + .flat_map(|x| { + x.1.clone() + .into_iter() + .map(|(asset_id, amount)| (x.0.clone(), asset_id, amount)) + }) + .collect::>() + }, + }, + "treasury": { + }, + "vesting": { + }, + "xykWarehouseLm": { + }, + "xykLiquidityMining": { + }, + } + ) } -) -} \ No newline at end of file diff --git a/node/src/chain_spec/rococo.rs b/node/src/chain_spec/rococo.rs index 1edfb3337c..5dfc1c3023 100644 --- a/node/src/chain_spec/rococo.rs +++ b/node/src/chain_spec/rococo.rs @@ -15,13 +15,13 @@ pub fn parachain_config() -> Result { vec![ ( // 5CcMLZnK8RNMfurDsRXHwtabSKt8ZmG3ry5G3sAeRXfj4QK2 - hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].into(), - hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].unchecked_into(), + hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].into(), + hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].unchecked_into(), ), ( // 5CfHZGU9iFpv2mRd9jBDu1VT6yNPFL3xsjnk971bsGBmuZ8x - hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].into(), - hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].unchecked_into(), + hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].into(), + hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].unchecked_into(), ), ], // candidacy bond @@ -29,25 +29,34 @@ pub fn parachain_config() -> Result { ), // endowed_accounts vec![ - (hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into(), INITIAL_BALANCE), // sudo - (hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].into(), INITIAL_BALANCE), // collator-01 - (hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].into(), INITIAL_BALANCE), // collator-02 + ( + hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into(), + INITIAL_BALANCE, + ), // sudo + ( + hex!["1822c7a002c35274bd5da15690e9d0027d9d189998990fcefd4458f768109a57"].into(), + INITIAL_BALANCE, + ), // collator-01 + ( + hex!["1a5fc9b99feaac2b2dcb8473b1b8e5d641296394233685499b7222edceb40327"].into(), + INITIAL_BALANCE, + ), // collator-02 ], // council_members vec![get_account_id_from_seed::("Alice")], // tech_committee_members - vec![hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into()], // same as sudo + vec![hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into()], // same as sudo // registered_assets vec![ - (b"KSM".to_vec(), 1_000u128, Some(1u32)), - (b"KUSD".to_vec(), 1_000u128, Some(2u32)), - ], + (b"KSM".to_vec(), 1_000u128, Some(1u32)), + (b"KUSD".to_vec(), 1_000u128, Some(2u32)), + ], // accepted_assets - vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], - // token_balances - vec![], - // elections - vec![], + vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], + // token_balances + vec![], + // elections + vec![], // parachain ID PARA_ID.into(), ); diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index 1cb8ce8216..22aad7ab03 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "basilisk-runtime" -version = "117.0.0" +version = "118.0.0" authors = ["GalacticCouncil"] edition = "2021" homepage = "https://github.com/galacticcouncil/Basilisk-node" diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 6da4e8a3c4..ae94d816f0 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -47,9 +47,6 @@ pub use governance::*; pub use system::*; pub use xcm::*; -pub use primitives::{ - AccountId, Amount, AssetId, Balance, BlockNumber, CollectionId, Hash, Index, ItemId, Price, Signature, -}; use frame_support::sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdConversion, BlakeTwo256, Block as BlockT}, @@ -57,6 +54,9 @@ use frame_support::sp_runtime::{ ApplyExtrinsicResult, }; use frame_system::pallet_prelude::BlockNumberFor; +pub use primitives::{ + AccountId, Amount, AssetId, Balance, BlockNumber, CollectionId, Hash, Index, ItemId, Price, Signature, +}; use sp_api::impl_runtime_apis; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{ConstU32, OpaqueMetadata}; @@ -66,7 +66,12 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. -use frame_support::{construct_runtime, genesis_builder_helper::{build_config, create_default_config}, parameter_types, weights::Weight}; +use frame_support::{ + construct_runtime, + genesis_builder_helper::{build_config, create_default_config}, + parameter_types, + weights::Weight, +}; /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats @@ -101,7 +106,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("basilisk"), impl_name: create_runtime_str!("basilisk"), authoring_version: 1, - spec_version: 117, + spec_version: 118, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1,