refactor: extract explorer helpers + layout into submodules#419
Merged
refactor: extract explorer helpers + layout into submodules#419
Conversation
…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.
explorer.rs was 1428 LOC mixing: - HTML-escape + truncate + srx + addr-with-label + fmt-ts + fmt-day (pure formatters with no shared state) - CSS + chart-section script + page wrapper + nav-tabs (chrome layout) - Per-page handlers (home / blocks / transactions / block / address / tx / validators / tokens / richlist / validator / token / mempool + stats_daily endpoint) Move the formatters into explorer/helpers.rs and the chrome into explorer/layout.rs. explorer.rs drops to 1197 LOC, focused on the handlers themselves. No behaviour change; cargo clippy + cargo test both clean. Phase 2 of the workspace audit (see internal AUDIT_REPORT). Per-handler splits stay deferred — they'd add new module surface for marginal readability gain on this round.
1 task
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>
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.
Summary
Phase 2 of the workspace audit.
explorer.rswas a 1428-LOC monolith mixing pure formatters, chrome layout, and per-page handlers. Split:explorer/helpers.rs—html_escape(still pub),truncate,srx,addr_with_label,fmt_ts,fmt_dayexplorer/layout.rs— CSS, chart-section script,page()wrapper,nav_tabs()explorer.rs— handlers only (home / blocks / transactions / detail pages / lists / mempool / daily stats)After: explorer.rs 1197 LOC + helpers 77 + layout 176. Same total surface area but the read-from-top experience is way calmer.
No behaviour change — only mechanical extraction. Public re-export of
html_escapepreserved (shape used elsewhere in the crate).Test plan