Skip to content

refactor(core): extract fork-heights into its own crate#797

Merged
github-actions[bot] merged 1 commit into
mainfrom
refactor/extract-fork-heights-crate
Jun 6, 2026
Merged

refactor(core): extract fork-heights into its own crate#797
github-actions[bot] merged 1 commit into
mainfrom
refactor/extract-fork-heights-crate

Conversation

@satyakwok
Copy link
Copy Markdown
Member

@satyakwok satyakwok commented Jun 6, 2026

Step 2 of breaking up the sentrix-core monolith. A pure, peripheral crate extraction: fork_heights is consts + env reads + chain-id selection with no consensus-state coupling, so it lifts out cleanly.

What moved

crates/sentrix-core/src/fork_heights.rs → new crate sentrix-fork-heights (crates/sentrix-fork-heights/src/lib.rs, via git mv so history follows). sentrix-core re-exports it:

pub use sentrix_fork_heights as fork_heights;

so every fleet-wide sentrix_core::fork_heights::* / crate::fork_heights::* call site (37 across core/network/bin) resolves unchanged — zero call-site edits.

Why

Separate compile unit (faster incremental builds when iterating fork schedule), clearer boundary, independently auditable/publishable. BUSL-1.1 + publish = false like the rest of the consensus crates.

Safety (pure motion)

  • Fork-schedule consts + selection logic are byte-identical.
  • Only deltas: the in-crate env-test lock is inlined (was crate::test_util), and one intra-doc-link to a sentrix-core type is plain-texted (would be circular: core depends on this crate, not vice versa).
  • New crate's only dep is tracing (one warn!).

Verification

  • cargo check --workspace -D warnings clean (all 37 call sites resolve via the re-export).
  • Tests conserved: sentrix-core 263 + sentrix-fork-heights 10 = 273 (was 273), 0 failed.

Summary by CodeRabbit

  • Chores
    • Bumped workspace version from 2.2.35 to 2.2.37.
    • Reorganized internal crate dependencies for improved modularity.

@github-actions github-actions Bot enabled auto-merge (squash) June 6, 2026 07:00
Move fork_heights.rs (pure consts + env + chain-id selection, no consensus-state coupling) out of the sentrix-core monolith into a standalone sentrix-fork-heights crate — separate compile unit (faster incremental builds), clearer boundary. sentrix-core re-exports it as `pub use sentrix_fork_heights as fork_heights`, so all fleet-wide `sentrix_core::fork_heights::*` / `crate::fork_heights::*` call sites resolve unchanged (zero call-site edits). Pure motion: fork-schedule consts/logic byte-identical; only the in-crate env-test lock is inlined and one intra-doc-link to a sentrix-core type is plain-texted (would be circular). cargo check --workspace -D warnings clean; tests conserved: sentrix-core 263 + sentrix-fork-heights 10 = 273 (was 273), 0 failed.
@satyakwok satyakwok force-pushed the refactor/extract-fork-heights-crate branch from d886a23 to bc87fc1 Compare June 6, 2026 07:03
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 6, 2026

Looking for one thing? Review this PR in Change Stack to search files, summaries, diffs, and code without losing your place.

Review Change Stack

Warning

Review limit reached

@satyakwok, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 25 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ee14fcc8-ca28-436e-ab5b-0d11ff3c9c00

📥 Commits

Reviewing files that changed from the base of the PR and between d886a23 and bc87fc1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (5)
  • Cargo.toml
  • crates/sentrix-core/Cargo.toml
  • crates/sentrix-core/src/lib.rs
  • crates/sentrix-fork-heights/Cargo.toml
  • crates/sentrix-fork-heights/src/lib.rs
📝 Walkthrough

Walkthrough

This PR extracts fork-height predicates and constants from sentrix-core into a new independent crate, sentrix-fork-heights. The workspace Cargo.toml is updated to include the new crate and version is bumped to 2.2.37. sentrix-core adds sentrix-fork-heights as a path dependency and re-exports its public interface as fork_heights, maintaining API compatibility for existing call sites. The new crate includes a local env_test_lock() utility to eliminate prior test-time dependency on sentrix-core's test infrastructure, and documentation is updated to reflect the new module ownership.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • sentrix-labs/sentrix#634: Both PRs reorganize the fork-height accessors around a fork_heights re-export or module (retrieved: extracting them into crates/sentrix-core/src/fork_heights.rs and re-exporting from blockchain.rs; main: switching sentrix-core's fork_heights entry to re-export from the new external sentrix-fork-heights crate).

  • sentrix-labs/sentrix#708: Both PRs directly edit the root Cargo.toml [workspace.package].version value (main: 2.2.352.2.37, retrieved: 2.2.142.2.15) as workspace-wide version bumps.

  • sentrix-labs/sentrix#657: Both PRs restructure the fork_heights logic: the retrieved PR moves the is_*_height predicate implementations, and the main PR externalizes those same fork-height predicates into the new sentrix-fork-heights crate and re-exports it as sentrix_core::fork_heights.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides detailed context about the refactoring (what moved, why, safety considerations, verification), but does not follow the repository's required template structure with sections like Summary, Scope, Checks, Linked issue, and Deploy impact. Restructure the description to match the template: add a Summary section (1-3 sentences), check the Scope checkboxes, verify Checks (forge build/test/fmt/slither), confirm Linked issue, and specify Deploy impact clearly.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: extracting fork-heights logic into its own separate crate, which aligns perfectly with the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/extract-fork-heights-crate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot merged commit 10b4874 into main Jun 6, 2026
19 checks passed
@satyakwok satyakwok self-assigned this Jun 6, 2026
@satyakwok satyakwok deleted the refactor/extract-fork-heights-crate branch June 6, 2026 07:21
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