Skip to content

Commit

Permalink
Fix turing node complilation
Browse files Browse the repository at this point in the history
  • Loading branch information
imstar15 committed Aug 1, 2024
1 parent 5d871e6 commit 75fc19c
Show file tree
Hide file tree
Showing 27 changed files with 776 additions and 5,737 deletions.
822 changes: 354 additions & 468 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resolver = "2"

members = [
"node",
"runtime/*",
"runtime/turing",
"pallets/automation-price",
"pallets/automation-time",
"pallets/automation-time/rpc",
Expand Down
17 changes: 9 additions & 8 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ path = "src/main.rs"

[features]
runtime-benchmarks = [
"neumann-runtime/runtime-benchmarks",
"oak-runtime/runtime-benchmarks",
# "neumann-runtime/runtime-benchmarks",
# "oak-runtime/runtime-benchmarks",
"turing-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
]
neumann-node = ["neumann-runtime"]
oak-node = ["oak-runtime"]
#neumann-node = ["neumann-runtime"]
#oak-node = ["oak-runtime"]
turing-node = ["turing-runtime"]
all-nodes = ["neumann-node", "turing-node", "oak-node"]
#all-nodes = ["neumann-node", "turing-node", "oak-node"]
all-nodes = ["turing-node"]
try-runtime = [
"try-runtime-cli/try-runtime",
"turing-runtime/try-runtime",
"oak-runtime/try-runtime",
# "oak-runtime/try-runtime",
]

[dependencies]
Expand All @@ -51,8 +52,8 @@ jsonrpsee = { version = "0.16.2", features = ["server"] }

# Local Dependencies
common-runtime = { path = "../runtime/common" }
neumann-runtime = { path = "../runtime/neumann", optional = true }
oak-runtime = { path = '../runtime/oak', optional = true }
#neumann-runtime = { path = "../runtime/neumann", optional = true }
#oak-runtime = { path = '../runtime/oak', optional = true }
turing-runtime = { path = '../runtime/turing', optional = true }
pallet-automation-time-rpc = { path = "../pallets/automation-time/rpc" }
pallet-automation-price-rpc = { path = "../pallets/automation-price/rpc" }
Expand Down
90 changes: 48 additions & 42 deletions node/src/chain_spec/turing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ use crate::chain_spec::{
Extensions,
};
use codec::Encode;
use common_runtime::constants::currency::{DOLLAR, TOKEN_DECIMALS};
use common_runtime::{
constants::currency::{DOLLAR, TOKEN_DECIMALS},
config::orml_asset_registry::{StringLimit, AssetMetadataOf},
};
use primitives::{assets::CustomMetadata, AccountId, AuraId, Balance, TokenId};
use turing_runtime::{
AssetRegistryConfig, CouncilConfig, PolkadotXcmConfig, TechnicalMembershipConfig, ValveConfig,
VestingConfig,
AssetRegistryConfig, CouncilConfig, PolkadotXcmConfig, TechnicalMembershipConfig,
// ValveConfig, VestingConfig,
};
use xcm::{prelude::*, VersionedMultiLocation::V3};
use frame_support::{
traits::{ ConstU32 }, BoundedVec,
};

const TOKEN_SYMBOL: &str = "TUR";
const SS_58_FORMAT: u32 = 51;
Expand Down Expand Up @@ -85,11 +91,11 @@ pub fn turing_development_config() -> ChainSpec {
vec![
(
1,
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata>::encode(
&orml_asset_registry::AssetMetadata {
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata, StringLimit>::encode(
&AssetMetadataOf {
decimals: 18,
name: b"Mangata Rococo".to_vec(),
symbol: b"MGR".to_vec(),
name: BoundedVec::truncate_from(b"Mangata Rococo".to_vec()),
symbol: BoundedVec::truncate_from(b"MGR".to_vec()),
existential_deposit: Default::default(),
location: Some(
MultiLocation::new(
Expand All @@ -110,11 +116,11 @@ pub fn turing_development_config() -> ChainSpec {
),
(
2,
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata>::encode(
&orml_asset_registry::AssetMetadata {
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata, StringLimit>::encode(
&AssetMetadataOf {
decimals: 18,
name: b"Rocstar".to_vec(),
symbol: b"RSTR".to_vec(),
name: BoundedVec::truncate_from(b"Rocstar".to_vec()),
symbol: BoundedVec::truncate_from(b"RSTR".to_vec()),
existential_deposit: 10_000_000_000_000_000,
location: Some(MultiLocation::new(1, X1(Parachain(2006))).into()),
additional: CustomMetadata {
Expand All @@ -126,11 +132,11 @@ pub fn turing_development_config() -> ChainSpec {
),
(
3,
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata>::encode(
&orml_asset_registry::AssetMetadata {
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata, StringLimit>::encode(
&AssetMetadataOf {
decimals: 18,
name: b"Shiden".to_vec(),
symbol: b"SDN".to_vec(),
name: BoundedVec::truncate_from(b"Shiden".to_vec()),
symbol: BoundedVec::truncate_from(b"SDN".to_vec()),
existential_deposit: 10_000_000_000_000_000,
location: Some(MultiLocation::new(1, X1(Parachain(2007))).into()),
additional: CustomMetadata {
Expand All @@ -142,11 +148,11 @@ pub fn turing_development_config() -> ChainSpec {
),
(
4,
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata>::encode(
&orml_asset_registry::AssetMetadata {
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata, StringLimit>::encode(
&AssetMetadataOf {
decimals: 18,
name: b"Shibuya".to_vec(),
symbol: b"SBY".to_vec(),
name: BoundedVec::truncate_from(b"Shibuya".to_vec()),
symbol: BoundedVec::truncate_from(b"SBY".to_vec()),
existential_deposit: 10_000_000_000_000_000,
location: Some(MultiLocation::new(1, X1(Parachain(2000))).into()),
additional: CustomMetadata {
Expand All @@ -158,11 +164,11 @@ pub fn turing_development_config() -> ChainSpec {
),
(
5,
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata>::encode(
&orml_asset_registry::AssetMetadata {
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata, StringLimit>::encode(
&AssetMetadataOf {
decimals: 18,
name: b"Moonbase".to_vec(),
symbol: b"DEV".to_vec(),
name: BoundedVec::truncate_from(b"Moonbase".to_vec()),
symbol: BoundedVec::truncate_from(b"DEV".to_vec()),
existential_deposit: 1,
location: Some(
MultiLocation::new(1, X2(Parachain(1000), PalletInstance(3)))
Expand Down Expand Up @@ -214,11 +220,11 @@ fn testnet_genesis(
let assets = [
vec![(
0,
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata>::encode(
&orml_asset_registry::AssetMetadata {
orml_asset_registry::AssetMetadata::<Balance, CustomMetadata, StringLimit>::encode(
&AssetMetadataOf {
decimals: TOKEN_DECIMALS,
name: "Native".as_bytes().to_vec(),
symbol: TOKEN_SYMBOL.as_bytes().to_vec(),
name: BoundedVec::truncate_from(b"Native".to_vec()),
symbol: BoundedVec::truncate_from(TOKEN_SYMBOL.as_bytes().to_vec()),
existential_deposit: 100_000_000,
location: Some(V3(MultiLocation { parents: 0, interior: Here })),
additional: CustomMetadata {
Expand Down Expand Up @@ -255,19 +261,19 @@ fn testnet_genesis(
})
.collect(),
},
parachain_staking: turing_runtime::ParachainStakingConfig {
candidates: invulnerables
.iter()
.cloned()
.map(|(acc, _)| (acc, candidate_stake))
.collect(),
delegations: vec![],
inflation_config: inflation_config(600, 5),
blocks_per_round: 600,
collator_commission: Perbill::from_percent(20),
parachain_bond_reserve_percent: Percent::from_percent(30),
num_selected_candidates: NUM_SELECTED_CANDIDATES,
},
// parachain_staking: turing_runtime::ParachainStakingConfig {
// candidates: invulnerables
// .iter()
// .cloned()
// .map(|(acc, _)| (acc, candidate_stake))
// .collect(),
// delegations: vec![],
// inflation_config: inflation_config(600, 5),
// blocks_per_round: 600,
// collator_commission: Perbill::from_percent(20),
// parachain_bond_reserve_percent: Percent::from_percent(30),
// num_selected_candidates: NUM_SELECTED_CANDIDATES,
// },
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this.
aura: Default::default(),
Expand All @@ -283,8 +289,8 @@ fn testnet_genesis(
parachain_system: Default::default(),
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
treasury: Default::default(),
valve: ValveConfig { start_with_valve_closed: false, closed_gates: pallet_gates_closed },
vesting: VestingConfig { vesting_schedule },
// valve: ValveConfig { start_with_valve_closed: false, closed_gates: pallet_gates_closed },
// vesting: VestingConfig { vesting_schedule },
asset_registry: AssetRegistryConfig { assets, last_asset_id },
}
}
Expand Down
34 changes: 0 additions & 34 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,34 +108,6 @@ impl SubstrateCli for Cli {
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
load_spec(id)
}

fn native_runtime_version(
chain_spec: &Box<dyn sc_service::ChainSpec>,
) -> &'static RuntimeVersion {
match chain_spec {
chain_spec if chain_spec.is_turing() => {
#[cfg(not(feature = "turing-node"))]
panic!("{}", service::TURING_RUNTIME_NOT_AVAILABLE);

#[cfg(feature = "turing-node")]
return &service::turing_runtime::VERSION;
},
chain_spec if chain_spec.is_oak() => {
#[cfg(not(feature = "oak-node"))]
panic!("{}", service::OAK_RUNTIME_NOT_AVAILABLE);

#[cfg(feature = "oak-node")]
return &service::oak_runtime::VERSION;
},
_ => {
#[cfg(not(feature = "neumann-node"))]
panic!("{}", service::NEUMANN_RUNTIME_NOT_AVAILABLE);

#[cfg(feature = "neumann-node")]
return &service::neumann_runtime::VERSION;
},
}
}
}

impl SubstrateCli for RelayChainCli {
Expand Down Expand Up @@ -179,12 +151,6 @@ impl SubstrateCli for RelayChainCli {
.load_spec(id),
}
}

fn native_runtime_version(
chain_spec: &Box<dyn sc_service::ChainSpec>,
) -> &'static RuntimeVersion {
polkadot_cli::Cli::native_runtime_version(chain_spec)
}
}

macro_rules! construct_async_run {
Expand Down
Loading

0 comments on commit 75fc19c

Please sign in to comment.