Skip to content

Conversation

@akundaz
Copy link
Collaborator

@akundaz akundaz commented Oct 27, 2025

Refactor and fix flashblock timing

  • Extract partition_time_into_flashblocks to calculate the first flashblock time and number of flashblocks and unit test it throughly.
  • Fix integration tests that check if the correct number of flashblocks are being produced according to different timing configuration.
    • Also check that flashblocks are produced at the correct time intervals in these tests
  • Added an additional step BreakAfterMaxFlashblocks to stop once we hit the maximum number of flashblocks

The new tests all pass, some old ones are still broken.

Also tested with builder-playground and fbutil and flashblocks are being produced at the right time:

🔗 Block #514 20:34:57.118
 - ⚡️ 0, gas: 65.1K/60.0M (0.1%), 2 txs  +238 ms  +0.0 (0.0%) gas
 - ⚡️ 1, gas: 86.4K/60.0M (0.1%), 1 txs  +210 ms  +21.3K (0.0%) gas
 - ⚡️ 2, gas: 107.6K/60.0M (0.2%), 1 txs  +211 ms  +21.3K (0.0%) gas
 - ⚡️ 3, gas: 128.9K/60.0M (0.2%), 1 txs  +211 ms  +21.3K (0.0%) gas
 - ⚡️ 4, gas: 150.2K/60.0M (0.3%), 1 txs  +212 ms  +21.3K (0.0%) gas
 - ⚡️ 5, gas: 171.4K/60.0M (0.3%), 1 txs  +212 ms  +21.3K (0.0%) gas
 - ⚡️ 6, gas: 192.7K/60.0M (0.3%), 1 txs  +212 ms  +21.3K (0.0%) gas
 - ⚡️ 7, gas: 214.0K/60.0M (0.4%), 1 txs  +212 ms  +21.3K (0.0%) gas
 - ⚡️ 8, gas: 235.3K/60.0M (0.4%), 1 txs  +213 ms  +21.3K (0.0%) gas
 - ⚡️ 9, gas: 256.5K/60.0M (0.4%), 1 txs  +212 ms  +21.3K (0.0%) gas

Occasionally flashblocks without a base will be produced but that seems out-of-scope for this PR.

@akundaz akundaz self-assigned this Oct 27, 2025
}

#[test]
fn many_flashblocks_with_large_remaining_time() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add test for zero remaining time?
This happens when FCU arrived later then dealine

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. It expects 0 flashblocks and the first flashblock time doesn't really matter since it'll break out

@akundaz akundaz force-pushed the ak-fix-flashblock-timing branch from d508863 to 7371ca5 Compare October 27, 2025 15:52
{
let gas_used = payload.cumulative_gas_used();
let remaining_gas = enclosing.gas_limit.saturating_sub(gas_used);
tracing::warn!(
Copy link
Collaborator

@SozinM SozinM Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was super useful log (but should be info, let's bring it back)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, and changed to info

@akundaz akundaz force-pushed the ak-fix-flashblock-timing branch from d352346 to 089f961 Compare October 29, 2025 19:31
flashblock_number.clone(),
)),
)
.with_step(BreakAfterDeadline),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why haven't you combined steps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried but it ended up breaking a couple tests

@SozinM SozinM merged commit 3560553 into main Oct 30, 2025
3 of 4 checks passed
@SozinM SozinM deleted the ak-fix-flashblock-timing branch October 30, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants