@effectstream/solana-node 0.103.0 → 0.103.2

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
@@ -6,7 +6,7 @@ cluster for local development. Downloads a pinned build into
6
6
  `vendor/bin/solana-test-validator` on first use so the orchestrator can boot it
7
7
  without each developer installing the Solana CLI.
8
8
 
9
- - Pinned Agave release, verified by SHA-256 before it is ever executed.
9
+ - Pinned Agave release (3.0.14), verified by SHA-256 before it is ever executed.
10
10
  - Exposes a `solana-node` bin plus a programmatic `run()`.
11
11
  - Consumed by `@effectstream/sync`'s `SolanaFetcher` via JSON-RPC on `:8899`.
12
12
  - Used by the orchestrator's `launchSolana` step for end-to-end local testing.
@@ -58,11 +58,14 @@ so this package hashes the **extracted binary** and refuses to run anything that
58
58
  isn't one of the pinned official builds. Set `SOLANA_NODE_SKIP_CHECKSUM=1` to
59
59
  bypass when deliberately testing a locally-built validator.
60
60
 
61
- Regenerate the digests whenever the pinned version changes:
61
+ Digests live in `checksums.js` and the check itself is
62
+ `@effectstream/binary-checksum`, shared with the other verified wrappers.
62
63
 
63
- ```bash
64
- shasum -a 256 packages/binaries/solana-node/vendor/bin/solana-test-validator
65
- ```
64
+ These three digests are **self-recorded**: they were hashed from a download on a
65
+ maintainer's machine, which pins the artifact against later mutation but does not
66
+ attest that it was correct to begin with. Regenerating them through
67
+ `scripts/generate-binary-checksums.ts`, so an Agave-published checksum backs them
68
+ the way bitcoin-core and the Grafana wrappers now are, is open work.
66
69
 
67
70
  ## Networking
68
71
 
package/checksums.js ADDED
@@ -0,0 +1,25 @@
1
+ // NOT a generated file, unlike the other `checksums.js` in packages/binaries.
2
+ //
3
+ // These three digests predate `scripts/generate-binary-checksums.ts` and are
4
+ // preserved verbatim from the original hand-recorded table. They are deliberately
5
+ // NOT relabelled 'upstream-verified': that claim means the archive was matched
6
+ // against a checksum the vendor publishes, and nobody has done that for these.
7
+ // Their real provenance is "recorded from a download on one maintainer's machine",
8
+ // which pins the artifact against later mutation and attests nothing about origin.
9
+ //
10
+ // Regenerating them through the script, so Agave's published sums actually back
11
+ // them, is worthwhile follow-up work. Until then this file states what is known
12
+ // rather than implying more.
13
+ export const CHECKSUM_VERSION = '3.0.14';
14
+
15
+ export const CHECKSUMS = {
16
+ 'linux-x64': '80f3bc0e3fa6a3090e69bafbfe00b249eaa655c5874ac83aebb6acdb157140ab',
17
+ 'darwin-x64': '2a4a5ad21f7cd50021fa55948710ee2f3559d9cccf95f7a31094e45c27023b52',
18
+ 'darwin-arm64': 'ab00c9a189341ef61402efce1a27713bb1b0ffb941715cea56ed5aa133992fe1',
19
+ };
20
+
21
+ export const CHECKSUM_PROVENANCE = {
22
+ 'linux-x64': 'self-recorded',
23
+ 'darwin-x64': 'self-recorded',
24
+ 'darwin-arm64': 'self-recorded',
25
+ };
package/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import BinWrapper from '@xhmikosr/bin-wrapper';
2
+ import { verifyBinaryChecksum } from '@effectstream/binary-checksum';
3
+ import { CHECKSUMS } from './checksums.js';
2
4
  import path from 'node:path';
3
5
  import { fileURLToPath } from 'node:url';
4
6
  import { spawn } from 'node:child_process';
5
- import crypto from 'node:crypto';
6
7
  import fs from 'node:fs';
7
8
  import os from 'node:os';
8
9
 
@@ -56,58 +57,23 @@ const bin = new BinWrapper()
56
57
 
57
58
  export default bin;
58
59
 
59
- /**
60
- * SHA-256 of the extracted `solana-test-validator` in each published v3.0.14
61
- * asset. bin-wrapper has no integrity support and discards the archive after
62
- * extracting, so this verifies the binary we are about to execute rather than
63
- * the tarball. Regenerate on every `version` bump with:
64
- *
65
- * shasum -a 256 packages/binaries/solana-node/vendor/bin/solana-test-validator
66
- *
67
- * Deliberately matched as a SET rather than by `os.arch()`. Asset selection goes
68
- * through bin-wrapper -> os-filter-obj -> arch, and the reported architecture
69
- * has not always agreed with `os.arch()`: arch@2.x had no notion of arm64 at all
70
- * (`darwin` was hardcoded to 'x64'), which is why every Mac used to download the
71
- * x86_64 build and run it under Rosetta. The root `overrides` now force arch@3,
72
- * so selection is correct today — but membership in the pinned set is immune to
73
- * that class of mismatch (including deliberate emulation) while still proving
74
- * the binary is one of the three official builds, which is the property that
75
- * matters here.
76
- */
77
- const CHECKSUMS = {
78
- 'linux-x64': '80f3bc0e3fa6a3090e69bafbfe00b249eaa655c5874ac83aebb6acdb157140ab',
79
- 'darwin-x64': '2a4a5ad21f7cd50021fa55948710ee2f3559d9cccf95f7a31094e45c27023b52',
80
- 'darwin-arm64': 'ab00c9a189341ef61402efce1a27713bb1b0ffb941715cea56ed5aa133992fe1',
81
- };
82
-
83
60
  /**
84
61
  * Fail closed if the downloaded validator isn't one of the builds we pinned.
85
- * Set SOLANA_NODE_SKIP_CHECKSUM=1 to bypass when intentionally testing a
86
- * locally-built validator.
62
+ * Digests live in ./checksums.js. Set SOLANA_NODE_SKIP_CHECKSUM=1 to bypass when
63
+ * intentionally testing a locally-built validator.
64
+ *
65
+ * The set-membership rationale (rather than a lookup by `os.arch()`) now lives
66
+ * with the shared helper in @effectstream/binary-checksum, since it applies to
67
+ * every wrapper and not just this one.
87
68
  */
88
69
  function verifyChecksum(binaryPath) {
89
- if (process.env.SOLANA_NODE_SKIP_CHECKSUM === '1') {
90
- console.warn('[solana-node] checksum verification skipped (SOLANA_NODE_SKIP_CHECKSUM=1)');
91
- return;
92
- }
93
- const actual = crypto
94
- .createHash('sha256')
95
- .update(fs.readFileSync(binaryPath))
96
- .digest('hex');
97
-
98
- const match = Object.entries(CHECKSUMS).find(([, digest]) => digest === actual);
99
- if (!match) {
100
- throw new Error(
101
- `[solana-node] checksum mismatch for ${binaryPath}\n` +
102
- ` got ${actual}\n` +
103
- ` expected one of:\n` +
104
- Object.entries(CHECKSUMS)
105
- .map(([platform, digest]) => ` ${digest} (${platform})`)
106
- .join('\n') +
107
- `\nThis is not a pinned v${version} build. Refusing to run it.`,
108
- );
109
- }
110
- return match[0];
70
+ return verifyBinaryChecksum({
71
+ binaryPath,
72
+ checksums: CHECKSUMS,
73
+ packageName: 'solana-node',
74
+ skipEnvVar: 'SOLANA_NODE_SKIP_CHECKSUM',
75
+ version,
76
+ });
111
77
  }
112
78
 
113
79
  export async function run(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectstream/solana-node",
3
- "version": "0.103.0",
3
+ "version": "0.103.2",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "start": "node index.js"
11
11
  },
12
12
  "dependencies": {
13
+ "@effectstream/binary-checksum": "0.103.2",
13
14
  "@xhmikosr/bin-wrapper": "^5.0.0"
14
15
  },
15
16
  "homepage": "https://effectstream.github.io/docs/",