• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iotaledger / iota / 29298811321

13 Jul 2026 04:31PM UTC coverage: 68.351% (+0.02%) from 68.327%
29298811321

push

github

web-flow
fix(core): amortize checkpoint interval over a sliding window (#12118)

# Description of change

Checkpoint creation rate regressed after sliding-window block creation
(#11790) raised the block/commit rate: block rate rose to the 20 b/s
ceiling but checkpoint rate fell (~4.85 → ~4.25 c/s, worst on large
committees).

`min_checkpoint_interval_ms = 200` caps the checkpoint rate to bound the
storage and bandwidth cost of creating, certifying, and syncing
checkpoints; the rate also drives end-to-end latency for consumers that
wait on verified checkpoints. This PR keeps the same ~5 c/s asymptotic
cap while restoring the rate to it under the relaxed block-creation
rules.

## Root cause

`maybe_build_checkpoints` gated each checkpoint on the previous one,
then advanced the anchor to the *actual* triggering commit timestamp:

```
build when  current_commit_ts >= last_checkpoint_ts + min_checkpoint_interval_ms
then        last_checkpoint_ts = current_commit_ts
```

Commit timestamps are discrete, so the trigger overshoots the deadline
every time. Anchoring on the actual timestamp makes every checkpoint pay
that overshoot, pushing sustained spacing above `interval` — worse as
higher block rates coarsen the timestamp grid.

## Fix

Keep the strict adjacent check and add a windowed one; checkpoint `k`
builds when **either** holds:

```
adjacent:  current_commit_ts >= timestamp(checkpoint k−1) + interval
windowed:  current_commit_ts >= timestamp(checkpoint k−N) + N * interval
```

The windowed arm amortizes the overshoot over `N` checkpoints (paid once
per window, not per checkpoint), restoring the rate to the ceiling; the
adjacent arm keeps every gap — hence every coalesced checkpoint — within
one interval, avoiding the burst-then-jumbo clustering a window-only
rule drifts into. Both arms consume ≥ one interval of commit time per
checkpoint, so the sustained ~5 c/s cap is preserved. `N` is the new
protocol parameter `checkpoint_rate_window_size`.

## Determinism
... (continued)

163752 of 239575 relevant lines covered (68.35%)

456938.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.58
/crates/iota-core/src/execution_cache/writeback_cache.rs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc