Repository navigation
Use views in getProtocolVersion - #1035
Merged
Merged
Conversation
cjonas9
added this pull request to stack #1038
September 24, 2026 15:24
cjonas9
force-pushed
the
readProtocolVersion-views
branch
from
September 25, 2026 17:59
d6b3da1 to
49a3d4f
Compare
cjonas9
marked this pull request as ready for review
September 25, 2026 18:02
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused optimization preserves existing behavior while avoiding an unnecessary full-ledger decode.
Review effort: Balanced
Findings: None
What changed in this PR
Optimizes protocol-version lookup by reading the latest ledger header through an XDR view instead of decoding the complete ledger metadata.
Changes:
- Replaces full ledger decoding with
LedgerCloseMetaView. - Preserves missing-ledger handling and adds contextual parsing errors.
| File | Description |
|---|---|
cmd/stellar-rpc/internal/methods/util.go |
Reads the protocol version directly from raw ledger header bytes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
tamirms
approved these changes
Sep 25, 2026
Base automatically changed from
scanledgers-iterator
to
feature/full-history
September 25, 2026 19:42
cjonas9
force-pushed
the
readProtocolVersion-views
branch
from
September 25, 2026 19:42
49a3d4f to
b320f39
Compare
This was referenced Sep 30, 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.
What
Swaps helper function
getProtocolVersionto use views instead of ledger decoding. In particular,getNetworkandgetVersionInfostop decoding the whole ~2 MB ledger for one 4-byte field that can instead be read off the header view of aLedgerCloseMetaView.See comments of #1003 for the speedup from this round of optimizations, and #1018 for what the original speeds are pre-optimization + pre-views-adoption.
Why
Performance reasons. In line with recent XDR views changes.
Benchmarks done locally on M4 Mac Pro:
Known limitations
N/A