Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
59 changes: 30 additions & 29 deletions .github/workflows/zombienet_polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,35 +201,6 @@ jobs:
build-id: ${{ needs.preflight.outputs.BUILD_RUN_ID }}
ref-slug: ${{ needs.preflight.outputs.SOURCE_REF_SLUG }}

#
zombienet-polkadot-functional-0008-dispute-old-finalized:
needs: [preflight]
if: ${{ (needs.preflight.outputs.changes_substrate || needs.preflight.outputs.changes_polkadot) && ! contains(needs.preflight.outputs.FLAKY_TESTS, 'zombienet-polkadot-functional-0008-dispute-old-finalized') }}
runs-on: ${{ needs.preflight.outputs.ZOMBIENET_LARGE_RUNNER }}
timeout-minutes: 60
container:
image: ${{ needs.preflight.outputs.ZOMBIENET_IMAGE }}
options: -v /tmp/zombienet:/tmp/zombienet
env:
ZOMBIENET_INTEGRATION_TEST_IMAGE: "${{ needs.preflight.outputs.TEMP_IMAGES_BASE }}/polkadot-debug:${{ needs.preflight.outputs.DOCKER_IMAGES_VERSION }}"
COL_IMAGE: "${{ needs.preflight.outputs.TEMP_IMAGES_BASE }}/colander:${{ needs.preflight.outputs.DOCKER_IMAGES_VERSION }}"
MALUS_IMAGE: "${{ needs.preflight.outputs.TEMP_IMAGES_BASE }}/malus:${{ needs.preflight.outputs.DOCKER_IMAGES_VERSION }}"
DEBUG: ${{ needs.preflight.outputs.DEBUG }}
ZOMBIENET_PROVIDER: ${{ needs.preflight.outputs.ZOMBIENET_PROVIDER }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: zombienet_test
uses: ./.github/actions/zombienet
with:
test: "0008-dispute-old-finalized.zndsl"
local-dir: "${{ env.LOCAL_DIR }}/functional"
gh-token: ${{ secrets.GITHUB_TOKEN }}
build-id: ${{ needs.preflight.outputs.BUILD_RUN_ID }}
ref-slug: ${{ needs.preflight.outputs.SOURCE_REF_SLUG }}


#
zombienet-polkadot-functional-0010-validator-disabling:
needs: [preflight]
Expand Down Expand Up @@ -1026,6 +997,36 @@ jobs:

#
#
#
#
zombienet-polkadot-functional-dispute-old-finalized:
needs: [preflight]
if: ${{ (needs.preflight.outputs.changes_substrate || needs.preflight.outputs.changes_polkadot) && ! contains(needs.preflight.outputs.FLAKY_TESTS, 'zombienet-polkadot-dispute-old-finalized') }}
runs-on: ${{ needs.preflight.outputs.ZOMBIENET_LARGE_RUNNER }}
timeout-minutes: 60
container:
image: ${{ needs.preflight.outputs.ZOMBIENET_SDK_IMAGE }}
env:
POLKADOT_IMAGE: "${{ needs.preflight.outputs.TEMP_IMAGES_BASE }}/polkadot-debug:${{ needs.preflight.outputs.DOCKER_IMAGES_VERSION }}"
COL_IMAGE: "${{ needs.preflight.outputs.TEMP_IMAGES_BASE }}/colander:${{ needs.preflight.outputs.DOCKER_IMAGES_VERSION }}"
CUMULUS_IMAGE: "${{ needs.preflight.outputs.TEMP_IMAGES_BASE }}/polkadot-parachain-debug:${{ needs.preflight.outputs.DOCKER_IMAGES_VERSION }}"
MALUS_IMAGE: "${{ needs.preflight.outputs.TEMP_IMAGES_BASE }}/malus:${{ needs.preflight.outputs.DOCKER_IMAGES_VERSION }}"
RUST_LOG: ${{ needs.preflight.outputs.RUST_LOG }}
ZOMBIE_PROVIDER: ${{ needs.preflight.outputs.ZOMBIE_PROVIDER }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: zombienet_test
uses: ./.github/actions/zombienet-sdk
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
build-id: ${{ needs.preflight.outputs.BUILD_RUN_ID }}
ref-slug: ${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
test: "functional::dispute_old_finalized::dispute_old_finalized"
prefix: "polkadot"
#
#
zombienet-polkadot-shared-core-idle-parachain:
needs: [preflight]
if: ${{ (needs.preflight.outputs.changes_substrate || needs.preflight.outputs.changes_polkadot) && ! contains(needs.preflight.outputs.FLAKY_TESTS, 'zombienet-polkadot-shared-core-idle-parachain') }}
Expand Down
135 changes: 135 additions & 0 deletions polkadot/zombienet-sdk-tests/tests/functional/dispute_old_finalized.rs
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/>.

// 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(())
}
1 change: 1 addition & 0 deletions polkadot/zombienet-sdk-tests/tests/functional/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
mod approval_voting_coalescing;
mod approved_peer_mixed_validators;
mod async_backing_6_seconds_rate;
mod dispute_old_finalized;
mod duplicate_collations;
mod shared_core_idle_parachain;
mod spam_statement_distribution_requests;
Expand Down

This file was deleted.

This file was deleted.

Loading