샘플
@tybys/wasm-util 0.10.2: loadSync
검증된 샘플 — npm @tybys/wasm-util 0.10.2: loadSync. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: loadSync instantiates a WebAssembly binary…
sha256:f703f957fe109dff81e4530b3d24fae14e60bcde0cc2cd9cabc16f8ce4a23797
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | SKIPPED | compile:SKIPPED · contract:SKIPPED · load:SKIPPED · resolve:FAIL CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-10-13 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-10-13 |
케이스
HOW- 목표
- verify @tybys/wasm-util.loadSync in pkg:npm/%40tybys/wasm-util@0.10.2
- 심벌
-
- @tybys/wasm-util.loadSync
- 환경
- node 22.23.2
- 생성일
- 2026-10-13T05:51:48Z
컨트랙트
- loadSync instantiates a WebAssembly binary synchronously from a Uint8Array buffer
- loadSync returns an object containing both WebAssembly.Instance and WebAssembly.Module
- loadSync instantiates a WebAssembly binary synchronously from an ArrayBuffer source
- instantiated WebAssembly module executes exported arithmetic functions correctly
- loadSync throws when provided invalid WebAssembly bytecode
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify @tybys/wasm-util.loadSync in pkg:npm/%40tybys/wasm-util@0.10.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40tybys/wasm-util@0.10.2
Demonstrate these symbols/APIs:
- @tybys/wasm-util.loadSync
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:02cdc4d43bc0eb68738c31510fe69ff9501876f44a0106a8e3a68fb87cbca861","contract":["loadSync instantiates a WebAssembly binary synchronously from a Uint8Array buffer","loadSync returns an object containing both WebAssembly.Instance and WebAssembly.Module","loadSync instantiates a WebAssembly binary synchronously from an ArrayBuffer source","instantiated WebAssembly module executes exported arithmetic functions correctly","loadSync throws when provided invalid WebAssembly bytecode"],"goal":"verify @tybys/wasm-util.loadSync in pkg:npm/%40tybys/wasm-util@0.10.2","kind":"HOW","packages":["pkg:npm/%40tybys/wasm-util@0.10.2"],"schemaVersion":1,"symbols":["@tybys/wasm-util.loadSync"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40tybys/wasm-util@0.10.2"],"schemaVersion":1,"subject":"pkg:npm/%40tybys/wasm-util@0.10.2","symbols":["@tybys/wasm-util.loadSync"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-tybys-wasm-util",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-tybys-wasm-util",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@tybys/wasm-util": "0.10.2"
}
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz",
"integrity": "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==",
"license": "MIT",
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
}
}
}
{
"name": "sample-tybys-wasm-util",
"version": "1.0.0",
"type": "module",
"private": true,
"description": "verify @tybys/wasm-util.loadSync in pkg:npm/@tybys/wasm-util@0.10.2",
"main": "src/index.mjs",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"@tybys/wasm-util": "0.10.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify @tybys/wasm-util.loadSync in pkg:npm/%40tybys/wasm-util@0.10.2",
"kind": "HOW",
"packages": [
"pkg:npm/%40tybys/wasm-util@0.10.2"
],
"symbols": [
"@tybys/wasm-util.loadSync"
]
}
import { loadSync } from '@tybys/wasm-util';
export const ADD_WASM_BYTES = new Uint8Array([
0x00, 0x61, 0x73, 0x6d,
0x01, 0x00, 0x00, 0x00,
0x01, 0x07, 0x01, 0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f,
0x03, 0x02, 0x01, 0x00,
0x07, 0x07, 0x01, 0x03, 0x61, 0x64, 0x64, 0x00, 0x00,
0x0a, 0x09, 0x01, 0x07, 0x00, 0x20, 0x00, 0x20, 0x01, 0x6a, 0x0b
]);
export function loadWasmSync(bufferSource, imports) {
return loadSync(bufferSource, imports);
}
export function loadAddModule() {
return loadSync(ADD_WASM_BYTES);
}
export { loadSync };
import assert from 'node:assert';
import {
loadSync,
loadWasmSync,
loadAddModule,
ADD_WASM_BYTES
} from '../src/index.mjs';
// 1. loadSync instantiates a WebAssembly binary synchronously from a Uint8Array buffer
const { instance, module } = loadSync(ADD_WASM_BYTES);
assert(instance instanceof WebAssembly.Instance, 'instance should be an instance of WebAssembly.Instance');
assert(module instanceof WebAssembly.Module, 'module should be an instance of WebAssembly.Module');
// 2. loadSync returns an object containing both WebAssembly.Instance and WebAssembly.Module
const loaded = loadWasmSync(ADD_WASM_BYTES);
assert(typeof loaded === 'object' && loaded !== null, 'result should be an object');
assert(loaded.instance instanceof WebAssembly.Instance, 'result.instance should be a WebAssembly.Instance');
assert(loaded.module instanceof WebAssembly.Module, 'result.module should be a WebAssembly.Module');
// 3. loadSync instantiates a WebAssembly binary synchronously from an ArrayBuffer source
const arrayBuffer = ADD_WASM_BYTES.buffer.slice(
ADD_WASM_BYTES.byteOffset,
ADD_WASM_BYTES.byteOffset + ADD_WASM_BYTES.byteLength
);
const fromBuffer = loadSync(arrayBuffer);
assert(fromBuffer.instance instanceof WebAssembly.Instance, 'instance from ArrayBuffer should be WebAssembly.Instance');
assert(fromBuffer.module instanceof WebAssembly.Module, 'module from ArrayBuffer should be WebAssembly.Module');
// 4. instantiated WebAssembly module executes exported arithmetic functions correctly
assert.strictEqual(typeof instance.exports.add, 'function', 'add export should be a callable function');
assert.strictEqual(instance.exports.add(15, 27), 42, 'add(15, 27) should equal 42');
assert.strictEqual(fromBuffer.instance.exports.add(100, 250), 350, 'fromBuffer add(100, 250) should equal 350');
const helperModule = loadAddModule();
assert.strictEqual(helperModule.instance.exports.add(7, 8), 15, 'helper module add(7, 8) should equal 15');
// 5. loadSync throws when provided invalid WebAssembly bytecode
const invalidBytes = new Uint8Array([0x00, 0x61, 0x73, 0x6d, 0x00, 0x00, 0x00, 0x00]);
assert.throws(
() => {
loadSync(invalidBytes);
},
(err) => err instanceof WebAssembly.CompileError || err instanceof TypeError || /WebAssembly/.test(err?.message || ''),
'loadSync should throw a WebAssembly compilation or type error on invalid bytecode'
);
console.log('Contract tests passed successfully.');
process.exit(0);
오리진 시더
익명