@lodestar/native 1.52.0-dev.6ab73fec0a → 1.52.0-dev.8bada2d599
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 +5 -4
- package/package.json +27 -16
- package/src/bindings.js +8 -1
- package/src/metrics.d.ts +1 -1
package/README.md
CHANGED
|
@@ -22,10 +22,11 @@ pnpm build
|
|
|
22
22
|
pnpm test:native
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
For native-only changes, rebuild with `pnpm build:native`.
|
|
26
|
-
`bindings/zig-out/lib/bindings
|
|
27
|
-
`pnpm --filter @lodestar/native prepare-
|
|
28
|
-
|
|
25
|
+
For native-only changes, rebuild with `pnpm build:native`. It builds one addon per preset
|
|
26
|
+
into `bindings/zig-out/lib/bindings-<preset>.node`, and `LODESTAR_PRESET` selects which one
|
|
27
|
+
is loaded (default `mainnet`). Use `pnpm --filter @lodestar/native prepare-mainnet`,
|
|
28
|
+
`prepare-minimal` or `prepare-gnosis` to rebuild a single preset. Do not run them
|
|
29
|
+
concurrently; they share an intermediate output file.
|
|
29
30
|
|
|
30
31
|
Bindings use their own Vitest configuration and the root workspace lockfile.
|
|
31
32
|
Consensus spec vectors are pinned in [`build.zig.zon`](../build.zig.zon).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodestar/native",
|
|
3
|
-
"version": "1.52.0-dev.
|
|
3
|
+
"version": "1.52.0-dev.8bada2d599",
|
|
4
4
|
"description": "Native consensus modules for Lodestar",
|
|
5
5
|
"files": [
|
|
6
6
|
"src/"
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"prepare-mainnet": "
|
|
45
|
-
"prepare-minimal": "
|
|
46
|
-
"prepare-gnosis": "
|
|
44
|
+
"prepare-mainnet": "zapi build --variant mainnet --optimize ReleaseSafe --zig-cwd .. --prefix bindings/zig-out",
|
|
45
|
+
"prepare-minimal": "zapi build --variant minimal --optimize ReleaseSafe --zig-cwd .. --prefix bindings/zig-out",
|
|
46
|
+
"prepare-gnosis": "zapi build --variant gnosis --optimize ReleaseSafe --zig-cwd .. --prefix bindings/zig-out",
|
|
47
47
|
"lint": "biome check",
|
|
48
48
|
"test": "NODE_OPTIONS='--expose-gc' vitest run",
|
|
49
49
|
"benchmark": "NODE_OPTIONS='--import tsx' benchmark 'perf/**/*.test.ts' --isolate --config .benchrc.yaml --defaultBranch unstable",
|
|
50
|
-
"build": "pnpm run prepare
|
|
51
|
-
"build:watch": "
|
|
50
|
+
"build": "pnpm run prepare-mainnet && pnpm run prepare-minimal && pnpm run prepare-gnosis",
|
|
51
|
+
"build:watch": "preset=${LODESTAR_PRESET:-mainnet} && mkdir -p zig-out/lib && ln -sf bindings.node zig-out/lib/bindings-$preset.node && cd .. && zig build build-lib:bindings -Doptimize=ReleaseSafe -Dcpu=baseline -Dpreset=$preset --prefix bindings/zig-out --watch",
|
|
52
52
|
"build:release": "pnpm clean && pnpm build",
|
|
53
53
|
"clean": "rm -rf zig-out",
|
|
54
|
-
"check-build": "node -e \"import('./src/index.js')\"",
|
|
54
|
+
"check-build": "for preset in mainnet minimal gnosis; do LODESTAR_PRESET=$preset node -e \"import('./src/index.js')\" || exit 1; done",
|
|
55
55
|
"prepack": "zapi prepublish --main-only"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [],
|
|
@@ -72,10 +72,21 @@
|
|
|
72
72
|
"x86_64-apple-darwin",
|
|
73
73
|
"x86_64-unknown-linux-gnu",
|
|
74
74
|
"x86_64-unknown-linux-musl"
|
|
75
|
-
]
|
|
75
|
+
],
|
|
76
|
+
"variants": {
|
|
77
|
+
"mainnet": [
|
|
78
|
+
"-Dpreset=mainnet"
|
|
79
|
+
],
|
|
80
|
+
"minimal": [
|
|
81
|
+
"-Dpreset=minimal"
|
|
82
|
+
],
|
|
83
|
+
"gnosis": [
|
|
84
|
+
"-Dpreset=gnosis"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
76
87
|
},
|
|
77
88
|
"dependencies": {
|
|
78
|
-
"@chainsafe/zapi": "4.
|
|
89
|
+
"@chainsafe/zapi": "4.5.0"
|
|
79
90
|
},
|
|
80
91
|
"devDependencies": {
|
|
81
92
|
"@chainsafe/benchmark": "2.1.0",
|
|
@@ -84,13 +95,13 @@
|
|
|
84
95
|
"publishConfig": {
|
|
85
96
|
"access": "public"
|
|
86
97
|
},
|
|
87
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "9308984e0392a846c15163406d3d471b30557cfb",
|
|
88
99
|
"optionalDependencies": {
|
|
89
|
-
"@lodestar/native-aarch64-apple-darwin": "1.52.0-dev.
|
|
90
|
-
"@lodestar/native-aarch64-unknown-linux-gnu": "1.52.0-dev.
|
|
91
|
-
"@lodestar/native-aarch64-unknown-linux-musl": "1.52.0-dev.
|
|
92
|
-
"@lodestar/native-x86_64-apple-darwin": "1.52.0-dev.
|
|
93
|
-
"@lodestar/native-x86_64-unknown-linux-gnu": "1.52.0-dev.
|
|
94
|
-
"@lodestar/native-x86_64-unknown-linux-musl": "1.52.0-dev.
|
|
100
|
+
"@lodestar/native-aarch64-apple-darwin": "1.52.0-dev.8bada2d599",
|
|
101
|
+
"@lodestar/native-aarch64-unknown-linux-gnu": "1.52.0-dev.8bada2d599",
|
|
102
|
+
"@lodestar/native-aarch64-unknown-linux-musl": "1.52.0-dev.8bada2d599",
|
|
103
|
+
"@lodestar/native-x86_64-apple-darwin": "1.52.0-dev.8bada2d599",
|
|
104
|
+
"@lodestar/native-x86_64-unknown-linux-gnu": "1.52.0-dev.8bada2d599",
|
|
105
|
+
"@lodestar/native-x86_64-unknown-linux-musl": "1.52.0-dev.8bada2d599"
|
|
95
106
|
}
|
|
96
107
|
}
|
package/src/bindings.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import {join} from "node:path";
|
|
2
2
|
import {requireNapiLibrary} from "@chainsafe/zapi";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// Consensus presets are compiled into the addon, so there is one binary per preset.
|
|
5
|
+
// The selection mirrors `ACTIVE_PRESET` in `@lodestar/params`.
|
|
6
|
+
const presets = ["mainnet", "minimal", "gnosis"];
|
|
7
|
+
const preset = process.env.LODESTAR_PRESET;
|
|
8
|
+
|
|
9
|
+
const bindings = requireNapiLibrary(join(import.meta.dirname, ".."), {
|
|
10
|
+
variant: preset !== undefined && presets.includes(preset) ? preset : "mainnet",
|
|
11
|
+
});
|
|
5
12
|
|
|
6
13
|
export default bindings;
|
package/src/metrics.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare function registerLocalValidator(index: number): void;
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Remove a validator index from the native validator monitor, so its
|
|
15
|
-
* `
|
|
15
|
+
* `lodestar_validator_monitor_*` status metrics stop being recorded. Mirrors the pruning
|
|
16
16
|
* of stale registrations in lodestar's validator monitor.
|
|
17
17
|
*/
|
|
18
18
|
export declare function unregisterLocalValidator(index: number): void;
|