-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
249 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Allowed since it's actually better to panic during chain setup when there is an error | ||
#![allow(clippy::unwrap_used)] | ||
|
||
use super::*; | ||
|
||
pub fn devnet_config() -> Result<ChainSpec, String> { | ||
let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; | ||
|
||
// Give front-ends necessary data to present to users | ||
let mut properties = sc_service::Properties::new(); | ||
properties.insert("tokenSymbol".into(), "testTAO".into()); | ||
properties.insert("tokenDecimals".into(), 9.into()); | ||
properties.insert("ss58Format".into(), 42.into()); | ||
|
||
Ok(ChainSpec::builder( | ||
wasm_binary, | ||
Extensions { | ||
bad_blocks: Some(HashSet::new()), | ||
..Default::default() | ||
}, | ||
) | ||
.with_name("Bittensor") | ||
.with_protocol_id("bittensor") | ||
.with_id("bittensor") | ||
.with_chain_type(ChainType::Development) | ||
.with_genesis_config_patch(testnet_genesis( | ||
// Initial PoA authorities (Validators) | ||
// aura | grandpa | ||
vec![ | ||
// Keys for debug | ||
authority_keys_from_ss58( | ||
"5D5ABUyMsdmJdH7xrsz9vREq5eGXr5pXhHxix2dENQR62dEo", | ||
"5H3qMjQjoeZxZ98jzDmoCwbz2sugd5fDN1wrr8Phf49zemKL", | ||
), // key 1 | ||
authority_keys_from_ss58( | ||
"5GbRc5sNDdhcPAU9suV2g9P5zyK1hjAQ9JHeeadY1mb8kXoM", | ||
"5GbkysfaCjK3cprKPhi3CUwaB5xWpBwcfrkzs6FmqHxej8HZ", | ||
), // key 1 | ||
authority_keys_from_ss58( | ||
"5CoVWwBwXz2ndEChGcS46VfSTb3RMUZzZzAYdBKo263zDhEz", | ||
"5HTLp4BvPp99iXtd8YTBZA1sMfzo8pd4mZzBJf7HYdCn2boU", | ||
), // key 1 | ||
authority_keys_from_ss58( | ||
"5EekcbqupwbgWqF8hWGY4Pczsxp9sbarjDehqk7bdyLhDCwC", | ||
"5GAemcU4Pzyfe8DwLwDFx3aWzyg3FuqYUCCw2h4sdDZhyFvE", | ||
), // key 1 | ||
authority_keys_from_ss58( | ||
"5GgdEQyS5DZzUwKuyucEPEZLxFKGmasUFm1mqM3sx1MRC5RV", | ||
"5EibpMomXmgekxcfs25SzFBpGWUsG9Lc8ALNjXN3TYH5Tube", | ||
), // key 1 | ||
authority_keys_from_ss58( | ||
"5Ek5JLCGk2PuoT1fS23GXiWYUT98HVUBERFQBu5g57sNf44x", | ||
"5Gyrc6b2mx1Af6zWJYHdx3gwgtXgZvD9YkcG9uTUPYry4V2a", | ||
), // key 1 | ||
], | ||
// Sudo account | ||
Ss58Codec::from_ss58check("5GpzQgpiAKHMWNSH3RN4GLf96GVTDct9QxYEFAY7LWcVzTbx").unwrap(), | ||
// Pre-funded accounts | ||
vec![], | ||
true, | ||
vec![], | ||
vec![], | ||
0, | ||
)) | ||
.with_properties(properties) | ||
.build()) | ||
} | ||
|
||
// Configure initial storage state for FRAME modules. | ||
#[allow(clippy::too_many_arguments)] | ||
fn testnet_genesis( | ||
initial_authorities: Vec<(AuraId, GrandpaId)>, | ||
root_key: AccountId, | ||
_endowed_accounts: Vec<AccountId>, | ||
_enable_println: bool, | ||
_stakes: Vec<(AccountId, Vec<(AccountId, (u64, u16))>)>, | ||
_balances: Vec<(AccountId, u64)>, | ||
_balances_issuance: u64, | ||
) -> serde_json::Value { | ||
serde_json::json!({ | ||
"balances": { | ||
"balances": vec![(root_key.clone(), 1_000_000_000_000u128)], | ||
}, | ||
"aura": { | ||
"authorities": initial_authorities.iter().map(|x| (x.0.clone())).collect::<Vec<_>>(), | ||
}, | ||
"grandpa": { | ||
"authorities": initial_authorities | ||
.iter() | ||
.map(|x| (x.1.clone(), 1)) | ||
.collect::<Vec<_>>(), | ||
}, | ||
"sudo": { | ||
"key": Some(root_key), | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.