@fluffylabs/anan-as 1.1.3-e3864a9 → 1.1.3-eee81bd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +47 -10
  2. package/dist/bin/index.js +174 -102
  3. package/dist/bin/{fuzz.js → src/fuzz.js} +3 -20
  4. package/dist/bin/src/log-host-call.js +41 -0
  5. package/dist/bin/src/trace-parse.js +315 -0
  6. package/dist/bin/src/trace-replay.js +130 -0
  7. package/dist/bin/src/tracer.js +64 -0
  8. package/dist/bin/src/utils.js +25 -0
  9. package/dist/bin/test.js +1 -3
  10. package/dist/build/compiler-inline.js +1 -1
  11. package/dist/build/compiler.d.ts +2 -2
  12. package/dist/build/compiler.js +1 -1
  13. package/dist/build/compiler.wasm +0 -0
  14. package/dist/build/debug-inline.js +1 -1
  15. package/dist/build/debug-raw-inline.js +1 -1
  16. package/dist/build/debug-raw.d.ts +113 -57
  17. package/dist/build/debug-raw.js +97 -61
  18. package/dist/build/debug-raw.wasm +0 -0
  19. package/dist/build/debug.d.ts +113 -57
  20. package/dist/build/debug.js +107 -64
  21. package/dist/build/debug.wasm +0 -0
  22. package/dist/build/release-inline.js +1 -1
  23. package/dist/build/release-mini-inline.js +1 -1
  24. package/dist/build/release-mini.d.ts +113 -57
  25. package/dist/build/release-mini.js +107 -64
  26. package/dist/build/release-mini.wasm +0 -0
  27. package/dist/build/release-stub-inline.js +1 -1
  28. package/dist/build/release-stub.d.ts +113 -57
  29. package/dist/build/release-stub.js +107 -64
  30. package/dist/build/release-stub.wasm +0 -0
  31. package/dist/build/release.d.ts +113 -57
  32. package/dist/build/release.js +107 -64
  33. package/dist/build/release.wasm +0 -0
  34. package/dist/build/test-inline.js +1 -1
  35. package/dist/build/test.wasm +0 -0
  36. package/dist/test/test-as.js +3 -0
  37. package/dist/{bin → test}/test-gas-cost.js +1 -1
  38. package/dist/test/test-trace-replay.js +19 -0
  39. package/dist/{bin → test}/test-w3f.js +3 -1
  40. package/package.json +5 -5
  41. /package/dist/bin/{test-json.js → src/test-json.js} +0 -0
Binary file
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { runAllTests } from "../build/test.js";
3
+ runAllTests();
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import "json-bigint-patch";
3
3
  import * as assert from "node:assert";
4
+ import { ERR, OK, read, run } from "../bin/src/test-json.js";
4
5
  import { disassemble, getGasCosts, HasMetadata, InputKind } from "../build/release.js";
5
- import { ERR, OK, read, run } from "./test-json.js";
6
6
  // Run the CLI application
7
7
  main();
8
8
  // Main function
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ import * as assert from "node:assert";
3
+ import { existsSync } from "node:fs";
4
+ import { fileURLToPath } from "node:url";
5
+ import { replayTraceFile } from "../bin/src/trace-replay.js";
6
+ import { HasMetadata } from "../build/release.js";
7
+ const fixture = fileURLToPath(new URL("./fixtures/io-trace-output.log", import.meta.url));
8
+ if (!existsSync(fixture)) {
9
+ throw new Error(`fixture not found: ${fixture}`);
10
+ }
11
+ const summary = replayTraceFile(fixture, {
12
+ logs: false,
13
+ hasMetadata: HasMetadata.Yes,
14
+ verify: true,
15
+ });
16
+ console.log(summary);
17
+ assert.ok(summary.ecalliCount > 0, "Expected at least one ecalli entry");
18
+ assert.strictEqual(summary.termination.type, "HALT");
19
+ assert.ok(summary.success, "Expected successful re-execution");
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import "json-bigint-patch";
3
3
  import * as assert from "node:assert";
4
+ import { ERR, OK, read, run } from "../bin/src/test-json.js";
4
5
  import { disassemble, HasMetadata, InputKind, prepareProgram, runProgram } from "../build/release.js";
5
- import { ERR, OK, read, run } from "./test-json.js";
6
6
  const ignored = [
7
7
  "inst_load_u8_nok",
8
8
  "inst_store_imm_indirect_u16_with_offset_nok",
@@ -68,6 +68,8 @@ function processW3f(data, options) {
68
68
  }
69
69
  // compare with expected values
70
70
  const expected = {
71
+ // just copy JAM-output result field
72
+ result: result.result,
71
73
  status: read(data, "expected-status"),
72
74
  registers: read(data, "expected-regs").map((x) => BigInt(x)),
73
75
  pc: read(data, "expected-pc"),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fluffylabs/anan-as",
3
3
  "description": "AssemblyScript PVM interpreter.",
4
- "version": "1.1.3-e3864a9",
4
+ "version": "1.1.3-eee81bd",
5
5
  "main": "./dist/bin/index.js",
6
6
  "bin": {
7
7
  "anan-as": "./dist/bin/index.js"
@@ -23,7 +23,7 @@
23
23
  "build:inline": "tsx ./bin/build-inline.ts",
24
24
  "cp-build": "rm -rf ./web/build; cp -r ./dist/build ./web/",
25
25
  "format": "biome format --write",
26
- "fuzz": "tsx ./bin/fuzz.ts",
26
+ "fuzz": "tsx ./bin/src/fuzz.ts",
27
27
  "lint": "biome lint --write; biome check --write",
28
28
  "prestart": "npm run build",
29
29
  "pretest:w3f": "npm run build",
@@ -32,10 +32,10 @@
32
32
  "qa": "biome ci",
33
33
  "qa-fix": "npm run format; npm run lint",
34
34
  "start": "tsx ./bin/index.ts",
35
- "test": "npm run asbuild:test && tsx ./bin/test.ts",
35
+ "test": "npm run asbuild:test && tsx ./test/test-as.ts && tsx ./test/test-trace-replay.ts",
36
36
  "tsbuild": "tsc",
37
- "test:w3f": "tsx ./bin/test-w3f.ts",
38
- "test:gas-cost": "tsx ./bin/test-gas-cost.ts",
37
+ "test:w3f": "tsx ./test/test-w3f.ts",
38
+ "test:gas-cost": "tsx ./test/test-gas-cost.ts",
39
39
  "update-version": "tsx ./web/bump-version.ts $GITHUB_SHA",
40
40
  "web": "npx live-server ./web"
41
41
  },
File without changes