Skip to content

refactor(staking): extract LivenessTracker + DoubleSignDetector into submodules#421

Merged
satyakwok merged 4 commits intomainfrom
refactor/slashing-extract-liveness-double-sign
Apr 29, 2026
Merged

refactor(staking): extract LivenessTracker + DoubleSignDetector into submodules#421
satyakwok merged 4 commits intomainfrom
refactor/slashing-extract-liveness-double-sign

Conversation

@satyakwok
Copy link
Copy Markdown
Member

Summary

Phase 3 follow-on of the workspace audit. slashing.rs was 954 LOC mixing three independent concerns:

  • LivenessTracker (sliding-window downtime detector) + LIVENESS_WINDOW / MIN_SIGNED_PER_WINDOW / DOWNTIME_SLASH_BP / DOWNTIME_JAIL_BLOCKS constants
  • DoubleSignEvidence + DoubleSignDetector + DOUBLE_SIGN_SLASH_BP constant
  • SlashingEngine (the orchestrator that uses both above) + tests

Pulled out the first two into slashing/{liveness,double_sign}.rs. slashing.rs drops to 728 LOC, focused on SlashingEngine + its 100 tests.

Pure mechanical extraction — public API at sentrix_staking::slashing::* unchanged via re-exports.

Test plan

  • cargo clippy --workspace --tests -- -D warnings clean
  • cargo test -p sentrix-staking 100 tests pass

Satya Kwok and others added 4 commits April 29, 2026 01:16
…chain.com

scan.sentrixchain.com remains the primary explorer with full
native-op coverage. Blockscout sidecar adds EVM-standard UX
(ERC-20 holders, source verification, EIP-3091 URLs) for listing
platforms + EVM tooling that expects that shape.
slashing.rs was 954 LOC carrying three independent concerns:

- LivenessTracker (sliding-window downtime detector) +
  LIVENESS_WINDOW / MIN_SIGNED_PER_WINDOW / DOWNTIME_SLASH_BP /
  DOWNTIME_JAIL_BLOCKS constants
- DoubleSignEvidence + DoubleSignDetector + DOUBLE_SIGN_SLASH_BP
- SlashingEngine (the orchestrator) + tests

Pulled out the first two into slashing/{liveness,double_sign}.rs.
slashing.rs drops to 728 LOC, focused on SlashingEngine + tests.

Pure mechanical extraction — public API at sentrix_staking::slashing::*
unchanged via re-exports.

Phase 3 follow-on of the workspace audit.
@satyakwok satyakwok merged commit c0a7942 into main Apr 29, 2026
5 checks passed
satyakwok added a commit that referenced this pull request Apr 29, 2026
* docs: dual-explorer note for Blockscout sidecar at blockscout.sentrixchain.com

scan.sentrixchain.com remains the primary explorer with full
native-op coverage. Blockscout sidecar adds EVM-standard UX
(ERC-20 holders, source verification, EIP-3091 URLs) for listing
platforms + EVM tooling that expects that shape.

* chore: humanize the just-extracted submodule headers

The recent batch of refactor PRs (#419 explorer, #420 bft engine, #421
slashing) shipped with header comments that read a bit like a release-
notes generator wrote them — "X.rs — short description. Pulled out
of Y for Z. No behaviour change." That's not the voice the rest of
this codebase carries. Comments here usually tell stories, reference
incidents, drop dates and PR numbers. This pass rewrites the seven
new file headers + the two re-export blocks so they sound like the
operator wrote them late at night, which is closer to the truth.

No code change.

---------

Co-authored-by: Satya Kwok <satyakwik@gmail.com>
Co-authored-by: satyakwok <satyakwok@users.noreply.github.com>
Co-authored-by: Satya Kwok <satyakwik@users.noreply.github.com>
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