Data: constructors with an index above 127 write the tag 102 pair with the wrong header
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]andConstr 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
- No Dockerfile or Docker Compose file
- No 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/evolution-sdk
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
IntersectMBO/evolution-sdk#559 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
IntersectMBO/evolution-sdk#557 ·
Maintainers usually reply within 1 day
-
dependencies good first issue
Difficulty 1/5 Under an hour Newbie friendliness 93/100
IntersectMBO/evolution-sdk#541 ·
Maintainers usually reply within 1 day
-
bug external-review
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
IntersectMBO/evolution-sdk#530 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
IntersectMBO/evolution-sdk#518 ·
Maintainers usually reply within 1 day
All issues in IntersectMBO/evolution-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
rajbos/ai-engineering-fluency#2340 · 1 comment ·
Maintainers usually reply within 1 day
-
community documentation first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 70/100
lingdojo/kana-dojo#31864 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
zenstackhq/zenstack#2873 ·
Maintainers usually reply within 1 day
-
CLI: TUI shows onboarding when the provider's API key is only in the environment (e.g. OPENROUTER_API_KEY)Possibly taken A pull request linked to this issue is open or already merged. OpenCLI
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
cline/cline#14923 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
paperclipai/paperclip#15490 ·
Maintainers usually reply within 1 day