Skip to content

Implement ping and pingAll JSON-RPC methods #21

Description

@aceppaluni

Problem

The TCK server does not implement ping / pingAll, so the TCK driver's ClientPing suite cannot run against the Python SDK.

This one has an SDK prerequisite and a deprecation constraint. The Python SDK currently has no Client.ping() / Client.ping_all(). Per the AccountBalanceQuery deprecation proposal (Stage 1), the ping probe must be a CryptoService/getAccountInfo query for account 0.0.2 with ResponseType = COST_ANSWER. Do not implement ping on top of AccountBalanceQuery — that was the historical approach in other SDKs, and its consensus endpoint (CryptoService/cryptoGetBalance) is being shut down in consensus node release 0.77 (testnet ~Aug 13, 2026; mainnet ~Sept 9, 2026). The TCK spec enforces this: the driver runs a gRPC-aware proxy in front of the consensus node and asserts the probe is getAccountInfo COST_ANSWER and that no cryptoGetBalance call is ever sent.

The spec also tests node-health bookkeeping, not just the probe: a failed ping must open backoff for that node, and a successful ping must reset it so the node selector considers the node again immediately. Read the spec's test table (including the proxy-based assertions) in full before designing anything.

Ordering: the spec requires the ClientPing suite to pass before the Stage 2 AccountBalanceQuery deprecation tests may run — so this issue is effectively a prerequisite of hiero-ledger#2525.

Before you start — required reading

TCK handlers are contract work: the TCK driver validates exact parameter names, optionality, defaults, and error semantics against the published spec. Please do not code from this issue title alone (or paste it into an AI tool and ship the first thing that runs) — read these first:

  1. The spec page linked below, in full — especially the parameter table, the expected response shape, and the error/edge-case tests. If your handler's behavior differs from the spec table, the TCK suite will fail even if the happy path works.
  2. The deprecation proposal linked above — it defines what the probe must be.
  3. tck/README.md — how the JSON-RPC server, param dataclasses, handler registry, and responses fit together, and how to run the TCK driver locally against your handler. Run the actual TCK suite before opening a PR; unit tests alone are not enough.
  4. An existing handler as your pattern — pick the closest one in tck/handlers/ with its matching tck/param/ dataclass and follow its structure, naming, and error handling exactly. Do not invent a new style, and do not re-implement SDK logic in the handler — handlers only wire validated params onto the existing SDK transaction/query.
  5. Other SDKs' post-Stage-1 Client.ping() implementations — match their semantics (probe form, backoff reset behavior), don't improvise.
  6. CONTRIBUTING.md — test and PR conventions.

Solution

  • (SDK) Add Client.ping(node_account_id) / Client.ping_all() implemented as a getAccountInfo COST_ANSWER probe of 0.0.2 pinned to the target node, wired into the SDK's node-health/backoff bookkeeping — possibly as its own issue/PR.
  • Add PingParams (node account ID / node ID per the spec table) to a suitable tck/param/ module.
  • Add ping and pingAll handlers registered via @rpc_method("ping") / @rpc_method("pingAll").
  • Add unit tests under tests/tck/, then run the TCK driver's ClientPing suite locally (it uses the driver's gRPC proxy via the setup nodeIp parameter — no extra per-SDK introspection surface is needed).

Acceptance criteria

  • ping and pingAll registered and dispatchable
  • Proxy capture shows a CryptoService/getAccountInfo COST_ANSWER probe of 0.0.2 and no cryptoGetBalance call
  • ping targets exactly the requested node; pingAll probes every node in the network map exactly once
  • Failed ping opens node backoff; successful ping resets it (spec tests 4–5)
  • Spec error cases behave as specified (unreachable/invalid node)
  • Unit tests added and the TCK ClientPing suite passes

Spec: https://github.com/hiero-ledger/hiero-sdk-tck/blob/main/docs/test-specifications/crypto-service/ClientPing.md
Deprecation proposal: https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/proposals/account-balance-query-deprecation.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions