Skip to content
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

update: tech committe & generate gtn chain_spec #171

Merged
merged 5 commits into from
Mar 3, 2024
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
172 changes: 172 additions & 0 deletions chain-specs/gtn.json

Large diffs are not rendered by default.

172 changes: 0 additions & 172 deletions chain-specs/mainnet.json

This file was deleted.

8,233 changes: 48 additions & 8,185 deletions chain-specs/testnet.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions node/src/chain_spec/mainnet.rs → node/src/chain_spec/gtn.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::{base_genesis, get_authority_from_pubkeys, ChainSpec};
use sc_network::config::MultiaddrWithPeerId;
use sc_service::ChainType;
use sp_application_crypto::Ss58Codec;
use sp_core::ecdsa;
use sp_runtime::traits::{IdentifyAccount, Verify};
use stability_runtime::{AccountId, Signature, WASM_BINARY};
use sc_network::config::MultiaddrWithPeerId;
use std::{str::FromStr, vec};

type AccountPublic = <Signature as Verify>::Signer;
Expand All @@ -13,13 +13,13 @@ fn get_account_id_from_public(pubkey: &str) -> AccountId {
AccountPublic::from(ecdsa::Public::from_string(pubkey).unwrap()).into_account()
}

pub fn mainnet_config() -> Result<ChainSpec, String> {
pub fn gtn_config() -> Result<ChainSpec, String> {
let wasm_binary = WASM_BINARY.ok_or_else(|| "Wasm not available".to_string())?;
Ok(ChainSpec::from_genesis(
// Name
"Mainnet",
"GTN",
// ID
"mainnet",
"gtn",
ChainType::Live,
move || {
base_genesis(
Expand Down Expand Up @@ -55,16 +55,16 @@ pub fn mainnet_config() -> Result<ChainSpec, String> {
),
],
vec![get_account_id_from_public(
"KWECfQF69Vr61qop6NVpesYrnw5WRS4M816286K7NUuVAn2zd",
"KWAWnNYYgJzqvZQ2LLYmTVya95oeyAXX76PZN86DjbQKp7Czw",
)],
101010,
)
},
// Bootnodes
vec![
MultiaddrWithPeerId::from_str("/dns4/s0.mainnet.stabilityprotocol.com/tcp/30333/p2p/12D3KooWNGnx5ZbeCkea9HVR5TTMjA5hyPqhLCBdM9KejPXD7GvQ").unwrap(),
MultiaddrWithPeerId::from_str("/dns4/s1.mainnet.stabilityprotocol.com/tcp/30333/p2p/12D3KooWAcZMqS6TjCNXFaZ6a3u6sob87cG3f4E3yUhAwNmzCAWF").unwrap(),
MultiaddrWithPeerId::from_str("/dns4/s2.mainnet.stabilityprotocol.com/tcp/30333/p2p/12D3KooWC9QrhPSewpysp3LPiXxo9Go25a8VgGsKCFwhBrccJ21n").unwrap()
MultiaddrWithPeerId::from_str("/dns4/s0.gtn.stabilityprotocol.com/tcp/30333/p2p/12D3KooWNGnx5ZbeCkea9HVR5TTMjA5hyPqhLCBdM9KejPXD7GvQ").unwrap(),
MultiaddrWithPeerId::from_str("/dns4/s1.gtn.stabilityprotocol.com/tcp/30333/p2p/12D3KooWAcZMqS6TjCNXFaZ6a3u6sob87cG3f4E3yUhAwNmzCAWF").unwrap(),
MultiaddrWithPeerId::from_str("/dns4/s2.gtn.stabilityprotocol.com/tcp/30333/p2p/12D3KooWC9QrhPSewpysp3LPiXxo9Go25a8VgGsKCFwhBrccJ21n").unwrap()
],
// Telemetry
None,
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use stability_runtime::{opaque::SessionKeys, EnableManualSeal, Signature};
pub mod alphanet;
pub mod betanet;
pub mod dev;
pub mod mainnet;
pub mod gtn;
pub mod testnet;

// The URL for the telemetry server.
Expand Down
9 changes: 6 additions & 3 deletions node/src/chain_spec/testnet.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::{base_genesis, get_authority_from_pubkeys, ChainSpec};
use sc_network::config::MultiaddrWithPeerId;
use sc_service::ChainType;
use sp_application_crypto::Ss58Codec;
use sp_core::ecdsa;
use sp_runtime::traits::{IdentifyAccount, Verify};
use stability_runtime::{AccountId, Signature, WASM_BINARY};
use std::vec;
use std::{str::FromStr, vec};

type AccountPublic = <Signature as Verify>::Signer;

Expand Down Expand Up @@ -50,13 +51,15 @@ pub fn testnet_config() -> Result<ChainSpec, String> {
),
],
vec![get_account_id_from_public(
"KWECfQF69Vr61qop6NVpesYrnw5WRS4M816286K7NUuVAn2zd",
"KWAWnNYYgJzqvZQ2LLYmTVya95oeyAXX76PZN86DjbQKp7Czw",
)],
20180427,
)
},
// Bootnodes
vec![],
vec![
MultiaddrWithPeerId::from_str("/dns4/s0.testnet.stble.io/tcp/30333/p2p/12D3KooWPaen1igo2WYUFCt3EAg4AWjWoMYgmr4tCa2Yb1WfgoDB").unwrap()
],
// Telemetry
None,
// Protocol ID
Expand Down
14 changes: 7 additions & 7 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl SubstrateCli for Cli {
"alphanet" => Box::new(chain_spec::alphanet::alphanet_config()?),
"betanet" => Box::new(chain_spec::betanet::betanet_config()?),
"testnet" => Box::new(chain_spec::testnet::testnet_config()?),
"mainnet" => Box::new(chain_spec::mainnet::mainnet_config()?),
"gtn" => Box::new(chain_spec::gtn::gtn_config()?),
"" | "local" | "dev" => {
let enable_manual_seal = self.sealing.map(|_| true);
Box::new(chain_spec::dev::development_config(enable_manual_seal))
Expand Down Expand Up @@ -237,19 +237,19 @@ pub fn run() -> sc_cli::Result<()> {
runner.sync_run(|mut config| {
let (client, _, _, _, frontier_backend) =
service::new_chain_ops(&mut config, &cli.eth)?;
let frontier_backend = match frontier_backend {
fc_db::Backend::KeyValue(kv) => std::sync::Arc::new(kv),
_ => panic!("Only fc_db::Backend::KeyValue supported"),
};
let frontier_backend = match frontier_backend {
fc_db::Backend::KeyValue(kv) => std::sync::Arc::new(kv),
_ => panic!("Only fc_db::Backend::KeyValue supported"),
};
cmd.run(client, frontier_backend)
})
}
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move {
service::build_full(config, cli.eth, cli.sealing, cli.stability)
.map_err(Into::into)
.await
.map_err(Into::into)
.await
})
}
}
Expand Down
Loading