Skip to content

Commit 2741062

Browse files
committed
update flashblocks integration test for CI
1 parent 44a849f commit 2741062

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,6 @@ fn simple_neon_integration() {
16761676
}
16771677

16781678
#[test]
1679-
#[ignore]
16801679
/// This test spins up a nakamoto-neon node.
16811680
/// It starts in Epoch 2.0, mines with `neon_node` to Epoch 3.0,
16821681
/// having flash blocks when epoch updates and expects everything to work normally,
@@ -1900,15 +1899,35 @@ fn simple_neon_integration_with_flash_blocks_on_epoch_3() {
19001899
assert!(tip.stacks_block_height >= block_height_pre_3_0 + 30);
19011900

19021901
// Check that we have the expected burn blocks
1903-
// We expect to have blocks 220-230 and 234 onwards, with a gap for the flash blocks
1902+
// We expect to have around the blocks 220-230 and 234 onwards, with a gap of 3 blocks for the flash blocks
19041903
let bhh = u64::from(tip.burn_header_height);
1905-
test_observer::contains_burn_block_range(220..=230).unwrap();
1906-
test_observer::contains_burn_block_range(234..=bhh).unwrap();
1907-
// Verify that we're missing the expected flash blocks
1908-
assert!(
1909-
test_observer::contains_burn_block_range(231..=233).is_err(),
1910-
"Expected to be missing burn blocks 231-233 due to flash blocks"
1904+
// Find the gap in burn blocks
1905+
let mut gap_start = 0;
1906+
let mut gap_end = 0;
1907+
for i in 220..=bhh {
1908+
if test_observer::contains_burn_block_range(i..=i).is_err() {
1909+
if gap_start == 0 {
1910+
gap_start = i;
1911+
}
1912+
gap_end = i;
1913+
} else if gap_start != 0 {
1914+
break;
1915+
}
1916+
}
1917+
1918+
// Verify that there's a gap of exactly 3 blocks
1919+
assert_eq!(
1920+
gap_end - gap_start + 1,
1921+
3,
1922+
"Expected a gap of exactly 3 burn blocks due to flash blocks, found gap from {} to {}",
1923+
gap_start,
1924+
gap_end
19111925
);
1926+
1927+
// Verify blocks before and after the gap
1928+
test_observer::contains_burn_block_range(220..=(gap_start - 1)).unwrap();
1929+
test_observer::contains_burn_block_range((gap_end + 1)..=bhh).unwrap();
1930+
19121931
info!("Verified burn block ranges, including expected gap for flash blocks");
19131932

19141933
coord_channel

0 commit comments

Comments
 (0)