Skip to content

Add celestia blockchain type (Celestia DA JSON-RPC API) - #326

Merged
l0gun0v merged 4 commits into
mainfrom
celestia-da
Aug 27, 2026
Merged

Add celestia blockchain type (Celestia DA JSON-RPC API)#326
l0gun0v merged 4 commits into
mainfrom
celestia-da

Conversation

@l0gun0v

@l0gun0v l0gun0v commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Adds the celestia blockchain type serving the Celestia DA node (celestia-node) JSON-RPC API — go-jsonrpc style namespaced methods (header.*, blob.*, share.*, das.*, blobstream.*).

Design

  • json-rpc only (phase 1). celestia-node subscriptions use the go-jsonrpc channel protocol (xrpc.ch.val notifications), which the current ws parser treats as a malformed message and drops the connection. Head tracking is polling header.LocalHead. WS support needs a dedicated ws.WsProtocol implementation (follow-up).
  • finalized == latest — CometBFT single-slot finality; the block processor (GenericBlockProcessor, safe-block detection off) publishes the head as the finalized pointer, like sui/stellar.
  • Lower bound: BLOCK via header.Tail — the node reports its lowest stored header (DA sampling/pruning window) directly; one RPC per 2-minute refresh with a 3-attempt retry, no probing. Nodes older than v0.28 don't expose it: the detector errors every tick, no bound is published, the upstream is treated as archive.
  • Method spec is read-only: 31 methods. blob.Submit / state.* writes are excluded (they spend TIA from the provider node's own wallet); node.*/p2p.* admin methods excluded; state.AccountAddress/state.Balance excluded (they expose the node's own wallet).
  • No labels detectornode.Info requires an admin token.
  • Chain ids are CometBFT strings (celestia / mocha-4), validated via header.LocalHead → .header.chain_id; any mismatch (empty id included) is FatalSettingError.
  • ExtendedHeader is tmjson-encoded: height is a decimal string, hashes are bare hex — parsing is shared in specific_helpers.ParseCelestiaExtendedHeader.

Changes

  • pkg/methods/specs/celestia.json: new plain spec, api-connectors: [json-rpc], 31 read methods, all cacheable: false
  • pkg/chains/chains.go: Celestia blockchain type + celestia method-spec name mapping
  • internal/upstreams/chains_specific/celestia_specific/celestia_chain_specific.go: ChainSpecific impl (head poll header.LocalHead, finalized == latest via GenericBlockProcessor, subscriptions rejected, labels/caps/methods processors nil)
  • internal/upstreams/chains_specific/specific_helpers/celestia.go: shared ExtendedHeader parsing (+ tests)
  • internal/upstreams/validations/celestia_validations/celestia_health_validator.go: health via node.Ready
  • internal/upstreams/validations/celestia_validations/celestia_chain_validator.go: chain-id validation (any mismatch incl. empty id → FatalSettingError)
  • internal/upstreams/lower_bounds/celestia_bounds/celestia_lower_bound.go: BLOCK bound via header.Tail, 2m period, 3 retries (+ tests)
  • internal/upstreams/upstream_factory.go: dispatch case in getChainSpecific
  • pkg/test_utils/test_helpers.go: NewCelestiaChainSpecific helper
  • internal/upstreams/chains_specific/celestia_specific/celestia_chain_specific_test.go: parse/head/finalized/validators/processors tests
  • docs/nodecore/11-method-specs.md, docs/nodecore/04-cache.md, docs/nodecore/05-upstream-config.md, README.md: shipped-specs table, cache blockchain-type list, validators/labels table rows, chain-family lists
  • no submodule / generated-code changes: main already pins the emerald-grpc and chains.yaml revisions that carry celestia (1175/10209)

Testing

  • unit: full ./internal/... ./pkg/... suite green (95 pkgs; docker-backed cache e2e need a daemon)
  • live E2E against mocha (re-run on the rebased code, 2026-08-26): nodecore + local celestia light node (--rpc.skip-auth):
    • head polling works, supervisor State of CELESTIA-MOCHA: height=…, statuses=[AVAILABLE/1], bounds=[BLOCK=13571945]
    • header.GetByHeight / header.NetworkHead / das.SamplingStats / share.SharesAvailable OK
    • blob.GetAll returned 8 real blobs at height 13581002 (active rollup namespace)
    • excluded methods (blob.Submit, node.Info, unknown) → -32601 (spec acts as the allowlist)
    • height below Tail → upstream error passthrough requested header (100) is below Tail (13571945)

Notes

Rebased on current main (Sui, sub-responses refactoring). Implements the current ChainSpecific surface: CapDetectors/MethodsProcessor return nil (no ws transport, no method introspection on celestia-node).

Companion PRs: emerald-grpc, public, dproxy — linked in comments.

@l0gun0v

l0gun0v commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

@l0gun0v
l0gun0v force-pushed the celestia-da branch 3 times, most recently from d2fc964 to c334501 Compare August 26, 2026 09:12
Comment thread docs/nodecore/11-method-specs.md
Comment thread internal/upstreams/chains_specific/celestia_specific/celestia_chain_specific.go Outdated
Comment thread internal/upstreams/validations/celestia_validations/celestia_chain_validator.go Outdated
@l0gun0v
l0gun0v force-pushed the celestia-da branch 2 times, most recently from d782607 to 22cb671 Compare August 26, 2026 14:27
denis added 2 commits August 26, 2026 16:27
…pty chain id

- ParseCelestiaExtendedHeader / CelestiaExtendedHeader live in specific_helpers (shared by head polling, chain validator, lower-bound detector), tests moved along
- chain validator: any mismatch incl. an empty chain id is FatalSettingError, no separate branch
- comment on GetFinalizedBlock: CometBFT commits are final, the head is the finalized pointer
- 05-upstream-config.md: Celestia rows in the validators/labels table
- README: Celestia in chain families and interfaces
@l0gun0v
l0gun0v merged commit 6ef9745 into main Aug 27, 2026
5 of 6 checks passed
@l0gun0v
l0gun0v deleted the celestia-da branch August 27, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants