Skip to content

feat(consensus): pin testnet SIP-6 activation at h=6_026_000 + bump v2.2.24 (SIP-6, PR 5/N)#759

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/sip-6-testnet-activation
Jun 1, 2026
Merged

feat(consensus): pin testnet SIP-6 activation at h=6_026_000 + bump v2.2.24 (SIP-6, PR 5/N)#759
github-actions[bot] merged 2 commits into
mainfrom
feat/sip-6-testnet-activation

Conversation

@satyakwok
Copy link
Copy Markdown
Collaborator

@satyakwok satyakwok commented Jun 1, 2026

Summary

Final code-side PR in the SIP-6 series. Pins testnet `STATE_IN_TRIE_HEIGHT` activation to 6,026,000 (~46 min buffer past the v2.2.24 deploy window at h≈6,020,400 on 2026-06-01). Mainnet default stays `u64::MAX` until the canonical-override design lands. Workspace version bumped to 2.2.24.

Pre-activation finding — drift IS already present

Direct read of `/staking/validators` against all 3 active testnet val ports confirms pending_rewards has already drifted across the active set:

Validator val1 val2 val4 spread
0x47b21b… 135,205,012,552,188 135,236,421,888,474 136,168,000,766,178 ~9.6M sentri
0x4f9988… 155,558,826,842,610 156,501,673,320,528 155,536,419,929,304 ~9.7M sentri
0x682126… 158,290,332,688,983 157,319,474,607,285 157,348,085,833,149 ~9.7M sentri

This is the exact activation hazard PRs #756 / #757 / #758 documented. Naïvely flipping the gate would fork the chain at the first post-activation block.

Mitigation — option C (chain.db harmonize)

Deploy will land via a single halt-all window doing all three steps in lockstep:

  1. `halt-all` val1+val2+val4 (testnet val3 already stopped, jailed).
  2. `cp -a val2/chain.db → val1/chain.db` + `cp -a val2/chain.db → val4/chain.db` (parallel, ~3 min for 29 GB each).
  3. Swap binary v2.2.23 → v2.2.24.
  4. `simul-start` val1+val2+val4.

All 3 vals reload identical in-memory state from val2's snapshot — the same recovery mechanism that worked for testnet val3 on 2026-05-30. After ~50 blocks (~25 s) the activation height crosses and SIP-6 captures the (now harmonized) state into the trie. Drift accumulation window between cp restart and activation is tiny enough to be negligible (~600 sentri max, 6e-6 SRX).

Rationale for option C over A (env canonical override) / B (reset to 0) / D (skip): option C has 0 env coordination risk, 0 financial loss (rewards preserved via val2 snapshot), and proven recovery mechanism. See sip-6 design doc for the full comparison.

What this PR changes

  • `Cargo.toml` — `workspace.package.version` 2.2.23 → 2.2.24.
  • `Cargo.lock` — regenerated for the version bump.
  • `crates/sentrix-core/src/fork_heights.rs`:
    • Restored `STATE_IN_TRIE_HEIGHT_TESTNET_DEFAULT = 6_026_000` const (the symmetry the PR feat(consensus): add STATE_IN_TRIE fork-gate scaffolding (SIP-6, PR 1/N) #755 fixup dropped — it's no longer u64::MAX, so the wrapper earns its keep).
    • Re-wired `get_state_in_trie_height` through `chain_default(...)`.
    • Doc comment expanded with the activation-hazard note + the chain.db-harmonize mitigation plan.

Self-review (per feedback_smoke_test_and_code_review_every_change)

  • ✅ `cargo clippy --workspace --tests -- -D warnings` clean on the exact CI command.
  • ✅ 77/77 `sentrix-trie` tests pass.
  • ✅ `sentrix-core` blockchain_trie_ops tests pass.
  • ✅ `cargo check --release` clean for the version bump (no breakage).
  • ✅ Mainnet default `u64::MAX` — zero impact on mainnet apply path until a separate PR pins it.

Post-merge sequence

This PR contains ONLY the code change. The actual deploy steps (halt-all, cp, binary swap, simul-start) happen out-of-band against the merged main, building v2.2.24 binary via the bullseye docker pattern documented in [[project-v2-2-23-testnet-deploy]]. Activation crosses ~46 minutes after deploy completion.

After activation crosses cleanly + a brief bake (~24 h on testnet to start, then ≥1 week per SIP-6 § Activation Plan), this SIP moves to "Last Call" status. Mainnet activation height is picked separately during the next operator window with a canonical-override env override (still to be designed).

Summary by CodeRabbit

  • Chores

    • Bumped package version from 2.2.23 to 2.2.24
  • New Features

    • Added testnet-specific activation height configuration for state-in-trie migration, enabling independent chain configuration between mainnet and testnet environments

@github-actions github-actions Bot enabled auto-merge (squash) June 1, 2026 11:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 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 1, 2026

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 40 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: 08dc8932-e957-49ae-9e65-b82538e6a425

📥 Commits

Reviewing files that changed from the base of the PR and between 95ec4b2 and 09e07cc.

📒 Files selected for processing (1)
  • crates/sentrix-core/src/fork_heights.rs
📝 Walkthrough

Walkthrough

This PR includes a workspace version bump from 2.2.23 to 2.2.24 in Cargo.toml. The fork_heights.rs module introduces a testnet-specific fork height constant STATE_IN_TRIE_HEIGHT_TESTNET_DEFAULT pinned to 6_026_000, complementing the existing mainnet default. The get_state_in_trie_height() runtime accessor is updated to select the default based on chain id via chain_default(), preserving environment variable overrides while making the fallback chain-aware.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • sentrix-labs/sentrix#755: Adds fork-gate scaffolding to the get_state_in_trie_height() accessor in the same file, establishing the pattern that this PR extends with chain-specific defaults.
  • sentrix-labs/sentrix#757: Extends update_trie_for_block to write liveness and total_minted during the SIP-6 state-in-trie post-fork window, gated by the same height selection that this PR makes chain-aware.
  • sentrix-labs/sentrix#687: Modifies fork_heights.rs using the same chain_default pattern to add chain-specific testnet defaults for other fork heights.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main changes: pinning testnet SIP-6 activation height and bumping the version, directly corresponding to the changeset.
Description check ✅ Passed The description is thorough and addresses most template sections, though it uses a narrative format rather than strict checkbox structure and omits explicit Checks section.
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 feat/sip-6-testnet-activation

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/sentrix-core/src/fork_heights.rs`:
- Around line 393-399: Add regression tests covering the new chain-aware
STATE_IN_TRIE_HEIGHT fallback: create a test (e.g.,
state_in_trie_height_defaults) that ensures read_height("STATE_IN_TRIE_HEIGHT",
chain_default(STATE_IN_TRIE_HEIGHT_DEFAULT,
STATE_IN_TRIE_HEIGHT_TESTNET_DEFAULT)) yields u64::MAX for mainnet and 6_026_000
for testnet when no env vars are set (ensure the env is cleared in the test),
and add boundary tests (e.g., is_state_in_trie_height_boundaries) that exercise
the is_state_in_trie_height predicate around the gate (one below, at, and one
above the threshold) to assert true/false behavior; reference the read_height
function, chain_default helper, STATE_IN_TRIE_HEIGHT constant(s), and
is_state_in_trie_height in these tests so the behavior is explicitly pinned.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 106e2bfa-35bf-4710-b181-b6907b08c445

📥 Commits

Reviewing files that changed from the base of the PR and between 481caf8 and 95ec4b2.

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

Comment thread crates/sentrix-core/src/fork_heights.rs
@satyakwok satyakwok self-assigned this Jun 1, 2026
@satyakwok satyakwok disabled auto-merge June 1, 2026 11:37
@github-actions github-actions Bot enabled auto-merge (squash) June 1, 2026 11:40
@github-actions github-actions Bot merged commit e0fe500 into main Jun 1, 2026
18 checks passed
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