@ethproofs/airbender-wasm-stark-verifier 0.1.0

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 ADDED
@@ -0,0 +1,41 @@
1
+ # ethproofs-verifier
2
+
3
+
4
+ First - download the airbender proof from ethproofs.
5
+
6
+ Run:
7
+
8
+ ```
9
+ RUST_MIN_STACK=267108864 cargo run --release -- --input-file ~/Downloads/matter-labs_f9c5e994-96fc-45c0-98fe-835a53313a62_705856.bin
10
+ ```
11
+
12
+ You'll get the output like this:
13
+
14
+ ```
15
+ End params (recursion verification key): [592082644, 914832686, 2098567393, 2326800689, 2139187838, 4177631951, 1218871476, 1805766682]
16
+ Basic program (verification key): [2515378349, 4234595854, 3925512183, 4162864624, 1989541961, 1232249954, 1448623067, 1605092683]
17
+ Public input (per block): [2820680802, 124999842, 2275559499, 200691927, 3104886037, 3143080570, 941459835, 587801584]
18
+ ```
19
+
20
+ The first 2 things are verification keys (for recursion and for the 'basic' program).
21
+ In theory they should be always 'constant' (and you should build the program + recursion program and check that they match).
22
+
23
+ The last entry (public input), would differ for each block, and it represents the hash of the commitment to the block (that contains information like new & old state roots etc).
24
+
25
+
26
+ ## Additional options
27
+
28
+ You can pass `--output_layouts_dir` to output the created setup files to a new directory.
29
+
30
+ You can also run with `--use-existing-layout` to use pre-created layouts (which would make program run a lot faster).
31
+
32
+
33
+ # Wasm
34
+
35
+ ```shell
36
+ cargo install wasm-bindgen-cli
37
+ ```
38
+
39
+ ```shell
40
+ RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack build --target web --no-opt
41
+ ```
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@ethproofs/airbender-wasm-stark-verifier",
3
+ "version": "0.1.0",
4
+ "description": "WASM wrapper for Airbender STARK verifier",
5
+ "type": "module",
6
+ "main": "pkg/ethproofs_verifier_lib.js",
7
+ "module": "pkg/ethproofs_verifier_lib.js",
8
+ "types": "pkg/ethproofs_verifier_lib.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./pkg/ethproofs_verifier_lib.d.ts",
12
+ "import": "./pkg/ethproofs_verifier_lib.js",
13
+ "require": "./pkg/ethproofs_verifier_lib.js"
14
+ },
15
+ "./pkg/*": "./pkg/*"
16
+ },
17
+ "files": [
18
+ "pkg/",
19
+ "README.md",
20
+ "test-browser.html",
21
+ "test-serve.mjs"
22
+ ],
23
+ "scripts": {
24
+ "build": "wasm-pack build --target bundler --out-dir pkg --no-opt",
25
+ "build:node": "wasm-pack build --target nodejs --out-dir pkg-node --no-opt",
26
+ "build:web": "wasm-pack build --target web --out-dir pkg-web --no-opt",
27
+ "build:all": "npm run build && npm run build:node && npm run build:web",
28
+ "test": "npm run build && node test-serve.mjs",
29
+ "test:node": "npm run build:node && node test-node.mjs"
30
+ },
31
+ "keywords": [
32
+ "wasm",
33
+ "webassembly",
34
+ "stark",
35
+ "verifier",
36
+ "airbender",
37
+ "zero-knowledge",
38
+ "zk",
39
+ "proof",
40
+ "blockchain",
41
+ "cryptography"
42
+ ],
43
+ "author": "Ethproofs",
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/ethproofs/airbender-wasm-stark-verifier"
48
+ },
49
+ "homepage": "https://github.com/ethproofs/airbender-wasm-stark-verifier#readme",
50
+ "bugs": {
51
+ "url": "https://github.com/ethproofs/airbender-wasm-stark-verifier/issues"
52
+ },
53
+ "engines": {
54
+ "node": ">=16.0.0"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "devDependencies": {
60
+ "wasm-pack": "^1.3.4"
61
+ }
62
+ }
package/pkg/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # ethproofs-verifier
2
+
3
+
4
+ First - download the airbender proof from ethproofs.
5
+
6
+ Run:
7
+
8
+ ```
9
+ RUST_MIN_STACK=267108864 cargo run --release -- --input-file ~/Downloads/matter-labs_f9c5e994-96fc-45c0-98fe-835a53313a62_705856.bin
10
+ ```
11
+
12
+ You'll get the output like this:
13
+
14
+ ```
15
+ End params (recursion verification key): [592082644, 914832686, 2098567393, 2326800689, 2139187838, 4177631951, 1218871476, 1805766682]
16
+ Basic program (verification key): [2515378349, 4234595854, 3925512183, 4162864624, 1989541961, 1232249954, 1448623067, 1605092683]
17
+ Public input (per block): [2820680802, 124999842, 2275559499, 200691927, 3104886037, 3143080570, 941459835, 587801584]
18
+ ```
19
+
20
+ The first 2 things are verification keys (for recursion and for the 'basic' program).
21
+ In theory they should be always 'constant' (and you should build the program + recursion program and check that they match).
22
+
23
+ The last entry (public input), would differ for each block, and it represents the hash of the commitment to the block (that contains information like new & old state roots etc).
24
+
25
+
26
+ ## Additional options
27
+
28
+ You can pass `--output_layouts_dir` to output the created setup files to a new directory.
29
+
30
+ You can also run with `--use-existing-layout` to use pre-created layouts (which would make program run a lot faster).
31
+
32
+
33
+ # Wasm
34
+
35
+ ```shell
36
+ cargo install wasm-bindgen-cli
37
+ ```
38
+
39
+ ```shell
40
+ RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack build --target web --no-opt
41
+ ```
@@ -0,0 +1,3 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function verify_stark(data: Uint8Array): Array<any>;
@@ -0,0 +1,5 @@
1
+ import * as wasm from "./ethproofs_verifier_lib_bg.wasm";
2
+ export * from "./ethproofs_verifier_lib_bg.js";
3
+ import { __wbg_set_wasm } from "./ethproofs_verifier_lib_bg.js";
4
+ __wbg_set_wasm(wasm);
5
+ wasm.__wbindgen_start();
@@ -0,0 +1,86 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ let cachedUint8ArrayMemory0 = null;
8
+
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
15
+
16
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
+
18
+ cachedTextDecoder.decode();
19
+
20
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
21
+ let numBytesDecoded = 0;
22
+ function decodeText(ptr, len) {
23
+ numBytesDecoded += len;
24
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
25
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
26
+ cachedTextDecoder.decode();
27
+ numBytesDecoded = len;
28
+ }
29
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
+ }
31
+
32
+ function getStringFromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ return decodeText(ptr, len);
35
+ }
36
+
37
+ let WASM_VECTOR_LEN = 0;
38
+
39
+ function passArray8ToWasm0(arg, malloc) {
40
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
41
+ getUint8ArrayMemory0().set(arg, ptr / 1);
42
+ WASM_VECTOR_LEN = arg.length;
43
+ return ptr;
44
+ }
45
+ /**
46
+ * @param {Uint8Array} data
47
+ * @returns {Array<any>}
48
+ */
49
+ export function verify_stark(data) {
50
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
51
+ const len0 = WASM_VECTOR_LEN;
52
+ const ret = wasm.verify_stark(ptr0, len0);
53
+ return ret;
54
+ }
55
+
56
+ export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
57
+ throw new Error(getStringFromWasm0(arg0, arg1));
58
+ };
59
+
60
+ export function __wbg_new_e17d9f43105b08be() {
61
+ const ret = new Array();
62
+ return ret;
63
+ };
64
+
65
+ export function __wbg_push_df81a39d04db858c(arg0, arg1) {
66
+ const ret = arg0.push(arg1);
67
+ return ret;
68
+ };
69
+
70
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
71
+ // Cast intrinsic for `Ref(String) -> Externref`.
72
+ const ret = getStringFromWasm0(arg0, arg1);
73
+ return ret;
74
+ };
75
+
76
+ export function __wbindgen_init_externref_table() {
77
+ const table = wasm.__wbindgen_externrefs;
78
+ const offset = table.grow(4);
79
+ table.set(0, undefined);
80
+ table.set(offset + 0, undefined);
81
+ table.set(offset + 1, null);
82
+ table.set(offset + 2, true);
83
+ table.set(offset + 3, false);
84
+ ;
85
+ };
86
+
@@ -0,0 +1,7 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const verify_stark: (a: number, b: number) => any;
5
+ export const __wbindgen_externrefs: WebAssembly.Table;
6
+ export const __wbindgen_malloc: (a: number, b: number) => number;
7
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "ethproofs_verifier",
3
+ "type": "module",
4
+ "version": "0.1.0",
5
+ "files": [
6
+ "ethproofs_verifier_lib_bg.wasm",
7
+ "ethproofs_verifier_lib.js",
8
+ "ethproofs_verifier_lib_bg.js",
9
+ "ethproofs_verifier_lib.d.ts"
10
+ ],
11
+ "main": "ethproofs_verifier_lib.js",
12
+ "types": "ethproofs_verifier_lib.d.ts",
13
+ "sideEffects": [
14
+ "./ethproofs_verifier_lib.js",
15
+ "./snippets/*"
16
+ ]
17
+ }