gRPC: Update to the latest UTxO RPC v1beta spec - #1303
Draft
carbolymer wants to merge 7 commits into
Draft
Conversation
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.
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.
Context
This PR syncs the vendored UTxO RPC v1beta proto definitions with the latest upstream utxorpc/spec (v0.19.2 plus the post-release
EvalReportoptionality fix), regenerates the proto-lens code, and implements the newly available surface:Vote/VotingProcedure/VoterVotesmessages are vendored and the newTx.votesfield 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
TxOutand its decoders accept non-canonical input.No protocol hash uses a standalone
TxOutas 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.
ReadState/StateQuery/StakePoolDistributionmessages are vendored, schema-only for now.The unimplemented ones (
ReadData,ReadTx,ReadEraSummary,ReadState,ReadMempool,WaitForTx,WatchMempool,DumpHistory) are declared with grapesy'sUnsupportedMethod, which makes the server respond with theUNIMPLEMENTEDgRPC status; the previous hand-rolleddumpHistorystub is converted to the same mechanism.The README support matrix documents this behaviour and gains the
ReadStaterow.Breaking:
FetchBlockis reset to the upstream v1beta shape withrepeatedrequest 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
proto/utxorpc/v1betaagainst upstreammainshows no differences.ServiceMethodsorder, not proto declaration order; each table inCardano/Rpc/Server.hsdocuments 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-Conwayvotes == []totality arms, anoriginal_cbordecode-back round-trip, and Byron empty-field assertions.grpcurl -plaintext localhost:<rpc-port> utxorpc.v1beta.query.QueryService/ReadDataresponds with theUnimplementedstatus.Checklist
.changes/