Sui uses a dual-layer finalization system: checkpoints provide fast, frequent state commitments, while epochs organize longer time periods for validator set changes and protocol upgrades.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mystenlabs/sui/llms.txt
Use this file to discover all available pages before exploring further.
Checkpoints
Checkpoints are Sui’s primary finalization mechanism, providing certified snapshots of the blockchain state at regular intervals.Purpose of Checkpoints
Checkpoints serve multiple critical functions:- State Finalization: Provide cryptographic commitments to executed transactions
- Fast Synchronization: Enable new validators and full nodes to catch up efficiently
- Light Clients: Support verification without executing all transactions
- Archival: Create immutable historical records for auditing and replay
Checkpoint Structure
Checkpoint Contents
Each checkpoint includes all transactions finalized since the previous checkpoint:Checkpoint contents are stored separately from the summary, allowing efficient summary-only verification for light clients.
Checkpoint Creation Process
Building Checkpoints
Validators continuously build checkpoints from executed transactions:Checkpoint Builder
TheCheckpointBuilder orchestrates checkpoint creation:
- Transaction Execution: Execute consensus-ordered transactions
- Content Collection: Gather transaction and effects digests
- State Commitment: Compute accumulator root over live objects
- Summary Creation: Build checkpoint summary with metadata
- Signing: Sign summary with validator’s key
Checkpoint Signature Aggregation
Validators submit their checkpoint signatures to consensus:- Validators create and sign checkpoint summaries locally
- Signatures are submitted as consensus transactions
- Validators collect signatures from consensus output
- Once 2f+1 stake worth of signatures are collected, checkpoint is certified
Certified Checkpoints
A checkpoint becomes certified when it has a quorum of validator signatures:- Immutability: Checkpoint contents cannot be changed
- Finality: All included transactions are permanently ordered
- Network Agreement: A quorum of validators agree on the state
Certified checkpoints are stored in the
CheckpointStore at crates/sui-core/src/checkpoints/mod.rs:156-200.Checkpoint Storage
TheCheckpointStore maintains checkpoint data:
Checkpoint Watermarks
Watermarks track checkpoint processing progress:- Highest Verified: Latest checkpoint with verified signatures
- Highest Synced: Latest checkpoint with downloaded contents
- Highest Executed: Latest checkpoint with executed transactions
Full Checkpoint Contents
For state synchronization, full checkpoint contents include:- Download complete checkpoint data
- Verify all transactions and effects
- Apply state changes without re-execution
Epochs
Epochs are fixed-duration periods that organize validator set changes and protocol upgrades.Epoch Structure
- Epoch ID: Sequential number starting from 0 (genesis)
- Start Timestamp: Wall clock time when epoch began
- Epoch Digest: Digest of the last checkpoint from previous epoch
- Duration: Typically 24 hours (configurable)
Epoch Lifecycle
Epoch Start
At the beginning of each epoch:- Load System State: Read epoch start configuration from previous epoch’s final checkpoint
- Initialize Committee: Create committee from validator set
- Configure Protocol: Load protocol version and parameters
- Start Consensus: Initialize consensus with new committee
- Open for Transactions: Begin accepting user transactions
Epoch Operation
During normal epoch operation:- Validators process transactions through consensus
- Checkpoints are created every few seconds
- Staking operations are recorded but not applied
- Protocol operates under consistent rules
Epoch End
As the epoch approaches its end (based on timestamp):- Close User Transactions: Stop accepting new user-submitted transactions
- Process Remaining: Complete all in-flight consensus transactions
- Build Final Checkpoint: Create the last checkpoint of the epoch
- Safe Mode Check: Determine if epoch should enter safe mode
- Execute Epoch Change: Run system transaction to transition to next epoch
End-of-Epoch Data
The final checkpoint of an epoch includes special end-of-epoch data:Epoch Statistics
Epochs accumulate statistics during their lifetime:- Total checkpoints created
- Total transactions processed
- Total gas fees collected
- Stake rewards distributed
State Synchronization
Checkpoints enable efficient state synchronization for validators and full nodes.Checkpoint Execution
TheCheckpointExecutor applies checkpoints to build state:
- Download Checkpoint: Fetch certified checkpoint and full contents
- Verify Signature: Validate quorum signatures on summary
- Execute Transactions: Apply transaction effects to state
- Update Accumulator: Recompute state commitments
- Advance Watermark: Mark checkpoint as executed
State Sync Protocol
Validators synchronize through the state sync network:Checkpoint Pruning
Older checkpoint data can be pruned to save storage:- Full Contents: Pruned after state is executed (configurable retention)
- Summaries: Retained indefinitely (small size)
- Watermarks: Track what can be safely pruned
Pruning configuration is managed by
AuthorityStorePruner and PrunerWatermarks.Checkpoint Height
Checkpoint height represents the consensus round that produced the checkpoint:- Derived from consensus commit round
- May not be strictly monotonic (due to checkpoint splitting)
- Used for consensus coordination
Fork Detection
Checkpoints enable detection of forks and inconsistencies:- Validators compute checkpoint summaries locally
- Compare local summary with certified summary
- If mismatch detected, log fork information
- Store evidence for investigation
Performance Considerations
Checkpoint Frequency
Checkpoints are created approximately every:- 2-3 seconds during normal operation
- Determined by consensus commit rate
- Configurable through protocol parameters
Checkpoint Size
Checkpoint size varies based on transaction throughput:- Summary: ~500 bytes (fixed)
- Contents: ~100 bytes per transaction
- Full Contents: ~1-5 KB per transaction (includes effects)
State Sync Performance
Checkpoint-based state sync achieves:- Download Rate: Limited by network bandwidth
- Execution Rate: Limited by database write speed
- Catch-up Time: Typically minutes to hours depending on lag
Key Implementation Files
- Checkpoint Types:
crates/sui-types/src/messages_checkpoint.rs - Checkpoint Store:
crates/sui-core/src/checkpoints/mod.rs - Checkpoint Builder:
crates/sui-core/src/checkpoints/checkpoint_output.rs - Checkpoint Executor:
crates/sui-core/src/checkpoints/checkpoint_executor/ - Epoch Data:
crates/sui-types/src/epoch_data.rs - Epoch Store:
crates/sui-core/src/authority/authority_per_epoch_store.rs - Committee Store:
crates/sui-core/src/epoch/committee_store.rs