diff --git a/polkadot/zombienet_tests/functional/0019-verify-included-events.js b/polkadot/zombienet_tests/functional/0019-verify-included-events.js index 6557a5a80e6b7..df3b1e1fdc03d 100644 --- a/polkadot/zombienet_tests/functional/0019-verify-included-events.js +++ b/polkadot/zombienet_tests/functional/0019-verify-included-events.js @@ -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; } @@ -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); }