Skip to content

Conversation

@sieniven
Copy link

@sieniven sieniven commented Dec 4, 2025

📝 Summary

This PR resolves the issue found on stress test where if the FCU arrives time=nice target_time-leeway_time, time drift calculated will be zero. This results in during calculate_flashblocks operation, the number of flashblocks to be built to be equal to zero, causing a panic on subsequent gas limit calculation due to a div-zero error.

The PR fixes handling on calculating time drift to additionally check if time drift is > 0.

Context of the issue:
img_v3_00sl_2e02e473-6625-44f5-a1bd-a7d4534266hu

✅ I have completed the following steps:

  • [ ✅ ] Run make lint
  • [✅ ] Run make test
  • Added tests (if applicable)

@SozinM
Copy link
Collaborator

SozinM commented Dec 9, 2025

Let's do it like this?

        let time_drift = match target_time.duration_since(now) {
            Ok(time_drift) if !time_drift.is_zero() => time_drift,
            _ => {
                error!(
                    target: "payload_builder",
                    message = "FCU arrived too late or system clock are unsynced",
                    ?target_time,
                    ?now,
                );
                return (
                    self.config.flashblocks_per_block(),
                    self.config.specific.interval,
                );
            }
        };

@sieniven
Copy link
Author

sieniven commented Dec 9, 2025

@SozinM Sure both fixes work. However, I think the original fix is more idiomatic since we are discarding the error entirely so unwrapping the result explicitly to an option and then doing the zero duration check might be better. I'll make the change to your suggestion if you think otherwise.

@SozinM
Copy link
Collaborator

SozinM commented Dec 9, 2025

@akundaz
@avalonche

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