@effectstream/orchestrator 0.100.15 → 0.100.17
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 +20 -13
- package/package.json +5 -4
- package/scripts/launch-celestia.ts +67 -0
- package/scripts/launch-evm.ts +43 -3
- package/scripts/launch-midnight.ts +26 -0
package/README.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# @effectstream/orchestrator
|
|
2
2
|
|
|
3
3
|
A multi-chain local development environment for EffectStream. One CLI
|
|
4
|
-
starts every dependency a template needs
|
|
4
|
+
starts every dependency a template needs - Postgres / PgLite, Hardhat,
|
|
5
5
|
contracts, Bitcoin Core, Midnight node + indexer + proof server,
|
|
6
6
|
Cardano-side services, Avail node + light client, NEAR sandbox,
|
|
7
|
-
Celestia, plus the EffectStream sync + runtime + batcher
|
|
7
|
+
Celestia, plus the EffectStream sync + runtime + batcher - in the right
|
|
8
8
|
order, with health checks.
|
|
9
9
|
|
|
10
|
+
- One CLI that starts every dependency a template needs: DB, chains, sync, runtime, batcher.
|
|
11
|
+
- Dependency-graph aware: runs in parallel where it can, sequential where it must.
|
|
12
|
+
- Disable any chain with `DISABLE_EVM=true`, `DISABLE_BITCOIN=true`, ...
|
|
13
|
+
- Used by every template in this repo and by the E2E runner.
|
|
14
|
+
|
|
10
15
|
## Install
|
|
11
16
|
|
|
12
17
|
```bash
|
|
@@ -64,8 +69,10 @@ export const config: OrchestratorConfig = {
|
|
|
64
69
|
|
|
65
70
|
Common chain launchers ship as subpath scripts you can compose: `./launch-pglite`,
|
|
66
71
|
`./launch-evm`, `./launch-bitcoin`, `./launch-cardano`, `./launch-midnight`,
|
|
67
|
-
`./launch-avail`, `./launch-near`. Each wraps a pinned binary from
|
|
68
|
-
|
|
72
|
+
`./launch-avail`, `./launch-near`. Each wraps a pinned binary from a
|
|
73
|
+
package under `packages/binaries/` (e.g. `@effectstream/npm-midnight-node`,
|
|
74
|
+
`@effectstream/bitcoin-core`, `@effectstream/near-sandbox`) with sensible
|
|
75
|
+
defaults.
|
|
69
76
|
|
|
70
77
|
> **Tip:** Disable chains you don't need with env vars: `DISABLE_EVM=true`,
|
|
71
78
|
> `DISABLE_BITCOIN=true`, `DISABLE_MIDNIGHT=true`, etc. Same flags work for
|
|
@@ -90,27 +97,27 @@ Global flags:
|
|
|
90
97
|
## Inside EffectStream
|
|
91
98
|
|
|
92
99
|
Every template under
|
|
93
|
-
[`templates/`](https://github.com/
|
|
100
|
+
[`templates/`](https://github.com/effectstream/effectstream/tree/main/templates)
|
|
94
101
|
defines an `orchestrator.config.ts` (or `.json`) and starts dev with one
|
|
95
102
|
command. The E2E runner at
|
|
96
|
-
[`e2e/runner.ts`](https://github.com/
|
|
103
|
+
[`e2e/runner.ts`](https://github.com/effectstream/effectstream/blob/main/e2e/runner.ts)
|
|
97
104
|
is the same machinery, serialised across nine chain suites.
|
|
98
105
|
|
|
99
106
|
## Key subpath exports
|
|
100
107
|
|
|
101
|
-
- `@effectstream/orchestrator/config`
|
|
102
|
-
- `@effectstream/orchestrator/resolve-package`
|
|
103
|
-
- `@effectstream/orchestrator/launch-pglite`, `./launch-evm`, `./launch-bitcoin`, `./launch-cardano`, `./launch-midnight`, `./launch-avail`, `./launch-near`
|
|
104
|
-
- `@effectstream/orchestrator/wait-tcp`, `./wait-http`
|
|
108
|
+
- `@effectstream/orchestrator/config` - `OrchestratorConfig`, `ProcessConfig` types.
|
|
109
|
+
- `@effectstream/orchestrator/resolve-package` - resolve a package's bin to an absolute path (used by launcher scripts).
|
|
110
|
+
- `@effectstream/orchestrator/launch-pglite`, `./launch-evm`, `./launch-bitcoin`, `./launch-cardano`, `./launch-midnight`, `./launch-avail`, `./launch-near` - opinionated launcher scripts for each chain.
|
|
111
|
+
- `@effectstream/orchestrator/wait-tcp`, `./wait-http` - readiness-check helpers.
|
|
105
112
|
|
|
106
113
|
## Examples
|
|
107
114
|
|
|
108
|
-
- Templates: every directory under [`templates/`](https://github.com/
|
|
109
|
-
- E2E: [`e2e/`](https://github.com/
|
|
115
|
+
- Templates: every directory under [`templates/`](https://github.com/effectstream/effectstream/tree/main/templates) ships a working orchestrator config.
|
|
116
|
+
- E2E: [`e2e/`](https://github.com/effectstream/effectstream/tree/main/e2e) drives the orchestrator under the hood.
|
|
110
117
|
|
|
111
118
|
Runnable: [`test/examples.test.ts`](./test/examples.test.ts).
|
|
112
119
|
|
|
113
120
|
## Links
|
|
114
121
|
|
|
115
122
|
- Docs: https://effectstream.github.io/docs/packages/tools/orchestrator
|
|
116
|
-
- Source: https://github.com/
|
|
123
|
+
- Source: https://github.com/effectstream/effectstream/tree/main/packages/build-tools/orchestrator
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectstream/orchestrator",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://effectstream.github.io/docs/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
8
|
+
"url": "https://github.com/effectstream/effectstream",
|
|
9
9
|
"directory": "packages/build-tools/orchestrator"
|
|
10
10
|
},
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/
|
|
12
|
+
"url": "https://github.com/effectstream/effectstream/issues"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
"./config": "./src/config.ts",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"./launch-cardano": "./scripts/launch-cardano.ts",
|
|
21
21
|
"./launch-midnight": "./scripts/launch-midnight.ts",
|
|
22
22
|
"./launch-avail": "./scripts/launch-avail.ts",
|
|
23
|
+
"./launch-celestia": "./scripts/launch-celestia.ts",
|
|
23
24
|
"./launch-near": "./scripts/launch-near.ts",
|
|
24
25
|
"./wait-tcp": "./scripts/wait-tcp.ts",
|
|
25
26
|
"./wait-http": "./scripts/wait-http.ts"
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"start": "bun src/cli.ts start"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@effectstream/db": "0.100.
|
|
35
|
+
"@effectstream/db": "0.100.17"
|
|
35
36
|
},
|
|
36
37
|
"description": "Multi-chain local development environment for EffectStream"
|
|
37
38
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ProcessConfig } from "../src/config.ts";
|
|
2
|
+
import { resolvePackageDir, type ResolveLocation } from "./resolve-package.ts";
|
|
3
|
+
|
|
4
|
+
export const CelestiaNames = {
|
|
5
|
+
CLEAN: "celestia-clean",
|
|
6
|
+
DEVNET: "celestia-devnet",
|
|
7
|
+
BRIDGE_WAIT: "celestia-bridge-wait",
|
|
8
|
+
FUND: "celestia-fund-bridge",
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
const REQUIRED_SCRIPTS = {
|
|
12
|
+
"celestia-bridge:start": "Start the Celestia consensus node + bridge",
|
|
13
|
+
"celestia-bridge:wait": "Wait for the Celestia bridge RPC to be ready",
|
|
14
|
+
"celestia-fund:bridge": "Fund the bridge node wallet with tokens",
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export function launchCelestia(
|
|
18
|
+
packageName: string,
|
|
19
|
+
location: ResolveLocation,
|
|
20
|
+
opts?: { ports?: number[]; home?: string },
|
|
21
|
+
): ProcessConfig[] {
|
|
22
|
+
const cwd = resolvePackageDir("launchCelestia", packageName, location, REQUIRED_SCRIPTS);
|
|
23
|
+
const ports = opts?.ports ?? [26657, 26658];
|
|
24
|
+
const home = opts?.home ?? "/tmp/celestia-home";
|
|
25
|
+
|
|
26
|
+
const cleanScript =
|
|
27
|
+
`await import('fs').then(fs => { try { fs.rmSync('${home}', { recursive: true, force: true }); } catch {} }); console.log('Celestia home cleaned');`;
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
name: CelestiaNames.CLEAN,
|
|
32
|
+
description: "Remove stale Celestia devnet data",
|
|
33
|
+
args: ["-e", cleanScript],
|
|
34
|
+
waitToExit: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: CelestiaNames.DEVNET,
|
|
38
|
+
description: `Celestia consensus node + bridge (${packageName} celestia-bridge:start)`,
|
|
39
|
+
cwd,
|
|
40
|
+
stopProcessAtPort: ports,
|
|
41
|
+
args: ["run", "celestia-bridge:start"],
|
|
42
|
+
env: { CELESTIA_HOME: home, CELESTIA_FORCE_NO_BBR: "1" },
|
|
43
|
+
waitToExit: false,
|
|
44
|
+
critical: true,
|
|
45
|
+
silent: true,
|
|
46
|
+
dependsOn: [CelestiaNames.CLEAN],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: CelestiaNames.BRIDGE_WAIT,
|
|
50
|
+
description: `Wait for Celestia bridge RPC (${packageName} celestia-bridge:wait)`,
|
|
51
|
+
cwd,
|
|
52
|
+
args: ["run", "celestia-bridge:wait"],
|
|
53
|
+
waitToExit: true,
|
|
54
|
+
dependsOn: [CelestiaNames.DEVNET],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: CelestiaNames.FUND,
|
|
58
|
+
description: `Fund the Celestia bridge wallet (${packageName} celestia-fund:bridge)`,
|
|
59
|
+
cwd,
|
|
60
|
+
args: ["run", "celestia-fund:bridge"],
|
|
61
|
+
env: { CELESTIA_HOME: home },
|
|
62
|
+
waitToExit: true,
|
|
63
|
+
critical: true,
|
|
64
|
+
dependsOn: [CelestiaNames.BRIDGE_WAIT],
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
}
|
package/scripts/launch-evm.ts
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
1
2
|
import type { ProcessConfig } from "../src/config.ts";
|
|
2
3
|
import { resolvePackageDir, type ResolveLocation } from "./resolve-package.ts";
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Foundry's `forge` is required to compile the EVM contracts (the mod builder
|
|
7
|
+
* derives the TypeScript bindings from the Forge artifacts). It is a system
|
|
8
|
+
* toolchain, not an npm dependency, so verify it is on PATH up front and stop
|
|
9
|
+
* with an actionable message instead of letting `build:forge` die with a
|
|
10
|
+
* cryptic "command not found" (exit 127) mid-run.
|
|
11
|
+
*/
|
|
12
|
+
function assertForgeInstalled(): void {
|
|
13
|
+
const found = spawnSync("forge", ["--version"], { stdio: "ignore" });
|
|
14
|
+
if (found.status === 0) return;
|
|
15
|
+
throw new Error(
|
|
16
|
+
[
|
|
17
|
+
"",
|
|
18
|
+
"Foundry's `forge` was not found on your PATH, but it is required to compile the EVM contracts.",
|
|
19
|
+
"",
|
|
20
|
+
" Install Foundry from: https://www.getfoundry.sh/",
|
|
21
|
+
"",
|
|
22
|
+
" (quick install) curl -L https://foundry.paradigm.xyz | bash && foundryup",
|
|
23
|
+
"",
|
|
24
|
+
].join("\n"),
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
4
28
|
export const EvmNames = {
|
|
5
29
|
HARDHAT: "hardhat",
|
|
6
30
|
HARDHAT_WAIT: "hardhat-wait",
|
|
7
31
|
COMPILE: "compile-evm-contracts",
|
|
32
|
+
COMPILE_FORGE: "compile-evm-contracts-forge",
|
|
8
33
|
DEPLOY: "deploy-evm-contracts",
|
|
9
34
|
GENERATE_MOD: "generate-evm-mod",
|
|
10
35
|
} as const;
|
|
@@ -13,6 +38,7 @@ const REQUIRED_SCRIPTS = {
|
|
|
13
38
|
"chain:start": "Start the Hardhat node (e.g. `bun ./node_modules/.bin/hardhat node`)",
|
|
14
39
|
"chain:wait": "Wait for the Hardhat node to be ready (e.g. `bun ./node_modules/.bin/hardhat node wait`)",
|
|
15
40
|
"build:hardhat": "Compile Solidity contracts with Hardhat (e.g. `hardhat compile`)",
|
|
41
|
+
"build:forge": "Compile Solidity contracts with Forge (e.g. `forge build`) — produces the artifacts the mod builder reads",
|
|
16
42
|
"deploy": "Deploy compiled contracts to the running chain (e.g. via Hardhat Ignition)",
|
|
17
43
|
} as const;
|
|
18
44
|
|
|
@@ -22,6 +48,7 @@ export function launchEvm(
|
|
|
22
48
|
opts?: { ports?: number[] },
|
|
23
49
|
): ProcessConfig[] {
|
|
24
50
|
const cwd = resolvePackageDir("launchEvm", packageName, location, REQUIRED_SCRIPTS);
|
|
51
|
+
assertForgeInstalled();
|
|
25
52
|
const ports = opts?.ports ?? [8545, 8546];
|
|
26
53
|
|
|
27
54
|
return [
|
|
@@ -44,12 +71,25 @@ export function launchEvm(
|
|
|
44
71
|
},
|
|
45
72
|
{
|
|
46
73
|
name: EvmNames.COMPILE,
|
|
47
|
-
description: `Compile Solidity contracts (${packageName} build:hardhat)`,
|
|
74
|
+
description: `Compile Solidity contracts with Hardhat (${packageName} build:hardhat)`,
|
|
48
75
|
cwd,
|
|
49
76
|
args: ["run", "build:hardhat"],
|
|
50
77
|
waitToExit: true,
|
|
51
78
|
critical: true,
|
|
52
79
|
},
|
|
80
|
+
{
|
|
81
|
+
// Serialized after Hardhat: both scripts rewrite the shared remappings.txt,
|
|
82
|
+
// so running them concurrently would race. The mod builder reads only the
|
|
83
|
+
// Forge artifacts (build/artifacts/forge), so this step is required for the
|
|
84
|
+
// TypeScript bindings to be generated.
|
|
85
|
+
name: EvmNames.COMPILE_FORGE,
|
|
86
|
+
description: `Compile Solidity contracts with Forge (${packageName} build:forge)`,
|
|
87
|
+
cwd,
|
|
88
|
+
args: ["run", "build:forge"],
|
|
89
|
+
waitToExit: true,
|
|
90
|
+
critical: true,
|
|
91
|
+
dependsOn: [EvmNames.COMPILE],
|
|
92
|
+
},
|
|
53
93
|
{
|
|
54
94
|
name: EvmNames.DEPLOY,
|
|
55
95
|
description: `Deploy contracts to the running chain (${packageName} deploy)`,
|
|
@@ -63,10 +103,10 @@ export function launchEvm(
|
|
|
63
103
|
name: EvmNames.GENERATE_MOD,
|
|
64
104
|
description: `Generate TypeScript bindings from deployed contracts (${packageName})`,
|
|
65
105
|
cwd,
|
|
66
|
-
args: ["-e", "
|
|
106
|
+
args: ["-e", "await import('@effectstream/evm-hardhat/builder')"],
|
|
67
107
|
waitToExit: true,
|
|
68
108
|
critical: true,
|
|
69
|
-
dependsOn: [EvmNames.DEPLOY],
|
|
109
|
+
dependsOn: [EvmNames.DEPLOY, EvmNames.COMPILE_FORGE],
|
|
70
110
|
},
|
|
71
111
|
];
|
|
72
112
|
}
|
|
@@ -1,6 +1,31 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
1
2
|
import type { ProcessConfig } from "../src/config.ts";
|
|
2
3
|
import { resolvePackageDir, type ResolveLocation } from "./resolve-package.ts";
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Midnight's `compact` compiler is required to compile the Compact contracts
|
|
7
|
+
* (the midnight-contract:deploy step). It is a system toolchain, not an npm
|
|
8
|
+
* dependency, so verify it is on PATH up front and stop with an actionable
|
|
9
|
+
* message instead of failing with a cryptic "command not found" mid-deploy.
|
|
10
|
+
* Install tips mirror .github/Dockerfile.
|
|
11
|
+
*/
|
|
12
|
+
function assertCompactInstalled(): void {
|
|
13
|
+
const found = spawnSync("compact", ["--version"], { stdio: "ignore" });
|
|
14
|
+
if (found.status === 0) return;
|
|
15
|
+
throw new Error(
|
|
16
|
+
[
|
|
17
|
+
"",
|
|
18
|
+
"Midnight's `compact` compiler was not found on your PATH, but it is required to compile the Midnight contracts.",
|
|
19
|
+
"",
|
|
20
|
+
" Install Compact from: https://github.com/midnightntwrk/compact",
|
|
21
|
+
"",
|
|
22
|
+
" (quick install) curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh",
|
|
23
|
+
" compact update 0.30.0",
|
|
24
|
+
"",
|
|
25
|
+
].join("\n"),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
4
29
|
export const MidnightNames = {
|
|
5
30
|
NODE: "midnight-node",
|
|
6
31
|
NODE_WAIT: "midnight-node-wait",
|
|
@@ -30,6 +55,7 @@ export function launchMidnight(
|
|
|
30
55
|
},
|
|
31
56
|
): ProcessConfig[] {
|
|
32
57
|
const cwd = resolvePackageDir("launchMidnight", packageName, location, REQUIRED_SCRIPTS);
|
|
58
|
+
assertCompactInstalled();
|
|
33
59
|
const deployEnv: Record<string, string> = {};
|
|
34
60
|
if (opts?.env?.MIDNIGHT_STORAGE_PASSWORD) {
|
|
35
61
|
deployEnv.MIDNIGHT_STORAGE_PASSWORD = opts.env.MIDNIGHT_STORAGE_PASSWORD;
|