diff --git a/Cargo.lock b/Cargo.lock index 70742ae5ba..996928e7bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5035,7 +5035,7 @@ dependencies = [ [[package]] name = "node-cli" -version = "0.9.12" +version = "0.9.16" dependencies = [ "cumulus-client-cli", "cumulus-client-service", diff --git a/Cargo.toml b/Cargo.toml index 99cb45c58d..386d3a9acf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -202,7 +202,6 @@ zenlink-protocol-rpc = { git = "https://github.com/zenlinkpro/Zenlink-DEX-Module zenlink-protocol-runtime-api = { git = "https://github.com/zenlinkpro/Zenlink-DEX-Module", rev = "e5747a897cfd0fb5d322781ffe656220ae1e814f" } merkle-distributor = { git = "https://github.com/zenlinkpro/merkle-distributor", rev = "e9bba954baaa0b1539e2647988da35f5fe81b0b3" } - orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "17a791edf431d7d7aee1ea3dfaeeb7bc21944301" } orml-currencies = {git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "17a791edf431d7d7aee1ea3dfaeeb7bc21944301" } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "17a791edf431d7d7aee1ea3dfaeeb7bc21944301" } diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index fa86f8aea3..d3ddb825ec 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-cli" -version = "0.9.12" +version = "0.9.16" authors = ["Liebi Technologies "] description = "Bifrost Parachain Node" build = "build.rs" diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index 70a50bb34e..fadd90dca8 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -89,12 +89,6 @@ pub struct ExportGenesisStateCommand { #[structopt(parse(from_os_str))] pub output: Option, - /// Id of the parachain this state is for. - /// - /// default 2001 - #[structopt(long)] - pub parachain_id: Option, - /// Write output in binary. Default is to write in hex. #[structopt(short, long)] pub raw: bool, @@ -136,9 +130,9 @@ pub struct Cli { #[structopt(long)] pub sealing: Option, - /// Relaychain arguments + /// Relay chain arguments #[structopt(raw = true)] - pub relaychain_args: Vec, + pub relay_chain_args: Vec, } #[derive(Debug)] diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index b48666e1b2..cb3dabe82e 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -44,10 +44,7 @@ fn get_exec_name() -> Option { .and_then(|s| s.into_string().ok()) } -fn load_spec( - id: &str, - para_id: ParaId, -) -> std::result::Result, String> { +fn load_spec(id: &str) -> std::result::Result, String> { let id = if id == "" { let n = get_exec_name().unwrap_or_default(); @@ -65,9 +62,9 @@ fn load_spec( &include_bytes!("../../service/res/asgard.json")[..], )?), #[cfg(feature = "with-asgard-runtime")] - "asgard-genesis" => Box::new(service::chain_spec::asgard::chainspec_config(para_id)), + "asgard-genesis" => Box::new(service::chain_spec::asgard::chainspec_config()), #[cfg(feature = "with-asgard-runtime")] - "asgard-local" => Box::new(service::chain_spec::asgard::local_testnet_config(para_id)?), + "asgard-local" => Box::new(service::chain_spec::asgard::local_testnet_config()?), #[cfg(any(feature = "with-bifrost-kusama-runtime", feature = "with-bifrost-runtime"))] "bifrost" | "bifrost-kusama" => Box::new(service::chain_spec::bifrost_kusama::ChainSpec::from_json_bytes( @@ -75,10 +72,10 @@ fn load_spec( )?), #[cfg(any(feature = "with-bifrost-kusama-runtime", feature = "with-bifrost-runtime"))] "bifrost-genesis" | "bifrost-kusama-genesis" => - Box::new(service::chain_spec::bifrost_kusama::chainspec_config(para_id)), + Box::new(service::chain_spec::bifrost_kusama::chainspec_config()), #[cfg(any(feature = "with-bifrost-kusama-runtime", feature = "with-bifrost-runtime"))] "bifrost-local" | "bifrost-kusama-local" => - Box::new(service::chain_spec::bifrost_kusama::local_testnet_config(para_id)?), + Box::new(service::chain_spec::bifrost_kusama::local_testnet_config()?), #[cfg(any(feature = "with-bifrost-polkadot-runtime", feature = "with-bifrost-runtime"))] "bifrost-polkadot" => @@ -86,14 +83,13 @@ fn load_spec( &include_bytes!("../../service/res/bifrost-polkadot.json")[..], )?), #[cfg(any(feature = "with-bifrost-polkadot-runtime", feature = "with-bifrost-runtime"))] - "bifrost-polkadot-genesis" => - Box::new(service::chain_spec::bifrost_polkadot::chainspec_config(para_id)), + "bifrost-polkadot-genesis" => Box::new(service::chain_spec::bifrost_polkadot::chainspec_config()), #[cfg(any(feature = "with-bifrost-polkadot-runtime", feature = "with-bifrost-runtime"))] "bifrost-polkadot-local" => - Box::new(service::chain_spec::bifrost_polkadot::local_testnet_config(para_id)?), + Box::new(service::chain_spec::bifrost_polkadot::local_testnet_config()?), #[cfg(feature = "with-asgard-runtime")] - "dev" => Box::new(service::chain_spec::asgard::development_config(para_id)?), + "dev" => Box::new(service::chain_spec::asgard::development_config()?), path => { let path = std::path::PathBuf::from(path); if path.to_str().map(|s| s.contains("asgard")) == Some(true) { @@ -170,7 +166,7 @@ impl SubstrateCli for Cli { } fn load_spec(&self, id: &str) -> std::result::Result, String> { - load_spec(id, ParaId::from(id.parse::().unwrap_or(2001))) + load_spec(id) } fn native_runtime_version(spec: &Box) -> &'static RuntimeVersion { @@ -359,16 +355,17 @@ pub fn run() -> Result<()> { let para_id = node_service::chain_spec::RelayExtensions::try_get(&*config.chain_spec) - .map(|e| e.para_id); + .map(|e| e.para_id) + .ok_or_else(|| "Could not find parachain ID in chain-spec.")?; let polkadot_cli = RelayChainCli::new( &config, [RelayChainCli::executable_name().to_string()] .iter() - .chain(cli.relaychain_args.iter()), + .chain(cli.relay_chain_args.iter()), ); - let id = ParaId::from(para_id.unwrap_or(2001)); + let id = ParaId::from(para_id); let parachain_account = AccountIdConversion::::into_account(&id); @@ -488,7 +485,7 @@ pub fn run() -> Result<()> { &config, [RelayChainCli::executable_name().to_string()] .iter() - .chain(cli.relaychain_args.iter()), + .chain(cli.relay_chain_args.iter()), ); let polkadot_config = SubstrateCli::create_configuration( diff --git a/node/service/src/chain_spec/asgard.rs b/node/service/src/chain_spec/asgard.rs index 36822cd5b7..e142299156 100644 --- a/node/service/src/chain_spec/asgard.rs +++ b/node/service/src/chain_spec/asgard.rs @@ -44,6 +44,8 @@ pub type ChainSpec = sc_service::GenericChainSpec Properties { let mut properties = sc_chain_spec::Properties::new(); let mut token_symbol: Vec = vec![]; @@ -207,17 +209,17 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig { ) } -pub fn development_config(id: ParaId) -> Result { +pub fn development_config() -> Result { Ok(ChainSpec::from_genesis( "Development", "dev", ChainType::Development, - move || development_config_genesis(id), + move || development_config_genesis(PARA_ID.into()), vec![], None, Some(DEFAULT_PROTOCOL_ID), Some(asgard_properties()), - RelayExtensions { relay_chain: "westend-dev".into(), para_id: id.into() }, + RelayExtensions { relay_chain: "westend-dev".into(), para_id: PARA_ID }, )) } @@ -293,31 +295,31 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig { ) } -pub fn local_testnet_config(id: ParaId) -> Result { +pub fn local_testnet_config() -> Result { Ok(ChainSpec::from_genesis( "Asgard Local Testnet", "asgard_local_testnet", ChainType::Local, - move || local_config_genesis(id), + move || local_config_genesis(PARA_ID.into()), vec![], None, Some(DEFAULT_PROTOCOL_ID), Some(asgard_properties()), - RelayExtensions { relay_chain: "westend-local".into(), para_id: id.into() }, + RelayExtensions { relay_chain: "westend-local".into(), para_id: PARA_ID }, )) } -pub fn chainspec_config(id: ParaId) -> ChainSpec { +pub fn chainspec_config() -> ChainSpec { ChainSpec::from_genesis( "Bifrost Asgard CC4", "asgard_testnet", ChainType::Custom("Asgard Testnet".into()), - move || asgard_config_genesis(id), + move || asgard_config_genesis(PARA_ID.into()), vec![], TelemetryEndpoints::new(vec![(TELEMETRY_URL.into(), 0)]).ok(), Some(DEFAULT_PROTOCOL_ID), Some(asgard_properties()), - RelayExtensions { relay_chain: "westend".into(), para_id: id.into() }, + RelayExtensions { relay_chain: "westend".into(), para_id: PARA_ID }, ) } diff --git a/node/service/src/chain_spec/bifrost_kusama.rs b/node/service/src/chain_spec/bifrost_kusama.rs index 08e05c9e16..ad0243a771 100644 --- a/node/service/src/chain_spec/bifrost_kusama.rs +++ b/node/service/src/chain_spec/bifrost_kusama.rs @@ -54,6 +54,8 @@ pub fn ENDOWMENT() -> u128 { 1_000_000 * dollar(CurrencyId::Native(TokenSymbol::BNC)) } +pub const PARA_ID: u32 = 2001; + fn bifrost_kusama_properties() -> Properties { let mut properties = sc_chain_spec::Properties::new(); let mut token_symbol: Vec = vec![]; @@ -281,31 +283,31 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig { ) } -pub fn local_testnet_config(id: ParaId) -> Result { +pub fn local_testnet_config() -> Result { Ok(ChainSpec::from_genesis( "Bifrost Local Testnet", "bifrost_local_testnet", ChainType::Local, - move || local_config_genesis(id), + move || local_config_genesis(PARA_ID.into()), vec![], None, Some(DEFAULT_PROTOCOL_ID), Some(bifrost_kusama_properties()), - RelayExtensions { relay_chain: "kusama-local".into(), para_id: id.into() }, + RelayExtensions { relay_chain: "kusama-local".into(), para_id: PARA_ID }, )) } -pub fn chainspec_config(id: ParaId) -> ChainSpec { +pub fn chainspec_config() -> ChainSpec { ChainSpec::from_genesis( "Bifrost", "bifrost", ChainType::Live, - move || bifrost_config_genesis(id), + move || bifrost_config_genesis(PARA_ID.into()), vec![], TelemetryEndpoints::new(vec![(TELEMETRY_URL.into(), 0)]).ok(), Some(DEFAULT_PROTOCOL_ID), Some(bifrost_kusama_properties()), - RelayExtensions { relay_chain: "kusama".into(), para_id: id.into() }, + RelayExtensions { relay_chain: "kusama".into(), para_id: PARA_ID }, ) } diff --git a/node/service/src/chain_spec/bifrost_polkadot.rs b/node/service/src/chain_spec/bifrost_polkadot.rs index 19bcf2892b..7ffdab309f 100644 --- a/node/service/src/chain_spec/bifrost_polkadot.rs +++ b/node/service/src/chain_spec/bifrost_polkadot.rs @@ -45,6 +45,8 @@ pub fn ENDOWMENT() -> u128 { 1_000_000 * dollar(CurrencyId::Native(TokenSymbol::BNC)) } +pub const PARA_ID: u32 = 2001; + fn bifrost_polkadot_properties() -> Properties { let mut properties = sc_chain_spec::Properties::new(); let mut token_symbol: Vec = vec![]; @@ -186,31 +188,31 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig { ) } -pub fn local_testnet_config(id: ParaId) -> Result { +pub fn local_testnet_config() -> Result { Ok(ChainSpec::from_genesis( "Bifrost Polkadot Local Testnet", "bifrost_polkadot_local_testnet", ChainType::Local, - move || local_config_genesis(id), + move || local_config_genesis(PARA_ID.into()), vec![], None, Some(DEFAULT_PROTOCOL_ID), Some(bifrost_polkadot_properties()), - RelayExtensions { relay_chain: "polkadot-local".into(), para_id: id.into() }, + RelayExtensions { relay_chain: "polkadot-local".into(), para_id: PARA_ID }, )) } -pub fn chainspec_config(id: ParaId) -> ChainSpec { +pub fn chainspec_config() -> ChainSpec { ChainSpec::from_genesis( "Bifrost Polkadot", "bifrost_polkadot", ChainType::Live, - move || bifrost_polkadot_config_genesis(id), + move || bifrost_polkadot_config_genesis(PARA_ID.into()), vec![], TelemetryEndpoints::new(vec![(TELEMETRY_URL.into(), 0)]).ok(), Some(DEFAULT_PROTOCOL_ID), Some(bifrost_polkadot_properties()), - RelayExtensions { relay_chain: "polkadot".into(), para_id: id.into() }, + RelayExtensions { relay_chain: "polkadot".into(), para_id: PARA_ID }, ) } diff --git a/runtime/asgard/src/lib.rs b/runtime/asgard/src/lib.rs index 582a3de9af..7dff4adf5f 100644 --- a/runtime/asgard/src/lib.rs +++ b/runtime/asgard/src/lib.rs @@ -92,10 +92,7 @@ use bifrost_runtime_common::{ use codec::{Decode, Encode, MaxEncodedLen}; use constants::currency::*; use cumulus_primitives_core::ParaId as CumulusParaId; -use frame_support::{ - sp_runtime::traits::Convert, - traits::{EnsureOrigin, OnRuntimeUpgrade}, -}; +use frame_support::{sp_runtime::traits::Convert, traits::EnsureOrigin}; pub use node_primitives::{ traits::CheckSubAccount, AccountId, Amount, Balance, BlockNumber, CurrencyId, ExtraFeeName, Moment, Nonce, ParaId, ParachainDerivedProxyAccountType, ParachainTransactProxyType, diff --git a/runtime/bifrost/src/lib.rs b/runtime/bifrost/src/lib.rs index 82bf26f70d..1dad4c374e 100644 --- a/runtime/bifrost/src/lib.rs +++ b/runtime/bifrost/src/lib.rs @@ -136,7 +136,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("bifrost"), impl_name: create_runtime_str!("bifrost"), authoring_version: 1, - spec_version: 912, + spec_version: 916, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1,