Redeemers: toScriptDataHash ignores the codec options when encoding datums
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- blockchain
調査の方向性
packages/evolution/src/Redeemers.ts から始め、encodeDatumsTaggedSet と toScriptDataHash の両方の分岐に注目してください。redeemers がある場合とない場合の canonical options、および default-options control に対する回帰テストを追加してください。canonical hash が node oracle と一致し、既存の default hash が変更されないことを確認できれば、テストは完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 22
- フォーク
- 33
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 44
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
IntersectMBO/evolution-sdk のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
IntersectMBO/evolution-sdk#559 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
IntersectMBO/evolution-sdk#557 ·
メンテナーはふだん 1 日以内に返信
-
dependencies good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 93/100
IntersectMBO/evolution-sdk#541 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
IntersectMBO/evolution-sdk#518 ·
メンテナーはふだん 1 日以内に返信
-
enhancement external-review
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
IntersectMBO/evolution-sdk#456 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
IntersectMBO/evolution-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Agenta-AI/agenta#7542 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
code quality security
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
homarr-labs/dashboard-icons#2939 ·
メンテナーはふだん 1 日以内に返信