feat: Rebrand Polkadot/Substrate references to PezkuwiChain
This commit systematically rebrands various references from Parity Technologies' Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk. Key changes include: - Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks. - Modified internal documentation and code comments to reflect PezkuwiChain naming and structure. - Replaced direct references to with or specific paths within the for XCM, Pezkuwi, and other modules. - Cleaned up deprecated issue and PR references in various and files, particularly in and modules. - Adjusted image and logo URLs in documentation to point to PezkuwiChain assets. - Removed or rephrased comments related to external Polkadot/Substrate PRs and issues. This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
@@ -0,0 +1,250 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! The zombienet spawner for integration tests for a transaction pool. Holds shared logic used
|
||||
//! across integration tests for transaction pool.
|
||||
|
||||
use anyhow::anyhow;
|
||||
use std::time::SystemTime;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use txtesttool::scenario::{ChainType, ScenarioBuilder};
|
||||
use zombienet_sdk::{
|
||||
subxt::BizinikiwiConfig, GlobalSettingsBuilder, LocalFileSystem, Network, NetworkConfig,
|
||||
NetworkConfigBuilder, NetworkConfigExt, WithRelaychain,
|
||||
};
|
||||
|
||||
/// Gathers TOML files paths for relaychains and for teyrchains' (that use pezkuwichain-local based
|
||||
/// relaychains) zombienet network specs for testing in relation to fork aware transaction pool.
|
||||
pub mod relaychain_pezkuwichain_local_network_spec {
|
||||
pub const HIGH_POOL_LIMIT_FATP: &'static str =
|
||||
"tests/zombienet/network-specs/pezkuwichain-local-high-pool-limit-fatp.toml";
|
||||
pub const LOW_POOL_LIMIT_FATP: &'static str =
|
||||
"tests/zombienet/network-specs/pezkuwichain-local-low-pool-limit-fatp.toml";
|
||||
pub const HIGH_POOL_LIMIT_FATP_TRACE: &'static str =
|
||||
"tests/zombienet/network-specs/pezkuwichain-local-gossiping.toml";
|
||||
|
||||
/// Network specs used for fork-aware tx pool testing of teyrchains.
|
||||
pub mod teyrchain_asset_hub_network_spec {
|
||||
pub const LOW_POOL_LIMIT_FATP: &'static str =
|
||||
"tests/zombienet/network-specs/asset-hub-low-pool-limit-fatp.toml";
|
||||
pub const HIGH_POOL_LIMIT_FATP: &'static str =
|
||||
"tests/zombienet/network-specs/asset-hub-high-pool-limit-fatp.toml";
|
||||
}
|
||||
}
|
||||
|
||||
mod yap_test;
|
||||
|
||||
/// Default time that we expect to need for a full run of current tests that send future and ready
|
||||
/// txs to teyrchain or relaychain networks.
|
||||
pub const DEFAULT_SEND_FUTURE_AND_READY_TXS_TESTS_TIMEOUT_IN_SECS: u64 = 1500;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Network initialization failure: {0}")]
|
||||
NetworkInit(anyhow::Error),
|
||||
#[error("Node couldn't be found as part of the network: {0}")]
|
||||
NodeNotFound(anyhow::Error),
|
||||
#[error("Failed to get node online client")]
|
||||
FailedToGetOnlineClinet,
|
||||
#[error("Failed to get node blocks stream")]
|
||||
FailedToGetBlocksStream,
|
||||
}
|
||||
|
||||
/// Result of work related to network spawning.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Environment variable defining the location of zombienet network base dir.
|
||||
const TXPOOL_TEST_DIR_ENV: &str = "TXPOOL_TEST_DIR";
|
||||
|
||||
/// Type for block subscription modes.
|
||||
pub enum BlockSubscriptionType {
|
||||
Finalized,
|
||||
Best,
|
||||
}
|
||||
|
||||
/// Provides logic to spawn a network based on a Zombienet toml file.
|
||||
pub struct NetworkSpawner {
|
||||
network: Network<LocalFileSystem>,
|
||||
}
|
||||
|
||||
impl NetworkSpawner {
|
||||
/// Initialize the network spawner using given `builder` closure.
|
||||
pub async fn with_closure<F>(builder: F) -> Result<NetworkSpawner>
|
||||
where
|
||||
F: FnOnce() -> NetworkConfigBuilder<WithRelaychain>,
|
||||
{
|
||||
let _ = env_logger::try_init_from_env(
|
||||
env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"),
|
||||
);
|
||||
|
||||
let config_builder = builder();
|
||||
|
||||
let net_config = config_builder
|
||||
.with_global_settings(|global_settings| match NetworkSpawner::base_dir_from_env() {
|
||||
Some(val) => global_settings.with_base_dir(val),
|
||||
_ => global_settings,
|
||||
})
|
||||
.build()
|
||||
.map_err(|errs| {
|
||||
let msg = errs.into_iter().map(|e| e.to_string()).collect::<Vec<_>>().join(", ");
|
||||
Error::NetworkInit(anyhow!(msg))
|
||||
})?;
|
||||
|
||||
Ok(NetworkSpawner {
|
||||
network: net_config
|
||||
.spawn_native()
|
||||
.await
|
||||
.map_err(|err| Error::NetworkInit(anyhow!(err.to_string())))?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Generates a directory path from an environment variable and the current timestamp.
|
||||
/// The format is "<TENV>/test_YMD_HMS"
|
||||
pub fn base_dir_from_env() -> Option<String> {
|
||||
std::env::var(TXPOOL_TEST_DIR_ENV)
|
||||
.map(|pool_test_dir| {
|
||||
let datetime: chrono::DateTime<chrono::Local> = SystemTime::now().into();
|
||||
let formatted_date = datetime.format("%Y%m%d_%H%M%S");
|
||||
format!("{}/test_{}", pool_test_dir, formatted_date)
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
|
||||
/// Initialize the network spawner based on a Zombienet toml file
|
||||
pub async fn from_toml_with_env_logger(toml_path: &'static str) -> Result<NetworkSpawner> {
|
||||
// Initialize the subscriber with a default log level of INFO if RUST_LOG is not set
|
||||
let env_filter =
|
||||
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
|
||||
// Set up the subscriber with the formatter and the environment filter
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(env_filter) // Use the env filter
|
||||
.init();
|
||||
|
||||
let net_config = if let Some(base_dir) = Self::base_dir_from_env() {
|
||||
let settings = GlobalSettingsBuilder::new().with_base_dir(base_dir).build().unwrap();
|
||||
NetworkConfig::load_from_toml_with_settings(toml_path, &settings)
|
||||
.map_err(Error::NetworkInit)?
|
||||
} else {
|
||||
tracing::info!("'{TXPOOL_TEST_DIR_ENV}' env not set, proceeding with defaults.");
|
||||
NetworkConfig::load_from_toml(toml_path).map_err(Error::NetworkInit)?
|
||||
};
|
||||
|
||||
Ok(NetworkSpawner {
|
||||
network: net_config
|
||||
.spawn_native()
|
||||
.await
|
||||
.map_err(|err| Error::NetworkInit(anyhow!(err.to_string())))?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the spawned network.
|
||||
pub fn network(&self) -> &Network<LocalFileSystem> {
|
||||
&self.network
|
||||
}
|
||||
|
||||
/// Waits for blocks production/import to kick-off on given node.
|
||||
///
|
||||
/// It subscribes to best/finalized blocks on the given node to determine whether
|
||||
/// the blocks were considered as best/finalized.
|
||||
pub async fn wait_for_block(
|
||||
&self,
|
||||
node_name: &str,
|
||||
subscription_type: BlockSubscriptionType,
|
||||
) -> Result<()> {
|
||||
let node = self
|
||||
.network
|
||||
.get_node(node_name)
|
||||
.map_err(|_| Error::NodeNotFound(anyhow!("{node_name}")))?;
|
||||
let client = node
|
||||
.wait_client::<BizinikiwiConfig>()
|
||||
.await
|
||||
.map_err(|_| Error::FailedToGetOnlineClinet)?;
|
||||
let mut stream = match subscription_type {
|
||||
BlockSubscriptionType::Best => client
|
||||
.blocks()
|
||||
.subscribe_finalized()
|
||||
.await
|
||||
.map_err(|_| Error::FailedToGetBlocksStream)?,
|
||||
BlockSubscriptionType::Finalized => client
|
||||
.blocks()
|
||||
.subscribe_best()
|
||||
.await
|
||||
.map_err(|_| Error::FailedToGetBlocksStream)?,
|
||||
};
|
||||
|
||||
// It should take at most two iterations to return with the best block, if any.
|
||||
for _ in 0..=1 {
|
||||
let Some(block) = stream.next().await else {
|
||||
continue;
|
||||
};
|
||||
|
||||
if let Some(block) = block.ok().filter(|block| block.number() == 1) {
|
||||
tracing::info!("[{node_name}] found first block: {:#?}", block.hash());
|
||||
break;
|
||||
}
|
||||
|
||||
tracing::info!("[{node_name}] waiting for first block");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the network filesystem base dir path.
|
||||
pub fn base_dir_path(&self) -> Option<&str> {
|
||||
self.network.base_dir()
|
||||
}
|
||||
|
||||
/// Get a certain node rpc uri.
|
||||
pub fn node_rpc_uri(&self, node_name: &str) -> Result<String> {
|
||||
self.network
|
||||
.get_node(node_name)
|
||||
.and_then(|node| Ok(node.ws_uri().to_string()))
|
||||
.map_err(|_| Error::NodeNotFound(anyhow!("{node_name}")))
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared params usually set in same way for most of the scenarios.
|
||||
pub struct ScenarioBuilderSharedParams {
|
||||
watched_txs: bool,
|
||||
does_block_monitoring: bool,
|
||||
send_threshold: usize,
|
||||
chain_type: ChainType,
|
||||
}
|
||||
|
||||
impl Default for ScenarioBuilderSharedParams {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
watched_txs: true,
|
||||
does_block_monitoring: false,
|
||||
send_threshold: 20000,
|
||||
chain_type: ChainType::Sub,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a [`txtesttool::scenario::ScenarioBuilder`] with a set of default parameters defined
|
||||
/// with [`ScenarioBuilderSharedParams::default`].
|
||||
pub fn default_zn_scenario_builder(net_spawner: &NetworkSpawner) -> ScenarioBuilder {
|
||||
let shared_params = ScenarioBuilderSharedParams::default();
|
||||
ScenarioBuilder::new()
|
||||
.with_watched_txs(shared_params.watched_txs)
|
||||
.with_send_threshold(shared_params.send_threshold)
|
||||
.with_block_monitoring(shared_params.does_block_monitoring)
|
||||
.with_chain_type(shared_params.chain_type)
|
||||
.with_base_dir_path(net_spawner.base_dir_path().unwrap().to_string())
|
||||
.with_timeout_in_secs(21600) //6 hours
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
[settings]
|
||||
timeout = 1500
|
||||
|
||||
[relaychain]
|
||||
default_image = "pezkuwichain/pezkuwi:latest"
|
||||
default_command = "pezkuwi"
|
||||
chain = "pezkuwichain-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
rpc_port = 9944
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
rpc_port = 9945
|
||||
validator = true
|
||||
|
||||
[[teyrchains]]
|
||||
id = 2000
|
||||
chain = "asset-hub-pezkuwichain-local"
|
||||
default_command = "pezkuwi-teyrchain"
|
||||
default_image = "pezkuwichain/pezkuwi-teyrchain:latest"
|
||||
cumulus_based = true
|
||||
default_args = [
|
||||
"--force-authoring",
|
||||
"--pool-kbytes 2048000",
|
||||
"--pool-limit 500000",
|
||||
"--pool-type=fork-aware",
|
||||
"--rpc-max-connections 15000",
|
||||
"--rpc-max-response-size 150",
|
||||
"--rpc-max-subscriptions-per-connection=128000",
|
||||
"--state-pruning=1024",
|
||||
"-laura::pezcumulus=info",
|
||||
"-lbasic-authorship=info",
|
||||
"-lpeerset=info",
|
||||
"-lsub-libp2p=info",
|
||||
"-lsync=info",
|
||||
"-ltxpool=debug",
|
||||
]
|
||||
[teyrchains.genesis.runtimeGenesis.patch.balances]
|
||||
devAccounts = [1000, 1000000000000000000, "//Sender//{}"]
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "charlie"
|
||||
validator = false
|
||||
rpc_port = 9933
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "dave"
|
||||
validator = true
|
||||
rpc_port = 9934
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "eve"
|
||||
validator = true
|
||||
rpc_port = 9935
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "ferdie"
|
||||
validator = true
|
||||
rpc_port = 9936
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
[settings]
|
||||
timeout = 1500
|
||||
|
||||
[relaychain]
|
||||
default_image = "pezkuwichain/pezkuwi:latest"
|
||||
default_command = "pezkuwi"
|
||||
chain = "pezkuwichain-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
rpc_port = 9944
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
validator = true
|
||||
|
||||
[[teyrchains]]
|
||||
id = 2000
|
||||
cumulus_based = true
|
||||
chain = "asset-hub-pezkuwichain-local"
|
||||
default_image = "pezkuwichain/pezkuwi-teyrchain:latest"
|
||||
default_command = "pezkuwi-teyrchain"
|
||||
default_args = [
|
||||
"--force-authoring",
|
||||
"--pool-kbytes 2048000",
|
||||
"--pool-limit 10000",
|
||||
"--pool-type=fork-aware",
|
||||
"--rpc-max-connections 100000",
|
||||
"--rpc-max-response-size 150",
|
||||
"--rpc-max-subscriptions-per-connection=128000",
|
||||
"--state-pruning=1024",
|
||||
"-laura::pezcumulus=info",
|
||||
"-lbasic-authorship=info",
|
||||
"-lpeerset=info",
|
||||
"-lsub-libp2p=info",
|
||||
"-lsync=info",
|
||||
"-ltxpool=debug",
|
||||
"-ltxpoolstat=debug",
|
||||
]
|
||||
[teyrchains.genesis.runtimeGenesis.patch.balances]
|
||||
devAccounts = [80000, 1000000000000000000, "//Sender//{}"]
|
||||
|
||||
# run charlie as teyrchain collator
|
||||
[[teyrchains.collators]]
|
||||
name = "charlie"
|
||||
validator = false
|
||||
rpc_port = 9933
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "dave"
|
||||
validator = true
|
||||
rpc_port = 9934
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "eve"
|
||||
validator = true
|
||||
rpc_port = 9935
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "ferdie"
|
||||
validator = true
|
||||
rpc_port = 9936
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
[settings]
|
||||
timeout = 1500
|
||||
|
||||
[relaychain]
|
||||
default_image = "pezkuwichain/pezkuwi:latest"
|
||||
default_command = "pezkuwi"
|
||||
chain = "pezkuwichain-local"
|
||||
default_args = [
|
||||
# "--network-backend litep2p",
|
||||
"--pool-kbytes 2048000",
|
||||
"--pool-limit 500000",
|
||||
"--pool-type=fork-aware",
|
||||
"--rpc-max-connections 15000",
|
||||
"--rpc-max-response-size 150",
|
||||
"--rpc-max-subscriptions-per-connection=128000",
|
||||
"--state-pruning=1024",
|
||||
"-ltxpool=trace",
|
||||
"-lsync=trace",
|
||||
"--out-peers=3",
|
||||
"--in-peers=3",
|
||||
]
|
||||
[relaychain.genesis.runtimeGenesis.patch.balances]
|
||||
devAccounts = [1000, 1000000000000000000, "//Sender//{}"]
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "a00"
|
||||
rpc_port = 9944
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b00"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b01"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b02"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b03"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b04"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b05"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b06"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b07"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b08"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b09"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b10"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b11"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b12"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b13"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b14"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b15"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b16"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b17"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b18"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "b19"
|
||||
validator = true
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
[settings]
|
||||
timeout = 1500
|
||||
|
||||
[relaychain]
|
||||
default_image = "pezkuwichain/pezkuwi:latest"
|
||||
default_command = "pezkuwi"
|
||||
chain = "pezkuwichain-local"
|
||||
default_args = [
|
||||
"--pool-kbytes 2048000",
|
||||
"--pool-limit 500000",
|
||||
"--pool-type=fork-aware",
|
||||
"--rpc-max-connections 15000",
|
||||
"--rpc-max-response-size 1500",
|
||||
"--rpc-max-subscriptions-per-connection=128000",
|
||||
"--state-pruning=1024",
|
||||
"-lsync=info",
|
||||
"-ltxpool=debug",
|
||||
]
|
||||
[relaychain.genesis.runtimeGenesis.patch.balances]
|
||||
devAccounts = [1000, 1000000000000000000, "//Sender//{}"]
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
rpc_port = 9944
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
rpc_port = 9945
|
||||
validator = true
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
[settings]
|
||||
timeout = 1500
|
||||
|
||||
[relaychain]
|
||||
default_image = "pezkuwichain/pezkuwi:latest"
|
||||
default_command = "pezkuwi"
|
||||
chain = "pezkuwichain-local"
|
||||
default_args = [
|
||||
"--pool-kbytes 2048000",
|
||||
"--pool-limit 100000",
|
||||
"--pool-type=fork-aware",
|
||||
"--rpc-max-connections 15000",
|
||||
"--rpc-max-response-size 150",
|
||||
"--rpc-max-subscriptions-per-connection=128000",
|
||||
"--state-pruning=1024",
|
||||
"-lsync=info",
|
||||
"-ltxpool=debug",
|
||||
"-ltxpoolstat=debug",
|
||||
]
|
||||
[relaychain.genesis.runtimeGenesis.patch.balances]
|
||||
devAccounts = [100000, 1000000000000000000, "//Sender//{}"]
|
||||
|
||||
[[relaychain.nodes]]
|
||||
# command = "/home/miszka/parity/14-txpool-forks/pezkuwi-sdk-master-02/target/release-tokio-console/pezkuwi"
|
||||
name = "alice"
|
||||
rpc_port = 9944
|
||||
validator = false
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
rpc_port = 9945
|
||||
validator = true
|
||||
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "charlie"
|
||||
rpc_port = 9946
|
||||
validator = true
|
||||
@@ -0,0 +1,145 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Test inspired (copied) from:
|
||||
// https://github.com/pezkuwichain/pezkuwi-sdk/blob/85b71daf7aac59da4d2186b45d589c7c619f0981/polkadot/zombienet-sdk-tests/tests/elastic_scaling/slot_based_3cores.rs#L21
|
||||
// and patched as in:
|
||||
// https://github.com/pezkuwichain/kurdistan-sdk/issues/124#issuecomment-2808830472
|
||||
|
||||
use crate::zombienet::{BlockSubscriptionType, NetworkSpawner, ScenarioBuilderSharedParams};
|
||||
use cumulus_zombienet_sdk_helpers::create_assign_core_call;
|
||||
use serde_json::json;
|
||||
use txtesttool::{execution_log::ExecutionLog, scenario::ScenarioBuilder};
|
||||
use zombienet_sdk::{
|
||||
subxt::{OnlineClient, PolkadotConfig},
|
||||
subxt_signer::sr25519::dev,
|
||||
NetworkConfigBuilder,
|
||||
};
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
#[ignore]
|
||||
async fn slot_based_3cores_test() -> Result<(), anyhow::Error> {
|
||||
let spawner = NetworkSpawner::with_closure(|| {
|
||||
let images = zombienet_sdk::environment::get_images_from_env();
|
||||
let names = ["alice", "bob", "charlie"];
|
||||
NetworkConfigBuilder::new()
|
||||
.with_relaychain(|r| {
|
||||
let r = r
|
||||
.with_chain("pezkuwichain-local")
|
||||
.with_default_command("pezkuwi")
|
||||
.with_default_image(images.pezkuwi.as_str())
|
||||
.with_default_args(vec![("-lteyrchain=debug").into()])
|
||||
.with_genesis_overrides(json!({
|
||||
"configuration": {
|
||||
"config": {
|
||||
"scheduler_params": {
|
||||
// Num cores is 2, because 1 extra will be added automatically when registering the para.
|
||||
"num_cores": 2,
|
||||
"max_validators_per_core": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
.with_default_resources(|resources| {
|
||||
resources.with_request_cpu(4).with_request_memory("4G")
|
||||
})
|
||||
// Have to set a `with_node` outside of the loop below, so that `r` has the
|
||||
// right type.
|
||||
.with_node(|node| node.with_name(names[0]));
|
||||
|
||||
(1..3).fold(r, |acc, i| acc.with_node(|node| node.with_name(names[i])))
|
||||
})
|
||||
.with_teyrchain(|p| {
|
||||
// Para 2200 uses the new RFC103-enabled collator which sends the UMP signal
|
||||
// commitment for selecting the core index
|
||||
p.with_id(2200)
|
||||
.with_default_command("pezkuwi-teyrchain")
|
||||
.with_default_image(images.pezcumulus.as_str())
|
||||
.with_chain("yap-pezkuwichain-local-2200")
|
||||
.with_genesis_overrides(json!({
|
||||
"balances": {
|
||||
"devAccounts": [
|
||||
100000, 1000000000000000000u64, "//Sender//{}"
|
||||
]
|
||||
}
|
||||
}))
|
||||
.with_default_args(vec![
|
||||
"--authoring=slot-based".into(),
|
||||
"--rpc-max-subscriptions-per-connection=256000".into(),
|
||||
"--rpc-max-connections=128000".into(),
|
||||
"--rpc-max-response-size=150".into(),
|
||||
"--pool-limit=2500000".into(),
|
||||
"--pool-kbytes=4048000".into(),
|
||||
"--pool-type=fork-aware".into(),
|
||||
("-lteyrchain=debug,aura=debug,txpool=debug,txpoolstat=debug").into(),
|
||||
])
|
||||
.with_collator(|n| n.with_name("dave").with_rpc_port(9944))
|
||||
})
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let relay_node = spawner.network().get_node("alice")?;
|
||||
|
||||
let relay_client: OnlineClient<PolkadotConfig> = relay_node.wait_client().await?;
|
||||
let alice = dev::alice();
|
||||
|
||||
let assign_cores_call = create_assign_core_call(&[(0, 2200), (1, 2200)]);
|
||||
// Assign two extra cores to each teyrchain.
|
||||
relay_client
|
||||
.tx()
|
||||
.sign_and_submit_then_watch_default(&assign_cores_call, &alice)
|
||||
.await?
|
||||
.wait_for_finalized_success()
|
||||
.await?;
|
||||
|
||||
tracing::info!("2 more cores assigned to the teyrchain");
|
||||
|
||||
// Wait for the teyrchain collator to start block production.
|
||||
spawner.wait_for_block("dave", BlockSubscriptionType::Best).await.unwrap();
|
||||
|
||||
// Create txs executor.
|
||||
let ws = spawner.node_rpc_uri("dave").unwrap();
|
||||
let executor = {
|
||||
let shared_params = ScenarioBuilderSharedParams::default();
|
||||
ScenarioBuilder::new()
|
||||
.with_watched_txs(shared_params.watched_txs)
|
||||
.with_send_threshold(shared_params.send_threshold)
|
||||
.with_block_monitoring(shared_params.does_block_monitoring)
|
||||
.with_chain_type(shared_params.chain_type)
|
||||
.with_base_dir_path(spawner.base_dir_path().unwrap().to_string())
|
||||
.with_timeout_in_secs(21600) //6 hours
|
||||
.with_legacy_backend(true)
|
||||
}
|
||||
.with_rpc_uri(ws)
|
||||
.with_start_id(0)
|
||||
.with_last_id(99999)
|
||||
.with_txs_count(150)
|
||||
.with_executor_id("txs-executor".to_string())
|
||||
.with_send_threshold(25000)
|
||||
.build()
|
||||
.await;
|
||||
|
||||
// Execute transactions and fetch the execution logs.
|
||||
let execution_logs = executor.execute().await;
|
||||
let finalized_txs = execution_logs.values().filter_map(|tx_log| tx_log.finalized()).count();
|
||||
|
||||
assert_eq!(finalized_txs, 15_000_000);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user