Skip to content

Add timestamp-based epoch close#26158

Open
mwtian wants to merge 6 commits intomainfrom
tmw/dreamy-lederberg
Open

Add timestamp-based epoch close#26158
mwtian wants to merge 6 commits intomainfrom
tmw/dreamy-lederberg

Conversation

@mwtian
Copy link
Copy Markdown
Contributor

@mwtian mwtian commented Apr 8, 2026

Summary

  • Each validator can now transition from AcceptAllCerts to RejectAllCerts directly when the consensus commit timestamp exceeds the epoch reconfiguration timestamp, instead of waiting for 2f+1 EndOfPublish messages
  • Simplifies epoch transitions and reduces latency by skipping EndOfPublish voting for epoch change
  • EndOfPublish quorum is preserved as a fallback for manual/forced epoch close
  • Gated behind timestamp_based_epoch_close feature flag (devnet and tests only)

Test plan

  • cargo insta test -p sui-protocol-config --accept (snapshot updated)
  • cargo check -p sui-core -p sui-node passes
  • SUI_SKIP_SIMTESTS=1 cargo nextest run -p sui-core
  • cargo simtest -p sui-e2e-tests

🤖 Generated with Claude Code

Each validator now transitions from AcceptAllCerts to RejectAllCerts when
the consensus commit timestamp exceeds the epoch reconfiguration timestamp,
instead of waiting for 2f+1 EndOfPublish messages. This simplifies epoch
transitions and reduces latency.

EndOfPublish quorum is preserved as a fallback for manual/forced epoch close.

Changes:
- Add timestamp_based_epoch_close feature flag (devnet only)
- Add next_reconfiguration_timestamp_ms() to AuthorityPerEpochStore
- Add handle_epoch_close() to ConsensusHandler with dual-path support
- Guard automatic EndOfPublish sending behind feature flag
- Guard checkpoint_output close_epoch() behind feature flag

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@mwtian mwtian requested review from a team and mystenmark as code owners April 8, 2026 17:36
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env April 8, 2026 17:36 — with GitHub Actions Inactive
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sui-docs Ready Ready Preview, Comment Apr 9, 2026 4:43pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
multisig-toolkit Ignored Ignored Preview Apr 9, 2026 4:43pm
sui-kiosk Ignored Ignored Preview Apr 9, 2026 4:43pm

Request Review

@mwtian mwtian marked this pull request as draft April 8, 2026 17:38
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env April 8, 2026 17:47 — with GitHub Actions Inactive
Override initial_reconfig_state to RejectAllCerts before filtering
when the commit timestamp crosses the reconfiguration threshold,
so user transactions are dropped in the same commit rather than
the next one.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
With timestamp_based_epoch_close, close_epoch() was returning early
without sending EndOfPublish. This broke trigger_reconfiguration() in
simtests which relies on manual EndOfPublish quorum to close the epoch.

Now close_epoch() sends EndOfPublish even with the flag enabled, which
handle_epoch_close() processes via the collected_eop_quorum path.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@mwtian mwtian force-pushed the tmw/dreamy-lederberg branch from 7d3171f to ec94cf6 Compare April 8, 2026 23:46
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env April 8, 2026 23:46 — with GitHub Actions Inactive
@mwtian mwtian marked this pull request as ready for review April 9, 2026 01:47
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env April 9, 2026 01:47 — with GitHub Actions Inactive
if epoch_store.should_send_end_of_publish() {
// Skip when timestamp_based_epoch_close is enabled (epoch close is timestamp-driven).
if epoch_store.should_send_end_of_publish()
&& !epoch_store.protocol_config().timestamp_based_epoch_close()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the case if EOP is manually done by an admin, we need to always preserve the crash recovery?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. We can recover manual eop.

if !self
.epoch_store
.protocol_config()
.timestamp_based_epoch_close()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this may have the same problem if EOP was manually triggered

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@mwtian mwtian requested a review from lxfind April 9, 2026 04:38
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env April 9, 2026 04:39 — with GitHub Actions Inactive
@mwtian mwtian force-pushed the tmw/dreamy-lederberg branch from ddf6ca1 to f4bd3a8 Compare April 9, 2026 04:45
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env April 9, 2026 04:45 — with GitHub Actions Inactive
@mwtian mwtian changed the title Replace EndOfPublish voting with timestamp-based epoch close Add timestamp-based epoch close Apr 9, 2026
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