Skip to content

Commit 57224f8

Browse files
committed
test: ref: rescans_events_with_ascending_blocks to assert everything at the end
1 parent 66522d6 commit 57224f8

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

tests/live/reorg.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ async fn rescans_events_with_ascending_blocks() -> anyhow::Result<()> {
6969
contract.increase().send().await?.watch().await?;
7070
}
7171

72+
// reorg the chain
73+
let tx_block_pairs = vec![
74+
(TransactionData::JSON(contract.increase().into_transaction_request()), 0),
75+
(TransactionData::JSON(contract.increase().into_transaction_request()), 1),
76+
(TransactionData::JSON(contract.increase().into_transaction_request()), 2),
77+
];
78+
79+
provider.primary().anvil_reorg(ReorgOptions { depth: 4, tx_block_pairs }).await?;
80+
7281
// assert initial events are emitted as expected
7382
assert_event_sequence!(
7483
stream,
@@ -80,19 +89,9 @@ async fn rescans_events_with_ascending_blocks() -> anyhow::Result<()> {
8089
CountIncreased { newCount: U256::from(5) }
8190
]
8291
);
83-
let mut stream = assert_empty!(stream);
84-
85-
// reorg the chain
86-
let tx_block_pairs = vec![
87-
(TransactionData::JSON(contract.increase().into_transaction_request()), 0),
88-
(TransactionData::JSON(contract.increase().into_transaction_request()), 1),
89-
(TransactionData::JSON(contract.increase().into_transaction_request()), 2),
90-
];
91-
92-
provider.primary().anvil_reorg(ReorgOptions { depth: 4, tx_block_pairs }).await?;
93-
9492
// assert expected messages post-reorg
9593
assert_next!(stream, ScannerStatus::ReorgDetected);
94+
// assert the reorged events are emitted
9695
assert_event_sequence!(
9796
stream,
9897
&[

0 commit comments

Comments
 (0)