feat: implement getVersionInfo and getFeeStats#34
Open
RaoulSchaffranek wants to merge 3 commits into
Open
Conversation
Cover the wire format of real stellar-rpc (protocol 22): getVersionInfo returns exactly version/commitHash/buildTimestamp/captiveCoreVersion/ protocolVersion with protocolVersion as a JSON number, and getFeeStats returns both FeeDistribution objects (fee values and transactionCount as decimal strings, ledgerCount as a number) plus a live latestLedger number. Both methods take no parameters. The tests currently fail with -32601 since neither method is implemented yet.
Add the two parameterless read-only methods per the Stellar RPC spec. getVersionInfo reports the komet-node package version, all-zeros commit hash and epoch build timestamp (nothing is baked in at build time), the komet package as the Captive Core, and protocolVersion 22 as a JSON number. getFeeStats returns constant fee distributions (there is no fee market; every statistic is the 100-stroop network minimum over an empty sample) with the stellar-rpc wire types — all fields except ledgerCount as decimal strings — and a live latestLedger number from metadata.json. Dispatch and response formatting live in node.md; server.py only supplies the version strings, which come from Python package metadata that K cannot read.
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
Adds the two parameterless read-only RPC methods from the Stellar RPC spec:
getVersionInforeturnsversion(the komet-node package version),commitHashandbuildTimestamp(all-zeros / epoch placeholders — komet-node is a Python package, so nothing is baked in at build time),captiveCoreVersion(the komet package, i.e. the K semantics of Soroban that execute the transactions), andprotocolVersion22 as a JSON number.getFeeStatsreturns constant fee distributions forsorobanInclusionFeeandinclusionFee— komet-node has no fee market, so every statistic is the 100-stroop network minimum over an empty sample (transactionCount: "0",ledgerCount: 0) — pluslatestLedgerread live frommetadata.json.Why
Spec compliance: both methods are part of the protocol-22 RPC surface (see the OpenRPC spec for
getVersionInfoandgetFeeStats) and were previously answered with-32601 Method not found. Wire types follow what real stellar-rpc emits:protocolVersionis a number (a Go uint32), and everyFeeDistributionfield exceptledgerCountuses Go's,stringencoding, i.e. JSON strings holding decimal numbers.How
Follows the existing architecture: dispatch and response formatting live in the K semantics (
src/komet_node/kdist/node.md);server.pyonly injects the version strings into the request envelope, since package metadata lives on the Python side and K cannot read it. Docs updated accordingly (docs/server.md,docs/node-semantics.md,docs/architecture.md,docs/notes.md).Testing
New integration tests in
src/tests/integration/test_server.pycheck the exact key sets and JSON types of both responses, that omittingparamsworks (both methods take no parameters), and thatgetFeeStats.latestLedgertracks the chain across transactions. Fulltest_server.pypasses (30 tests), and flake8/isort/black are clean.