Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fork-aware-tx-pool: add heavy load tests based on zombienet #7257

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0283ab9
wip: impl parachain network with zn-sdk
iulianbarbu Jan 16, 2025
67c2ee9
wip adding more stuff to the nodes to catch all network
iulianbarbu Jan 17, 2025
7afefe1
made network primitives more flexible
iulianbarbu Jan 19, 2025
6d10819
added todos for what's wip
iulianbarbu Jan 19, 2025
0e084ab
added network base_dir & the rest of the testing networks
iulianbarbu Jan 20, 2025
daba086
renames and added builder support
iulianbarbu Jan 20, 2025
f73874a
added todos
iulianbarbu Jan 20, 2025
21fda5f
fixed derive_builder erros
iulianbarbu Jan 20, 2025
ef9b658
wip
iulianbarbu Jan 23, 2025
90ab08d
wip: load zn tomls with zn-sdk
iulianbarbu Jan 23, 2025
94b8891
wip: add genesis config patches and path to runtime in zn tomls
iulianbarbu Jan 23, 2025
136b95a
wip
iulianbarbu Jan 27, 2025
5556573
merge with latest master
iulianbarbu Jan 27, 2025
13cffe6
wip testing zn patch from toml
iulianbarbu Jan 28, 2025
8ec35b9
Apply suggestions from code review
pepoviola Jan 29, 2025
0b81d99
Update Cargo.toml
pepoviola Jan 29, 2025
5f82daf
Update network-specs and zn-sdk/zn-config
iulianbarbu Jan 30, 2025
e90b9d6
resolve conflicts
iulianbarbu Jan 30, 2025
11fee80
remove unecessary deps
iulianbarbu Jan 30, 2025
fbc25ff
make tomls compatible with zn/cli
iulianbarbu Jan 31, 2025
b912e05
Merge branch 'master' into ib-zn-test-fatp
iulianbarbu Feb 4, 2025
bf02c0b
fix zn toml
iulianbarbu Feb 4, 2025
c30f602
added test - it fails though
iulianbarbu Feb 4, 2025
f275ba3
fix nonce incrementing
iulianbarbu Feb 4, 2025
8de7754
created test scenario
iulianbarbu Feb 11, 2025
e59e4bf
updated assertions
iulianbarbu Feb 12, 2025
2507d2c
merge with master
iulianbarbu Feb 13, 2025
032e631
updated ttxt usage
iulianbarbu Feb 13, 2025
0e5b5a9
refactored integration test logic
iulianbarbu Feb 18, 2025
3f27669
update test for latest ttxt
iulianbarbu Feb 18, 2025
9a665b6
address Michal review
iulianbarbu Feb 18, 2025
b1c9938
Merge branch 'master' into ib-zn-test-fatp
iulianbarbu Feb 18, 2025
7cbf852
cleanup Cargo.toml
iulianbarbu Feb 18, 2025
63a9943
made chain type sub a default
iulianbarbu Feb 18, 2025
2b06198
instrumented the executors & organised asset hub network spec files
iulianbarbu Feb 18, 2025
254ae67
addressed more of Michal feedback
iulianbarbu Feb 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 67 additions & 1 deletion Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ cumulus-test-service = { path = "cumulus/test/service" }
curve25519-dalek = { version = "4.1.3" }
derivative = { version = "2.2.0", default-features = false }
derive-syn-parse = { version = "0.2.0" }
derive_builder = { version = "0.20.2", default-features = false }
derive_more = { version = "0.99.17", default-features = false }
digest = { version = "0.10.3", default-features = false }
directories = { version = "5.0.1" }
Expand Down Expand Up @@ -1380,6 +1381,7 @@ westend-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated
westend-runtime = { path = "polkadot/runtime/westend" }
westend-runtime-constants = { path = "polkadot/runtime/westend/constants", default-features = false }
westend-system-emulated-network = { path = "cumulus/parachains/integration-tests/emulated/networks/westend-system" }
which = { version = "7.0.1" }
x25519-dalek = { version = "2.0" }
xcm = { path = "polkadot/xcm", default-features = false, package = "staging-xcm" }
xcm-builder = { path = "polkadot/xcm/xcm-builder", default-features = false, package = "staging-xcm-builder" }
Expand All @@ -1390,7 +1392,8 @@ xcm-procedural = { path = "polkadot/xcm/procedural", default-features = false }
xcm-runtime-apis = { path = "polkadot/xcm/xcm-runtime-apis", default-features = false }
xcm-simulator = { path = "polkadot/xcm/xcm-simulator", default-features = false }
zeroize = { version = "1.7.0", default-features = false }
zombienet-sdk = { version = "0.2.20" }
zombienet-configuration = { version = "0.2.21" }
zombienet-sdk = { version = "0.2.21" }
zstd = { version = "0.12.4", default-features = false }

[profile.release]
Expand Down
15 changes: 15 additions & 0 deletions substrate/client/transaction-pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,29 @@ tokio = { workspace = true, default-features = true, features = ["macros", "time
tokio-stream = { workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
array-bytes = { workspace = true, default-features = true }
assert_matches = { workspace = true }
async-trait = { workspace = true }
chrono = { workspace = true }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is chrono used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see, some of other crates seems to be not used, too.

cmd_lib = { workspace = true }
criterion = { workspace = true, default-features = true }
cumulus-client-cli = { workspace = true, default-features = true }
derive_builder = { workspace = true, features = ["alloc"] }
env_logger = { workspace = true }
log = { workspace = true }
polkadot-cli = { workspace = true, default-features = true }
sc-block-builder = { workspace = true, default-features = true }
sp-consensus = { workspace = true, default-features = true }
strum = { workspace = true, features = ["derive"] }
substrate-test-runtime = { workspace = true }
substrate-test-runtime-client = { workspace = true }
substrate-test-runtime-transaction-pool = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread"] }
which = { workspace = true }
zombienet-configuration = { workspace = true }
zombienet-sdk = { workspace = true }

[[bench]]
name = "basics"
Expand Down
36 changes: 36 additions & 0 deletions substrate/client/transaction-pool/tests/integration.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// This file is part of Substrate.

// 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/>.

// Testsuite of fatp integration tests.

pub mod zombienet;

use std::time::Duration;

use zombienet::NetworkSpawner;
use zombienet_sdk::NetworkConfigExt;

#[tokio::test(flavor = "multi_thread")]
// TODO: continue this scenario
async fn send_future_and_then_ready() {
let _ = env_logger::try_init_from_env(
env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"),
);
let net = NetworkSpawner::init_from_asset_hub_fatp_low_pool_limit_spec().await.unwrap();
pepoviola marked this conversation as resolved.
Show resolved Hide resolved
tokio::time::sleep(Duration::from_secs(1400)).await;
}

Large diffs are not rendered by default.

128,057 changes: 128,057 additions & 0 deletions substrate/client/transaction-pool/tests/zombienet/chain-specs/yap-westend-live-2022.json

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions substrate/client/transaction-pool/tests/zombienet/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// This file is part of Substrate.

// 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/>.

// Integration tests for fork-aware transaction pool.
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved

use anyhow::anyhow;
use zombienet_sdk::{LocalFileSystem, Network, NetworkConfig, NetworkConfigExt};

const DEFAULT_BASE_DIR: &'static str = "/tmp/zn-spawner";

const ASSET_HUB_LOW_POOL_LIMIT_FATP_SPEC_PATH: &'static str =
"tests/zombienet/network-specs/asset-hub-low-pool-limit-fatp.toml";

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Network initialization failure: {0}")]
NetworkInit(anyhow::Error),
}

type Result<T> = std::result::Result<T, Error>;

pub struct NetworkSpawner;
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved

impl NetworkSpawner {
pub async fn init_from_asset_hub_fatp_low_pool_limit_spec() -> Result<Network<LocalFileSystem>>
{
let net_config = NetworkConfig::load_from_toml(ASSET_HUB_LOW_POOL_LIMIT_FATP_SPEC_PATH)
.map_err(Error::NetworkInit)?;
net_config
.spawn_native()
.await
.map_err(|err| Error::NetworkInit(anyhow!(err.to_string())))
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[relaychain]
# single-state
# fork-aware
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# single-state
# fork-aware

default_image = "parity/polkadot:latest"
default_command = "polkadot"
chain = "rococo-local"

[[relaychain.nodes]]
name = "alice"
ws_port = 9944
validator = true

[[relaychain.nodes]]
name = "bob"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should expose rpc port for bob too?

I think we can also enabled fatxpool on the relaychain. So we would need to copy some args to the relaychain nodes.

Some scenarios sending to the relay-chain would nice. As discussed in element they can also be quicker for development (no need to wait for 10 blocks).

validator = true

[[parachains]]
id = 2000
default_command = "polkadot-parachain"
default_image = "parity/polkadot-parachain:latest"
# run charlie as parachain collatorid = 2000
cumulus_based = true
genesis_wasm_path = "target/release/asset-hub-rococo-runtime/asset_hub_rococo_runtime.wasm"
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::cumulus=debug",
"-lbasic-authorship=debug",
"-lpeerset=trace",
"-lsub-libp2p=debug",
"-lsync=trace",
"-ltxpool=trace",
]


[[parachains.collators]]
name = "charlie"
validator = false
ws_port = 9933


[[parachains.collators]]
name = "dave"
validator = true
ws_port = 9934

[[parachains.collators]]
name = "eve"
validator = true
ws_port = 9935

[[parachains.collators]]
name = "ferdie"
validator = true
ws_port = 9936
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[relaychain]
# single-state
# fork-aware
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# single-state
# fork-aware

default_image = "parity/polkadot:latest"
default_command = "polkadot"
chain = "rococo-local"

[[relaychain.nodes]]
name = "alice"
ws_port = 9944
validator = true

[[relaychain.nodes]]
name = "bob"
validator = true

[[parachains]]
id = 2000
cumulus_based = true
chain = "tests/zombienet/chain-specs/asset-hub-rococo-local-20k.json"
default_image = "parity/polkadot-parachain:latest"
default_command = "polkadot-parachain"
default_args = [
"--force-authoring",
"--pool-kbytes 2048000",
"--pool-limit 500000",
"--rpc-max-connections 15000",
"--rpc-max-response-size 150",
"--rpc-max-subscriptions-per-connection=128000",
"--state-pruning=1024",
"-laura::cumulus=debug",
"-lbasic-authorship=info",
"-lpeerset=trace",
"-lsub-libp2p=debug",
"-lsync=trace",
"-ltxpool=debug",
]

# run charlie as parachain collator
[[parachains.collators]]
name = "charlie"
validator = false
ws_port = 9933

[[parachains.collators]]
name = "dave"
validator = true
ws_port = 9934

[[parachains.collators]]
name = "eve"
validator = true
ws_port = 9935
Loading
Loading