Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
polkadot-like testnets should be 10 decimal places (#5369)
Browse files Browse the repository at this point in the history
* polkadot is 10 decimal places

* cargo fmt

* Update node/service/src/chain_spec.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* name change

* update test also

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
  • Loading branch information
gilescope and bkchr authored Apr 25, 2022
1 parent 6eff73b commit 59b2d46
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ futures = "0.3.21"
hex-literal = "0.3.4"
gum = { package = "tracing-gum", path = "../gum/" }
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.59"
thiserror = "1.0.30"
kvdb = "0.11.0"
kvdb-rocksdb = { version = "0.15.2", optional = true }
Expand Down
16 changes: 13 additions & 3 deletions node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,16 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
}
}

/// Returns the properties for the [`PolkadotChainSpec`].
pub fn polkadot_chain_spec_properties() -> serde_json::map::Map<String, serde_json::Value> {
serde_json::json!({
"tokenDecimals": 10,
})
.as_object()
.expect("Map given; qed")
.clone()
}

/// Polkadot staging testnet config.
#[cfg(feature = "polkadot-native")]
pub fn polkadot_staging_testnet_config() -> Result<PolkadotChainSpec, String> {
Expand All @@ -1103,7 +1113,7 @@ pub fn polkadot_staging_testnet_config() -> Result<PolkadotChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Some(polkadot_chain_spec_properties()),
Default::default(),
))
}
Expand Down Expand Up @@ -1653,7 +1663,7 @@ pub fn polkadot_development_config() -> Result<PolkadotChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Some(polkadot_chain_spec_properties()),
Default::default(),
))
}
Expand Down Expand Up @@ -1793,7 +1803,7 @@ pub fn polkadot_local_testnet_config() -> Result<PolkadotChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Some(polkadot_chain_spec_properties()),
Default::default(),
))
}
Expand Down
6 changes: 4 additions & 2 deletions node/test/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use babe_primitives::AuthorityId as BabeId;
use grandpa::AuthorityId as GrandpaId;
use pallet_staking::Forcing;
use polkadot_primitives::v2::{AccountId, AssignmentId, ValidatorId, MAX_CODE_SIZE, MAX_POV_SIZE};
use polkadot_service::chain_spec::{get_account_id_from_seed, get_from_seed, Extensions};
use polkadot_service::chain_spec::{
get_account_id_from_seed, get_from_seed, polkadot_chain_spec_properties, Extensions,
};
use polkadot_test_runtime::BABE_GENESIS_EPOCH_CONFIG;
use sc_chain_spec::{ChainSpec, ChainType};
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
Expand All @@ -45,7 +47,7 @@ pub fn polkadot_local_testnet_config() -> PolkadotChainSpec {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Some(polkadot_chain_spec_properties()),
Default::default(),
)
}
Expand Down

0 comments on commit 59b2d46

Please sign in to comment.