Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Data: constructors with an index above 127 write the tag 102 pair with the wrong header

Chiusa Adatta ai principianti
#601 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #616 di @solidsnakedev — integrata

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
blockchain, typescript
Ambito
backend

Direzione di ricerca

Individua l'encoder dei dati Plutus (Constr) nello SDK TypeScript e le opzioni di data preset introdotte in #598, poi trova dove viene codificata la coppia tag-102 [index, fields]. Secondo encodeData in PlutusCore/Data.hs, la coppia deve essere un array definito di 2 elementi, mentre solo i campi usano le opzioni di lista. Aggiungi test di regressione che verifichino i byte del nodo d866 82 1880 9f01ff / d866 82 1903e8 9f01ff e i loro hash blake2b-256 per Constr 128 [1] e Constr 1000 [1], oltre a un controllo che i costruttori 0-127 siano invariati.

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

Descrizione

Summary

For a constructor index above 127, Plutus data is written as tag 102 wrapping a pair [index, fields]. The node writes that pair as a definite 2-element array and the fields as a list. The SDK writes the pair with the list options, so every data preset that uses indefinite lists gets the wrong header, and no preset produces the node's bytes. The datum hash differs from cardano-cli and from what a validator computes with serialise_data.

Value Node (cardano-cli 10.5.1, Aiken v1.1.24) SDK default and CML_DATA_DEFAULT_OPTIONS CARDANO_NODE_DATA_OPTIONS
Constr 128 [1] d866 82 1880 9f01ff, hash fd05a09e… d866 9f 1880 9f01ff ff, hash e964637c… d866 82 1880 8101, hash 1bd42101…
Constr 1000 [1] d866 82 1903e8 9f01ff, hash ba07c752… d866 9f 1903e8 9f01ff ff, hash 1f014ffb… d866 82 1903e8 8101, hash c8b3c9a8…

The node hashes come from cardano-cli conway transaction hash-script-data; Aiken's serialiseData returns the same bytes, and their blake2b-256 equals those hashes.

Haskell source: PlutusCore/Data.hs encodeData writes CBOR.encodeTag 102 <> CBOR.encodeListLen 2 <> tagEncoding <> encode ds. The pair is always definite; only the fields follow the list encoding.

Affected

The Plutus data encoder for constructors with an index above 127 (tag 102), under every data preset.

Fix

Always write the tag 102 pair as a definite 2-element array, and write the fields with the list options. Decoding already accepts both forms; keep that.

Regression test

  • Constr 128 [1] and Constr 1000 [1] with the node-layout preset from #598 give the node bytes above, and their blake2b-256 equals the cardano-cli hashes.
  • An Aiken validator that compares blake2b_256(serialise_data(datum)) with its redeemer accepts the SDK hash.
  • Constructors 0 to 127 are unchanged.

Must FAIL on main today and PASS after the fix.

Lingua principale
TypeScript
Stelle
22
Fork
33
Merge medio
2g 1h
PR unite (30g)
44

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/evolution-sdk

Tutte le issue di IntersectMBO/evolution-sdk

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.