Skip to content

Hashed parachain spec #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 43 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9123b79
added hashed parachain spec
Nov 7, 2022
4fca3c6
collator/src/*
Nov 13, 2022
13668c5
luhn chain spec
Nov 13, 2022
c2ec97b
updates to spec and address-checker
Nov 13, 2022
c103811
updated luhn spec
Nov 20, 2022
7ef9e04
Merge pull request #265 from hashed-io/feature/luhn-chain-spec
mgravitt Nov 20, 2022
f80a035
updated hashed spec
Nov 20, 2022
3f3db1b
adding hashed dockerfile
Nov 23, 2022
82031f8
updating hashed collator supporting files
Nov 24, 2022
f885e2f
updating manifests
Nov 28, 2022
8a08de4
changing labels and protocol ID in rust
Nov 30, 2022
2b25e70
Developed hashed-collator manifests. Developed luhn collator manifest…
sebastianmontero Dec 1, 2022
507f536
Updated image name of hashed-collator and luhn-collator manifests.
sebastianmontero Dec 5, 2022
04b2ae3
Updated start collator script to accept the base-path as parameter. U…
sebastianmontero Dec 7, 2022
b3bfec6
Updated manifests of collators with the latest image.
sebastianmontero Dec 7, 2022
db3f834
updated start_collator usage message
sebastianmontero Dec 7, 2022
b21fdc0
Updated image for hashed collator manifest. Updated image for luhn c…
sebastianmontero Dec 12, 2022
c85551c
added logs to the luhn collator
sebastianmontero Dec 14, 2022
2fdb0d6
Increased disk space for the hashed collator 1
sebastianmontero Dec 14, 2022
1531476
Updated start_collator script to include md5.
sebastianmontero Dec 22, 2022
d652784
Developed md5 collator deployment manifest. Developed md5 collator in…
sebastianmontero Dec 23, 2022
05c4898
Developed start collator script to enable the specification of the no…
sebastianmontero Dec 23, 2022
6aa210d
Started developing luhn-collator statefulset template.
sebastianmontero Dec 23, 2022
a5c7ebe
Updated the luhn collator statefulset.
sebastianmontero Dec 24, 2022
43fd31a
Updated image in luhn-collator-1-statefulset
sebastianmontero Dec 24, 2022
c76e305
Developed statefulset manifest for hashed-collator-1.Developed statef…
sebastianmontero Dec 24, 2022
e661c0d
Added optional node-key parameter to start collator script
sebastianmontero Dec 25, 2022
1a8b76f
Added zombinet files
sebastianmontero Feb 18, 2023
9877a66
Updated start_collator script to use raw chain specs
sebastianmontero Feb 18, 2023
d8b0f51
updated raw spec
sebastianmontero Feb 19, 2023
10d4951
Udpated manifests
sebastianmontero Feb 21, 2023
06507ad
Updated hashed collator raw spec
sebastianmontero Feb 21, 2023
5cf576a
Updated hashed-collator stateful set manifests
sebastianmontero Feb 21, 2023
373f465
Updated bootnodes for hashed collators
sebastianmontero Feb 24, 2023
ffe4ccd
Added zombinet file
sebastianmontero Feb 24, 2023
972da7e
Increased resource limits for the collators statefulsets
sebastianmontero Feb 28, 2023
e7e6cc4
Developed hashed-collator-3 ingress manifest. Developed hashed-collat…
sebastianmontero Mar 12, 2023
9273483
mend
sebastianmontero Mar 12, 2023
797e42e
Updated start collator script to enable the specification of the list…
sebastianmontero Mar 12, 2023
51b6fc3
Updated collator statefulsets with the new env vars
sebastianmontero Mar 13, 2023
ece3533
Updated manifest with the wss bootnode url
sebastianmontero Mar 15, 2023
e4d912c
Updated the md5 chain to closer resemble the hashed deployment.
sebastianmontero Apr 18, 2023
87bff67
Added md5 network chain spec, raw chain spec, genesis state and wasm
sebastianmontero Apr 19, 2023
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# These are backup files generated by rustfmt
**/*.rs.bk

**/node_modules

.DS_Store

# The cache for docker container dependency
Expand Down Expand Up @@ -32,3 +34,4 @@ gcloud-md5-ingress.yml
collator-data
relay-data
.vscode/settings.json

362 changes: 181 additions & 181 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM paritytech/ci-linux:production

WORKDIR /var/www

RUN git clone https://github.com/hashed-io/hashed-substrate.git && cd hashed-substrate && git checkout feature/collator && cargo build --release
RUN git clone https://github.com/hashed-io/hashed-substrate.git && cd hashed-substrate && git checkout feature/hashed-chain-spec && cargo build --release

# COPY ./target/release/hashed-parachain .
# COPY ./resources/* resources/.
Expand Down
2 changes: 1 addition & 1 deletion collator.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN git clone https://github.com/hashed-io/hashed-substrate.git

WORKDIR /var/www/hashed-substrate
# change to main or develop
RUN git checkout develop && cargo build --release
RUN git checkout feature/hashed-chain-spec && cargo build --release

EXPOSE 30333 40333 9933 9944 9946

Expand Down
50 changes: 26 additions & 24 deletions collator/src/chain_spec/hashed.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use sc_service::ChainType;
use sp_core::sr25519;
// use sp_core::sr25519;
use sp_core::{crypto::UncheckedInto};

use hex_literal::hex;

use super::{
get_account_id_from_seed, get_collator_keys_from_seed, session_keys, SAFE_XCM_VERSION, Extensions,
/*get_account_id_from_seed, get_collator_keys_from_seed,*/ session_keys, SAFE_XCM_VERSION, Extensions,
};

use cumulus_primitives_core::ParaId;
Expand All @@ -19,7 +21,12 @@ pub fn get_chain_spec() -> HashedChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "HASH".into());
properties.insert("tokenDecimals".into(), 18.into());
properties.insert("ss58Format".into(), 3000.into());
properties.insert("ss58Format".into(), 9072.into());
properties.insert("prefix".into(), 9072.into());
properties.insert("network".into(), "hashed".into());
properties.insert("displayName".into(), "Hashed Network".into());
properties.insert("standardAccount".into(),"*25519".into());
properties.insert("website".into(), "https://hashed.network".into());

// REVIEW: this is where the Hashed genesis is customized, for now,
// it is just a duplicate of the development configuration
Expand All @@ -32,30 +39,25 @@ pub fn get_chain_spec() -> HashedChainSpec {
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
// JA
// haZmb2DUWLEjv3z7NDn5nArSGoMgaN6xeJdAr9TDaeQYpxe6g
hex!["90150e105b07c3357d43ed5c727efb9be347699cb2b5a41a26423b559615b222"].into(),
hex!["90150e105b07c3357d43ed5c727efb9be347699cb2b5a41a26423b559615b222"].unchecked_into(),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob"),
// MdL
// haWa1d98tnLtvNCLSrdWmSo1DYHQDiKBoM9s5xNYtScTUwJ74
hex!["028c3a5c8890c3e98023b35f99a5d904b170612b78b6b9fdd8f60cbf24ab9f59"].into(),
hex!["028c3a5c8890c3e98023b35f99a5d904b170612b78b6b9fdd8f60cbf24ab9f59"].unchecked_into(),
),
],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
// GW
// haWZRqBVdT9vDAM1Wpga7B1GZ99WDWnXsLyzCBtpwrjPLaZUa
hex!["021a78fcc3ec988411388ec2f8ab25fbb79a7eaacead997d13f211ebe34ce359"].into(),
],
hex!["f83a0218e100ce3ede12c5d403116ef034124c62b181fff6935403cea9396d2f"].into(),
1000.into(),
hex!["021a78fcc3ec988411388ec2f8ab25fbb79a7eaacead997d13f211ebe34ce359"].into(),
2093.into(),
)
},
Vec::new(),
Expand All @@ -64,8 +66,8 @@ pub fn get_chain_spec() -> HashedChainSpec {
None,
Some(properties),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 1000,
relay_chain: "polkadot".into(), // You MUST set this to the correct network!
para_id: 2093,
},
)
}
Expand All @@ -83,7 +85,7 @@ fn hashed_genesis(
.to_vec(),
},
balances: hashed_parachain_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
balances: endowed_accounts.iter().cloned().map(|k| (k, 1000000000000000000000000000)).collect(),
},
sudo: SudoConfig { key: Some(root_key) },
council: Default::default(),
Expand Down
120 changes: 120 additions & 0 deletions collator/src/chain_spec/luhn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
use sc_service::ChainType;
// use sp_core::sr25519;
use sp_core::{crypto::UncheckedInto};

use hex_literal::hex;

use super::{
/*get_account_id_from_seed, get_collator_keys_from_seed,*/ session_keys, SAFE_XCM_VERSION, Extensions,
};

use cumulus_primitives_core::ParaId;
use hashed_parachain_runtime::{AccountId, AuraId, SudoConfig, EXISTENTIAL_DEPOSIT};

/// Specialized `ChainSpec` for Hashed Network
pub type HashedChainSpec =
sc_service::GenericChainSpec<hashed_parachain_runtime::GenesisConfig, Extensions>;

/// Gen HASH chain specification
pub fn get_chain_spec() -> HashedChainSpec {

let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "LUHN".into());
properties.insert("tokenDecimals".into(), 18.into());
properties.insert("ss58Format".into(), 11486.into());
properties.insert("prefix".into(), 11486.into());
properties.insert("network".into(), "luhn".into());
properties.insert("displayName".into(), "Luhn Network".into());
properties.insert("standardAccount".into(),"*25519".into());
properties.insert("website".into(), "https://luhn.network".into());

HashedChainSpec::from_genesis(
"Luhn Network",
"luhn",
ChainType::Live,
move || {
hashed_genesis(
// initial collators.
vec![
(
// Collator #1
// uhsPQGuXYwjnLvoJWWttQ6FEVtztHSvsjE7UFzxS8mSfoSmts
hex!["1cfc7e49e91696b84bf8e931c16375ea634c3997b36155657faf7dc4716e273e"].into(),
hex!["1cfc7e49e91696b84bf8e931c16375ea634c3997b36155657faf7dc4716e273e"].unchecked_into(),
),
(
// Collator #2
// uhujXWvqSqGrY3K62qeamwCGQd7tTo1hm1s9ZYrgxAZFBLyLv
hex!["84ce3f0bc9ae73d8497c6161927e9e04f39f4bc54579689532d048188c10a77c"].into(),
hex!["84ce3f0bc9ae73d8497c6161927e9e04f39f4bc54579689532d048188c10a77c"].unchecked_into(),
),
],
vec![
// PH
// uhtqJBJ9ZeKguyAG4GJ2S7cme5FvJ661P5NVdHTYKQgvDEQAR
hex!["5cf8957922e4058a953281f82fdced2e4d389fe37c77f41a0fd2379df0caf877"].into(),
],
// uhtqJBJ9ZeKguyAG4GJ2S7cme5FvJ661P5NVdHTYKQgvDEQAR
hex!["5cf8957922e4058a953281f82fdced2e4d389fe37c77f41a0fd2379df0caf877"].into(),
2232.into(),
)
},
Vec::new(),
None,
None,
None,
Some(properties),
Extensions {
relay_chain: "kusama".into(),
para_id: 2232,
},
)
}

fn hashed_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
root_key: AccountId,
id: ParaId,
) -> hashed_parachain_runtime::GenesisConfig {
hashed_parachain_runtime::GenesisConfig {
system: hashed_parachain_runtime::SystemConfig {
code: hashed_parachain_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
},
balances: hashed_parachain_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1000000000000000000000000000)).collect(),
},
sudo: SudoConfig { key: Some(root_key) },
council: Default::default(),
treasury: Default::default(),
parachain_info: hashed_parachain_runtime::ParachainInfoConfig { parachain_id: id },
collator_selection: hashed_parachain_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
..Default::default()
},
session: hashed_parachain_runtime::SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
session_keys(aura), // session keys
)
})
.collect(),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this.
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: hashed_parachain_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
}
}

Loading