Skip to content
Merged
Changes from all 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
17 changes: 10 additions & 7 deletions polkadot/zombienet_tests/functional/0019-verify-included-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ async function run(nodeName, networkInfo) {

await new Promise(async (resolve, _) => {
let block_count = 0;
let new_session_started = false;
const unsubscribe = await api.query.system.events(async (events, block_hash) => {
block_count++;
if (new_session_started) {
block_count++;
}

events.forEach((record) => {
const event = record.event;

if (event.method != 'CandidateIncluded') {
if (event.method == 'NewSession') {
new_session_started = true;
console.log(`New session started. Measuring CandidateIncluded events.`);
}

if (event.method != 'CandidateIncluded' || !new_session_started) {
return;
}

Expand All @@ -40,11 +48,6 @@ async function run(nodeName, networkInfo) {
console.log(`Result: 2000: ${blocks_per_para[2000]}, 2001: ${blocks_per_para[2001]}`);
// This check assumes that para 2000 runs slot based collator which respects its claim queue
// and para 2001 runs lookahead which generates blocks for each relay parent.
//
// For 12 blocks there will be one session change. One block won't have anything backed/included.
// In the next there will be one backed so for 12 blocks we should expect 10 included events - no
// more than 4 for para 2001 and at least 6 for para 2000. This should also cover the unlucky
// case when we observe two session changes during the 12 block period.
return (blocks_per_para[2000] >= 6) && (blocks_per_para[2001] <= 4);
}

Expand Down
Loading