cardano-rpc: Fix TxOutput.address and Datum.hash wire encoding#1258
Open
carbolymer wants to merge 1 commit into
Open
cardano-rpc: Fix TxOutput.address and Datum.hash wire encoding#1258carbolymer wants to merge 1 commit into
carbolymer wants to merge 1 commit into
Conversation
carbolymer
changed the base branch from
master
to
mgalazyn/feature/fetchBlock-tx-bodies
July 20, 2026 14:48
carbolymer
force-pushed
the
mgalazyn/fix-grpc-bytes-fields
branch
from
July 20, 2026 14:50
a848339 to
7688714
Compare
carbolymer
marked this pull request as ready for review
July 20, 2026 14:58
carbolymer
requested review from
CarlosLopezDeLara,
Jimbo4350,
disassembler,
erikd and
palas
as code owners
July 20, 2026 14:58
carbolymer
marked this pull request as draft
July 20, 2026 15:00
carbolymer
force-pushed
the
mgalazyn/fix-grpc-bytes-fields
branch
2 times, most recently
from
July 20, 2026 15:39
97908ba to
b4ffb7d
Compare
carbolymer
marked this pull request as ready for review
July 20, 2026 15:43
carbolymer
force-pushed
the
mgalazyn/fix-grpc-bytes-fields
branch
from
July 21, 2026 15:45
b4ffb7d to
4f93e0b
Compare
carbolymer
force-pushed
the
mgalazyn/feature/fetchBlock-tx-bodies
branch
from
July 21, 2026 16:21
ddec16c to
792f6ae
Compare
carbolymer
force-pushed
the
mgalazyn/fix-grpc-bytes-fields
branch
from
July 22, 2026 09:23
4f93e0b to
a7ec745
Compare
carbolymer
force-pushed
the
mgalazyn/fix-grpc-bytes-fields
branch
from
July 22, 2026 09:29
a7ec745 to
2112d60
Compare
carbolymer
force-pushed
the
mgalazyn/feature/fetchBlock-tx-bodies
branch
from
July 22, 2026 09:29
792f6ae to
1af9cd2
Compare
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
An audit of the proto
bytesfields populated by the UTxO RPC server found two fields carrying the wrong encoding.TxOutput.addresswas populated with human-readable address text (bech32 for Shelley, base58 for Byron) instead of raw ledger address bytes.Datum.hashwas populated with the datum's CBOR instead of its blake2b-256 hash when the datum was inline.Both diverged from the other UTxO RPC implementations (Dolos via pallas-utxorpc, Blink Labs cardano-node-api) and, for the address, from our own predicate and reward-account encoding.
The server is unreleased, so the wire format can still change without breaking clients.
Fixes #1246
Stacked on #1222 - only the last two commits belong to this PR.
How to trust this PR
txOutToUtxoRpcTxOutputnow usesserialiseToRawBytesfor the address (raw header plus payload bytes, Byron included) andhashScriptDataBytesfor the inline datum hash, andutxoRpcTxOutputToTxOutdecodes the address withdeserialiseFromRawBytesin lockstep.Address serialisation is now uniform across cardano-rpc: transaction outputs,
exact_addresspredicates and reward accounts all use raw on-chain bytes in both directions, so a client can echoTxOutput.addressinto aSearchUtxospredicate and get matches.The new
hprop_tx_output_wire_formatproperty pins the wire format directly; the existing round-trip property cannot catch the inline datum bug because decoding never readsDatum.hashwhenoriginal_cboris present.Run
cabal test cardano-rpc:cardano-rpc-testto verify; all 78 tests pass.The cardano-node E2E test
Cardano.Testnet.Test.Rpc.FetchBlockasserts the same encoding and changes in lockstep (branchmgalazyn/fix-grpc-bytes-fieldsin cardano-node).Checklist
.changes/