Skip to content

Commit

Permalink
Merge pull request #57 from CherryNetwork/mainnet-upgrade-to-v0.9.39
Browse files Browse the repository at this point in the history
Mainnet upgrade to v0.9.39
  • Loading branch information
zycon91 authored Dec 10, 2023
2 parents ddc0abb + 04171d4 commit 9fbab6f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 50 deletions.
17 changes: 3 additions & 14 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl SubstrateCli for Cli {
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
let id = if id == "" {
let n = get_exec_name().unwrap_or_default();
["cherry", "rococo", "versi"]
["cherry", "rococo"]
.iter()
.cloned()
.find(|&chain| n.starts_with(chain))
Expand Down Expand Up @@ -111,15 +111,6 @@ impl SubstrateCli for Cli {
#[cfg(not(feature = "rococo-native"))]
name if name.starts_with("wococo-") =>
Err(format!("`{}` only supported with `rococo-native` feature enabled.", name))?,
#[cfg(feature = "rococo-native")]
"versi-dev" => Box::new(service::chain_spec::versi_development_config()?),
#[cfg(feature = "rococo-native")]
"versi-local" => Box::new(service::chain_spec::versi_local_testnet_config()?),
#[cfg(feature = "rococo-native")]
"versi-staging" => Box::new(service::chain_spec::versi_staging_testnet_config()?),
#[cfg(not(feature = "rococo-native"))]
name if name.starts_with("versi-") =>
Err(format!("`{}` only supported with `rococo-native` feature enabled.", name))?,
path => {
let path = std::path::PathBuf::from(path);

Expand All @@ -129,9 +120,7 @@ impl SubstrateCli for Cli {
// When `force_*` is given or the file name starts with the name of one of the known chains,
// we use the chain spec for the specific chain.
if self.run.force_rococo ||
chain_spec.is_rococo() ||
chain_spec.is_wococo() ||
chain_spec.is_versi()
chain_spec.is_rococo()
{
Box::new(service::RococoChainSpec::from_json_file(path)?)
} else {
Expand All @@ -143,7 +132,7 @@ impl SubstrateCli for Cli {

fn native_runtime_version(spec: &Box<dyn service::ChainSpec>) -> &'static RuntimeVersion {
#[cfg(feature = "rococo-native")]
if spec.is_rococo() || spec.is_wococo() || spec.is_versi() {
if spec.is_rococo() {
return &service::rococo_runtime::VERSION
}

Expand Down
37 changes: 2 additions & 35 deletions node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ use grandpa::AuthorityId as GrandpaId;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_staking::Forcing;
use polkadot_primitives::{AccountId, AccountPublic, AssignmentId, ValidatorId};
#[cfg(feature = "polkadot-native")]
use polkadot_runtime as polkadot;
#[cfg(feature = "polkadot-native")]
use polkadot_runtime_constants::currency::UNITS as DOT;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;

#[cfg(feature = "rococo-native")]
use rococo_runtime as rococo;
#[cfg(feature = "rococo-native")]
Expand All @@ -47,8 +42,6 @@ use telemetry::TelemetryEndpoints;
const POLKADOT_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
#[cfg(feature = "rococo-native")]
const ROCOCO_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
#[cfg(feature = "rococo-native")]
const VERSI_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
const DEFAULT_PROTOCOL_ID: &str = "dot";

/// Node `ChainSpec` extensions.
Expand Down Expand Up @@ -366,7 +359,7 @@ fn cherry_staging_testnet_config_genesis(wasm_binary: &[u8]) -> cherry::GenesisC
},
paras: Default::default(),
xcm_pallet: Default::default(),
sudo: Default::default(),
sudo: cherry_runtime::SudoConfig { key: Some(endowed_accounts[0].clone()) },
// nomination_pools: Default::default(),
}
}
Expand Down Expand Up @@ -1130,32 +1123,6 @@ pub fn versi_chain_spec_properties() -> serde_json::map::Map<String, serde_json:
.clone()
}

/// Versi staging testnet config.
#[cfg(feature = "rococo-native")]
pub fn versi_staging_testnet_config() -> Result<RococoChainSpec, String> {
let wasm_binary = rococo::WASM_BINARY.ok_or("Versi development wasm not available")?;
let boot_nodes = vec![];

Ok(RococoChainSpec::from_genesis(
"Versi Staging Testnet",
"versi_staging_testnet",
ChainType::Live,
move || RococoGenesisExt {
runtime_genesis_config: rococo_staging_testnet_config_genesis(wasm_binary),
session_length_in_blocks: Some(100),
},
boot_nodes,
Some(
TelemetryEndpoints::new(vec![(VERSI_STAGING_TELEMETRY_URL.to_string(), 0)])
.expect("Versi Staging telemetry url is valid; qed"),
),
Some("versi"),
None,
Some(versi_chain_spec_properties()),
Default::default(),
))
}

/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
Expand Down Expand Up @@ -1319,7 +1286,7 @@ pub fn cherry_testnet_genesis(
},
paras: Default::default(),
xcm_pallet: Default::default(),
sudo: Default::default(),
sudo: cherry_runtime::SudoConfig { key: Some(root_key.clone()) },
// nomination_pools: Default::default(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/cherry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("cherry"),
impl_name: create_runtime_str!("cherry"),
authoring_version: 0,
spec_version: 23,
spec_version: 24,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
Expand Down

0 comments on commit 9fbab6f

Please sign in to comment.