Skip to content

gRPC: Update to the latest UTxO RPC v1beta spec - #1303

Draft
carbolymer wants to merge 7 commits into
masterfrom
mgalazyn/utxorpc-spec-update
Draft

gRPC: Update to the latest UTxO RPC v1beta spec#1303
carbolymer wants to merge 7 commits into
masterfrom
mgalazyn/utxorpc-spec-update

Conversation

@carbolymer

@carbolymer carbolymer commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Context

This PR syncs the vendored UTxO RPC v1beta proto definitions with the latest upstream utxorpc/spec (v0.19.2 plus the post-release EvalReport optionality fix), regenerates the proto-lens code, and implements the newly available surface:

  • Governance votes (upstream #193): the Vote/VotingProcedure/VoterVotes messages are vendored and the new Tx.votes field is populated for Conway-onwards transactions.
    DRep and constitutional committee voters map to stake credentials, SPO voters to their pool key hash, each with their votes, governance action ids and optional anchors.
  • TxOutput.original_cbor (upstream #201): populated with the era-encoded CBOR of the output.
    Note this is a canonical re-encoding, not guaranteed to be byte-identical to the on-chain encoding: the ledger does not memoise TxOut and its decoders accept non-canonical input.
    No protocol hash uses a standalone TxOut as preimage, and the memoised components inside it (inline datums, plutus scripts) keep their original bytes, so datum and script hashes remain verifiable.
    The caveat is documented at the computation site.
  • Ledger-state query machinery (upstream #200): the ReadState/StateQuery/StakePoolDistribution messages are vendored, schema-only for now.
  • All v1beta service methods are now exposed.
    The unimplemented ones (ReadData, ReadTx, ReadEraSummary, ReadState, ReadMempool, WaitForTx, WatchMempool, DumpHistory) are declared with grapesy's UnsupportedMethod, which makes the server respond with the UNIMPLEMENTED gRPC status; the previous hand-rolled dumpHistory stub is converted to the same mechanism.
    The README support matrix documents this behaviour and gains the ReadState row.

Breaking: FetchBlock is reset to the upstream v1beta shape with repeated request refs and response blocks, and the handler now fetches every referenced block.
The previous single-item variant has moved to the upcoming utxorpc v1 (utxorpc/spec#208 was retargeted there), so v1beta stays with the repeated form.
Clients built against the single-item shape (e.g. cardano-node's RPC integration tests) need adapting when they pick up this version.

How to trust this PR

  • The proto files are upstream-verbatim: diffing proto/utxorpc/v1beta against upstream main shows no differences.
  • The grapesy method tables must list handlers in the alphabetically sorted ServiceMethods order, not proto declaration order; each table in Cardano/Rpc/Server.hs documents its expected order in the haddock.
  • cabal test cardano-rpc-test: all 98 tests pass, including new coverage: injected DRep/SPO votes with exact content assertions at Conway, vote-count projections, pre-Conway votes == [] totality arms, an original_cbor decode-back round-trip, and Byron empty-field assertions.
  • To observe the stub behaviour against a running node: grpcurl -plaintext localhost:<rpc-port> utxorpc.v1beta.query.QueryService/ReadData responds with the Unimplemented status.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff
  • Changelog fragment added in .changes/

Sync the vendored proto definitions with utxorpc/spec main (v0.19.2 plus
unreleased EvalReport tweaks): governance vote messages and Tx.votes,
TxOutput.original_cbor, the ReadState ledger-state query machinery, and
all upstream service methods restored in the service blocks.
Regenerate the proto-lens code with buf.
The new AnyChainStateQuery/AnyChainStateData oneofs in query.proto
generate maybe'query/maybe'result lenses that collide with the ones from
cardano.proto's StateQuery/StateData envelopes, making the wholesale
re-export of both Fields modules ambiguous. Hide the Cardano_Fields
copies, following the module's existing convention.
Wire every method of QueryService, SubmitService and SyncService into
the grapesy method tables. Methods without an implementation (ReadData,
ReadEraSummary, ReadState, ReadTx, ReadMempool, WaitForTx, WatchMempool,
DumpHistory) are declared with UnsupportedMethod, which makes the server
respond with the UNIMPLEMENTED gRPC status; the previous hand-rolled
dumpHistory stub is converted to the same mechanism. Document the
behaviour and the new ReadState method in the README support matrix.
Convert the voting procedures of Conway-onwards transactions to the
UTxO RPC VoterVotes messages: DRep and constitutional committee voters
map to stake credentials, stake pool voters to their pool key hash, each
with their votes, gov action ids and optional anchors. Read through the
any-era getter, so earlier eras yield the empty list.
Fill the field with the era-encoded CBOR of the output. This is a
canonical re-encoding, not guaranteed to be the original on-chain bytes:
the ledger does not memoise TxOut and its decoders accept non-canonical
encodings, so decode-then-encode may differ for historical outputs. No
protocol hash uses a standalone TxOut as preimage, and the memoised
components inside it (inline datums, plutus scripts) keep their original
bytes, so datum and script hashes remain verifiable.
@carbolymer carbolymer self-assigned this Aug 19, 2026
@carbolymer carbolymer moved this to In Progress in DevTools roadmap Aug 19, 2026
@carbolymer carbolymer changed the title Mgalazyn/utxorpc spec update gRPC: Update to the latest UTxO RPC v1beta spec Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant