Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
46 changes: 0 additions & 46 deletions .cargo-husky/hooks/post-commit

This file was deleted.

27 changes: 0 additions & 27 deletions .cargo-husky/hooks/pre-commit

This file was deleted.

37 changes: 0 additions & 37 deletions .cargo-husky/hooks/pre-push

This file was deleted.

36 changes: 36 additions & 0 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 hyperparameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MaxAllowedUids: u16 = 1024;
Issuance: u64 = 0;
MinAllowedWeights: u16 = 8;
EmissionValue: u64 = 142_223_000;
MaxWeightsLimit: u16 = 32768; // 50% of u16
MaxWeightsLimit: 455; // 455/2^16 = 0.0069
ValidatorBatchSize: u16 = 1;
ValidatorSequenceLen: u16 = 2048; // 2048
ValidatorEpochLen: u16 = 100;
Expand Down
4 changes: 2 additions & 2 deletions node/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

fn main() {
generate_cargo_keys();
generate_cargo_keys();

rerun_if_git_head_changed();
rerun_if_git_head_changed();
}
63 changes: 3 additions & 60 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use node_subtensor_runtime::{
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, Signature, SudoConfig,
SystemConfig, WASM_BINARY, SubtensorModuleConfig, TriumvirateConfig, TriumvirateMembersConfig,
SenateConfig, SenateMembersConfig
SystemConfig, WASM_BINARY, SubtensorModuleConfig, TriumvirateConfig, TriumvirateMembersConfig, SenateMembersConfig
};
use sc_service::ChainType;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
Expand Down Expand Up @@ -288,52 +287,8 @@ pub fn finney_testnet_config() -> Result<ChainSpec, String> {
}

pub fn localnet_config() -> Result<ChainSpec, String> {
let path: PathBuf = std::path::PathBuf::from("./snapshot.json");
let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?;

// We mmap the file into memory first, as this is *a lot* faster than using
// `serde_json::from_reader`. See https://github.com/serde-rs/json/issues/160
let file = File::open(&path)
.map_err(|e| format!("Error opening genesis file `{}`: {}", path.display(), e))?;

// SAFETY: `mmap` is fundamentally unsafe since technically the file can change
// underneath us while it is mapped; in practice it's unlikely to be a problem
let bytes = unsafe {
memmap2::Mmap::map(&file)
.map_err(|e| format!("Error mmaping genesis file `{}`: {}", path.display(), e))?
};

let old_state: ColdkeyHotkeys =
json::from_slice(&bytes).map_err(|e| format!("Error parsing genesis file: {}", e))?;

let mut processed_stakes: Vec<(sp_runtime::AccountId32, Vec<(sp_runtime::AccountId32, (u64, u16))>)> = Vec::new();
for (coldkey_str, hotkeys) in old_state.stakes.iter() {
let coldkey = <sr25519::Public as Ss58Codec>::from_ss58check(&coldkey_str).unwrap();
let coldkey_account = sp_runtime::AccountId32::from(coldkey);

let mut processed_hotkeys: Vec<(sp_runtime::AccountId32, (u64, u16))> = Vec::new();

for (hotkey_str, amount_uid) in hotkeys.iter() {
let (amount, uid) = amount_uid;
let hotkey = <sr25519::Public as Ss58Codec>::from_ss58check(&hotkey_str).unwrap();
let hotkey_account = sp_runtime::AccountId32::from(hotkey);

processed_hotkeys.push((hotkey_account, (*amount, *uid)));
}

processed_stakes.push((coldkey_account, processed_hotkeys));
}

let mut balances_issuance: u64 = 0;
let mut processed_balances: Vec<(sp_runtime::AccountId32, u64)> = Vec::new();
for (key_str, amount) in old_state.balances.iter() {
let key = <sr25519::Public as Ss58Codec>::from_ss58check(&key_str).unwrap();
let key_account = sp_runtime::AccountId32::from(key);

processed_balances.push((key_account, *amount));
balances_issuance += *amount;
}

// Give front-ends necessary data to present to users
let mut properties = sc_service::Properties::new();
properties.insert("tokenSymbol".into(), "TAO".into());
Expand Down Expand Up @@ -418,10 +373,6 @@ fn localnet_genesis(
],
phantom: Default::default()
},
senate: SenateConfig {
members: Default::default(),
phantom: Default::default(),
},
senate_members: SenateMembersConfig {
members: bounded_vec![
get_account_id_from_seed::<sr25519::Public>("Dave"),
Expand All @@ -438,7 +389,7 @@ fn localnet_genesis(
fn testnet_genesis(
wasm_binary: &[u8],
initial_authorities: Vec<(AuraId, GrandpaId)>,
root_key: AccountId,
_root_key: AccountId,
_endowed_accounts: Vec<AccountId>,
_enable_println: bool,
_stakes: Vec<(AccountId, Vec<(AccountId, (u64, u16))>)>,
Expand Down Expand Up @@ -475,10 +426,6 @@ fn testnet_genesis(
members: Default::default(),
phantom: Default::default()
},
senate: SenateConfig {
members: Default::default(),
phantom: Default::default(),
},
senate_members: SenateMembersConfig {
members: Default::default(),
phantom: Default::default()
Expand All @@ -491,7 +438,7 @@ fn testnet_genesis(
fn finney_genesis(
wasm_binary: &[u8],
initial_authorities: Vec<(AuraId, GrandpaId)>,
root_key: AccountId,
_root_key: AccountId,
_endowed_accounts: Vec<AccountId>,
_enable_println: bool,
stakes: Vec<(AccountId, Vec<(AccountId, (u64, u16))>)>,
Expand Down Expand Up @@ -531,10 +478,6 @@ fn finney_genesis(
members: Default::default(),
phantom: Default::default()
},
senate: SenateConfig {
members: Default::default(),
phantom: Default::default(),
},
senate_members: SenateMembersConfig {
members: Default::default(),
phantom: Default::default()
Expand Down
6 changes: 3 additions & 3 deletions node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
mod chain_spec;
#[macro_use]
mod service;
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
mod cli;
mod command;
mod rpc;
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;

fn main() -> sc_cli::Result<()> {
command::run()
command::run()
}
1 change: 0 additions & 1 deletion node/tests/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ fn test_authority_keys_from_seed_panics() {
let bad_seed = "";
authority_keys_from_seed(bad_seed);
}

Loading