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:
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:
node -e "const b=new Uint8Array(200000); String.fromCharCode(...b)"
It fails with:
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.
Summary
Deploying a compiled contract can fail before
useDeploy()is called when the compiled package is large enough.ContractListconvertscontract.packageBytesto base64 with:Spreading a large
Uint8ArrayintoString.fromCharCode()is limited by the JavaScript engine's maximum argument count. Once the compiled package crosses that threshold, the click handler throws synchronously withRangeError: Maximum call stack size exceededand the deploy flow never starts.Repro
This is the same conversion pattern used by the deploy button:
node -e "const b=new Uint8Array(200000); String.fromCharCode(...b)"It fails with:
Impact
A contract can compile successfully and still be impossible to deploy from the UI solely because its
.masppackage 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
Uint8Arrayin chunks, or move a safeuint8ArrayToBase64()helper into a shared utility and use it fromContractList.