Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#601 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
blockchain, typescript
Domain
backend

Research direction

Locate the Plutus data (Constr) encoder in the TypeScript SDK and the data preset options introduced in #598, then find where the tag-102 [index, fields] pair is encoded. Per PlutusCore/Data.hs encodeData, the pair must be a definite 2-element array while only the fields use list options. Add regression tests asserting the node bytes d866 82 1880 9f01ff / d866 82 1903e8 9f01ff and their blake2b-256 hashes for Constr 128 [1] and Constr 1000 [1], plus a check that constructors 0-127 are unchanged.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
22
Forks
33
Avg merge
2d 12h
Merged PRs (30d)
36

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from IntersectMBO/evolution-sdk

All issues in IntersectMBO/evolution-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.