Encoders overflow on data nested past 1,000 to 3,000 levels
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- backend
調査の方向性
Start with the recursive encoder paths in Data.ts (writeData, plutusDataToCBORValue) and CBOR.ts (internalEncodeSync), then trace how Data.toCBORBytes is used by the hash and inline datum writers named in the issue. Reproduce the reported stack overflow with the nested CBOR input and check the listed hash and TxOut paths. Done means every encoder handles Plutus data and CBOR values at ledger-accepted depths, including provider UTxOs passed to evaluators.
索引モデルが issue の本文から書いたものです。
説明
Data.toCBORHex(Data.fromCBORHex("81".repeat(3000) + "00")) throws RangeError: Maximum call stack size exceeded on a first call in a fresh process. Since #677 the decode in that call works at 16,384 levels; the encode does not. On a first call, the deepest list each encoder writes is:
- 2,963 levels for
Data.toCBORHexandData.toDatumHash, 2,961 forRedeemers.toScriptDataHashwith the list among its datums, and 2,950 forTxOut.toCBORHexof an output that holds it as an inline datum - 1,738 levels for
CBOR.toCBORHexandCBOR.toCBORHexWithFormat - 996 levels for
Data.plutusDataToCBORValue
Once the code is warm, Data.toCBORHex reaches 13,224 levels and CBOR.toCBORHex 5,880. A constructor nested in a constructor fails sooner: CBOR.toCBORHex stops at 838 levels of d87981.
Each encoder recurses once per level. writeData calls writeList, writeMap and writeConstr, which call writeData for each child (Data.ts:665-770). internalEncodeSync (CBOR.ts:1111) calls encodeArraySync, encodeMapEntriesSync and encodeTagSync, which call it back for each child (CBOR.ts:1507, CBOR.ts:1530, CBOR.ts:1583-1599, CBOR.ts:1750, CBOR.ts:1776). plutusDataToCBORValue maps each child through itself (Data.ts:788-837). toDatumHash (Data.ts:1243), toScriptDataHash (Redeemers.ts:648-655, Redeemers.ts:688) and the inline datum writer (DatumOption.ts:85) all go through Data.toCBORBytes.
Since #677 a provider returns a UTxO with a 15,000-level datum, but the SDK cannot pass that UTxO to a local evaluator. The builder hands every selected input and reference input to the evaluator (Evaluation.ts:514-516). The aiken-uplc and scalus-uplc evaluators re-encode each one as a TxOut (packages/aiken-uplc/src/Evaluator.ts:100-111, packages/scalus-uplc/src/Evaluator.ts:33-40), and TxOut writes a provider datum with Data.toCBORBytes. TxOut.toCBORHex of the provider copy of a 15,000-level datum throws, while the same UTxO read from a CIP-30 wallet keeps its original bytes and re-encodes. With passAdditionalUtxos: true, the Blockfrost, Ogmios and Maestro evaluators re-encode the inputs too (BlockfrostEffect.ts:114, Ogmios.ts:220, MaestroEffect.ts:232); by default they receive none (resolve.ts:179).
Anyone can send a UTxO with such a datum to any address. From the code, a build that selects it and evaluates locally fails; no end-to-end build has confirmed this yet. The ledger accepts the data. The Plutus data decoder limits the size of each leaf, not the depth (PlutusCore/Data.hs, decodeData), so a datum can nest about 16,000 levels in one transaction.
Every encoder of Plutus data and CBOR values should write any value the ledger accepts, so a UTxO read from a provider can go to any evaluator.
- 主要言語
- TypeScript
- スター
- 22
- フォーク
- 33
- 平均マージ
- 21時間 38分
- マージ済み PR(30日)
- 55
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
IntersectMBO/evolution-sdk のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
IntersectMBO/evolution-sdk#696 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
IntersectMBO/evolution-sdk#694 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
IntersectMBO/evolution-sdk#559 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
IntersectMBO/evolution-sdk#557 ·
メンテナーはふだん 1 日以内に返信
-
txBuilder: committee cert redeemers are never resolved to a certificate index対応中かも @emmanuel-musau が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
IntersectMBO/evolution-sdk#518 ·
メンテナーはふだん 1 日以内に返信
IntersectMBO/evolution-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
complexity:simple priority:P3 ready-to-build
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
junruxiong/IncarnaMind#2919 ·
-
Runner API: GET /api/jobs/<id> returns branch: null; the branch only appears under input.branchオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
radiancelux/prgenie#204 ·
メンテナーはふだん 1 日以内に返信
-
bug documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
cqframework/vscode-cql#198 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
WalletConnect/walletconnect-monorepo#7392 · コメント 1 件 ·