Skip to content

Commit

Permalink
Merge pull request #1109 from subspace/dev_net
Browse files Browse the repository at this point in the history
  • Loading branch information
vedhavyas authored Jan 26, 2023
2 parents 9ce0ed8 + 51b8afa commit 843afcb
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 138 deletions.
118 changes: 118 additions & 0 deletions crates/subspace-node/res/chain-spec-raw-devnet.json

Large diffs are not rendered by default.

115 changes: 0 additions & 115 deletions crates/subspace-node/res/chain-spec-raw-x-net-2.json

This file was deleted.

20 changes: 10 additions & 10 deletions crates/subspace-node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use system_domain_runtime::GenesisConfig as SystemDomainGenesisConfig;

const SUBSPACE_TELEMETRY_URL: &str = "wss://telemetry.subspace.network/submit/";
const GEMINI_3C_CHAIN_SPEC: &[u8] = include_bytes!("../res/chain-spec-raw-gemini-3c.json");
const X_NET_2_CHAIN_SPEC: &[u8] = include_bytes!("../res/chain-spec-raw-x-net-2.json");
const DEVNET_CHAIN_SPEC: &[u8] = include_bytes!("../res/chain-spec-raw-devnet.json");

/// List of accounts which should receive token grants, amounts are specified in SSC.
const TOKEN_GRANTS: &[(&str, u128)] = &[
Expand Down Expand Up @@ -161,19 +161,19 @@ pub fn gemini_3c_compiled(
))
}

pub fn x_net_2_config(
pub fn devnet_config(
) -> Result<ConsensusChainSpec<GenesisConfig, SystemDomainGenesisConfig>, String> {
ConsensusChainSpec::from_json_bytes(X_NET_2_CHAIN_SPEC)
ConsensusChainSpec::from_json_bytes(DEVNET_CHAIN_SPEC)
}

pub fn x_net_2_config_compiled(
pub fn devnet_config_compiled(
) -> Result<ConsensusChainSpec<GenesisConfig, SystemDomainGenesisConfig>, String> {
Ok(ConsensusChainSpec::from_genesis(
// Name
"Subspace X-Net 2",
"Subspace Dev network",
// ID
"subspace_x_net_2a",
ChainType::Custom("Subspace X-Net 2".to_string()),
"subspace_devnet",
ChainType::Custom("Testnet".to_string()),
|| {
let sudo_account =
AccountId::from_ss58check("5CXTmJEusve5ixyJufqHThmy4qUrrm6FyLCR7QfE4bbyMTNC")
Expand Down Expand Up @@ -226,7 +226,7 @@ pub fn x_net_2_config_compiled(
enable_storage_access: false,
allow_authoring_by: AllowAuthoringBy::FirstFarmer,
enable_executor: true,
enable_transfer: false,
enable_transfer: true,
},
)
},
Expand All @@ -238,13 +238,13 @@ pub fn x_net_2_config_compiled(
.map_err(|error| error.to_string())?,
),
// Protocol ID
Some("subspace-x-net-2a"),
Some("subspace-devnet"),
None,
// Properties
Some(chain_spec_properties()),
// Extensions
ChainSpecExtensions {
execution_chain_spec: system_domain::chain_spec::x_net_2_config(),
execution_chain_spec: system_domain::chain_spec::devnet_config(),
},
))
}
Expand Down
1 change: 1 addition & 0 deletions crates/subspace-node/src/core_domain/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ impl SubstrateCli for CoreDomainCli {
DomainId::CORE_PAYMENTS => match id {
"dev" => core_payments_chain_spec::development_config(),
"gemini-3c" => core_payments_chain_spec::gemini_3c_config(),
"devnet" => core_payments_chain_spec::devnet_config(),
"" | "local" => core_payments_chain_spec::local_testnet_config(),
path => core_payments_chain_spec::ChainSpec::from_json_file(
std::path::PathBuf::from(path),
Expand Down
41 changes: 41 additions & 0 deletions crates/subspace-node/src/core_domain/core_payments_chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,47 @@ pub fn gemini_3c_config() -> ExecutionChainSpec<GenesisConfig> {
)
}

pub fn devnet_config() -> ExecutionChainSpec<GenesisConfig> {
ExecutionChainSpec::from_genesis(
// Name
"Subspace Devnet Core Payments Domain",
// ID
"subspace_devnet_core_payments_domain",
ChainType::Custom("Testnet".to_string()),
move || {
let sudo_account =
AccountId::from_ss58check("5CXTmJEusve5ixyJufqHThmy4qUrrm6FyLCR7QfE4bbyMTNC")
.expect("Invalid Sudo account");
testnet_genesis(
vec![
// Genesis executor
AccountId::from_ss58check("5Df6w8CgYY8kTRwCu8bjBsFu46fy4nFa61xk6dUbL6G4fFjQ")
.expect("Wrong executor account address"),
// Sudo account
sudo_account.clone(),
],
Some(sudo_account.clone()),
vec![(
sudo_account,
RelayerId::from_ss58check("5D7kgfacBsP6pkMB628221HG98mz2euaytthdoeZPGceQusS")
.expect("Wrong relayer account address"),
)],
)
},
// Bootnodes
vec![],
// Telemetry
None,
// Protocol ID
Some("subspace-devnet-core-payments-domain"),
None,
// Properties
Some(chain_spec_properties()),
// Extensions
None,
)
}

fn testnet_genesis(
endowed_accounts: Vec<AccountId>,
maybe_sudo_account: Option<AccountId>,
Expand Down
4 changes: 2 additions & 2 deletions crates/subspace-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ impl SubstrateCli for Cli {
let mut chain_spec = match id {
"gemini-3c" => chain_spec::gemini_3c()?,
"gemini-3c-compiled" => chain_spec::gemini_3c_compiled()?,
"x-net-2" => chain_spec::x_net_2_config()?,
"x-net-2-compiled" => chain_spec::x_net_2_config_compiled()?,
"devnet" => chain_spec::devnet_config()?,
"devnet-compiled" => chain_spec::devnet_config_compiled()?,
"dev" => chain_spec::dev_config()?,
"" | "local" => chain_spec::local_config()?,
path => ConsensusChainSpec::from_json_file(std::path::PathBuf::from(path))?,
Expand Down
32 changes: 21 additions & 11 deletions crates/subspace-node/src/system_domain/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,24 @@ pub fn gemini_3c_config() -> ExecutionChainSpec<GenesisConfig> {
)
}

pub fn x_net_2_config() -> ExecutionChainSpec<GenesisConfig> {
pub fn devnet_config() -> ExecutionChainSpec<GenesisConfig> {
ExecutionChainSpec::from_genesis(
// Name
"Subspace X-Net 2 Execution",
"Subspace Devnet System domain",
// ID
"subspace_x_net_2a_execution",
ChainType::Local,
"subspace_devnet_system_domain",
ChainType::Custom("Testnet".to_string()),
move || {
let sudo_account =
AccountId::from_ss58check("5CXTmJEusve5ixyJufqHThmy4qUrrm6FyLCR7QfE4bbyMTNC")
.expect("Invalid Sudo account");
testnet_genesis(
vec![
// Genesis executor
AccountId::from_ss58check("5Df6w8CgYY8kTRwCu8bjBsFu46fy4nFa61xk6dUbL6G4fFjQ")
.expect("Wrong executor account address"),
// Sudo account
sudo_account.clone(),
],
vec![(
AccountId::from_ss58check("5Df6w8CgYY8kTRwCu8bjBsFu46fy4nFa61xk6dUbL6G4fFjQ")
Expand All @@ -254,32 +259,37 @@ pub fn x_net_2_config() -> ExecutionChainSpec<GenesisConfig> {
.expect("Wrong executor public key"),
)],
vec![(
get_account_id_from_seed("Alice"),
AccountId::from_ss58check("5Df6w8CgYY8kTRwCu8bjBsFu46fy4nFa61xk6dUbL6G4fFjQ")
.expect("Wrong executor account address"),
1_000 * SSC,
// TODO: proper genesis domain config
DomainConfig {
wasm_runtime_hash: blake2b_256_hash(
system_domain_runtime::CORE_PAYMENTS_WASM_BUNDLE,
)
.into(),
max_bundle_size: 1024 * 1024,
max_bundle_size: 4 * 1024 * 1024,
bundle_slot_probability: (1, 1),
max_bundle_weight: Weight::MAX,
min_operator_stake: 100 * SSC,
},
get_account_id_from_seed("Alice"),
AccountId::from_ss58check("5Df6w8CgYY8kTRwCu8bjBsFu46fy4nFa61xk6dUbL6G4fFjQ")
.expect("Wrong executor account address"),
Percent::one(),
)],
None,
Default::default(),
Some(sudo_account.clone()),
vec![(
sudo_account,
RelayerId::from_ss58check("5D7kgfacBsP6pkMB628221HG98mz2euaytthdoeZPGceQusS")
.expect("Invalid relayer id account"),
)],
)
},
// Bootnodes
vec![],
// Telemetry
None,
// Protocol ID
Some("subspace-x-net-2a-execution"),
Some("subspace-devnet-execution"),
None,
// Properties
Some(chain_spec_properties()),
Expand Down

0 comments on commit 843afcb

Please sign in to comment.