Skip to content

Commit 537b6a9

Browse files
committed
tests: use expect_tx
1 parent 02bbc3e commit 537b6a9

File tree

1 file changed

+16
-28
lines changed

1 file changed

+16
-28
lines changed

crates/node/tests/e2e.rs

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,27 +1132,14 @@ async fn requeues_transactions_after_l1_reorg() -> eyre::Result<()> {
11321132

11331133
// Inject a user transaction and force the sequencer to include it in the next block
11341134
let hash = sequencer.inject_transfer().await?;
1135-
let block_with_tx = sequencer.build_block().await_block().await?;
1136-
1137-
let hashes: Vec<_> =
1138-
block_with_tx.body.transactions.into_iter().map(|tx| *tx.tx_hash()).collect();
1139-
assert!(
1140-
hashes.len() == 1 && hashes.contains(&hash),
1141-
"block 11 should contain the injected transaction before the reorg"
1142-
);
1135+
sequencer.build_block().expect_tx(hash).expect_tx_count(1).await_block().await?;
11431136

11441137
// Trigger an L1 reorg that reverts the block containing the transaction
11451138
sequencer.l1().reorg_to(1).await?;
11461139
sequencer.expect_event().l1_reorg().await?;
11471140

11481141
// Build the next block – the reverted transaction should have been requeued
1149-
let block_with_tx = sequencer.build_block().await_block().await?;
1150-
let hashes: Vec<_> =
1151-
block_with_tx.body.transactions.into_iter().map(|tx| *tx.tx_hash()).collect();
1152-
assert!(
1153-
hashes.len() == 1 && hashes.contains(&hash),
1154-
"re-sequenced block should contain the reverted transaction"
1155-
);
1142+
sequencer.build_block().expect_tx(hash).expect_tx_count(1).await_block().await?;
11561143

11571144
Ok(())
11581145
}
@@ -1181,13 +1168,13 @@ async fn requeues_transactions_after_update_fcs_head() -> eyre::Result<()> {
11811168

11821169
// Inject a user transaction and include it in block 5.
11831170
let hash = sequencer.inject_transfer().await?;
1184-
let block = sequencer.build_block().expect_block_number(5).await_block().await?;
1185-
1186-
let hashes: Vec<_> = block.body.transactions.into_iter().map(|tx| *tx.tx_hash()).collect();
1187-
assert!(
1188-
hashes.len() == 1 && hashes.contains(&hash),
1189-
"block 5 should contain the injected transaction before the FCU"
1190-
);
1171+
sequencer
1172+
.build_block()
1173+
.expect_block_number(5)
1174+
.expect_tx(hash)
1175+
.expect_tx_count(1)
1176+
.await_block()
1177+
.await?;
11911178

11921179
// Reset FCS head back to block 4; this should collect block 5's txs and requeue them.
11931180
let head = target_head.expect("target head exists");
@@ -1199,12 +1186,13 @@ async fn requeues_transactions_after_update_fcs_head() -> eyre::Result<()> {
11991186
.expect("update_fcs_head should succeed");
12001187

12011188
// Build the next block – the reverted transaction should have been requeued and included.
1202-
let block = sequencer.build_block().expect_block_number(5).await_block().await?;
1203-
let hashes: Vec<_> = block.body.transactions.into_iter().map(|tx| *tx.tx_hash()).collect();
1204-
assert!(
1205-
hashes.len() == 1 && hashes.contains(&hash),
1206-
"re-sequenced block should contain the reverted transaction after FCS reset",
1207-
);
1189+
sequencer
1190+
.build_block()
1191+
.expect_block_number(5)
1192+
.expect_tx(hash)
1193+
.expect_tx_count(1)
1194+
.await_block()
1195+
.await?;
12081196

12091197
Ok(())
12101198
}

0 commit comments

Comments
 (0)