0xMiden / 0xMiden/takeoff

Deploying larger compiled packages can fail during base64 encoding

オープン 初心者向け
#8 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
2
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

説明

## Summary

Deploying a compiled contract can fail before `useDeploy()` is called when the compiled package is large enough.

`ContractList` converts `contract.packageBytes` to base64 with:

```ts
btoa(String.fromCharCode(...contract.packageBytes))
```

Spreading a large `Uint8Array` into `String.fromCharCode()` is limited by the JavaScript engine's maximum argument count. Once the compiled package crosses that threshold, the click handler throws synchronously with `RangeError: Maximum call stack size exceeded` and the deploy flow never starts.

## Repro

This is the same conversion pattern used by the deploy button:

```sh
node -e "const b=new Uint8Array(200000); String.fromCharCode(...b)"
```

It fails with:

```text
RangeError: Maximum call stack size exceeded
```

## Impact

A contract can compile successfully and still be impossible to deploy from the UI solely because its `.masp` package is too large for the spread call. The deploy hook already accepts base64, so this is only an encoding issue in the UI boundary.

## Suggested fix

Encode the `Uint8Array` in chunks, or move a safe `uint8ArrayToBase64()` helper into a shared utility and use it from `ContractList`.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

contract.packageBytes が base64 に変換される ContractList コンポーネントを確認してください。問題は String.fromCharCode(...contract.packageBytes) の使用にあります。大きな Uint8Array を安全に base64 エンコードするためのユーティリティ関数を、共有の utils ファイルなどで探すか作成してください。大きなパッケージのデプロイをシミュレートして修正をテストします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
cli, frontend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
75/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。