diff --git a/node/Cargo.toml b/node/Cargo.toml index da62b0e43..c161288f2 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -7,7 +7,7 @@ edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } -description = "Tangle Standalone chain node" +description = "Tangle Chain node" [package.metadata.wasm-pack.profile.release] # `wasm-opt` has some problems on linux, see diff --git a/node/src/chainspec/mainnet.rs b/node/src/chainspec/mainnet.rs index babad6510..b7c2e43d9 100644 --- a/node/src/chainspec/mainnet.rs +++ b/node/src/chainspec/mainnet.rs @@ -92,7 +92,7 @@ pub fn local_mainnet_config(chain_id: u64) -> Result { let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "TNT".into()); properties.insert("tokenDecimals".into(), 18u32.into()); - properties.insert("ss58Format".into(), 4006.into()); + properties.insert("ss58Format".into(), tangle_primitives::MAINNET_SS58_PREFIX.into()); Ok(ChainSpec::from_genesis( "Local Tangle Mainnet", @@ -112,6 +112,9 @@ pub fn local_mainnet_config(chain_id: u64) -> Result { get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), ], // Sudo account get_account_id_from_seed::("Alice"), @@ -151,7 +154,7 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result { let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "TNT".into()); properties.insert("tokenDecimals".into(), 18u32.into()); - properties.insert("ss58Format".into(), 4006.into()); + properties.insert("ss58Format".into(), tangle_primitives::MAINNET_SS58_PREFIX.into()); Ok(ChainSpec::from_genesis( "Tangle Mainnet", diff --git a/node/src/chainspec/testnet.rs b/node/src/chainspec/testnet.rs index 3c8243889..68dd4dfc2 100644 --- a/node/src/chainspec/testnet.rs +++ b/node/src/chainspec/testnet.rs @@ -36,9 +36,9 @@ use tangle_crypto_primitives::crypto::AuthorityId as RoleKeyId; use tangle_primitives::types::BlockNumber; use tangle_testnet_runtime::{ AccountId, BabeConfig, Balance, BalancesConfig, ClaimsConfig, EVMChainIdConfig, EVMConfig, - ElectionsConfig, Eth2ClientConfig, ImOnlineConfig, MaxNominations, MaxVestingSchedules, - Perbill, RuntimeGenesisConfig, SessionConfig, Signature, StakerStatus, StakingConfig, - SudoConfig, SystemConfig, TreasuryPalletId, UNIT, WASM_BINARY, + ElectionsConfig, Eth2ClientConfig, ImOnlineConfig, MaxVestingSchedules, Perbill, + RuntimeGenesisConfig, SessionConfig, Signature, StakerStatus, StakingConfig, SudoConfig, + SystemConfig, TreasuryPalletId, UNIT, WASM_BINARY, }; use webb_consensus_types::network_config::{Network, NetworkConfig}; @@ -93,7 +93,7 @@ pub fn local_testnet_config(chain_id: u64) -> Result { let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "tTNT".into()); properties.insert("tokenDecimals".into(), 18u32.into()); - properties.insert("ss58Format".into(), 42.into()); + properties.insert("ss58Format".into(), tangle_primitives::TESTNET_SS58_PREFIX.into()); Ok(ChainSpec::from_genesis( // Name @@ -124,11 +124,8 @@ pub fn local_testnet_config(chain_id: u64) -> Result { get_account_id_from_seed::("Eve"), ], chain_id, - combine_distributions(vec![ - develop::get_evm_balance_distribution(), - testnet::get_evm_balance_distribution(), - ]), - testnet::get_substrate_balance_distribution(), + vec![], + vec![], true, ) }, @@ -153,12 +150,12 @@ pub fn tangle_testnet_config(chain_id: u64) -> Result { let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "tTNT".into()); properties.insert("tokenDecimals".into(), 18u32.into()); - properties.insert("ss58Format".into(), 42.into()); + properties.insert("ss58Format".into(), tangle_primitives::TESTNET_SS58_PREFIX.into()); Ok(ChainSpec::from_genesis( - "Tangle Standalone Testnet", + "Tangle Testnet", "tangle-testnet", - ChainType::Development, + ChainType::Live, move || { testnet_genesis( wasm_binary, @@ -225,7 +222,7 @@ pub fn tangle_testnet_config(chain_id: u64) -> Result { fn testnet_genesis( wasm_binary: &[u8], initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId, RoleKeyId)>, - initial_nominators: Vec, + _initial_nominators: Vec, root_key: AccountId, endowed_accounts: Vec, chain_id: u64, @@ -237,22 +234,12 @@ fn testnet_genesis( const STASH: Balance = ENDOWMENT / 100; // stakers: all validators and nominators. - let mut rng = rand::thread_rng(); + let _rng = rand::thread_rng(); + // stakers: all validators and nominators. let stakers = initial_authorities .iter() - .map(|x| (x.0.clone(), x.0.clone(), STASH, StakerStatus::Validator)) - .chain(initial_nominators.iter().map(|x| { - use rand::{seq::SliceRandom, Rng}; - let limit = (MaxNominations::get() as usize).min(initial_authorities.len()); - let count = rng.gen::() % limit; - let nominations = initial_authorities - .as_slice() - .choose_multiple(&mut rng, count) - .map(|choice| choice.0.clone()) - .collect::>(); - (x.clone(), x.clone(), STASH, StakerStatus::Nominator(nominations)) - })) - .collect::>(); + .map(|x| (x.0.clone(), x.0.clone(), UNIT, StakerStatus::Validator)) + .collect(); let num_endowed_accounts = endowed_accounts.len(); let claims: Vec<(MultiAddress, Balance, Option)> = endowed_accounts diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 5c618977f..5ba8ba461 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -288,3 +288,11 @@ pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, MAX_POV_SIZE as u64); pub use sp_consensus_babe::AuthorityId as BabeId; + +// 5845 this would give us addresses with tg prefix for mainnet like +// tgGmBRR5yM53bvq8tTzgsUirpPtfCXngYYU7uiihmWFJhmYGM +pub const MAINNET_SS58_PREFIX: u16 = 5845; + +// 3799 this would give us addresses with tt prefix for testnet like +// ttFELSU4MTyzpfsgZ9tFinrmox7pV7nF1BLbfYjsu4rfDYM74 +pub const TESTNET_SS58_PREFIX: u16 = 3799; diff --git a/runtime/mainnet/src/lib.rs b/runtime/mainnet/src/lib.rs index 54e3de93e..688d9d21c 100644 --- a/runtime/mainnet/src/lib.rs +++ b/runtime/mainnet/src/lib.rs @@ -165,7 +165,7 @@ parameter_types! { ::with_sensible_defaults(MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength ::max_with_normal_ratio(MAXIMUM_BLOCK_LENGTH, NORMAL_DISPATCH_RATIO); - pub const SS58Prefix: u8 = 42; + pub const SS58Prefix: u16 = tangle_primitives::MAINNET_SS58_PREFIX; } /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index 56e6f975f..1941189fe 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -181,7 +181,7 @@ parameter_types! { ::with_sensible_defaults(MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength ::max_with_normal_ratio(MAXIMUM_BLOCK_LENGTH, NORMAL_DISPATCH_RATIO); - pub const SS58Prefix: u8 = 42; + pub const SS58Prefix: u16 = tangle_primitives::TESTNET_SS58_PREFIX; } /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know