Conversation
Rosetta is a POST-only HTTP API that a cosmos operator runs beside the node (cosmos/rosetta, since the SDK dropped its in-process implementation in v0.50). Its paths are already expressible in the existing spec format - "POST#/block", "POST#/network/status" - but no spec declares them, so nodecore cannot route to a Rosetta sidecar at all. This adds pkg/methods/specs/rosetta.json: a plain spec on the rest-additional connector, covering the Data API, the Construction API and /search/transactions, modelled on hyperliquid-rest-additional.json. It is imported into the cosmos bundle so every cosmos chain can carry it. An operator opts in per upstream by adding a rest-additional connector pointing at the Rosetta URL; upstreams without one are unaffected, because a method is only dispatchable on a connector the upstream actually declares. rest-additional is excluded from head and internal-request connector selection by IsAdditionalApiConnectorType, so it cannot become an upstream's head connector either. Verified against an Axelar archive: /network/status, /network/list and /block return the node's own Rosetta payloads, while the tendermint methods on the same upstream keep answering unchanged. Historical blocks 1, 100000, 5000000, 15000000, 25000000, 30000000 and 34000000 all resolve, at about 0.11 s per call.
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 this adds
Rosetta is a POST-only HTTP API that a cosmos operator runs beside the node —
cosmos/rosetta, since the SDK dropped its in-process implementation in v0.50. Its paths are already expressible in the existing spec format (POST#/block,POST#/network/status), but no spec declares them, so nodecore cannot route to a Rosetta sidecar at all.This PR adds
pkg/methods/specs/rosetta.json— aplainspec on therest-additionalconnector covering the Data API, the Construction API and/search/transactions— and imports it into thecosmosbundle. It is modelled directly on the existinghyperliquid-rest-additional.json."spec-imports": [ "cosmos-tendermint", "cosmos-rest", - "cosmos-grpc" + "cosmos-grpc", + "rosetta" ]Why
rest-additionalRosetta is a separate service on its own port, not a namespace on the node, which is exactly what
rest-additionalis described as indata.go: "used for connectors that provide extra REST methods, but they can't be used for chain-specific". It also keeps the change inert for everyone else:rest-additionalconnector pointing at their Rosetta URL;IsAdditionalApiConnectorTypeexcludes it from head and internal-request connector selection, so it can never become an upstream's head connector.Verification
Run against an Axelar mainnet archive (
axelar-dojo-1,earliest_block_height1), on an upstream with atendermintconnector for the head and arest-additionalconnector for Rosetta:Historical blocks through the same upstream, ~0.11 s per call:
The tendermint methods on that same upstream keep answering unchanged (
status→axelar-dojo-1), and an undeclared path still fails cleanly withthe method POST#/... does not exist/is not available.Note for reviewers
The one-line edit to
cosmos.jsoncould not be exercised locally, becauseNewMethodSpecLoaderWithExtraFsadds specs rather than overriding them and rejects a duplicate name. The runs above used a bundle with the same import pattern and this exactrosetta.json; only the bundle's name differs.Happy to split the spec out of the
cosmosbundle and leave it standalone if you would rather have chains opt in explicitly, or to extend it to other chain families.