mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
* Update wasm-builder version to 2.0.0 * Fix all crate compile * Update cargo lock * Bump runtime impl_version
This commit is contained in:
@@ -53,18 +53,18 @@ impl SubstrateCli for Cli {
|
|||||||
.unwrap_or("polkadot")
|
.unwrap_or("polkadot")
|
||||||
} else { id };
|
} else { id };
|
||||||
Ok(match id {
|
Ok(match id {
|
||||||
"polkadot-dev" | "dev" => Box::new(service::chain_spec::polkadot_development_config()),
|
"polkadot-dev" | "dev" => Box::new(service::chain_spec::polkadot_development_config()?),
|
||||||
"polkadot-local" => Box::new(service::chain_spec::polkadot_local_testnet_config()),
|
"polkadot-local" => Box::new(service::chain_spec::polkadot_local_testnet_config()?),
|
||||||
"polkadot-staging" => Box::new(service::chain_spec::polkadot_staging_testnet_config()),
|
"polkadot-staging" => Box::new(service::chain_spec::polkadot_staging_testnet_config()?),
|
||||||
"kusama-dev" => Box::new(service::chain_spec::kusama_development_config()),
|
"kusama-dev" => Box::new(service::chain_spec::kusama_development_config()?),
|
||||||
"kusama-local" => Box::new(service::chain_spec::kusama_local_testnet_config()),
|
"kusama-local" => Box::new(service::chain_spec::kusama_local_testnet_config()?),
|
||||||
"kusama-staging" => Box::new(service::chain_spec::kusama_staging_testnet_config()),
|
"kusama-staging" => Box::new(service::chain_spec::kusama_staging_testnet_config()?),
|
||||||
"polkadot" => Box::new(service::chain_spec::polkadot_config()?),
|
"polkadot" => Box::new(service::chain_spec::polkadot_config()?),
|
||||||
"westend" => Box::new(service::chain_spec::westend_config()?),
|
"westend" => Box::new(service::chain_spec::westend_config()?),
|
||||||
"kusama" => Box::new(service::chain_spec::kusama_config()?),
|
"kusama" => Box::new(service::chain_spec::kusama_config()?),
|
||||||
"westend-dev" => Box::new(service::chain_spec::westend_development_config()),
|
"westend-dev" => Box::new(service::chain_spec::westend_development_config()?),
|
||||||
"westend-local" => Box::new(service::chain_spec::westend_local_testnet_config()),
|
"westend-local" => Box::new(service::chain_spec::westend_local_testnet_config()?),
|
||||||
"westend-staging" => Box::new(service::chain_spec::westend_staging_testnet_config()),
|
"westend-staging" => Box::new(service::chain_spec::westend_staging_testnet_config()?),
|
||||||
path if self.run.force_kusama => {
|
path if self.run.force_kusama => {
|
||||||
Box::new(service::KusamaChainSpec::from_json_file(std::path::PathBuf::from(path))?)
|
Box::new(service::KusamaChainSpec::from_json_file(std::path::PathBuf::from(path))?)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ fn westend_session_keys(
|
|||||||
westend::SessionKeys { babe, grandpa, im_online, parachain_validator, authority_discovery }
|
westend::SessionKeys { babe, grandpa, im_online, parachain_validator, authority_discovery }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
|
fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig {
|
||||||
// subkey inspect "$SECRET"
|
// subkey inspect "$SECRET"
|
||||||
let endowed_accounts = vec![];
|
let endowed_accounts = vec![];
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
|
|||||||
|
|
||||||
polkadot::GenesisConfig {
|
polkadot::GenesisConfig {
|
||||||
system: Some(polkadot::SystemConfig {
|
system: Some(polkadot::SystemConfig {
|
||||||
code: polkadot::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
balances: Some(polkadot::BalancesConfig {
|
balances: Some(polkadot::BalancesConfig {
|
||||||
@@ -197,7 +197,7 @@ fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn westend_staging_testnet_config_genesis() -> westend::GenesisConfig {
|
fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::GenesisConfig {
|
||||||
// subkey inspect "$SECRET"
|
// subkey inspect "$SECRET"
|
||||||
let endowed_accounts = vec![
|
let endowed_accounts = vec![
|
||||||
// 5ENpP27BrVdJTdUfY6djmcw3d3xEJ6NzSUU52CCPmGpMrdEY
|
// 5ENpP27BrVdJTdUfY6djmcw3d3xEJ6NzSUU52CCPmGpMrdEY
|
||||||
@@ -284,7 +284,7 @@ fn westend_staging_testnet_config_genesis() -> westend::GenesisConfig {
|
|||||||
|
|
||||||
westend::GenesisConfig {
|
westend::GenesisConfig {
|
||||||
system: Some(westend::SystemConfig {
|
system: Some(westend::SystemConfig {
|
||||||
code: westend::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
balances: Some(westend::BalancesConfig {
|
balances: Some(westend::BalancesConfig {
|
||||||
@@ -337,7 +337,7 @@ fn westend_staging_testnet_config_genesis() -> westend::GenesisConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
|
fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisConfig {
|
||||||
// subkey inspect "$SECRET"
|
// subkey inspect "$SECRET"
|
||||||
let endowed_accounts = vec![
|
let endowed_accounts = vec![
|
||||||
// 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
|
// 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
|
||||||
@@ -424,7 +424,7 @@ fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
|
|||||||
|
|
||||||
kusama::GenesisConfig {
|
kusama::GenesisConfig {
|
||||||
system: Some(kusama::SystemConfig {
|
system: Some(kusama::SystemConfig {
|
||||||
code: kusama::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
balances: Some(kusama::BalancesConfig {
|
balances: Some(kusama::BalancesConfig {
|
||||||
@@ -490,54 +490,60 @@ fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Polkadot staging testnet config.
|
/// Polkadot staging testnet config.
|
||||||
pub fn polkadot_staging_testnet_config() -> PolkadotChainSpec {
|
pub fn polkadot_staging_testnet_config() -> Result<PolkadotChainSpec, String> {
|
||||||
|
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
|
||||||
let boot_nodes = vec![];
|
let boot_nodes = vec![];
|
||||||
PolkadotChainSpec::from_genesis(
|
|
||||||
|
Ok(PolkadotChainSpec::from_genesis(
|
||||||
"Polkadot Staging Testnet",
|
"Polkadot Staging Testnet",
|
||||||
"polkadot_staging_testnet",
|
"polkadot_staging_testnet",
|
||||||
ChainType::Live,
|
ChainType::Live,
|
||||||
polkadot_staging_testnet_config_genesis,
|
move || polkadot_staging_testnet_config_genesis(wasm_binary),
|
||||||
boot_nodes,
|
boot_nodes,
|
||||||
Some(TelemetryEndpoints::new(vec![(POLKADOT_STAGING_TELEMETRY_URL.to_string(), 0)])
|
Some(TelemetryEndpoints::new(vec![(POLKADOT_STAGING_TELEMETRY_URL.to_string(), 0)])
|
||||||
.expect("Polkadot Staging telemetry url is valid; qed")),
|
.expect("Polkadot Staging telemetry url is valid; qed")),
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Staging testnet config.
|
/// Staging testnet config.
|
||||||
pub fn kusama_staging_testnet_config() -> KusamaChainSpec {
|
pub fn kusama_staging_testnet_config() -> Result<KusamaChainSpec, String> {
|
||||||
|
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
|
||||||
let boot_nodes = vec![];
|
let boot_nodes = vec![];
|
||||||
KusamaChainSpec::from_genesis(
|
|
||||||
|
Ok(KusamaChainSpec::from_genesis(
|
||||||
"Kusama Staging Testnet",
|
"Kusama Staging Testnet",
|
||||||
"kusama_staging_testnet",
|
"kusama_staging_testnet",
|
||||||
ChainType::Live,
|
ChainType::Live,
|
||||||
kusama_staging_testnet_config_genesis,
|
move || kusama_staging_testnet_config_genesis(wasm_binary),
|
||||||
boot_nodes,
|
boot_nodes,
|
||||||
Some(TelemetryEndpoints::new(vec![(KUSAMA_STAGING_TELEMETRY_URL.to_string(), 0)])
|
Some(TelemetryEndpoints::new(vec![(KUSAMA_STAGING_TELEMETRY_URL.to_string(), 0)])
|
||||||
.expect("Kusama Staging telemetry url is valid; qed")),
|
.expect("Kusama Staging telemetry url is valid; qed")),
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Westend staging testnet config.
|
/// Westend staging testnet config.
|
||||||
pub fn westend_staging_testnet_config() -> WestendChainSpec {
|
pub fn westend_staging_testnet_config() -> Result<WestendChainSpec, String> {
|
||||||
|
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
|
||||||
let boot_nodes = vec![];
|
let boot_nodes = vec![];
|
||||||
WestendChainSpec::from_genesis(
|
|
||||||
|
Ok(WestendChainSpec::from_genesis(
|
||||||
"Westend Staging Testnet",
|
"Westend Staging Testnet",
|
||||||
"westend_staging_testnet",
|
"westend_staging_testnet",
|
||||||
ChainType::Live,
|
ChainType::Live,
|
||||||
westend_staging_testnet_config_genesis,
|
move || westend_staging_testnet_config_genesis(wasm_binary),
|
||||||
boot_nodes,
|
boot_nodes,
|
||||||
Some(TelemetryEndpoints::new(vec![(WESTEND_STAGING_TELEMETRY_URL.to_string(), 0)])
|
Some(TelemetryEndpoints::new(vec![(WESTEND_STAGING_TELEMETRY_URL.to_string(), 0)])
|
||||||
.expect("Westend Staging telemetry url is valid; qed")),
|
.expect("Westend Staging telemetry url is valid; qed")),
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to generate a crypto pair from seed
|
/// Helper function to generate a crypto pair from seed
|
||||||
@@ -595,6 +601,7 @@ fn testnet_accounts() -> Vec<AccountId> {
|
|||||||
|
|
||||||
/// Helper function to create polkadot GenesisConfig for testing
|
/// Helper function to create polkadot GenesisConfig for testing
|
||||||
pub fn polkadot_testnet_genesis(
|
pub fn polkadot_testnet_genesis(
|
||||||
|
wasm_binary: &[u8],
|
||||||
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
||||||
_root_key: AccountId,
|
_root_key: AccountId,
|
||||||
endowed_accounts: Option<Vec<AccountId>>,
|
endowed_accounts: Option<Vec<AccountId>>,
|
||||||
@@ -606,7 +613,7 @@ pub fn polkadot_testnet_genesis(
|
|||||||
|
|
||||||
polkadot::GenesisConfig {
|
polkadot::GenesisConfig {
|
||||||
system: Some(polkadot::SystemConfig {
|
system: Some(polkadot::SystemConfig {
|
||||||
code: polkadot::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
indices: Some(polkadot::IndicesConfig {
|
indices: Some(polkadot::IndicesConfig {
|
||||||
@@ -669,6 +676,7 @@ pub fn polkadot_testnet_genesis(
|
|||||||
|
|
||||||
/// Helper function to create kusama GenesisConfig for testing
|
/// Helper function to create kusama GenesisConfig for testing
|
||||||
pub fn kusama_testnet_genesis(
|
pub fn kusama_testnet_genesis(
|
||||||
|
wasm_binary: &[u8],
|
||||||
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
||||||
_root_key: AccountId,
|
_root_key: AccountId,
|
||||||
endowed_accounts: Option<Vec<AccountId>>,
|
endowed_accounts: Option<Vec<AccountId>>,
|
||||||
@@ -680,7 +688,7 @@ pub fn kusama_testnet_genesis(
|
|||||||
|
|
||||||
kusama::GenesisConfig {
|
kusama::GenesisConfig {
|
||||||
system: Some(kusama::SystemConfig {
|
system: Some(kusama::SystemConfig {
|
||||||
code: kusama::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
indices: Some(kusama::IndicesConfig {
|
indices: Some(kusama::IndicesConfig {
|
||||||
@@ -743,6 +751,7 @@ pub fn kusama_testnet_genesis(
|
|||||||
|
|
||||||
/// Helper function to create polkadot GenesisConfig for testing
|
/// Helper function to create polkadot GenesisConfig for testing
|
||||||
pub fn westend_testnet_genesis(
|
pub fn westend_testnet_genesis(
|
||||||
|
wasm_binary: &[u8],
|
||||||
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
||||||
root_key: AccountId,
|
root_key: AccountId,
|
||||||
endowed_accounts: Option<Vec<AccountId>>,
|
endowed_accounts: Option<Vec<AccountId>>,
|
||||||
@@ -754,7 +763,7 @@ pub fn westend_testnet_genesis(
|
|||||||
|
|
||||||
westend::GenesisConfig {
|
westend::GenesisConfig {
|
||||||
system: Some(westend::SystemConfig {
|
system: Some(westend::SystemConfig {
|
||||||
code: westend::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
indices: Some(westend::IndicesConfig {
|
indices: Some(westend::IndicesConfig {
|
||||||
@@ -803,8 +812,9 @@ pub fn westend_testnet_genesis(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn polkadot_development_config_genesis() -> polkadot::GenesisConfig {
|
fn polkadot_development_config_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig {
|
||||||
polkadot_testnet_genesis(
|
polkadot_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
],
|
],
|
||||||
@@ -813,8 +823,9 @@ fn polkadot_development_config_genesis() -> polkadot::GenesisConfig {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kusama_development_config_genesis() -> kusama::GenesisConfig {
|
fn kusama_development_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisConfig {
|
||||||
kusama_testnet_genesis(
|
kusama_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
],
|
],
|
||||||
@@ -823,8 +834,9 @@ fn kusama_development_config_genesis() -> kusama::GenesisConfig {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn westend_development_config_genesis() -> westend::GenesisConfig {
|
fn westend_development_config_genesis(wasm_binary: &[u8]) -> westend::GenesisConfig {
|
||||||
westend_testnet_genesis(
|
westend_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
],
|
],
|
||||||
@@ -834,52 +846,59 @@ fn westend_development_config_genesis() -> westend::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Polkadot development config (single validator Alice)
|
/// Polkadot development config (single validator Alice)
|
||||||
pub fn polkadot_development_config() -> PolkadotChainSpec {
|
pub fn polkadot_development_config() -> Result<PolkadotChainSpec, String> {
|
||||||
PolkadotChainSpec::from_genesis(
|
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(PolkadotChainSpec::from_genesis(
|
||||||
"Development",
|
"Development",
|
||||||
"dev",
|
"dev",
|
||||||
ChainType::Development,
|
ChainType::Development,
|
||||||
polkadot_development_config_genesis,
|
move || polkadot_development_config_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Kusama development config (single validator Alice)
|
/// Kusama development config (single validator Alice)
|
||||||
pub fn kusama_development_config() -> KusamaChainSpec {
|
pub fn kusama_development_config() -> Result<KusamaChainSpec, String> {
|
||||||
KusamaChainSpec::from_genesis(
|
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(KusamaChainSpec::from_genesis(
|
||||||
"Development",
|
"Development",
|
||||||
"kusama_dev",
|
"kusama_dev",
|
||||||
ChainType::Development,
|
ChainType::Development,
|
||||||
kusama_development_config_genesis,
|
move || kusama_development_config_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Westend development config (single validator Alice)
|
/// Westend development config (single validator Alice)
|
||||||
pub fn westend_development_config() -> WestendChainSpec {
|
pub fn westend_development_config() -> Result<WestendChainSpec, String> {
|
||||||
WestendChainSpec::from_genesis(
|
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(WestendChainSpec::from_genesis(
|
||||||
"Development",
|
"Development",
|
||||||
"westend_dev",
|
"westend_dev",
|
||||||
ChainType::Development,
|
ChainType::Development,
|
||||||
westend_development_config_genesis,
|
move || westend_development_config_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn polkadot_local_testnet_genesis() -> polkadot::GenesisConfig {
|
fn polkadot_local_testnet_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig {
|
||||||
polkadot_testnet_genesis(
|
polkadot_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
get_authority_keys_from_seed("Bob"),
|
get_authority_keys_from_seed("Bob"),
|
||||||
@@ -890,22 +909,25 @@ fn polkadot_local_testnet_genesis() -> polkadot::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Polkadot local testnet config (multivalidator Alice + Bob)
|
/// Polkadot local testnet config (multivalidator Alice + Bob)
|
||||||
pub fn polkadot_local_testnet_config() -> PolkadotChainSpec {
|
pub fn polkadot_local_testnet_config() -> Result<PolkadotChainSpec, String> {
|
||||||
PolkadotChainSpec::from_genesis(
|
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(PolkadotChainSpec::from_genesis(
|
||||||
"Local Testnet",
|
"Local Testnet",
|
||||||
"local_testnet",
|
"local_testnet",
|
||||||
ChainType::Local,
|
ChainType::Local,
|
||||||
polkadot_local_testnet_genesis,
|
move || polkadot_local_testnet_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kusama_local_testnet_genesis() -> kusama::GenesisConfig {
|
fn kusama_local_testnet_genesis(wasm_binary: &[u8]) -> kusama::GenesisConfig {
|
||||||
kusama_testnet_genesis(
|
kusama_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
get_authority_keys_from_seed("Bob"),
|
get_authority_keys_from_seed("Bob"),
|
||||||
@@ -916,22 +938,25 @@ fn kusama_local_testnet_genesis() -> kusama::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Kusama local testnet config (multivalidator Alice + Bob)
|
/// Kusama local testnet config (multivalidator Alice + Bob)
|
||||||
pub fn kusama_local_testnet_config() -> KusamaChainSpec {
|
pub fn kusama_local_testnet_config() -> Result<KusamaChainSpec, String> {
|
||||||
KusamaChainSpec::from_genesis(
|
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(KusamaChainSpec::from_genesis(
|
||||||
"Kusama Local Testnet",
|
"Kusama Local Testnet",
|
||||||
"kusama_local_testnet",
|
"kusama_local_testnet",
|
||||||
ChainType::Local,
|
ChainType::Local,
|
||||||
kusama_local_testnet_genesis,
|
move || kusama_local_testnet_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn westend_local_testnet_genesis() -> westend::GenesisConfig {
|
fn westend_local_testnet_genesis(wasm_binary: &[u8]) -> westend::GenesisConfig {
|
||||||
westend_testnet_genesis(
|
westend_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
get_authority_keys_from_seed("Bob"),
|
get_authority_keys_from_seed("Bob"),
|
||||||
@@ -942,16 +967,18 @@ fn westend_local_testnet_genesis() -> westend::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Westend local testnet config (multivalidator Alice + Bob)
|
/// Westend local testnet config (multivalidator Alice + Bob)
|
||||||
pub fn westend_local_testnet_config() -> WestendChainSpec {
|
pub fn westend_local_testnet_config() -> Result<WestendChainSpec, String> {
|
||||||
WestendChainSpec::from_genesis(
|
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(WestendChainSpec::from_genesis(
|
||||||
"Westend Local Testnet",
|
"Westend Local Testnet",
|
||||||
"westend_local_testnet",
|
"westend_local_testnet",
|
||||||
ChainType::Local,
|
ChainType::Local,
|
||||||
westend_local_testnet_genesis,
|
move || westend_local_testnet_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ fn polkadot_testnet_genesis(
|
|||||||
|
|
||||||
polkadot::GenesisConfig {
|
polkadot::GenesisConfig {
|
||||||
system: Some(polkadot::SystemConfig {
|
system: Some(polkadot::SystemConfig {
|
||||||
code: polkadot::WASM_BINARY.to_vec(),
|
code: polkadot::WASM_BINARY.expect("Wasm binary must be built for testing").to_vec(),
|
||||||
changes_trie_config,
|
changes_trie_config,
|
||||||
}),
|
}),
|
||||||
indices: Some(polkadot::IndicesConfig { indices: vec![] }),
|
indices: Some(polkadot::IndicesConfig { indices: vec![] }),
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use wasm_builder_runner::WasmBuilder;
|
|||||||
fn main() {
|
fn main() {
|
||||||
WasmBuilder::new()
|
WasmBuilder::new()
|
||||||
.with_current_project()
|
.with_current_project()
|
||||||
.with_wasm_builder_from_crates("1.0.11")
|
.with_wasm_builder_from_crates("2.0.0")
|
||||||
.export_heap_base()
|
.export_heap_base()
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
/// Wasm binary unwrapped. If built with `BUILD_DUMMY_WASM_BINARY`, the function panics.
|
||||||
|
pub fn wasm_binary_unwrap() -> &'static [u8] {
|
||||||
|
WASM_BINARY.expect("Development wasm binary is not available. Testing is only \
|
||||||
|
supported with the flag disabled.")
|
||||||
|
}
|
||||||
|
|
||||||
/// Head data for this parachain.
|
/// Head data for this parachain.
|
||||||
#[derive(Default, Clone, Hash, Eq, PartialEq, Encode, Decode)]
|
#[derive(Default, Clone, Hash, Eq, PartialEq, Encode, Decode)]
|
||||||
pub struct HeadData {
|
pub struct HeadData {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use wasm_builder_runner::WasmBuilder;
|
|||||||
fn main() {
|
fn main() {
|
||||||
WasmBuilder::new()
|
WasmBuilder::new()
|
||||||
.with_current_project()
|
.with_current_project()
|
||||||
.with_wasm_builder_from_crates("1.0.11")
|
.with_wasm_builder_from_crates("2.0.0")
|
||||||
.export_heap_base()
|
.export_heap_base()
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,13 @@ static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
/// Wasm binary unwrapped. If built with `BUILD_DUMMY_WASM_BINARY`, the function panics.
|
||||||
|
pub fn wasm_binary_unwrap() -> &'static [u8] {
|
||||||
|
WASM_BINARY.expect("Development wasm binary is not available. Testing is only \
|
||||||
|
supported with the flag disabled.")
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Encode, Decode, Clone, Default)]
|
#[derive(Encode, Decode, Clone, Default)]
|
||||||
pub struct State {
|
pub struct State {
|
||||||
/// The current code that is "active" in this chain.
|
/// The current code that is "active" in this chain.
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use wasm_builder_runner::WasmBuilder;
|
|||||||
fn main() {
|
fn main() {
|
||||||
WasmBuilder::new()
|
WasmBuilder::new()
|
||||||
.with_current_project()
|
.with_current_project()
|
||||||
.with_wasm_builder_from_crates("1.0.11")
|
.with_wasm_builder_from_crates("2.0.0")
|
||||||
.export_heap_base()
|
.export_heap_base()
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,13 @@
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
/// Wasm binary unwrapped. If built with `BUILD_DUMMY_WASM_BINARY`, the function panics.
|
||||||
|
pub fn wasm_binary_unwrap() -> &'static [u8] {
|
||||||
|
WASM_BINARY.expect("Development wasm binary is not available. Testing is only \
|
||||||
|
supported with the flag disabled.")
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@@ -46,4 +53,3 @@ pub fn oom(_: core::alloc::Layout) -> ! {
|
|||||||
pub extern fn validate_block(params: *const u8, len: usize) -> usize {
|
pub extern fn validate_block(params: *const u8, len: usize) -> usize {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ struct BlockData {
|
|||||||
add: u64,
|
add: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
const TEST_CODE: &[u8] = adder::WASM_BINARY;
|
|
||||||
|
|
||||||
fn hash_state(state: u64) -> [u8; 32] {
|
fn hash_state(state: u64) -> [u8; 32] {
|
||||||
tiny_keccak::keccak256(state.encode().as_slice())
|
tiny_keccak::keccak256(state.encode().as_slice())
|
||||||
}
|
}
|
||||||
@@ -70,7 +68,7 @@ pub fn execute_good_on_parent() {
|
|||||||
let pool = parachain::wasm_executor::ValidationPool::new();
|
let pool = parachain::wasm_executor::ValidationPool::new();
|
||||||
|
|
||||||
let ret = parachain::wasm_executor::validate_candidate(
|
let ret = parachain::wasm_executor::validate_candidate(
|
||||||
TEST_CODE,
|
adder::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
parent_head: GenericHeadData(parent_head.encode()),
|
parent_head: GenericHeadData(parent_head.encode()),
|
||||||
block_data: GenericBlockData(block_data.encode()),
|
block_data: GenericBlockData(block_data.encode()),
|
||||||
@@ -109,7 +107,7 @@ fn execute_good_chain_on_parent() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let ret = parachain::wasm_executor::validate_candidate(
|
let ret = parachain::wasm_executor::validate_candidate(
|
||||||
TEST_CODE,
|
adder::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
parent_head: GenericHeadData(parent_head.encode()),
|
parent_head: GenericHeadData(parent_head.encode()),
|
||||||
block_data: GenericBlockData(block_data.encode()),
|
block_data: GenericBlockData(block_data.encode()),
|
||||||
@@ -149,7 +147,7 @@ fn execute_bad_on_parent() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let _ret = parachain::wasm_executor::validate_candidate(
|
let _ret = parachain::wasm_executor::validate_candidate(
|
||||||
TEST_CODE,
|
adder::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
parent_head: GenericHeadData(parent_head.encode()),
|
parent_head: GenericHeadData(parent_head.encode()),
|
||||||
block_data: GenericBlockData(block_data.encode()),
|
block_data: GenericBlockData(block_data.encode()),
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ use parachain::primitives::{
|
|||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use code_upgrader::{hash_state, HeadData, BlockData, State};
|
use code_upgrader::{hash_state, HeadData, BlockData, State};
|
||||||
|
|
||||||
const TEST_CODE: &[u8] = code_upgrader::WASM_BINARY;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn execute_good_no_upgrade() {
|
pub fn execute_good_no_upgrade() {
|
||||||
let pool = parachain::wasm_executor::ValidationPool::new();
|
let pool = parachain::wasm_executor::ValidationPool::new();
|
||||||
@@ -42,7 +40,7 @@ pub fn execute_good_no_upgrade() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let ret = parachain::wasm_executor::validate_candidate(
|
let ret = parachain::wasm_executor::validate_candidate(
|
||||||
TEST_CODE,
|
code_upgrader::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
parent_head: GenericHeadData(parent_head.encode()),
|
parent_head: GenericHeadData(parent_head.encode()),
|
||||||
block_data: GenericBlockData(block_data.encode()),
|
block_data: GenericBlockData(block_data.encode()),
|
||||||
@@ -78,7 +76,7 @@ pub fn execute_good_with_upgrade() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let ret = parachain::wasm_executor::validate_candidate(
|
let ret = parachain::wasm_executor::validate_candidate(
|
||||||
TEST_CODE,
|
code_upgrader::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
parent_head: GenericHeadData(parent_head.encode()),
|
parent_head: GenericHeadData(parent_head.encode()),
|
||||||
block_data: GenericBlockData(block_data.encode()),
|
block_data: GenericBlockData(block_data.encode()),
|
||||||
@@ -121,7 +119,7 @@ pub fn code_upgrade_not_allowed() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
parachain::wasm_executor::validate_candidate(
|
parachain::wasm_executor::validate_candidate(
|
||||||
TEST_CODE,
|
code_upgrader::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
parent_head: GenericHeadData(parent_head.encode()),
|
parent_head: GenericHeadData(parent_head.encode()),
|
||||||
block_data: GenericBlockData(block_data.encode()),
|
block_data: GenericBlockData(block_data.encode()),
|
||||||
@@ -151,7 +149,7 @@ pub fn applies_code_upgrade_after_delay() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let ret = parachain::wasm_executor::validate_candidate(
|
let ret = parachain::wasm_executor::validate_candidate(
|
||||||
TEST_CODE,
|
code_upgrader::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
parent_head: GenericHeadData(parent_head.encode()),
|
parent_head: GenericHeadData(parent_head.encode()),
|
||||||
block_data: GenericBlockData(block_data.encode()),
|
block_data: GenericBlockData(block_data.encode()),
|
||||||
@@ -186,7 +184,7 @@ pub fn applies_code_upgrade_after_delay() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let ret = parachain::wasm_executor::validate_candidate(
|
let ret = parachain::wasm_executor::validate_candidate(
|
||||||
TEST_CODE,
|
code_upgrader::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
parent_head: GenericHeadData(parent_head.encode()),
|
parent_head: GenericHeadData(parent_head.encode()),
|
||||||
block_data: GenericBlockData(block_data.encode()),
|
block_data: GenericBlockData(block_data.encode()),
|
||||||
|
|||||||
@@ -22,15 +22,12 @@ use parachain::{
|
|||||||
wasm_executor::EXECUTION_TIMEOUT_SEC,
|
wasm_executor::EXECUTION_TIMEOUT_SEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Code that exposes `validate_block` and loops infinitely
|
|
||||||
const INFINITE_LOOP_CODE: &[u8] = halt::WASM_BINARY;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn terminates_on_timeout() {
|
fn terminates_on_timeout() {
|
||||||
let pool = parachain::wasm_executor::ValidationPool::new();
|
let pool = parachain::wasm_executor::ValidationPool::new();
|
||||||
|
|
||||||
let result = parachain::wasm_executor::validate_candidate(
|
let result = parachain::wasm_executor::validate_candidate(
|
||||||
INFINITE_LOOP_CODE,
|
halt::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
block_data: BlockData(Vec::new()),
|
block_data: BlockData(Vec::new()),
|
||||||
parent_head: Default::default(),
|
parent_head: Default::default(),
|
||||||
@@ -59,7 +56,7 @@ fn parallel_execution() {
|
|||||||
let pool2 = pool.clone();
|
let pool2 = pool.clone();
|
||||||
let thread = std::thread::spawn(move ||
|
let thread = std::thread::spawn(move ||
|
||||||
parachain::wasm_executor::validate_candidate(
|
parachain::wasm_executor::validate_candidate(
|
||||||
INFINITE_LOOP_CODE,
|
halt::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
block_data: BlockData(Vec::new()),
|
block_data: BlockData(Vec::new()),
|
||||||
parent_head: Default::default(),
|
parent_head: Default::default(),
|
||||||
@@ -71,7 +68,7 @@ fn parallel_execution() {
|
|||||||
parachain::wasm_executor::ExecutionMode::RemoteTest(&pool2),
|
parachain::wasm_executor::ExecutionMode::RemoteTest(&pool2),
|
||||||
).ok());
|
).ok());
|
||||||
let _ = parachain::wasm_executor::validate_candidate(
|
let _ = parachain::wasm_executor::validate_candidate(
|
||||||
INFINITE_LOOP_CODE,
|
halt::wasm_binary_unwrap(),
|
||||||
ValidationParams {
|
ValidationParams {
|
||||||
block_data: BlockData(Vec::new()),
|
block_data: BlockData(Vec::new()),
|
||||||
parent_head: Default::default(),
|
parent_head: Default::default(),
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use wasm_builder_runner::WasmBuilder;
|
|||||||
fn main() {
|
fn main() {
|
||||||
WasmBuilder::new()
|
WasmBuilder::new()
|
||||||
.with_current_project()
|
.with_current_project()
|
||||||
.with_wasm_builder_from_crates("1.0.11")
|
.with_wasm_builder_from_crates("2.0.0")
|
||||||
.import_memory()
|
.import_memory()
|
||||||
.export_heap_base()
|
.export_heap_base()
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
impl_name: create_runtime_str!("parity-kusama"),
|
impl_name: create_runtime_str!("parity-kusama"),
|
||||||
authoring_version: 2,
|
authoring_version: 2,
|
||||||
spec_version: 2020,
|
spec_version: 2020,
|
||||||
impl_version: 0,
|
impl_version: 1,
|
||||||
#[cfg(not(feature = "disable-runtime-api"))]
|
#[cfg(not(feature = "disable-runtime-api"))]
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
#[cfg(feature = "disable-runtime-api")]
|
#[cfg(feature = "disable-runtime-api")]
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use wasm_builder_runner::WasmBuilder;
|
|||||||
fn main() {
|
fn main() {
|
||||||
WasmBuilder::new()
|
WasmBuilder::new()
|
||||||
.with_current_project()
|
.with_current_project()
|
||||||
.with_wasm_builder_from_crates("1.0.11")
|
.with_wasm_builder_from_crates("2.0.0")
|
||||||
.import_memory()
|
.import_memory()
|
||||||
.export_heap_base()
|
.export_heap_base()
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
impl_name: create_runtime_str!("parity-polkadot"),
|
impl_name: create_runtime_str!("parity-polkadot"),
|
||||||
authoring_version: 0,
|
authoring_version: 0,
|
||||||
spec_version: 20,
|
spec_version: 20,
|
||||||
impl_version: 0,
|
impl_version: 1,
|
||||||
#[cfg(not(feature = "disable-runtime-api"))]
|
#[cfg(not(feature = "disable-runtime-api"))]
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
#[cfg(feature = "disable-runtime-api")]
|
#[cfg(feature = "disable-runtime-api")]
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use wasm_builder_runner::WasmBuilder;
|
|||||||
fn main() {
|
fn main() {
|
||||||
WasmBuilder::new()
|
WasmBuilder::new()
|
||||||
.with_current_project()
|
.with_current_project()
|
||||||
.with_wasm_builder_from_crates("1.0.11")
|
.with_wasm_builder_from_crates("2.0.0")
|
||||||
.import_memory()
|
.import_memory()
|
||||||
.export_heap_base()
|
.export_heap_base()
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
impl_name: create_runtime_str!("parity-polkadot-test-runtime"),
|
impl_name: create_runtime_str!("parity-polkadot-test-runtime"),
|
||||||
authoring_version: 2,
|
authoring_version: 2,
|
||||||
spec_version: 1053,
|
spec_version: 1053,
|
||||||
impl_version: 0,
|
impl_version: 1,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
transaction_version: 1,
|
transaction_version: 1,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use wasm_builder_runner::WasmBuilder;
|
|||||||
fn main() {
|
fn main() {
|
||||||
WasmBuilder::new()
|
WasmBuilder::new()
|
||||||
.with_current_project()
|
.with_current_project()
|
||||||
.with_wasm_builder_from_crates("1.0.11")
|
.with_wasm_builder_from_crates("2.0.0")
|
||||||
.import_memory()
|
.import_memory()
|
||||||
.export_heap_base()
|
.export_heap_base()
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
impl_name: create_runtime_str!("parity-westend"),
|
impl_name: create_runtime_str!("parity-westend"),
|
||||||
authoring_version: 2,
|
authoring_version: 2,
|
||||||
spec_version: 40,
|
spec_version: 40,
|
||||||
impl_version: 0,
|
impl_version: 1,
|
||||||
#[cfg(not(feature = "disable-runtime-api"))]
|
#[cfg(not(feature = "disable-runtime-api"))]
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
#[cfg(feature = "disable-runtime-api")]
|
#[cfg(feature = "disable-runtime-api")]
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ fn westend_session_keys(
|
|||||||
westend::SessionKeys { babe, grandpa, im_online, parachain_validator, authority_discovery }
|
westend::SessionKeys { babe, grandpa, im_online, parachain_validator, authority_discovery }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
|
fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig {
|
||||||
// subkey inspect "$SECRET"
|
// subkey inspect "$SECRET"
|
||||||
let endowed_accounts = vec![];
|
let endowed_accounts = vec![];
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
|
|||||||
|
|
||||||
polkadot::GenesisConfig {
|
polkadot::GenesisConfig {
|
||||||
system: Some(polkadot::SystemConfig {
|
system: Some(polkadot::SystemConfig {
|
||||||
code: polkadot::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
balances: Some(polkadot::BalancesConfig {
|
balances: Some(polkadot::BalancesConfig {
|
||||||
@@ -197,7 +197,7 @@ fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn westend_staging_testnet_config_genesis() -> westend::GenesisConfig {
|
fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::GenesisConfig {
|
||||||
// subkey inspect "$SECRET"
|
// subkey inspect "$SECRET"
|
||||||
let endowed_accounts = vec![
|
let endowed_accounts = vec![
|
||||||
// 5ENpP27BrVdJTdUfY6djmcw3d3xEJ6NzSUU52CCPmGpMrdEY
|
// 5ENpP27BrVdJTdUfY6djmcw3d3xEJ6NzSUU52CCPmGpMrdEY
|
||||||
@@ -284,7 +284,7 @@ fn westend_staging_testnet_config_genesis() -> westend::GenesisConfig {
|
|||||||
|
|
||||||
westend::GenesisConfig {
|
westend::GenesisConfig {
|
||||||
system: Some(westend::SystemConfig {
|
system: Some(westend::SystemConfig {
|
||||||
code: westend::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
balances: Some(westend::BalancesConfig {
|
balances: Some(westend::BalancesConfig {
|
||||||
@@ -337,7 +337,7 @@ fn westend_staging_testnet_config_genesis() -> westend::GenesisConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
|
fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisConfig {
|
||||||
// subkey inspect "$SECRET"
|
// subkey inspect "$SECRET"
|
||||||
let endowed_accounts = vec![
|
let endowed_accounts = vec![
|
||||||
// 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
|
// 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
|
||||||
@@ -424,7 +424,7 @@ fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
|
|||||||
|
|
||||||
kusama::GenesisConfig {
|
kusama::GenesisConfig {
|
||||||
system: Some(kusama::SystemConfig {
|
system: Some(kusama::SystemConfig {
|
||||||
code: kusama::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
balances: Some(kusama::BalancesConfig {
|
balances: Some(kusama::BalancesConfig {
|
||||||
@@ -490,54 +490,60 @@ fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Polkadot staging testnet config.
|
/// Polkadot staging testnet config.
|
||||||
pub fn polkadot_staging_testnet_config() -> PolkadotChainSpec {
|
pub fn polkadot_staging_testnet_config() -> Result<PolkadotChainSpec, String> {
|
||||||
|
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
|
||||||
let boot_nodes = vec![];
|
let boot_nodes = vec![];
|
||||||
PolkadotChainSpec::from_genesis(
|
|
||||||
|
Ok(PolkadotChainSpec::from_genesis(
|
||||||
"Polkadot Staging Testnet",
|
"Polkadot Staging Testnet",
|
||||||
"polkadot_staging_testnet",
|
"polkadot_staging_testnet",
|
||||||
ChainType::Live,
|
ChainType::Live,
|
||||||
polkadot_staging_testnet_config_genesis,
|
move || polkadot_staging_testnet_config_genesis(wasm_binary),
|
||||||
boot_nodes,
|
boot_nodes,
|
||||||
Some(TelemetryEndpoints::new(vec![(POLKADOT_STAGING_TELEMETRY_URL.to_string(), 0)])
|
Some(TelemetryEndpoints::new(vec![(POLKADOT_STAGING_TELEMETRY_URL.to_string(), 0)])
|
||||||
.expect("Polkadot Staging telemetry url is valid; qed")),
|
.expect("Polkadot Staging telemetry url is valid; qed")),
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Staging testnet config.
|
/// Staging testnet config.
|
||||||
pub fn kusama_staging_testnet_config() -> KusamaChainSpec {
|
pub fn kusama_staging_testnet_config() -> Result<KusamaChainSpec, String> {
|
||||||
|
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
|
||||||
let boot_nodes = vec![];
|
let boot_nodes = vec![];
|
||||||
KusamaChainSpec::from_genesis(
|
|
||||||
|
Ok(KusamaChainSpec::from_genesis(
|
||||||
"Kusama Staging Testnet",
|
"Kusama Staging Testnet",
|
||||||
"kusama_staging_testnet",
|
"kusama_staging_testnet",
|
||||||
ChainType::Live,
|
ChainType::Live,
|
||||||
kusama_staging_testnet_config_genesis,
|
move || kusama_staging_testnet_config_genesis(wasm_binary),
|
||||||
boot_nodes,
|
boot_nodes,
|
||||||
Some(TelemetryEndpoints::new(vec![(KUSAMA_STAGING_TELEMETRY_URL.to_string(), 0)])
|
Some(TelemetryEndpoints::new(vec![(KUSAMA_STAGING_TELEMETRY_URL.to_string(), 0)])
|
||||||
.expect("Kusama Staging telemetry url is valid; qed")),
|
.expect("Kusama Staging telemetry url is valid; qed")),
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Westend staging testnet config.
|
/// Westend staging testnet config.
|
||||||
pub fn westend_staging_testnet_config() -> WestendChainSpec {
|
pub fn westend_staging_testnet_config() -> Result<WestendChainSpec, String> {
|
||||||
|
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
|
||||||
let boot_nodes = vec![];
|
let boot_nodes = vec![];
|
||||||
WestendChainSpec::from_genesis(
|
|
||||||
|
Ok(WestendChainSpec::from_genesis(
|
||||||
"Westend Staging Testnet",
|
"Westend Staging Testnet",
|
||||||
"westend_staging_testnet",
|
"westend_staging_testnet",
|
||||||
ChainType::Live,
|
ChainType::Live,
|
||||||
westend_staging_testnet_config_genesis,
|
move || westend_staging_testnet_config_genesis(wasm_binary),
|
||||||
boot_nodes,
|
boot_nodes,
|
||||||
Some(TelemetryEndpoints::new(vec![(WESTEND_STAGING_TELEMETRY_URL.to_string(), 0)])
|
Some(TelemetryEndpoints::new(vec![(WESTEND_STAGING_TELEMETRY_URL.to_string(), 0)])
|
||||||
.expect("Westend Staging telemetry url is valid; qed")),
|
.expect("Westend Staging telemetry url is valid; qed")),
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to generate a crypto pair from seed
|
/// Helper function to generate a crypto pair from seed
|
||||||
@@ -595,6 +601,7 @@ fn testnet_accounts() -> Vec<AccountId> {
|
|||||||
|
|
||||||
/// Helper function to create polkadot GenesisConfig for testing
|
/// Helper function to create polkadot GenesisConfig for testing
|
||||||
pub fn polkadot_testnet_genesis(
|
pub fn polkadot_testnet_genesis(
|
||||||
|
wasm_binary: &[u8],
|
||||||
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
||||||
_root_key: AccountId,
|
_root_key: AccountId,
|
||||||
endowed_accounts: Option<Vec<AccountId>>,
|
endowed_accounts: Option<Vec<AccountId>>,
|
||||||
@@ -606,7 +613,7 @@ pub fn polkadot_testnet_genesis(
|
|||||||
|
|
||||||
polkadot::GenesisConfig {
|
polkadot::GenesisConfig {
|
||||||
system: Some(polkadot::SystemConfig {
|
system: Some(polkadot::SystemConfig {
|
||||||
code: polkadot::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
indices: Some(polkadot::IndicesConfig {
|
indices: Some(polkadot::IndicesConfig {
|
||||||
@@ -669,6 +676,7 @@ pub fn polkadot_testnet_genesis(
|
|||||||
|
|
||||||
/// Helper function to create kusama GenesisConfig for testing
|
/// Helper function to create kusama GenesisConfig for testing
|
||||||
pub fn kusama_testnet_genesis(
|
pub fn kusama_testnet_genesis(
|
||||||
|
wasm_binary: &[u8],
|
||||||
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
||||||
_root_key: AccountId,
|
_root_key: AccountId,
|
||||||
endowed_accounts: Option<Vec<AccountId>>,
|
endowed_accounts: Option<Vec<AccountId>>,
|
||||||
@@ -680,7 +688,7 @@ pub fn kusama_testnet_genesis(
|
|||||||
|
|
||||||
kusama::GenesisConfig {
|
kusama::GenesisConfig {
|
||||||
system: Some(kusama::SystemConfig {
|
system: Some(kusama::SystemConfig {
|
||||||
code: kusama::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
indices: Some(kusama::IndicesConfig {
|
indices: Some(kusama::IndicesConfig {
|
||||||
@@ -743,6 +751,7 @@ pub fn kusama_testnet_genesis(
|
|||||||
|
|
||||||
/// Helper function to create polkadot GenesisConfig for testing
|
/// Helper function to create polkadot GenesisConfig for testing
|
||||||
pub fn westend_testnet_genesis(
|
pub fn westend_testnet_genesis(
|
||||||
|
wasm_binary: &[u8],
|
||||||
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
||||||
root_key: AccountId,
|
root_key: AccountId,
|
||||||
endowed_accounts: Option<Vec<AccountId>>,
|
endowed_accounts: Option<Vec<AccountId>>,
|
||||||
@@ -754,7 +763,7 @@ pub fn westend_testnet_genesis(
|
|||||||
|
|
||||||
westend::GenesisConfig {
|
westend::GenesisConfig {
|
||||||
system: Some(westend::SystemConfig {
|
system: Some(westend::SystemConfig {
|
||||||
code: westend::WASM_BINARY.to_vec(),
|
code: wasm_binary.to_vec(),
|
||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
indices: Some(westend::IndicesConfig {
|
indices: Some(westend::IndicesConfig {
|
||||||
@@ -803,8 +812,9 @@ pub fn westend_testnet_genesis(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn polkadot_development_config_genesis() -> polkadot::GenesisConfig {
|
fn polkadot_development_config_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig {
|
||||||
polkadot_testnet_genesis(
|
polkadot_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
],
|
],
|
||||||
@@ -813,8 +823,9 @@ fn polkadot_development_config_genesis() -> polkadot::GenesisConfig {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kusama_development_config_genesis() -> kusama::GenesisConfig {
|
fn kusama_development_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisConfig {
|
||||||
kusama_testnet_genesis(
|
kusama_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
],
|
],
|
||||||
@@ -823,8 +834,9 @@ fn kusama_development_config_genesis() -> kusama::GenesisConfig {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn westend_development_config_genesis() -> westend::GenesisConfig {
|
fn westend_development_config_genesis(wasm_binary: &[u8]) -> westend::GenesisConfig {
|
||||||
westend_testnet_genesis(
|
westend_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
],
|
],
|
||||||
@@ -834,52 +846,59 @@ fn westend_development_config_genesis() -> westend::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Polkadot development config (single validator Alice)
|
/// Polkadot development config (single validator Alice)
|
||||||
pub fn polkadot_development_config() -> PolkadotChainSpec {
|
pub fn polkadot_development_config() -> Result<PolkadotChainSpec, String> {
|
||||||
PolkadotChainSpec::from_genesis(
|
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(PolkadotChainSpec::from_genesis(
|
||||||
"Development",
|
"Development",
|
||||||
"dev",
|
"dev",
|
||||||
ChainType::Development,
|
ChainType::Development,
|
||||||
polkadot_development_config_genesis,
|
move || polkadot_development_config_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Kusama development config (single validator Alice)
|
/// Kusama development config (single validator Alice)
|
||||||
pub fn kusama_development_config() -> KusamaChainSpec {
|
pub fn kusama_development_config() -> Result<KusamaChainSpec, String> {
|
||||||
KusamaChainSpec::from_genesis(
|
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(KusamaChainSpec::from_genesis(
|
||||||
"Development",
|
"Development",
|
||||||
"kusama_dev",
|
"kusama_dev",
|
||||||
ChainType::Development,
|
ChainType::Development,
|
||||||
kusama_development_config_genesis,
|
move || kusama_development_config_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Westend development config (single validator Alice)
|
/// Westend development config (single validator Alice)
|
||||||
pub fn westend_development_config() -> WestendChainSpec {
|
pub fn westend_development_config() -> Result<WestendChainSpec, String> {
|
||||||
WestendChainSpec::from_genesis(
|
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(WestendChainSpec::from_genesis(
|
||||||
"Development",
|
"Development",
|
||||||
"westend_dev",
|
"westend_dev",
|
||||||
ChainType::Development,
|
ChainType::Development,
|
||||||
westend_development_config_genesis,
|
move || westend_development_config_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn polkadot_local_testnet_genesis() -> polkadot::GenesisConfig {
|
fn polkadot_local_testnet_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig {
|
||||||
polkadot_testnet_genesis(
|
polkadot_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
get_authority_keys_from_seed("Bob"),
|
get_authority_keys_from_seed("Bob"),
|
||||||
@@ -890,22 +909,25 @@ fn polkadot_local_testnet_genesis() -> polkadot::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Polkadot local testnet config (multivalidator Alice + Bob)
|
/// Polkadot local testnet config (multivalidator Alice + Bob)
|
||||||
pub fn polkadot_local_testnet_config() -> PolkadotChainSpec {
|
pub fn polkadot_local_testnet_config() -> Result<PolkadotChainSpec, String> {
|
||||||
PolkadotChainSpec::from_genesis(
|
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(PolkadotChainSpec::from_genesis(
|
||||||
"Local Testnet",
|
"Local Testnet",
|
||||||
"local_testnet",
|
"local_testnet",
|
||||||
ChainType::Local,
|
ChainType::Local,
|
||||||
polkadot_local_testnet_genesis,
|
move || polkadot_local_testnet_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kusama_local_testnet_genesis() -> kusama::GenesisConfig {
|
fn kusama_local_testnet_genesis(wasm_binary: &[u8]) -> kusama::GenesisConfig {
|
||||||
kusama_testnet_genesis(
|
kusama_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
get_authority_keys_from_seed("Bob"),
|
get_authority_keys_from_seed("Bob"),
|
||||||
@@ -916,22 +938,25 @@ fn kusama_local_testnet_genesis() -> kusama::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Kusama local testnet config (multivalidator Alice + Bob)
|
/// Kusama local testnet config (multivalidator Alice + Bob)
|
||||||
pub fn kusama_local_testnet_config() -> KusamaChainSpec {
|
pub fn kusama_local_testnet_config() -> Result<KusamaChainSpec, String> {
|
||||||
KusamaChainSpec::from_genesis(
|
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(KusamaChainSpec::from_genesis(
|
||||||
"Kusama Local Testnet",
|
"Kusama Local Testnet",
|
||||||
"kusama_local_testnet",
|
"kusama_local_testnet",
|
||||||
ChainType::Local,
|
ChainType::Local,
|
||||||
kusama_local_testnet_genesis,
|
move || kusama_local_testnet_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn westend_local_testnet_genesis() -> westend::GenesisConfig {
|
fn westend_local_testnet_genesis(wasm_binary: &[u8]) -> westend::GenesisConfig {
|
||||||
westend_testnet_genesis(
|
westend_testnet_genesis(
|
||||||
|
wasm_binary,
|
||||||
vec![
|
vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
get_authority_keys_from_seed("Bob"),
|
get_authority_keys_from_seed("Bob"),
|
||||||
@@ -942,16 +967,18 @@ fn westend_local_testnet_genesis() -> westend::GenesisConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Westend local testnet config (multivalidator Alice + Bob)
|
/// Westend local testnet config (multivalidator Alice + Bob)
|
||||||
pub fn westend_local_testnet_config() -> WestendChainSpec {
|
pub fn westend_local_testnet_config() -> Result<WestendChainSpec, String> {
|
||||||
WestendChainSpec::from_genesis(
|
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
|
||||||
|
|
||||||
|
Ok(WestendChainSpec::from_genesis(
|
||||||
"Westend Local Testnet",
|
"Westend Local Testnet",
|
||||||
"westend_local_testnet",
|
"westend_local_testnet",
|
||||||
ChainType::Local,
|
ChainType::Local,
|
||||||
westend_local_testnet_genesis,
|
move || westend_local_testnet_genesis(wasm_binary),
|
||||||
vec![],
|
vec![],
|
||||||
None,
|
None,
|
||||||
Some(DEFAULT_PROTOCOL_ID),
|
Some(DEFAULT_PROTOCOL_ID),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user