Redeemers: toScriptDataHash ignores the codec options when encoding datums
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
- 88/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ệ
- typescript
- Lĩnh vực
- blockchain
Hướng nghiên cứu
Bắt đầu trong packages/evolution/src/Redeemers.ts, tập trung vào encodeDatumsTaggedSet và cả hai nhánh của toScriptDataHash. Thêm kiểm thử hồi quy cho các tùy chọn canonical có và không có redeemers, cùng với phần kiểm soát các tùy chọn mặc định; các bài kiểm thử hoàn tất khi hash canonical khớp với node oracle và hash mặc định hiện có vẫn 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
Redeemers.toScriptDataHash(redeemers, costModels, datums, options) applies options to the redeemers but always encodes the datums with CML_DATA_DEFAULT_OPTIONS. Asked for a canonical hash, it returns the hash over indefinite-length datums:
const d = Data.fromCBORHex("d8799f019f02ffff")
Data.toCBORHex(d, CBOR.CANONICAL_OPTIONS) // d87982018102, the bytes in the witness set
Redeemers.toScriptDataHash(empty, costModels, [d], CBOR.CANONICAL_OPTIONS)
// 80dbaeaf…, the hash over d8799f019f02ffff; expected ac4817df…
The ledger hashes the datums exactly as they appear in the witness set: cardano-ledger Alonzo/Tx.hs L318-321 builds the script integrity bytes from originalBytes of the redeemers and datums. A transaction whose witness set carries canonical datums therefore needs the hash over canonical datums.
Affected
packages/evolution/src/Redeemers.ts
encodeDatumsTaggedSet(L548-555) defaults toCML_DATA_DEFAULT_OPTIONStoScriptDataHashcalls it withoutoptionsin both branches: datums with no redeemers (L600) and redeemers with datums (L612)
The builder is not affected today: it computes the hash with default options and does not add witness datums.
Fix
Pass the caller's options through to encodeDatumsTaggedSet when the caller gives them. When options is left at its default, keep encoding datums with CML_DATA_DEFAULT_OPTIONS, so today's default hashes do not change.
Regression test
Oracle is the node.
- given: datum
d8799f019f02ffff, no redeemers,CANONICAL_OPTIONS - before fix:
80dbaeaf… - after fix:
ac4817df…, blake2b-256 ofa0 d9010281 d87982018102 a0 - same check for the branch with redeemers and datums
- control: with default options the hash is unchanged
Devnet, raw submission through Ogmios. The witness set carries d87982018102, and the output holds its datum hash:
- script data hash from
toScriptDataHash(..., CANONICAL_OPTIONS): rejected with 3113, provided80dbaeaf…, computedac4817df… - script data hash
ac4817df…: accepted
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 1 giờ
- Pull request đã merge (30 ngày)
- 44
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của IntersectMBO/evolution-sdk
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
IntersectMBO/evolution-sdk#559 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
IntersectMBO/evolution-sdk#557 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
IntersectMBO/evolution-sdk#541 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
IntersectMBO/evolution-sdk#518 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement external-review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
IntersectMBO/evolution-sdk#456 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của IntersectMBO/evolution-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
status:approved type:bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
egdev6/quorb#109 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
stage:4
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ilan-pinto/roaring-lions#598 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Frontmatter next to `src:` is applied to every imported slide, not only the first (undocumented)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày