refactor(types): move the interval grid into ethlambda-types - #569
Merged
Conversation
ethlambda-storage derives slot and interval from `store.time()` but cannot depend on ethlambda-blockchain, so it could only document the formula in a comment rather than use the constants. Housing MILLISECONDS_PER_INTERVAL, INTERVALS_PER_SLOT and MILLISECONDS_PER_SLOT in ethlambda-types — which both crates already depend on — removes that asymmetry and keeps a second copy of a consensus-critical constant from appearing in storage. Values are unchanged; blockchain re-exports all three so existing imports keep resolving.
3 tasks
Contributor
Greptile SummaryThis PR moves the consensus interval-grid constants into the shared
Confidence Score: 5/5The PR appears safe to merge because it preserves both the timing values and the existing public import paths. The shared constants module is public, blockchain already depends on the types crate, and the re-exported constants retain their original names,
|
| Filename | Overview |
|---|---|
| crates/blockchain/src/lib.rs | Replaces local timing constants with transparent public re-exports of the same names, types, and values. |
| crates/common/types/src/constants.rs | Adds the unchanged interval-grid constants to the shared types crate without affecting serialized types or consensus data layouts. |
Reviews (1): Last reviewed commit: "refactor(types): move the interval grid ..." | Re-trigger Greptile
pablodeymo
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description / Motivation
Extracted from #561, which needs the interval grid readable from
ethlambda-storage. The move stands on its own, so it lands here rather than riding along with the heartbeat work.ethlambda-storagederives slot and interval fromstore.time(), but it cannot depend onethlambda-blockchain— the dependency runs the other way. Today it can only document the formula in a comment onStore::time()instead of using the constants.ethlambda-typesis already a dependency of both crates, so housing them there removes the asymmetry and keeps a second copy of a consensus-critical constant from appearing in storage.What Changed
crates/common/types/src/constants.rs— now definesMILLISECONDS_PER_INTERVAL,INTERVALS_PER_SLOTandMILLISECONDS_PER_SLOT, docs carried over verbatim.crates/blockchain/src/lib.rs— the three definitions become a re-export of the same names fromethlambda_types::constants.Correctness / Behavior Guarantees
Pure move. Values are unchanged: 800 ms per interval, 5 intervals per slot, 4000 ms per slot.
ethlambda_blockchain::{MILLISECONDS_PER_INTERVAL, INTERVALS_PER_SLOT, MILLISECONDS_PER_SLOT}still resolve via the re-export, so no downstream import changes —crates/net/rpc/src/spec.rsin particular is untouched.tooling/event-monitorkeeps its ownDEFAULT_INTERVALS_PER_SLOT; it is a separate binary that reads the real value from/lean/v0/config/specover HTTP and only falls back to the local default when no node answers.Tests Added / Run
No new tests — there is no behavior to test. Existing suite covers the constants through every consumer.
Related Issues / PRs
✅ Verification Checklist
make fmt— cleanmake lint(clippy with-D warnings) — cleanmake test(cargo test --workspace --profile release-fast) — all passing