Skip to content

docs+test(settlement): pin idle-flush-secs' max-interval settlement semantics#642

Merged
kariy merged 2 commits into
mainfrom
feat/time-based-settlement
Jul 21, 2026
Merged

docs+test(settlement): pin idle-flush-secs' max-interval settlement semantics#642
kariy merged 2 commits into
mainfrom
feat/time-based-settlement

Conversation

@kariy

@kariy kariy commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

idle-flush-secs already provides time-based settlement, but its docs described it as an inactivity timer ("settle a partial batch after this many seconds without a new block"). The implementation never resets the deadline when blocks arrive mid-window, so it is actually a max interval between settlements: a batch settles when it reaches batch-size blocks or when idle-flush-secs have elapsed since its first pending block — whichever comes first — meaning even a single block produced in the window settles on time. This PR corrects the docs to state that contract and adds run-loop tests that pin it. No behavior change; the config key keeps its name.

Changes

  • chain-spec / settlement: corrected doc comments on SettlementRuntime.idle_flush_secs and SettlementConfig.idle_flush_interval, plus stale in-loop comments in the settlement worker.
  • New paused-clock tests drive Worker::run end to end: a lone pending block settles once the interval elapses, and blocks arriving mid-window don't push the deadline back (settlement happens ~interval after the window opens, not after the last block). Adds katana-db as a dev-dependency to advance the chain head via direct table writes.
  • docs/tee-deployment.md: config snippet comments updated to the accurate semantics.

🤖 Generated with Claude Code

…s setting

Rename the settlement runtime's `idle-flush-secs` knob to
`settle-interval-secs` to match what it actually does: a batch settles when
it reaches `batch-size` blocks or when this many seconds have elapsed since
its first pending block — whichever comes first. The old name (and its doc
comment, "settle after this many seconds without a new block") suggested an
inactivity timer, but the deadline was never reset by blocks arriving
mid-window, so it has always been a max-interval cadence: even a single
block produced in the window settles once the interval elapses.

The old `idle-flush-secs` key still parses via a serde alias, so existing
chain configs keep working.

New paused-clock tests drive the worker's run loop end to end and pin the
guarantee: a lone pending block settles once the interval elapses, and
blocks arriving mid-window do not push the deadline back.

Co-Authored-By: Claude Fable 5 <[email protected]>
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codec benchmark diff vs main

Benchmark Baseline (ns) Current (ns) Δ
CompiledClass(fixture)/compress 2638010 2675257 +1.41%
CompiledClass(fixture)/decompress 2803968 2806309 +0.08%
ExecutionCheckpoint/compress 30 30 +0.00%
ExecutionCheckpoint/decompress 23 24 +4.35%
PruningCheckpoint/compress 30 30 +0.00%
PruningCheckpoint/decompress 23 23 +0.00%
VersionedHeader/compress 642 641 -0.16%
VersionedHeader/decompress 822 842 +2.43%
StoredBlockBodyIndices/compress 73 74 +1.37%
StoredBlockBodyIndices/decompress 36 36 +0.00%
StorageEntry/compress 138 136 -1.45%
StorageEntry/decompress 140 140 +0.00%
ContractNonceChange/compress 138 140 +1.45%
ContractNonceChange/decompress 233 235 +0.86%
ContractClassChange/compress 180 180 +0.00%
ContractClassChange/decompress 274 262 -4.38%
ContractStorageEntry/compress 150 148 -1.33%
ContractStorageEntry/decompress 309 328 +6.15%
GenericContractInfo/compress 133 136 +2.26%
GenericContractInfo/decompress 102 102 +0.00%
Felt/compress 70 71 +1.43%
Felt/decompress 55 55 +0.00%
BlockHash/compress 70 71 +1.43%
BlockHash/decompress 54 58 +7.41%
TxHash/compress 70 71 +1.43%
TxHash/decompress 53 56 +5.66%
ClassHash/compress 70 71 +1.43%
ClassHash/decompress 56 56 +0.00%
CompiledClassHash/compress 70 71 +1.43%
CompiledClassHash/decompress 54 55 +1.85%
BlockNumber/compress 33 33 +0.00%
BlockNumber/decompress 23 23 +0.00%
TxNumber/compress 32 33 +3.13%
TxNumber/decompress 23 23 +0.00%
FinalityStatus/compress 1 1 +0.00%
FinalityStatus/decompress 11 11 +0.00%
TypedTransactionExecutionInfo/compress 16393 18460 +12.61%
TypedTransactionExecutionInfo/decompress 3655 3550 -2.87%
VersionedContractClass/compress 375 376 +0.27%
VersionedContractClass/decompress 809 800 -1.11%
MigratedCompiledClassHash/compress 139 139 +0.00%
MigratedCompiledClassHash/decompress 140 138 -1.43%
ContractInfoChangeList/compress 1418 1411 -0.49%
ContractInfoChangeList/decompress 2084 2126 +2.02%
BlockChangeList/compress 618 633 +2.43%
BlockChangeList/decompress 850 848 -0.24%
ReceiptEnvelope/compress 30933 31529 +1.93%
ReceiptEnvelope/decompress 5992 6134 +2.37%
TrieDatabaseValue/compress 171 175 +2.34%
TrieDatabaseValue/decompress 211 211 +0.00%
TrieHistoryEntry/compress 297 326 +9.76%
TrieHistoryEntry/decompress 238 240 +0.84%

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Runner: AMD EPYC 7763 64-Core Processor (4 cores) · 15Gi RAM

Keep the existing `idle-flush-secs` / `idle_flush_interval` names. The doc
comments still get the fix — the knob is a max time between settlements
while blocks are pending (the deadline is not reset by mid-window blocks),
not an inactivity timer — and the new paused-clock run-loop tests that pin
that behavior stay.

Co-Authored-By: Claude Fable 5 <[email protected]>
@kariy kariy changed the title feat(settlement): make the time-based settlement trigger a first-class setting docs+test(settlement): pin idle-flush-secs' max-interval settlement semantics Jul 21, 2026
@kariy
kariy merged commit 3d856a6 into main Jul 21, 2026
8 checks passed
@kariy
kariy deleted the feat/time-based-settlement branch July 21, 2026 10:07
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.28%. Comparing base (9bde0ae) to head (2a8b558).
⚠️ Report is 501 commits behind head on main.

Files with missing lines Patch % Lines
crates/settlement/src/service.rs 93.10% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #642      +/-   ##
==========================================
- Coverage   73.32%   68.28%   -5.05%     
==========================================
  Files         209      335     +126     
  Lines       23132    47059   +23927     
==========================================
+ Hits        16961    32133   +15172     
- Misses       6171    14926    +8755     

☔ View full report in Codecov by Harness.
📢 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant