Str 2540 explorer upgrade#36
Merged
Merged
Conversation
- Replace `strata_getLatestCheckpointIndex` with `strata_getChainStatus`; use `confirmed.epoch` as the latest checkpoint index - Replace per-block `strata_getHeadersAtIdx` with batch `strata_getHeadersInRange`; fetch up to 5000 headers per call - Update `RpcCheckpointInfo` to use a private tagged `ConfStatus` enum (`pending`/`confirmed`/`finalized`) matching the new wire format - Add `RpcOLChainStatus` / `EpochCommitment` wire types for chain status - Switch checkpoint→block channel from `mpsc` to `watch`; block fetcher wakes on change and fetches up to the signalled L2 slot target - Introduce `L2BlockFetchTarget` type alias for the watch channel value - Collect task `JoinHandle`s and `tokio::select!` in `main` so any task panic exits the process; same pattern for status updater sub-tasks - Remove redundant `block_exists` pre-check; rely on DB unique constraint (error 1062) and distinguish duplicate-key errors from real failures - Update mock fullnode to match new RPC interface in functional tests
krsnapaudel
reviewed
Apr 17, 2026
krsnapaudel
left a comment
Collaborator
There was a problem hiding this comment.
A nit and a question.
krsnapaudel
approved these changes
Apr 18, 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.
STR-2540: Update explorer to new Strata RPC interface
Summary
Updates the checkpoint explorer backend to work with the revised Strata RPC interface and improves the block fetching algorithm.
RPC interface changes
strata_getLatestCheckpointIndexstrata_getChainStatus→confirmed.epochstrata_getHeadersAtIdx(slot)strata_getHeadersInRange(start, end)RpcCheckpointInfo.confirmation_statusis now a tagged enum (pending/confirmed { l1_reference }/finalized { l1_reference }).RpcOLChainStatus/EpochCommitmentwire types forstrata_getChainStatus.fetch_data<T>(method, idx)helper with a dedicatedfetch_checkpoint_info(idx)method.Block fetch algorithm
Previously the block fetcher received one mpsc message per checkpoint and made a separate RPC call per block slot.
The new algorithm:
watchchannel carries the L2 end slot of the latest checkpoint seen by the checkpoint fetcher (L2BlockFetchTarget).rx.changed()).last + 1.strata_getHeadersInRange, advancing a cursor until it reaches the target.This reduces RPC calls from O(n) per slot to O(n/5000) and avoids redundant fetching on restart.
Other changes
tokio::select!on all taskJoinHandles inmainand inside the status updater; any task exit callsstd::process::exit(1)to bring down the whole process (TODO: replace with service framework in follow-up).block_existspre-check before INSERT; the DB unique constraint onblock_hash/heightrejects duplicates (MariaDB error 1062), logged atdebuginstead oferror.Local tests
I have run/observed the explorer locally.