Skip to content

Commit

Permalink
fmt and versions
Browse files Browse the repository at this point in the history
  • Loading branch information
vgantchev committed Aug 30, 2024
1 parent 75c7aa6 commit a1ed285
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 124 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "basilisk"
version = "13.0.0"
version = "14.0.0"
description = "Basilisk node"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
19 changes: 11 additions & 8 deletions node/src/chain_spec/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
],
// 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::<sr25519::Public>("Alice"),
vec![(1, INITIAL_TOKEN_BALANCE), (2, INITIAL_TOKEN_BALANCE)],
Expand All @@ -85,8 +85,11 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
vec![(1, INITIAL_TOKEN_BALANCE), (2, INITIAL_TOKEN_BALANCE)],
),
],
// elections
vec![(get_account_id_from_seed::<sr25519::Public>("Alice"), INITIAL_TOKEN_BALANCE),],
// elections
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
INITIAL_TOKEN_BALANCE,
)],
// parachain ID
PARA_ID.into(),
);
Expand Down
178 changes: 87 additions & 91 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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::<Vec<_>>(),
},
"assetRegistry": {
"registeredAssets": registered_assets.clone(),
"nativeAssetName": TOKEN_SYMBOL.as_bytes().to_vec(),
"nativeExistentialDeposit": NATIVE_EXISTENTIAL_DEPOSIT,
},
"aura": {
"authorities": Vec::<sp_consensus_aura::sr25519::AuthorityId>::new()
},
"auraExt": {
},
"balances": {
"balances": endowed_accounts
.iter()
.cloned()
.map(|k| (k.0.clone(), k.1 * UNITS))
.collect::<Vec<_>>(),
},
"collatorSelection": {
"invulnerables": initial_authorities.0.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": initial_authorities.1,
"desiredCandidates": 0u32,
},
"council": {
"members": council_members,
},
"duster": {
"accountBlacklist": vec![get_account_id_from_seed::<sr25519::Public>("Duster")],
"rewardAccount": Some(get_account_id_from_seed::<sr25519::Public>("Duster")),
"dustAccount": Some(get_account_id_from_seed::<sr25519::Public>("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::<Vec<_>>()
.collect::<Vec<_>>(),
},
"assetRegistry": {
"registeredAssets": registered_assets.clone(),
"nativeAssetName": TOKEN_SYMBOL.as_bytes().to_vec(),
"nativeExistentialDeposit": NATIVE_EXISTENTIAL_DEPOSIT,
},
"aura": {
"authorities": Vec::<sp_consensus_aura::sr25519::AuthorityId>::new()
},
"auraExt": {
},
"balances": {
"balances": endowed_accounts
.iter()
.cloned()
.map(|k| (k.0.clone(), k.1 * UNITS))
.collect::<Vec<_>>(),
},
"collatorSelection": {
"invulnerables": initial_authorities.0.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": initial_authorities.1,
"desiredCandidates": 0u32,
},
},
"treasury": {
},
"vesting": {
},
"xykWarehouseLm": {
},
"xykLiquidityMining": {
},
"council": {
"members": council_members,
},
"duster": {
"accountBlacklist": vec![get_account_id_from_seed::<sr25519::Public>("Duster")],
"rewardAccount": Some(get_account_id_from_seed::<sr25519::Public>("Duster")),
"dustAccount": Some(get_account_id_from_seed::<sr25519::Public>("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::<Vec<_>>()
},
},
"treasury": {
},
"vesting": {
},
"xykWarehouseLm": {
},
"xykLiquidityMining": {
},
}
)
}
)
}
41 changes: 25 additions & 16 deletions node/src/chain_spec/rococo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,48 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
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
10_000 * UNITS,
),
// 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::<sr25519::Public>("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(),
);
Expand Down
2 changes: 1 addition & 1 deletion runtime/basilisk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
15 changes: 10 additions & 5 deletions runtime/basilisk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ 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},
transaction_validity::{TransactionSource, TransactionValidity},
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};
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a1ed285

Please sign in to comment.