cardano-rpc: honour field masks inside nested messages of ReadGenesis and ReadEraSummary

Aperta
#1,423 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
haskell

Direzione di ricerca

Read readGenesisFill in cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Query.hs and boundToProto in cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Type/EraSummary.hs, then profile both methods with narrow masks against mainnet-sized data. If conversion is a noticeable share of request time, pass sub-masks into genesisBundleToProto and boundToProto so only selected nested fields are built; done when unselected nested fields avoid their conversion work and the responses remain correctly masked.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ReadGenesis and ReadEraSummary now honour field_mask and skip the node queries and genesis file reads that unselected top-level fields would need (PR below). Below the top level the work is still all or nothing, because each nested message is built in one piece and proto-lens message fields are strict:

  • ReadGenesis: selecting any path under cardano, for example cardano.network_magic, converts the whole genesis bundle with genesisBundleToProto (readGenesisFill in cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Query.hs).
  • ReadEraSummary: selecting cardano.summaries.start.slot still computes the boundary timestamp, because boundToProto in cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Type/EraSummary.hs sets time, slot and epoch together.

The response is still trimmed correctly; only the server-side cost is affected. Nobody has measured yet how much this conversion costs compared with the rest of the request.

I'd suggest profiling both methods first, with a narrow mask against mainnet-sized genesis files and era history. If the conversion is a noticeable share of the request time, pass the sub-mask down into genesisBundleToProto and boundToProto with the sub-mask helpers from the PR below, so each nested field is built only when it is selected.

A client that polls a single value, such as the network magic or an era's start slot, would then pay only for that value, and the field mask would behave the same at every nesting level.

Raised in the review of:

Follow-up to:

Lingua principale
Haskell
Stelle
41
Fork
33
Merge medio
5g 17h
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di IntersectMBO/cardano-api

Tutte le issue di IntersectMBO/cardano-api

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.