cardano-wasm: gRPC-Web UTxO glue incompatible with shipped v1beta protobuf bundle
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- grpc, haskell, javascript
- Domain
- api, backend, blockchain
Research direction
Start with GRPC.hs:51-54 and compare its generated JS against the v1beta ReadUtxosRequest fields in query.proto:101-104 and the shipped bundle. Then read Query.hs:95 and cardano.proto:36,256-262 to trace keyless requests and coin representations. Done means getUtxosForAddress and getAllUtxos work with the v1beta server and non-empty coin values no longer cause a type error.
Written by the indexing model from the issue text.
Description
Summary
The cardano-wasm JS glue is written against the obsolete utxorpc.v1alpha API, while the shipped browser bundle is generated from this repo's v1beta protos (nix/proto-to-js.nix:17 uses cardano-rpc-src = ../cardano-rpc).
As a result the core UTxO-reading API of the browser SDK does not work against the in-repo proto and server.
Wallets depending on it cannot read balances.
It fails closed (exception or empty list), so there is no on-chain fund loss.
Concrete breaks
1. getUtxosForAddress throws an unconditional TypeError
GRPC.hs:51-54 references proto.utxorpc.v1alpha.cardano.AddressArray and calls req.setCardanoAddresses().
Neither exists in v1beta: ReadUtxosRequest only has keys + field_mask (query.proto:101-104).
Every call throws before any network request is made.
2. getAllUtxos always returns empty
js_readAllUtxos sends a keyless ReadUtxosRequest.
The v1beta server deliberately returns an empty response for that (Query.hs:95: "Returns an empty response when no keys are provided").
This means a silent zero balance for every wallet built on the SDK.
3. BigInt(utxo.cardano.coin) type mismatch
The glue assumes a scalar coin, but the v1beta TxOutput.coin is a BigInt message {int|bigUInt|bigNInt} (cardano.proto:36,256-262).
It would throw a BigInt(object) TypeError if the UTxO list were ever non-empty.
Note: js-test/basic-test.golden never exercises the gRPC paths, so the breakage is untested in-repo.
Reproduction
- Inspect the JS emitted by
GRPC.hs:51-54:let addresses = new proto.utxorpc.v1alpha.cardano.AddressArray(); addresses.addItems(btoa($2)); req.setCardanoAddresses(addresses); - Inspect the shipped bundle's schema (generated from v1beta):
ReadUtxosRequestfields are onlykeys+field_mask.utxorpc.v1alpha.cardano.AddressArraydoes not exist in the bundle. - Server side:
Query.hs:95- a keylessReadUtxosRequestreturnsdefMessage(empty).
Any wallet calling getUtxosForAddress(addr) throws TypeError: proto.utxorpc.v1alpha.cardano.AddressArray is not a constructor.
getAllUtxos() always resolves to [].
Suggested fix
Regenerate the JS glue against the v1beta protos.
Use ReadUtxosRequest.keys for address lookups.
Parse coin from the v1beta BigInt message fields (int as Number, bigUInt as base64 big-endian bytes converted to BigInt).
Originally reported by @Ranchhand87 as security advisory GHSA-6f73-hf45-g35g.
Converted to a public issue since it fails closed and has no security impact.
- Dominant language
- Haskell
- Stars
- 41
- Forks
- 33
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 15
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from IntersectMBO/cardano-api
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
IntersectMBO/cardano-api#1434 ·
Maintainers usually reply within 2 days
-
`Prelude.maximum: empty list` crash in fee estimation for empty `RequireAnyOf` (`{"type": "any", "scripts": []}`) scriptsPossibly taken @Jimbo4350 claimed this 8 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
IntersectMBO/cardano-api#1424 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 53/100
IntersectMBO/cardano-api#1431 ·
Maintainers usually reply within 2 days
-
type: enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
IntersectMBO/cardano-api#1423 ·
Maintainers usually reply within 2 days
-
Add a dedicated transaction viewing type to the experimental APIPossibly taken @palas claimed this 21 days ago. Opentype: enhancement
IntersectMBO/cardano-api#1416 · 1 assignee ·
Maintainers usually reply within 2 days
All issues in IntersectMBO/cardano-api
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
haskell/bytestring#730 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
seal-harness/seal-harness#399 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
fmidue/codeworld-tasks#124 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
reflex-frp/reflex#563 ·