Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#601 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
blockchain, typescript
Lĩnh vực
backend

Hướng nghiên cứu

Tìm bộ mã hóa dữ liệu Plutus (Constr) trong TypeScript SDK và các tùy chọn data preset được giới thiệu trong #598, sau đó tìm nơi cặp tag-102 [index, fields] được mã hóa. Theo encodeData trong PlutusCore/Data.hs, cặp này phải là một mảng xác định gồm 2 phần tử, trong khi chỉ các trường dùng các tùy chọn danh sách. Thêm các bài kiểm tra hồi quy khẳng định các byte nút d866 82 1880 9f01ff / d866 82 1903e8 9f01ff và các băm blake2b-256 tương ứng của Constr 128 [1] và Constr 1000 [1], cùng một kiểm tra rằng các constructor 0-127 không thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
22
Fork
33
Merge trung bình
2 ngày 5 giờ
Pull request đã merge (30 ngày)
41

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của IntersectMBO/evolution-sdk

Tất cả issue của IntersectMBO/evolution-sdk

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.