Description
Describe the bug
The following errors occurs when using @std/encoding
v1.0.8
but not v1.0.7
. It seems a bug has been introduced in v1.0.8
. The issue still occurs with the latest version v1.0.10
.
error: Uncaught (in promise) TypeError: Cannot perform Construct on a detached ArrayBuffer
at new Uint8Array (<anonymous>)
at fromArrayLike (ext:deno_node/internal/buffer.mjs:341:15)
at fromObject (ext:deno_node/internal/buffer.mjs:353:12)
at _from (ext:deno_node/internal/buffer.mjs:209:15)
at Buffer.from (ext:deno_node/internal/buffer.mjs:234:10)
at Object.actualMethods.sign (file:///Users/leighmcculloch/Library/Caches/deno/npm/registry.npmjs.org/@stellar/stellar-base/13.1.0/lib/signing.js:82:19)
at sign (file:///Users/leighmcculloch/Library/Caches/deno/npm/registry.npmjs.org/@stellar/stellar-base/13.1.0/lib/signing.js:25:24)
at Keypair.sign (file:///Users/leighmcculloch/Library/Caches/deno/npm/registry.npmjs.org/@stellar/stellar-base/13.1.0/lib/keypair.js:178:32)
at file:///Users/leighmcculloch/Code/soroban-examples/main/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519-js/main.ts:82:29
at eventLoopTick (ext:core/01_core.js:178:7)
Steps to Reproduce
I'm triggering the error in a rather large workflow that I have not yet narrowed down to a small example, but I wanted to share this sooner rather than delay because the lib is still only a few patch versions away from when the erroring behaviour was introduced.
Checkout the code:
git clone https://github.com/stellar/soroban-examples
cd soroban-examples
git checkout add-multisig-1-of-n-account
cd multisig_1_of_n_account/stellar-cli-sign-auth-ed25519-js
Change the version to the version with the bug:
sed -i '' 's/@std\/[email protected]/@std\/[email protected]/g' deno.json
Run the command:
echo 'AAAAAgAAAABC6aNIWicaOZvbWjNaoGvec9eoaZtxiJSK40S9WE3jBAAMWRMACv+rAAAALQAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAAAAAAEApfy0ir3P25JeOT8QRjPyxAnQ8OLu2giwz56oChmeUwAAAARtaW50AAAAAgAAABIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAewAAAAEAAAABAAAAAZeQKv/IzrOq8h1qTA8hvoVbXzIop3CGFC44ybxJu3UkEvzbsZmvfowAAAAAAAAAAQAAAAAAAAABAKX8tIq9z9uSXjk/EEYz8sQJ0PDi7toIsM+eqAoZnlMAAAAEbWludAAAAAIAAAASAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAAAAAAAAAAAAHsAAAAAAAAAAQAAAAAAAAADAAAABgAAAAEApfy0ir3P25JeOT8QRjPyxAnQ8OLu2giwz56oChmeUwAAABQAAAABAAAABgAAAAGXkCr/yM6zqvIdakwPIb6FW18yKKdwhhQuOMm8Sbt1JAAAABQAAAABAAAAB6J2Feel6+9l/OSx1PnVqbfuw2tQCicshc/wJpjForp9AAAAAgAAAAYAAAABAKX8tIq9z9uSXjk/EEYz8sQJ0PDi7toIsM+eqAoZnlMAAAAQAAAAAQAAAAIAAAAPAAAAB0JhbGFuY2UAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAGAAAAAZeQKv/IzrOq8h1qTA8hvoVbXzIop3CGFC44ybxJu3UkAAAAFRL827GZr36MAAAAAAAGdVkAAAqYAAABKAAAAAAADFivAAAAAA==' \
| deno run --allow-read --no-prompt main.ts \
--secret-key 0000000000000000000000000000000000000000000000000000000000000001 \
--signature-expiration-ledger 2296800
If the command is run with @std/encoding
on v1.0.7, then it works fine.
If the command is run with @std/encoding
on v1.0.8, the error above is output.
Expected behavior
No error about a detached ArrayBuffer.
Environment
- OS:
macOS 15
- deno version:
2.3.1
- std version:
v1.0.8