@effectstream/npm-midnight-node 0.104.1 → 0.200.1

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
@@ -5,7 +5,8 @@ NPM wrapper that downloads and runs the
5
5
  version on first invocation and exposes a `npm-midnight-node` CLI for
6
6
  the EffectStream orchestrator and templates.
7
7
 
8
- - Pinned Midnight node binary (1.0.0), downloaded on first run.
8
+ - Pinned Midnight node binary (`2.0.0-rc.4`), downloaded on first run.
9
+ - Native targets are `macos-arm64` and `linux-amd64`; no Linux arm64 asset is published.
9
10
  - `--dev` for a local node; `--clean-binaries` / `--only-clean` to manage the cache.
10
11
  - Consumed by `@effectstream/sync`'s `MidnightFetcher`.
11
12
  - Templates: `evm-midnight-v2`, `night-bitcoin`, `zswap-da`, `zk-cardano`.
package/binary.js CHANGED
@@ -4,7 +4,7 @@ const axios = require("axios");
4
4
  const extract = require("extract-zip");
5
5
  const path = require("path");
6
6
 
7
- const CURRENT_BINARY_VERSION = "1.0.0";
7
+ const CURRENT_BINARY_VERSION = "2.0.0-rc.4";
8
8
  const FINAL_BINARY_NAME = "midnight-node";
9
9
 
10
10
  /*
package/local-mock.json CHANGED
@@ -1,29 +1,17 @@
1
1
  [
2
2
  {
3
- "registrations": [
4
- {
5
- "name": "LocalValidator1",
6
- "aura_pub_key": "0xb606fc73f57f03cdb4c932d475ab426043e429cecc2ffff0d2672b0df8398c48",
7
- "grandpa_pub_key": "0xbf3a763d817cee09bf785b9cc6118f58dab5c03f3ace6d524899bcb28ac74f27",
8
- "sidechain_pub_key": "0x0333022898140662dfea847e3cbfe5e989845ac6766e83472f8b0c650d85e77bae",
9
- "mainchain_pub_key": "0xd5f64925e8722583ab9f8bb633a6938780873cf59504b3d12527719d3310b0ff",
10
- "mainchain_signature": "0x9e417ede1ab0d710ce3d5854627baef9b32d4dd69ec75f20d1f28234f167b3f679dadafce995fc63a05eefefa322ebe84b5ffccf526481710d086a16aef61506",
11
- "sidechain_signature": "0x568e305af7f6d51668a76f3aaa72aa3f0f3554be20f150dcabb759f8bff66b484bf66cf248916a40bda649b3ce302ecaf689b9c7b4abd66b44b2aeb039ff85a5",
12
- "registration_utxo": "ff428f8f916a832d146e58f3656c17c769a6bbc44bba1693fe2a4f9c605b8f16#0",
13
- "status": "Active"
14
- }
15
- ],
3
+ "registrations": [],
16
4
  "permissioned": [
17
5
  {
18
- "name": "LocalPermissioned1",
19
- "aura_pub_key": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
20
- "grandpa_pub_key": "0x88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee",
6
+ "name": "Alice",
21
7
  "sidechain_pub_key": "0x020a1091341fe5664bfa1782d5e04779689068c916b04cb365ec3153755684d9a1",
22
- "mainchain_pub_key": "0xd5f64925e8722583ab9f8bb633a6938780873cf59504b3d12527719d3310b0ff",
8
+ "mainchain_pub_key": "0xcef2d1630c034d3b9034eb7903d61f419a3074a1ad01d4550cc72f2b733de6e7",
23
9
  "mainchain_signature": "0x9e417ede1ab0d710ce3d5854627baef9b32d4dd69ec75f20d1f28234f167b3f679dadafce995fc63a05eefefa322ebe84b5ffccf526481710d086a16aef61506",
24
10
  "sidechain_signature": "0x568e305af7f6d51668a76f3aaa72aa3f0f3554be20f150dcabb759f8bff66b484bf66cf248916a40bda649b3ce302ecaf689b9c7b4abd66b44b2aeb039ff85a5",
25
- "registration_utxo": "ff428f8f916a832d146e58f3656c17c769a6bbc44bba1693fe2a4f9c605b8f16#1",
26
- "status": "Active"
11
+ "registration_utxo": "d3600cf1032b2f147d592332032975bc70aff78f78b5be96e4311c0b0b28d7d6#0",
12
+ "status": "Active",
13
+ "aura_pub_key": "d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
14
+ "grandpa_pub_key": "88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee"
27
15
  }
28
16
  ],
29
17
  "nonce": "0x1234",
@@ -33,4 +21,3 @@
33
21
  }
34
22
  }
35
23
  ]
36
-
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@effectstream/npm-midnight-node",
3
- "version": "0.104.1",
3
+ "version": "0.200.1",
4
4
  "description": "Downloads and starts the binary for Midnight Node",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
7
+ "test": "bun test run_midnight_node.test.js",
8
8
  "clean": "node index.js --clean-binaries",
9
9
  "clean-only": "node index.js --only-clean"
10
10
  },
@@ -23,7 +23,6 @@
23
23
  "url": "https://github.com/effectstream/effectstream/issues"
24
24
  },
25
25
  "supportedPlatforms": [
26
- "linux-arm64",
27
26
  "linux-amd64",
28
27
  "macos-arm64"
29
28
  ],
@@ -14,6 +14,9 @@ function applyDefaultEnv(env) {
14
14
  if (!("MOCK_REGISTRATIONS_FILE" in newEnv)) {
15
15
  newEnv.MOCK_REGISTRATIONS_FILE = path.join(__dirname, "local-mock.json");
16
16
  }
17
+ if (!("USE_MAIN_CHAIN_FOLLOWER_MOCK" in newEnv)) {
18
+ newEnv.USE_MAIN_CHAIN_FOLLOWER_MOCK = "true";
19
+ }
17
20
  return newEnv;
18
21
  }
19
22
 
@@ -58,4 +61,4 @@ function runMidnightNode(env = process.env, args = []) {
58
61
  return childProcess;
59
62
  }
60
63
 
61
- module.exports = { runMidnightNode };
64
+ module.exports = { applyDefaultEnv, runMidnightNode };
@@ -0,0 +1,35 @@
1
+ const { describe, expect, test } = require("bun:test");
2
+ const registrations = require("./local-mock.json");
3
+ const { applyDefaultEnv } = require("./run_midnight_node");
4
+
5
+ describe("midnight-node 2.x local defaults", () => {
6
+ test("enables the main-chain follower mock with its registrations file", () => {
7
+ const env = applyDefaultEnv({});
8
+ expect(env.USE_MAIN_CHAIN_FOLLOWER_MOCK).toBe("true");
9
+ expect(env.MOCK_REGISTRATIONS_FILE).toEndWith("local-mock.json");
10
+ expect(env.MC__SLOT_DURATION_MILLIS).toBe("1000");
11
+ });
12
+
13
+ test("does not override explicit caller settings", () => {
14
+ const env = applyDefaultEnv({
15
+ USE_MAIN_CHAIN_FOLLOWER_MOCK: "false",
16
+ MOCK_REGISTRATIONS_FILE: "/tmp/custom-registrations.json",
17
+ MC__SLOT_DURATION_MILLIS: "2500",
18
+ });
19
+ expect(env.USE_MAIN_CHAIN_FOLLOWER_MOCK).toBe("false");
20
+ expect(env.MOCK_REGISTRATIONS_FILE).toBe(
21
+ "/tmp/custom-registrations.json",
22
+ );
23
+ expect(env.MC__SLOT_DURATION_MILLIS).toBe("2500");
24
+ });
25
+
26
+ test("uses the rc.4 local-dev registration contract", () => {
27
+ expect(registrations).toHaveLength(1);
28
+ expect(registrations[0].registrations).toEqual([]);
29
+ expect(registrations[0].permissioned).toHaveLength(1);
30
+ expect(registrations[0].permissioned[0].name).toBe("Alice");
31
+ expect(registrations[0].permissioned[0].registration_utxo).toBe(
32
+ "d3600cf1032b2f147d592332032975bc70aff78f78b5be96e4311c0b0b28d7d6#0",
33
+ );
34
+ });
35
+ });