forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
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 test (paritytech#6452)
Adds a new zombienet-sdk test 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. Also enables the V2 receipts node feature for testnet genesis config. Part of paritytech#5049 --------- Co-authored-by: Javier Viola <[email protected]> Co-authored-by: Javier Viola <[email protected]>
- Loading branch information
1 parent
4a0e3f6
commit f24007e
Showing
19 changed files
with
369 additions
and
41 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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(()) | ||
} |
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,8 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#[subxt::subxt(runtime_metadata_path = "metadata-files/rococo-local.scale")] | ||
pub mod rococo {} | ||
|
||
mod helpers; | ||
mod slot_based_3cores; |
Oops, something went wrong.