Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion node/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "node-cli"
version = "0.9.12"
version = "0.9.16"
authors = ["Liebi Technologies <bifrost@liebi.com>"]
description = "Bifrost Parachain Node"
build = "build.rs"
Expand Down
10 changes: 2 additions & 8 deletions node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ pub struct ExportGenesisStateCommand {
#[structopt(parse(from_os_str))]
pub output: Option<PathBuf>,

/// Id of the parachain this state is for.
///
/// default 2001
#[structopt(long)]
pub parachain_id: Option<u32>,

/// Write output in binary. Default is to write in hex.
#[structopt(short, long)]
pub raw: bool,
Expand Down Expand Up @@ -136,9 +130,9 @@ pub struct Cli {
#[structopt(long)]
pub sealing: Option<String>,

/// Relaychain arguments
/// Relay chain arguments
#[structopt(raw = true)]
pub relaychain_args: Vec<String>,
pub relay_chain_args: Vec<String>,
}

#[derive(Debug)]
Expand Down
31 changes: 14 additions & 17 deletions node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ fn get_exec_name() -> Option<String> {
.and_then(|s| s.into_string().ok())
}

fn load_spec(
id: &str,
para_id: ParaId,
) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
let id = if id == "" {
let n = get_exec_name().unwrap_or_default();

Expand All @@ -65,35 +62,34 @@ 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(
&include_bytes!("../../service/res/bifrost-kusama.json")[..],
)?),
#[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" =>
Box::new(service::chain_spec::bifrost_polkadot::ChainSpec::from_json_bytes(
&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) {
Expand Down Expand Up @@ -170,7 +166,7 @@ impl SubstrateCli for Cli {
}

fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
load_spec(id, ParaId::from(id.parse::<u32>().unwrap_or(2001)))
load_spec(id)
}

fn native_runtime_version(spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
Expand Down Expand Up @@ -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::<polkadot_primitives::v0::AccountId>::into_account(&id);
Expand Down Expand Up @@ -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(
Expand Down
20 changes: 11 additions & 9 deletions node/service/src/chain_spec/asgard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, RelayExtensions

const ENDOWMENT: u128 = 1_000_000 * DOLLARS;

pub const PARA_ID: u32 = 2001;

fn asgard_properties() -> Properties {
let mut properties = sc_chain_spec::Properties::new();
let mut token_symbol: Vec<String> = vec![];
Expand Down Expand Up @@ -207,17 +209,17 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig {
)
}

pub fn development_config(id: ParaId) -> Result<ChainSpec, String> {
pub fn development_config() -> Result<ChainSpec, String> {
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 },
))
}

Expand Down Expand Up @@ -293,31 +295,31 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
)
}

pub fn local_testnet_config(id: ParaId) -> Result<ChainSpec, String> {
pub fn local_testnet_config() -> Result<ChainSpec, String> {
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 },
)
}

Expand Down
14 changes: 8 additions & 6 deletions node/service/src/chain_spec/bifrost_kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = vec![];
Expand Down Expand Up @@ -281,31 +283,31 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
)
}

pub fn local_testnet_config(id: ParaId) -> Result<ChainSpec, String> {
pub fn local_testnet_config() -> Result<ChainSpec, String> {
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 },
)
}

Expand Down
14 changes: 8 additions & 6 deletions node/service/src/chain_spec/bifrost_polkadot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = vec![];
Expand Down Expand Up @@ -186,31 +188,31 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
)
}

pub fn local_testnet_config(id: ParaId) -> Result<ChainSpec, String> {
pub fn local_testnet_config() -> Result<ChainSpec, String> {
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 },
)
}

Expand Down
5 changes: 1 addition & 4 deletions runtime/asgard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion runtime/bifrost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down