Skip to content

Restore Taiko FCU timestamp validation allowing equal timestamps#10810

Merged
jmadibekov merged 8 commits intomasterfrom
jmadibekov/fix-taiko-fcu-timestamp-validation
Mar 13, 2026
Merged

Restore Taiko FCU timestamp validation allowing equal timestamps#10810
jmadibekov merged 8 commits intomasterfrom
jmadibekov/fix-taiko-fcu-timestamp-validation

Conversation

@jmadibekov
Copy link
Contributor

@jmadibekov jmadibekov commented Mar 12, 2026

Changes

  • Add IsPayloadTimestampValid virtual method to ForkchoiceUpdatedHandler (base: > for strict increase)
  • Override in TaikoForkchoiceUpdatedHandler as a one-liner using >= (allowing equal timestamps)
  • Reduce timeout-minutes from 45 to 20 in ci-surge.yml and ci-taiko.yml, add step-level 15m timeout on the test step so timeouts surface as failures instead of cancellations
  • Add unit tests covering equal, greater, and lesser timestamp scenarios

PR #10325 renamed IsPayloadAttributesTimestampValidArePayloadAttributesTimestampAndSlotNumberValid, removed virtual, and deleted the Taiko override. In Taiko, multiple L2 blocks can be derived from a single L1 block sharing the same L1 anchor timestamp, so equal timestamps must be allowed.

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)

Testing

Requires testing

  • Yes

If yes, did you write tests?

  • Yes

Notes on testing

Added 3 test cases in TaikoEngineApiTests verifying equal timestamps are accepted, greater timestamps are accepted, and lesser timestamps are rejected.

Integration tests passed on this PR:

Documentation

Requires documentation update

  • No

Requires explanation in Release Notes

  • No

…amps

Commit 195829e (Bal devnet 2) renamed IsPayloadAttributesTimestampValid,
removed the virtual keyword, and deleted TaikoForkchoiceUpdatedHandler's
override that allowed equal timestamps. This broke Taiko Pacaya where
multiple L2 blocks derived from a single L1 block share the same timestamp.
@github-actions github-actions bot added bug fix + reliability taiko related to the taiko alethia rollup labels Mar 12, 2026
@jmadibekov jmadibekov self-assigned this Mar 12, 2026
@jmadibekov jmadibekov changed the title fix: Restore Taiko FCU timestamp validation allowing equal timestamps Restore Taiko FCU timestamp validation allowing equal timestamps Mar 12, 2026
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Maybe make the change smaller by having something like GetMinRequiredTimestamp overridable. Thus overriding a one-liner?

@smartprogrammer93
Copy link
Contributor

@copilot implement the following suggestion to this PR::

Maybe make the change smaller by having something like GetMinRequiredTimestamp overridable. Thus overriding a one-liner?

Copy link
Contributor

Copilot AI commented Mar 12, 2026

@smartprogrammer93 I've opened a new pull request, #10811, to work on those changes. Once the pull request is ready, I'll request review from you.

Job-level timeout 45m → 20m, add step-level 15m timeout on the test
step so timeouts show as failures instead of cancellations.
@jmadibekov jmadibekov requested review from a team and rubo as code owners March 12, 2026 17:44
if (newHeadBlock.Timestamp >= payloadAttributes.Timestamp)
if (payloadAttributes.Timestamp < GetMinRequiredTimestamp(newHeadBlock))
{
string error = $"Payload timestamp {payloadAttributes.Timestamp} must be greater than block timestamp {newHeadBlock.Timestamp}.";
Copy link
Member

Choose a reason for hiding this comment

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

This message should be adjusted to use GetMinRequiredTimestamp too - save it in variable.

Copy link
Member

@LukaszRozmej LukaszRozmej Mar 13, 2026

Choose a reason for hiding this comment

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

Also not sure which would be better here < or <= (which would require amending GetMinRequiredTimestamp accordingly), WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding the first comment, done! Regarding the second, I'd rather leave it as-is (that is <) because I find that more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I went ahead with the approach @dipkakwani suggested below because I found that even more elegant :)

Copy link
Member

Choose a reason for hiding this comment

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

But the error message for taiko is now wrong?


// Taiko Pacaya allows equal timestamps because multiple L2 blocks can be derived
// from a single L1 block, all sharing the same L1 anchor timestamp.
protected override ulong GetMinRequiredTimestamp(Block newHeadBlock) => newHeadBlock.Timestamp;
Copy link
Member

Choose a reason for hiding this comment

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

This change will allow equal timestamps for all the forks, not just Pacaya right?
We need to have conditions to return based on the current fork, similar to taiko geth here: https://github.com/taikoxyz/taiko-geth/blob/1fda81a9372dd79056427487caef38cee2be75b5/consensus/taiko/consensus.go#L158-L168

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, we do already have similar per-fork rules during block validation: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.Taiko/TaikoHeaderValidator.cs#L204-L226.

And when it comes to fcu, nmc is actually correctly mirroring here taiko-geth because taiko-geth also allows equal timestamps for all forks unconditionally: https://github.com/taikoxyz/taiko-geth/blob/taiko/miner/worker.go#L174-L187.

So I don't think there is a need for this.

return null;
}

protected virtual ulong GetMinRequiredTimestamp(Block newHeadBlock) => newHeadBlock.Timestamp + 1;
Copy link
Member

Choose a reason for hiding this comment

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

This function looks a bit random, the intention of adding 1 to the timestamp is not clear.
Do you think it wil be better to have the complete logic for checking timestamp as virtual, instead of only the minimum required timestamp? Something like IsPayloadTimestampValid in the if statement of line 296, and each module can override that function?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Also noticed Lukaz comment, I think we can still make IsPayloadTimestampValid one-liner in the base class instead of using GetMinRequiredTimestamp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like that, done!

@jmadibekov jmadibekov merged commit a438f5e into master Mar 13, 2026
415 of 416 checks passed
@jmadibekov jmadibekov deleted the jmadibekov/fix-taiko-fcu-timestamp-validation branch March 13, 2026 19:36
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (8964a2e) to head (8ce5731).
⚠️ Report is 29 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #10810       +/-   ##
===========================================
- Coverage   50.22%        0   -50.23%     
===========================================
  Files        3207        0     -3207     
  Lines      165267        0   -165267     
  Branches    23135        0    -23135     
===========================================
- Hits        83010        0    -83010     
+ Misses      76622        0    -76622     
+ Partials     5635        0     -5635     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix + reliability devops taiko related to the taiko alethia rollup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants