-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Rewrite old disputes test with zombienet-sdk #9257
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
Merged
AlexandruCihodaru
merged 9 commits into
master
from
acihodaru/9256-dispute_old_finalized
Jul 21, 2025
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
016df55
[tests]: Rewrite old disputes test with zombienet-sdk
AlexandruCihodaru 74fe1ea
fix CI
AlexandruCihodaru 32c2025
Merge branch 'master' into acihodaru/9256-dispute_old_finalized
AlexandruCihodaru 9e57aa4
remove prdoc
AlexandruCihodaru 8dfc202
Describe what is being tested
AlexandruCihodaru d6c5991
rename step in workflow
AlexandruCihodaru 1955361
Merge branch 'master' into acihodaru/9256-dispute_old_finalized
AlexandruCihodaru 74b99c4
Merge branch 'master' into acihodaru/9256-dispute_old_finalized
AlexandruCihodaru 0c2deb4
fix CI
AlexandruCihodaru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
polkadot/zombienet-sdk-tests/tests/functional/dispute_old_finalized.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| // Copyright (C) Parity Technologies (UK) Ltd. | ||
| // This file is part of Polkadot. | ||
|
|
||
| // Polkadot 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. | ||
|
|
||
| // Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
AlexandruCihodaru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Test if disputes triggered on finalized blocks out of scope never get to be confirmed and | ||
| // concluded. | ||
|
|
||
| use anyhow::anyhow; | ||
|
|
||
| use cumulus_zombienet_sdk_helpers::assert_para_throughput; | ||
| use serde_json::json; | ||
| use tokio::time::Duration; | ||
| use zombienet_orchestrator::network::node::LogLineCountOptions; | ||
|
|
||
| #[tokio::test(flavor = "multi_thread")] | ||
| async fn dispute_old_finalized() -> Result<(), anyhow::Error> { | ||
| let _ = env_logger::try_init_from_env( | ||
| env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"), | ||
| ); | ||
| let images = zombienet_sdk::environment::get_images_from_env(); | ||
| let config = zombienet_sdk::NetworkConfigBuilder::new() | ||
| .with_relaychain(|r| { | ||
| let r = r | ||
| .with_chain("rococo-local") | ||
| .with_default_command("polkadot") | ||
| .with_default_image(images.polkadot.as_str()) | ||
| .with_default_args(vec![("-lparachain=debug").into()]) | ||
| .with_genesis_overrides(json!({ | ||
| "patch": { | ||
| "configuration" : { | ||
| "config": { | ||
| "needed_approvals": 1, | ||
| "scheduler_params": { | ||
| "max_validators_per_core": 1, | ||
| } | ||
| } | ||
| } | ||
| } | ||
| })) | ||
| .with_default_resources(|r| { | ||
| r.with_limit_memory("4G") | ||
| .with_limit_cpu("2") | ||
| .with_request_memory("2G") | ||
| .with_request_cpu("1") | ||
| }); | ||
| // Add malus validator | ||
| let r = r.with_node(|node| { | ||
| node.with_name("malus") | ||
| .with_args(vec![ | ||
| "-lparachain=debug,MALUS=trace".into(), | ||
| "--dispute-offset=14".into(), | ||
| "--alice".into(), | ||
| "--insecure-validator-i-know-what-i-do".into(), | ||
| ]) | ||
| .with_image( | ||
| std::env::var("MALUS_IMAGE") | ||
| .unwrap_or("docker.io/paritypr/malus".to_string()) | ||
| .as_str(), | ||
| ) | ||
| .with_command("malus") | ||
| .with_subcommand("dispute-finalized-candidates") | ||
| .invulnerable(false) | ||
| }); | ||
| // Add honest validators | ||
| let r = (0..6).fold(r, |acc, i| { | ||
| acc.with_node(|node| { | ||
| node.with_name(&format!("honest-{i}")) | ||
| .with_args(vec!["-lparachain=debug".into()]) | ||
| }) | ||
| }); | ||
| r | ||
| }) | ||
| .with_parachain(|p| { | ||
| p.with_id(2000) | ||
| .cumulus_based(false) | ||
| .with_default_image( | ||
| std::env::var("COL_IMAGE") | ||
| .unwrap_or("docker.io/paritypr/colander:latest".to_string()) | ||
| .as_str(), | ||
| ) | ||
| .with_default_command("undying-collator") | ||
| .with_default_args(vec!["-lparachain=debug".into()]) | ||
| .with_collator(|n| n.with_name("collator")) | ||
| }) | ||
| .build() | ||
| .map_err(|e| { | ||
| let errors = e.into_iter().map(|e| e.to_string()).collect::<Vec<_>>().join(" "); | ||
| anyhow!("config errors: {errors}") | ||
| })?; | ||
|
|
||
| let spawn_fn = zombienet_sdk::environment::get_spawn_fn(); | ||
| let network = spawn_fn(config).await?; | ||
|
|
||
| let honest = network.get_node("honest-0")?; | ||
| let relay_client = honest.wait_client().await?; | ||
| let malus = network.get_node("malus")?; | ||
|
|
||
| log::info!("Waiting for parablocks to be produced"); | ||
| assert_para_throughput( | ||
| &relay_client, | ||
| 20, | ||
| [(polkadot_primitives::Id::from(2000), 10..30)].into_iter().collect(), | ||
| ) | ||
| .await?; | ||
|
|
||
| let result = malus | ||
| .wait_log_line_count_with_timeout( | ||
| "*😈 Disputing candidate with hash:*", | ||
| true, | ||
| LogLineCountOptions::new(|n| n == 1, Duration::from_secs(180_u64), false), | ||
| ) | ||
| .await?; | ||
| assert!(result.success()); | ||
| let result = honest | ||
| .wait_log_line_count_with_timeout( | ||
| "*Dispute on candidate concluded*", | ||
| true, | ||
| LogLineCountOptions::new(|n| n == 0, Duration::from_secs(180_u64), false), | ||
| ) | ||
| .await?; | ||
| assert!(result.success()); | ||
| Ok(()) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.