-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
elastic scaling RFC 103 end-to-end tests (#6452)
Adds two new zombienet-sdk tests: - one which verifies that elastic scaling works correctly both with the MVP and the new RFC 103 implementation which sends the core selector as a UMP signal. - one which spawns a parachain with two collators, but only one of them is using v2 receipts. The parachain will still make progress but without full throughput Also enables the V2 receipts node feature for testnet genesis config. Part of #5049
- Loading branch information
Showing
18 changed files
with
493 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
60 changes: 60 additions & 0 deletions
60
polkadot/zombienet-sdk-tests/tests/elastic_scaling/helpers.rs
This file contains 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,60 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use super::rococo; | ||
use std::{collections::HashMap, ops::Range}; | ||
use subxt::{OnlineClient, PolkadotConfig}; | ||
|
||
// Helper function for asserting the throughput of parachains (total number of backed candidates in | ||
// a window of relay chain blocks), after the first session change. | ||
pub async fn assert_para_throughput( | ||
relay_client: &OnlineClient<PolkadotConfig>, | ||
stop_at: u32, | ||
expected_candidate_ranges: HashMap<u32, Range<u32>>, | ||
) -> Result<(), anyhow::Error> { | ||
let mut blocks_sub = relay_client.blocks().subscribe_finalized().await?; | ||
let mut candidate_count: HashMap<u32, u32> = HashMap::new(); | ||
let mut current_block_count = 0; | ||
let mut had_first_session_change = false; | ||
|
||
while let Some(block) = blocks_sub.next().await { | ||
let block = block?; | ||
log::debug!("Finalized relay chain block {}", block.number()); | ||
let events = block.events().await?; | ||
let is_session_change = events.has::<rococo::session::events::NewSession>()?; | ||
|
||
if !had_first_session_change && is_session_change { | ||
had_first_session_change = true; | ||
} | ||
|
||
if had_first_session_change && !is_session_change { | ||
current_block_count += 1; | ||
|
||
for event in events.find::<rococo::para_inclusion::events::CandidateBacked>() { | ||
*(candidate_count.entry(event?.0.descriptor.para_id.0).or_default()) += 1; | ||
} | ||
} | ||
|
||
if current_block_count == stop_at { | ||
break; | ||
} | ||
} | ||
|
||
log::info!( | ||
"Reached {} finalized relay chain blocks that contain backed candidates. The per-parachain distribution is: {:#?}", | ||
stop_at, | ||
candidate_count | ||
); | ||
|
||
for (para_id, expected_candidate_range) in expected_candidate_ranges { | ||
let actual = candidate_count | ||
.get(¶_id) | ||
.expect("ParaId did not have any backed candidates"); | ||
assert!( | ||
expected_candidate_range.contains(actual), | ||
"Candidate count {actual} not within range {expected_candidate_range:?}" | ||
); | ||
} | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.