Skip to content

Commit a95aae2

Browse files
committed
fix tests
1 parent 6c8681d commit a95aae2

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

crates/op-rbuilder/src/builders/flashblocks/payload.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl OpPayloadBuilderCtx<FlashblocksExtraCtx> {
100100

101101
/// Returns if the flashblock is the last one
102102
pub(crate) fn is_last_flashblock(&self) -> bool {
103-
self.flashblock_index() == self.target_flashblock_count() - 1
103+
self.flashblock_index() == self.target_flashblock_count()
104104
}
105105
}
106106

@@ -439,7 +439,7 @@ where
439439
info!(
440440
target: "payload_builder",
441441
target = ctx.target_flashblock_count(),
442-
flashblock_count = ctx.flashblock_index(),
442+
flashblock_index = ctx.flashblock_index(),
443443
block_number = ctx.block_number(),
444444
"Skipping flashblock reached target",
445445
);
@@ -449,7 +449,7 @@ where
449449
info!(
450450
target: "payload_builder",
451451
block_number = ctx.block_number(),
452-
flashblock_count = ctx.flashblock_index(),
452+
flashblock_index = ctx.flashblock_index(),
453453
target_gas = total_gas_per_batch,
454454
gas_used = info.cumulative_gas_used,
455455
target_da = total_da_per_batch.unwrap_or(0),
@@ -614,7 +614,7 @@ where
614614
info!(
615615
target: "payload_builder",
616616
message = "Flashblock built",
617-
flashblock_count = ctx.flashblock_index(),
617+
flashblock_index = ctx.flashblock_index(),
618618
current_gas = info.cumulative_gas_used,
619619
current_da = info.cumulative_da_bytes_used,
620620
target_flashblocks = flashblocks_per_block,

crates/op-rbuilder/src/tests/flashblocks.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,12 @@ async fn unichain_dynamic_with_lag(rbuilder: LocalInstance) -> eyre::Result<()>
189189
let block = driver
190190
.build_new_block_with_current_timestamp(Some(Duration::from_millis(i * 100)))
191191
.await?;
192-
assert_eq!(block.transactions.len(), 8, "Got: {:?}", block.transactions); // 5 normal txn + deposit + 2 builder txn
192+
assert_eq!(
193+
block.transactions.len(),
194+
8,
195+
"Got: {:#?}",
196+
block.transactions
197+
); // 5 normal txn + deposit + 2 builder txn
193198
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
194199
}
195200

@@ -383,17 +388,17 @@ async fn test_flashblock_min_max_filtering(rbuilder: LocalInstance) -> eyre::Res
383388

384389
let _block = driver.build_new_block_with_current_timestamp(None).await?;
385390

386-
// It ends up in the flashblock with index 3. Flashblock number and index
387-
// are different.
391+
// It ends up in the 2nd flashblock
388392
assert_eq!(
389-
2 + 1,
393+
2,
390394
flashblocks_listener
391395
.find_transaction_flashblock(tx1.tx_hash())
392-
.unwrap()
396+
.unwrap(),
397+
"Transaction should be in the 2nd flashblock"
393398
);
394399

395400
let flashblocks = flashblocks_listener.get_flashblocks();
396-
assert_eq!(6, flashblocks.len());
401+
assert_eq!(6, flashblocks.len(), "Flashblocks length should be 6");
397402

398403
flashblocks_listener.stop().await
399404
}

0 commit comments

Comments
 (0)