Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request paritytech#131 from subspace/testnet-updates
Browse files Browse the repository at this point in the history
Set SS58 prefix in testnet chain spec properties and runtime
  • Loading branch information
nazar-pc committed Nov 14, 2021
2 parents cec59d3 + 49bd9f6 commit 6acdf0b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions crates/subspace-node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ use sp_core::crypto::Ss58Codec;
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};
use subspace_runtime::{
AccountId, Balance, BalancesConfig, BlockNumber, GenesisConfig, Signature, SubspaceConfig,
SudoConfig, SystemConfig, VestingConfig, MILLISECS_PER_BLOCK, SSC, WASM_BINARY,
AccountId, Balance, BalancesConfig, BlockNumber, GenesisConfig, SS58Prefix, Signature,
SubspaceConfig, SudoConfig, SystemConfig, VestingConfig, DECIMAL_PLACES, MILLISECS_PER_BLOCK,
SSC, WASM_BINARY,
};

// The URL for the telemetry server.
Expand Down Expand Up @@ -144,9 +145,13 @@ pub fn testnet_config() -> Result<ChainSpec, String> {
Some("subspace"),
// Properties
Some(Properties::from_iter([
(
"ss58Format".to_string(),
serde_json::to_value(SS58Prefix::get()).expect("u16 is always serializable; qed"),
),
(
"tokenDecimals".to_string(),
serde_json::to_value(18_u8).expect("u8 is always serializable; qed"),
serde_json::to_value(DECIMAL_PLACES).expect("u8 is always serializable; qed"),
),
(
"tokenSymbol".to_string(),
Expand Down
10 changes: 6 additions & 4 deletions crates/subspace-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ pub fn native_version() -> NativeVersion {

/// The smallest unit of the token is called Shannon.
pub const SHANNON: Balance = 1;
/// One Subspace Credit has 18 decimal places.
pub const SSC: Balance = (10 * SHANNON).pow(18);
/// Subspace Credits have 18 decimal places.
pub const DECIMAL_PLACES: u8 = 18;
/// One Subspace Credit.
pub const SSC: Balance = (10 * SHANNON).pow(DECIMAL_PLACES as u32);

// TODO: Many of below constants should probably be updatable but currently they are not

Expand Down Expand Up @@ -214,7 +216,7 @@ parameter_types! {
pub SubspaceBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
/// We allow for 3.75 MiB for `Normal` extrinsic with 5 MiB maximum block length.
pub SubspaceBlockLength: BlockLength = BlockLength::max_with_normal_ratio(MAX_BLOCK_LENGTH, NORMAL_DISPATCH_RATIO);
pub const SS58Prefix: u8 = 42;
pub const SS58Prefix: u16 = 2254;
}

// Configure FRAME pallets to include in runtime.
Expand Down Expand Up @@ -264,7 +266,7 @@ impl frame_system::Config for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
/// This is used as an identifier of the chain.
type SS58Prefix = SS58Prefix;
/// The set code logic, just the default since we're not a parachain.
type OnSetCode = ();
Expand Down

0 comments on commit 6acdf0b

Please sign in to comment.