@lodestar/native 1.51.0-dev.fb216e169a → 1.52.0-dev.47827ac6f8

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 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`. The output is
26
- `bindings/zig-out/lib/bindings.node`. Use
27
- `pnpm --filter @lodestar/native prepare-minimal` or `prepare-gnosis` to select another
28
- preset. Rebuild before switching presets; they share an output directory.
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.51.0-dev.fb216e169a",
3
+ "version": "1.52.0-dev.47827ac6f8",
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": "cd .. && zig build build-lib:bindings -Doptimize=ReleaseSafe -Dcpu=baseline -Dpreset=mainnet --prefix bindings/zig-out",
45
- "prepare-minimal": "cd .. && zig build build-lib:bindings -Doptimize=ReleaseSafe -Dcpu=baseline -Dpreset=minimal --prefix bindings/zig-out",
46
- "prepare-gnosis": "cd .. && zig build build-lib:bindings -Doptimize=ReleaseSafe -Dcpu=baseline -Dpreset=gnosis --prefix bindings/zig-out",
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-${LODESTAR_PRESET:-mainnet}",
51
- "build:watch": "pnpm run 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.3.0"
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": "b81476f744c1ac8b7cc16d6fa42f23b77eb0eb0f",
98
+ "gitHead": "646ce54a70d1f60280751689e4ff4e1bd9a69947",
88
99
  "optionalDependencies": {
89
- "@lodestar/native-aarch64-apple-darwin": "1.51.0-dev.fb216e169a",
90
- "@lodestar/native-aarch64-unknown-linux-gnu": "1.51.0-dev.fb216e169a",
91
- "@lodestar/native-aarch64-unknown-linux-musl": "1.51.0-dev.fb216e169a",
92
- "@lodestar/native-x86_64-apple-darwin": "1.51.0-dev.fb216e169a",
93
- "@lodestar/native-x86_64-unknown-linux-gnu": "1.51.0-dev.fb216e169a",
94
- "@lodestar/native-x86_64-unknown-linux-musl": "1.51.0-dev.fb216e169a"
100
+ "@lodestar/native-aarch64-apple-darwin": "1.52.0-dev.47827ac6f8",
101
+ "@lodestar/native-aarch64-unknown-linux-gnu": "1.52.0-dev.47827ac6f8",
102
+ "@lodestar/native-aarch64-unknown-linux-musl": "1.52.0-dev.47827ac6f8",
103
+ "@lodestar/native-x86_64-apple-darwin": "1.52.0-dev.47827ac6f8",
104
+ "@lodestar/native-x86_64-unknown-linux-gnu": "1.52.0-dev.47827ac6f8",
105
+ "@lodestar/native-x86_64-unknown-linux-musl": "1.52.0-dev.47827ac6f8"
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
- const bindings = requireNapiLibrary(join(import.meta.dirname, ".."));
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
- * `validator_monitor_*` status metrics stop being recorded. Mirrors the pruning
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;