@fluffylabs/anan-as 1.0.0-791e5e1 → 1.0.0-8e153ff
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.
- package/README.md +21 -18
- package/build/debug-raw.d.ts +7 -0
- package/build/debug-raw.js +4 -0
- package/build/debug-raw.wasm +0 -0
- package/build/debug.d.ts +7 -0
- package/build/debug.js +5 -0
- package/build/debug.wasm +0 -0
- package/build/release-mini.d.ts +7 -0
- package/build/release-mini.js +5 -0
- package/build/release-mini.wasm +0 -0
- package/build/release.d.ts +7 -0
- package/build/release.js +5 -0
- package/build/release.wasm +0 -0
- package/package.json +14 -10
package/README.md
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
# 🍍 anan-as
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AssemblyScript implementation of the JAM PVM (64-bit).
|
|
4
4
|
|
|
5
5
|
[Demo](https://todr.me/anan-as)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Todo
|
|
8
8
|
|
|
9
9
|
- [x] Memory
|
|
10
10
|
- [x] [JAM tests](https://github.com/w3f/jamtestvectors/pull/3) compatibility
|
|
11
11
|
- [x] 64-bit & new instructions ([GrayPaper v0.5.0](https://graypaper.fluffylabs.dev))
|
|
12
12
|
- [x] GP 0.5.4 compatibility (ZBB extensions)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## Why?
|
|
15
15
|
|
|
16
|
-
- [
|
|
16
|
+
- [Pineapples](https://en.wikipedia.org/wiki/Ananas) are cool.
|
|
17
17
|
- [JAM](https://graypaper.com/) is promising.
|
|
18
18
|
- [PVM](https://github.com/paritytech/polkavm) is neat.
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
### Useful where?
|
|
20
|
+
## Useful where?
|
|
22
21
|
|
|
23
22
|
- Potentially as an alternative implementation for [`typeberry`](https://github.com/fluffylabs).
|
|
24
23
|
- To test out the [PVM debugger](https://pvm.fluffylabs.dev).
|
|
@@ -54,9 +53,11 @@ ananAs.__collect();
|
|
|
54
53
|
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
## Raw Bindings
|
|
58
57
|
|
|
59
|
-
Raw bindings give you direct access to WebAssembly exports
|
|
58
|
+
Raw bindings give you direct access to WebAssembly exports
|
|
59
|
+
without the JavaScript wrapper layer.
|
|
60
|
+
This is useful for instantiating multiple instances or when you need more control:
|
|
60
61
|
|
|
61
62
|
```javascript
|
|
62
63
|
// Raw bindings
|
|
@@ -74,9 +75,10 @@ const ananAs = await instantiate(module);
|
|
|
74
75
|
|
|
75
76
|
```
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
## Version Tags
|
|
78
79
|
|
|
79
|
-
When installing the package, you can choose between stable releases
|
|
80
|
+
When installing the package, you can choose between stable releases
|
|
81
|
+
and bleeding-edge builds:
|
|
80
82
|
|
|
81
83
|
```bash
|
|
82
84
|
# Latest stable release
|
|
@@ -89,24 +91,25 @@ npm install @fluffylabs/anan-as@next
|
|
|
89
91
|
## Building
|
|
90
92
|
|
|
91
93
|
To download the dependencies:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
|
|
95
|
+
```cmd
|
|
96
|
+
npm ci
|
|
94
97
|
```
|
|
95
98
|
|
|
96
99
|
To build the WASM modules (in `./build/{release,debug}.wasm`):
|
|
97
100
|
|
|
98
|
-
```
|
|
99
|
-
|
|
101
|
+
```cmd
|
|
102
|
+
npm run build
|
|
100
103
|
```
|
|
101
104
|
|
|
102
105
|
To run the example in the browser at [http://localhost:3000](http://localhost:3000).
|
|
103
106
|
|
|
104
|
-
```
|
|
105
|
-
|
|
107
|
+
```cmd
|
|
108
|
+
npm run web
|
|
106
109
|
```
|
|
107
110
|
|
|
108
111
|
To run JSON test vectors.
|
|
109
112
|
|
|
110
|
-
```
|
|
111
|
-
|
|
113
|
+
```cmd
|
|
114
|
+
npm start ./path/to/tests/*.json
|
|
112
115
|
```
|
package/build/debug-raw.d.ts
CHANGED
|
@@ -97,6 +97,13 @@ declare namespace __AdaptedExports {
|
|
|
97
97
|
* @returns `~lib/typedarray/Uint8Array`
|
|
98
98
|
*/
|
|
99
99
|
export function getPageDump(index: number): Uint8Array;
|
|
100
|
+
/**
|
|
101
|
+
* assembly/api-debugger/getMemory
|
|
102
|
+
* @param address `u32`
|
|
103
|
+
* @param length `u32`
|
|
104
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
105
|
+
*/
|
|
106
|
+
export function getMemory(address: number, length: number): Uint8Array;
|
|
100
107
|
/**
|
|
101
108
|
* assembly/api-debugger/setMemory
|
|
102
109
|
* @param address `u32`
|
package/build/debug-raw.js
CHANGED
|
@@ -109,6 +109,10 @@ export async function instantiate(module, imports = {}) {
|
|
|
109
109
|
// assembly/api-debugger/getPageDump(u32) => ~lib/typedarray/Uint8Array
|
|
110
110
|
return __liftTypedArray(Uint8Array, exports.getPageDump(index) >>> 0);
|
|
111
111
|
},
|
|
112
|
+
getMemory(address, length) {
|
|
113
|
+
// assembly/api-debugger/getMemory(u32, u32) => ~lib/typedarray/Uint8Array
|
|
114
|
+
return __liftTypedArray(Uint8Array, exports.getMemory(address, length) >>> 0);
|
|
115
|
+
},
|
|
112
116
|
setMemory(address, data) {
|
|
113
117
|
// assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => void
|
|
114
118
|
data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
|
package/build/debug-raw.wasm
CHANGED
|
Binary file
|
package/build/debug.d.ts
CHANGED
|
@@ -96,6 +96,13 @@ export declare function setRegisters(flatRegisters: Array<number>): void;
|
|
|
96
96
|
* @returns `~lib/typedarray/Uint8Array`
|
|
97
97
|
*/
|
|
98
98
|
export declare function getPageDump(index: number): Uint8Array;
|
|
99
|
+
/**
|
|
100
|
+
* assembly/api-debugger/getMemory
|
|
101
|
+
* @param address `u32`
|
|
102
|
+
* @param length `u32`
|
|
103
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
104
|
+
*/
|
|
105
|
+
export declare function getMemory(address: number, length: number): Uint8Array;
|
|
99
106
|
/**
|
|
100
107
|
* assembly/api-debugger/setMemory
|
|
101
108
|
* @param address `u32`
|
package/build/debug.js
CHANGED
|
@@ -109,6 +109,10 @@ async function instantiate(module, imports = {}) {
|
|
|
109
109
|
// assembly/api-debugger/getPageDump(u32) => ~lib/typedarray/Uint8Array
|
|
110
110
|
return __liftTypedArray(Uint8Array, exports.getPageDump(index) >>> 0);
|
|
111
111
|
},
|
|
112
|
+
getMemory(address, length) {
|
|
113
|
+
// assembly/api-debugger/getMemory(u32, u32) => ~lib/typedarray/Uint8Array
|
|
114
|
+
return __liftTypedArray(Uint8Array, exports.getMemory(address, length) >>> 0);
|
|
115
|
+
},
|
|
112
116
|
setMemory(address, data) {
|
|
113
117
|
// assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => void
|
|
114
118
|
data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
|
|
@@ -388,6 +392,7 @@ export const {
|
|
|
388
392
|
getRegisters,
|
|
389
393
|
setRegisters,
|
|
390
394
|
getPageDump,
|
|
395
|
+
getMemory,
|
|
391
396
|
setMemory,
|
|
392
397
|
InputKind,
|
|
393
398
|
HasMetadata,
|
package/build/debug.wasm
CHANGED
|
Binary file
|
package/build/release-mini.d.ts
CHANGED
|
@@ -102,6 +102,13 @@ export declare function setRegisters(flatRegisters: Array<number>): void;
|
|
|
102
102
|
* @returns `~lib/typedarray/Uint8Array`
|
|
103
103
|
*/
|
|
104
104
|
export declare function getPageDump(index: number): Uint8Array;
|
|
105
|
+
/**
|
|
106
|
+
* assembly/api-debugger/getMemory
|
|
107
|
+
* @param address `u32`
|
|
108
|
+
* @param length `u32`
|
|
109
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
110
|
+
*/
|
|
111
|
+
export declare function getMemory(address: number, length: number): Uint8Array;
|
|
105
112
|
/**
|
|
106
113
|
* assembly/api-debugger/setMemory
|
|
107
114
|
* @param address `u32`
|
package/build/release-mini.js
CHANGED
|
@@ -109,6 +109,10 @@ async function instantiate(module, imports = {}) {
|
|
|
109
109
|
// assembly/api-debugger/getPageDump(u32) => ~lib/typedarray/Uint8Array
|
|
110
110
|
return __liftTypedArray(Uint8Array, exports.getPageDump(index) >>> 0);
|
|
111
111
|
},
|
|
112
|
+
getMemory(address, length) {
|
|
113
|
+
// assembly/api-debugger/getMemory(u32, u32) => ~lib/typedarray/Uint8Array
|
|
114
|
+
return __liftTypedArray(Uint8Array, exports.getMemory(address, length) >>> 0);
|
|
115
|
+
},
|
|
112
116
|
setMemory(address, data) {
|
|
113
117
|
// assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => void
|
|
114
118
|
data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
|
|
@@ -393,6 +397,7 @@ export const {
|
|
|
393
397
|
getRegisters,
|
|
394
398
|
setRegisters,
|
|
395
399
|
getPageDump,
|
|
400
|
+
getMemory,
|
|
396
401
|
setMemory,
|
|
397
402
|
InputKind,
|
|
398
403
|
HasMetadata,
|
package/build/release-mini.wasm
CHANGED
|
Binary file
|
package/build/release.d.ts
CHANGED
|
@@ -96,6 +96,13 @@ export declare function setRegisters(flatRegisters: Array<number>): void;
|
|
|
96
96
|
* @returns `~lib/typedarray/Uint8Array`
|
|
97
97
|
*/
|
|
98
98
|
export declare function getPageDump(index: number): Uint8Array;
|
|
99
|
+
/**
|
|
100
|
+
* assembly/api-debugger/getMemory
|
|
101
|
+
* @param address `u32`
|
|
102
|
+
* @param length `u32`
|
|
103
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
104
|
+
*/
|
|
105
|
+
export declare function getMemory(address: number, length: number): Uint8Array;
|
|
99
106
|
/**
|
|
100
107
|
* assembly/api-debugger/setMemory
|
|
101
108
|
* @param address `u32`
|
package/build/release.js
CHANGED
|
@@ -109,6 +109,10 @@ async function instantiate(module, imports = {}) {
|
|
|
109
109
|
// assembly/api-debugger/getPageDump(u32) => ~lib/typedarray/Uint8Array
|
|
110
110
|
return __liftTypedArray(Uint8Array, exports.getPageDump(index) >>> 0);
|
|
111
111
|
},
|
|
112
|
+
getMemory(address, length) {
|
|
113
|
+
// assembly/api-debugger/getMemory(u32, u32) => ~lib/typedarray/Uint8Array
|
|
114
|
+
return __liftTypedArray(Uint8Array, exports.getMemory(address, length) >>> 0);
|
|
115
|
+
},
|
|
112
116
|
setMemory(address, data) {
|
|
113
117
|
// assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => void
|
|
114
118
|
data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
|
|
@@ -388,6 +392,7 @@ export const {
|
|
|
388
392
|
getRegisters,
|
|
389
393
|
setRegisters,
|
|
390
394
|
getPageDump,
|
|
395
|
+
getMemory,
|
|
391
396
|
setMemory,
|
|
392
397
|
InputKind,
|
|
393
398
|
HasMetadata,
|
package/build/release.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluffylabs/anan-as",
|
|
3
3
|
"description": "AssemblyScript PVM interpreter.",
|
|
4
|
-
"version": "1.0.0-
|
|
5
|
-
"main": "./bin/index.
|
|
4
|
+
"version": "1.0.0-8e153ff",
|
|
5
|
+
"main": "./bin/index.ts",
|
|
6
6
|
"repository": {
|
|
7
7
|
"url": "https://github.com/tomusdrw/anan-as"
|
|
8
8
|
},
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"asbuild:release-mini": "asc assembly/index.ts --uncheckedBehavior=always --target release-mini",
|
|
14
14
|
"asbuild:raw": "asc assembly/index.ts --target raw",
|
|
15
15
|
"asbuild:test": "asc assembly/test-run.ts --target test",
|
|
16
|
-
"build": "npm run asbuild && npm run cp-build",
|
|
16
|
+
"build": "npm run asbuild && npm run asbuild:test && npm run tsbuild && npm run cp-build",
|
|
17
17
|
"cp-build": "rm -rf ./web/build; cp -r ./build ./web/",
|
|
18
18
|
"format": "biome format --write",
|
|
19
|
-
"fuzz": "
|
|
19
|
+
"fuzz": "tsx ./bin/fuzz.ts",
|
|
20
20
|
"lint": "biome lint --write; biome check --write",
|
|
21
21
|
"prestart": "npm run build",
|
|
22
22
|
"pretest:w3f": "npm run build",
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"preweb": "npm run build",
|
|
25
25
|
"qa": "biome ci",
|
|
26
26
|
"qa-fix": "npm run format; npm run lint",
|
|
27
|
-
"start": "
|
|
28
|
-
"test": "npm run asbuild:test &&
|
|
29
|
-
"
|
|
30
|
-
"test:
|
|
31
|
-
"
|
|
27
|
+
"start": "tsx ./bin/index.ts",
|
|
28
|
+
"test": "npm run asbuild:test && tsx ./bin/test.ts",
|
|
29
|
+
"tsbuild": "tsc",
|
|
30
|
+
"test:w3f": "tsx ./bin/test-w3f.ts",
|
|
31
|
+
"test:gas-cost": "tsx ./bin/test-gas-cost.ts",
|
|
32
|
+
"update-version": "tsx ./web/bump-version.ts $GITHUB_SHA",
|
|
32
33
|
"web": "npx live-server ./web"
|
|
33
34
|
},
|
|
34
35
|
"type": "module",
|
|
@@ -37,7 +38,10 @@
|
|
|
37
38
|
"license": "MPL-2.0",
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@biomejs/biome": "^2.2.6",
|
|
40
|
-
"
|
|
41
|
+
"@types/node": "^24.8.1",
|
|
42
|
+
"assemblyscript": "^0.28.8",
|
|
43
|
+
"tsx": "^4.20.6",
|
|
44
|
+
"typescript": "^5.9.3"
|
|
41
45
|
},
|
|
42
46
|
"files": [
|
|
43
47
|
"build/**/*.wasm",
|