@cartesi/cli 2.0.0-alpha.14 → 2.0.0-alpha.16
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/dist/base.d.ts +1 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +11 -4
- package/dist/builder/directory.d.ts +1 -1
- package/dist/builder/directory.d.ts.map +1 -1
- package/dist/builder/directory.js +4 -2
- package/dist/builder/docker.d.ts +1 -1
- package/dist/builder/docker.d.ts.map +1 -1
- package/dist/builder/docker.js +31 -29
- package/dist/builder/empty.d.ts +1 -1
- package/dist/builder/empty.d.ts.map +1 -1
- package/dist/builder/none.d.ts +1 -1
- package/dist/builder/none.d.ts.map +1 -1
- package/dist/builder/tar.d.ts +1 -1
- package/dist/builder/tar.d.ts.map +1 -1
- package/dist/commands/build.d.ts +3 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +73 -37
- package/dist/commands/deposit/erc20.d.ts +1 -2
- package/dist/commands/deposit/erc20.d.ts.map +1 -1
- package/dist/commands/deposit/erc20.js +2 -3
- package/dist/commands/deposit/erc721.d.ts +1 -3
- package/dist/commands/deposit/erc721.d.ts.map +1 -1
- package/dist/commands/deposit/erc721.js +0 -1
- package/dist/commands/deposit/ether.d.ts +1 -1
- package/dist/commands/deposit/ether.d.ts.map +1 -1
- package/dist/commands/deposit/ether.js +0 -1
- package/dist/commands/deposit.js +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +3 -1
- package/dist/commands/run.js +1 -1
- package/dist/commands/send.js +2 -2
- package/dist/commands/shell.d.ts +2 -2
- package/dist/commands/shell.d.ts.map +1 -1
- package/dist/commands/shell.js +24 -19
- package/dist/compose/docker-compose-explorer.yaml +9 -5
- package/dist/config.d.ts +25 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +70 -21
- package/dist/exec/cartesi-machine.d.ts.map +1 -1
- package/dist/exec/cartesi-machine.js +3 -5
- package/dist/exec/genext2fs.d.ts +4 -1
- package/dist/exec/genext2fs.d.ts.map +1 -1
- package/dist/exec/genext2fs.js +5 -5
- package/dist/exec/index.d.ts +0 -1
- package/dist/exec/index.d.ts.map +1 -1
- package/dist/exec/index.js +0 -1
- package/dist/exec/rollups.js +1 -1
- package/dist/exec/util.d.ts +0 -15
- package/dist/exec/util.d.ts.map +1 -1
- package/dist/exec/util.js +0 -45
- package/dist/machine.d.ts +7 -1
- package/dist/machine.d.ts.map +1 -1
- package/dist/machine.js +22 -15
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +2 -3
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +1 -1
- package/package.json +3 -3
- package/dist/exec/crane.d.ts +0 -15
- package/dist/exec/crane.d.ts.map +0 -1
- package/dist/exec/crane.js +0 -17
|
@@ -39,7 +39,7 @@ configs:
|
|
|
39
39
|
|
|
40
40
|
services:
|
|
41
41
|
explorer_api:
|
|
42
|
-
image: cartesi/rollups-explorer-api:1.0.0
|
|
42
|
+
image: cartesi/rollups-explorer-api:1.0.0
|
|
43
43
|
environment:
|
|
44
44
|
<<: *explorer_db_env
|
|
45
45
|
GQL_PORT: 4350
|
|
@@ -50,8 +50,9 @@ services:
|
|
|
50
50
|
test:
|
|
51
51
|
[
|
|
52
52
|
"CMD",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
53
|
+
"wget",
|
|
54
|
+
"--spider",
|
|
55
|
+
"-q",
|
|
55
56
|
"http://127.0.0.1:4350/graphql?query=%7B__typename%7D",
|
|
56
57
|
]
|
|
57
58
|
start_period: 10s
|
|
@@ -64,7 +65,7 @@ services:
|
|
|
64
65
|
condition: service_healthy
|
|
65
66
|
|
|
66
67
|
squid_processor:
|
|
67
|
-
image: cartesi/rollups-explorer-api:1.0.0
|
|
68
|
+
image: cartesi/rollups-explorer-api:1.0.0
|
|
68
69
|
environment:
|
|
69
70
|
<<: *explorer_db_env
|
|
70
71
|
CHAIN_IDS: ${CARTESI_BLOCKCHAIN_ID:-13370}
|
|
@@ -77,7 +78,10 @@ services:
|
|
|
77
78
|
condition: service_healthy
|
|
78
79
|
|
|
79
80
|
explorer:
|
|
80
|
-
image: cartesi/rollups-explorer:1.
|
|
81
|
+
image: cartesi/rollups-explorer:1.2.0
|
|
82
|
+
environment:
|
|
83
|
+
NODE_RPC_URL: "http://127.0.0.1:${CARTESI_LISTEN_PORT:-6751}/anvil"
|
|
84
|
+
EXPLORER_API_URL: "http://127.0.0.1:${CARTESI_LISTEN_PORT:-6751}/explorer-api/graphql"
|
|
81
85
|
expose:
|
|
82
86
|
- 3000
|
|
83
87
|
depends_on:
|
package/dist/config.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export type DirectoryDriveConfig = {
|
|
|
48
48
|
};
|
|
49
49
|
export type DockerDriveConfig = {
|
|
50
50
|
builder: "docker";
|
|
51
|
+
buildArgs: string[];
|
|
51
52
|
context: string;
|
|
52
53
|
dockerfile: string;
|
|
53
54
|
extraSize: number;
|
|
@@ -81,13 +82,12 @@ export type MachineConfig = {
|
|
|
81
82
|
assertRollingTemplate?: boolean;
|
|
82
83
|
bootargs: string[];
|
|
83
84
|
entrypoint?: string;
|
|
84
|
-
finalHash: boolean;
|
|
85
|
-
interactive?: boolean;
|
|
86
85
|
maxMCycle?: bigint;
|
|
87
86
|
noRollup?: boolean;
|
|
88
87
|
ramLength: string;
|
|
89
|
-
ramImage
|
|
90
|
-
|
|
88
|
+
ramImage?: string;
|
|
89
|
+
useDockerEnv: boolean;
|
|
90
|
+
useDockerWorkdir: boolean;
|
|
91
91
|
user?: string;
|
|
92
92
|
};
|
|
93
93
|
export type Config = {
|
|
@@ -95,10 +95,30 @@ export type Config = {
|
|
|
95
95
|
machine: MachineConfig;
|
|
96
96
|
sdk: string;
|
|
97
97
|
};
|
|
98
|
+
type TomlTable = {
|
|
99
|
+
[key: string]: TomlPrimitive;
|
|
100
|
+
};
|
|
98
101
|
export declare const defaultRootDriveConfig: () => DriveConfig;
|
|
99
102
|
export declare const defaultMachineConfig: () => MachineConfig;
|
|
100
103
|
export declare const defaultConfig: () => Config;
|
|
101
104
|
export declare const getDriveFormat: (filename: string) => DriveFormat;
|
|
102
|
-
export declare const parse: (str: string) => Config;
|
|
105
|
+
export declare const parse: (str: string[]) => Config;
|
|
106
|
+
/**
|
|
107
|
+
* Recursively merges two TOML table objects
|
|
108
|
+
* Values from 'other' take precedence over 'base'
|
|
109
|
+
*
|
|
110
|
+
* @param base - The base TOML table
|
|
111
|
+
* @param other - The TOML table to merge into base (takes precedence)
|
|
112
|
+
* @returns A new merged TOML table
|
|
113
|
+
*/
|
|
114
|
+
export declare function mergeTomlTables(base: TomlTable, other: TomlTable): TomlTable;
|
|
115
|
+
/**
|
|
116
|
+
* Merges two TOML values of any type
|
|
117
|
+
*
|
|
118
|
+
* @param base - The base TOML value
|
|
119
|
+
* @param other - The TOML value to merge into base (takes precedence)
|
|
120
|
+
* @returns The merged TOML value
|
|
121
|
+
*/
|
|
122
|
+
export declare function mergeTomlValues(base: TomlPrimitive, other: TomlPrimitive): TomlPrimitive;
|
|
103
123
|
export {};
|
|
104
124
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAEnE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,aAAa;CAIrC;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBAClC,MAAM,EAAE,aAAa;CAIpC;AAED,qBAAa,4BAA6B,SAAQ,KAAK;gBACvC,MAAM,EAAE,aAAa;CAIpC;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gB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,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CAAC;AAElD,eAAO,MAAM,sBAAsB,QAAO,WAQxC,CAAC;AAEH,eAAO,MAAM,oBAAoB,QAAO,aAUtC,CAAC;AAEH,eAAO,MAAM,aAAa,QAAO,MAI/B,CAAC;AA+LH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,WAUjD,CAAC;AA4GF,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,EAAE,KAAG,MAgBrC,CAAC;AAcF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,CAgB5E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC3B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,aAAa,GACrB,aAAa,CAQf"}
|
package/dist/config.js
CHANGED
|
@@ -63,12 +63,12 @@ export class InvalidStringArrayError extends Error {
|
|
|
63
63
|
*/
|
|
64
64
|
const DEFAULT_FORMAT = "ext2";
|
|
65
65
|
const DEFAULT_RAM = "128Mi";
|
|
66
|
-
const DEFAULT_RAM_IMAGE = "/usr/share/cartesi-machine/images/linux.bin";
|
|
67
66
|
export const DEFAULT_SDK_VERSION = "0.12.0-alpha.20";
|
|
68
67
|
export const DEFAULT_SDK_IMAGE = "cartesi/sdk";
|
|
69
68
|
export const PREFERRED_PORT = 6751;
|
|
70
69
|
export const defaultRootDriveConfig = () => ({
|
|
71
70
|
builder: "docker",
|
|
71
|
+
buildArgs: [],
|
|
72
72
|
context: ".",
|
|
73
73
|
dockerfile: "Dockerfile", // file on current working directory
|
|
74
74
|
extraSize: 0,
|
|
@@ -79,13 +79,11 @@ export const defaultMachineConfig = () => ({
|
|
|
79
79
|
assertRollingTemplate: undefined,
|
|
80
80
|
bootargs: [],
|
|
81
81
|
entrypoint: undefined,
|
|
82
|
-
finalHash: true,
|
|
83
|
-
interactive: undefined,
|
|
84
82
|
maxMCycle: undefined,
|
|
85
83
|
noRollup: undefined,
|
|
86
84
|
ramLength: DEFAULT_RAM,
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
useDockerEnv: true,
|
|
86
|
+
useDockerWorkdir: true,
|
|
89
87
|
user: undefined,
|
|
90
88
|
});
|
|
91
89
|
export const defaultConfig = () => ({
|
|
@@ -252,15 +250,15 @@ const parseMachine = (value) => {
|
|
|
252
250
|
}
|
|
253
251
|
const toml = value;
|
|
254
252
|
return {
|
|
255
|
-
assertRollingTemplate: parseOptionalBoolean(toml
|
|
256
|
-
bootargs: parseStringArray(toml.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
253
|
+
assertRollingTemplate: parseOptionalBoolean(toml.assert_rolling_template),
|
|
254
|
+
bootargs: parseStringArray(toml.boot_args),
|
|
255
|
+
entrypoint: parseOptionalString(toml.entrypoint),
|
|
256
|
+
maxMCycle: parseOptionalNumber(toml.max_mcycle),
|
|
257
|
+
noRollup: parseBoolean(toml.no_rollup, false),
|
|
258
|
+
ramLength: parseString(toml.ram_length, DEFAULT_RAM),
|
|
259
|
+
ramImage: parseOptionalString(toml.ram_image),
|
|
260
|
+
useDockerEnv: parseBoolean(toml.use_docker_env, true),
|
|
261
|
+
useDockerWorkdir: parseBoolean(toml.use_docker_workdir, true),
|
|
264
262
|
user: parseOptionalString(toml.user),
|
|
265
263
|
};
|
|
266
264
|
};
|
|
@@ -279,10 +277,10 @@ const parseDrive = (drive) => {
|
|
|
279
277
|
const builder = parseBuilder(drive.builder);
|
|
280
278
|
switch (builder) {
|
|
281
279
|
case "directory": {
|
|
282
|
-
const {
|
|
280
|
+
const { extra_size, format, mount, directory, shared, user } = drive;
|
|
283
281
|
return {
|
|
284
282
|
builder: "directory",
|
|
285
|
-
extraSize: parseBytes(
|
|
283
|
+
extraSize: parseBytes(extra_size, 0),
|
|
286
284
|
format: parseFormat(format),
|
|
287
285
|
mount: parseOptionalStringBoolean(mount),
|
|
288
286
|
directory: parseRequiredString(directory, "directory"),
|
|
@@ -291,13 +289,14 @@ const parseDrive = (drive) => {
|
|
|
291
289
|
};
|
|
292
290
|
}
|
|
293
291
|
case "docker": {
|
|
294
|
-
const { context, dockerfile,
|
|
292
|
+
const { build_args, context, dockerfile, extra_size, format, image, mount, shared, tags, target, user, } = drive;
|
|
295
293
|
return {
|
|
296
294
|
builder: "docker",
|
|
295
|
+
buildArgs: parseStringArray(build_args),
|
|
297
296
|
image: parseOptionalString(image),
|
|
298
297
|
context: parseString(context, "."),
|
|
299
298
|
dockerfile: parseString(dockerfile, "Dockerfile"),
|
|
300
|
-
extraSize: parseBytes(
|
|
299
|
+
extraSize: parseBytes(extra_size, 0),
|
|
301
300
|
format: parseFormat(format),
|
|
302
301
|
mount: parseOptionalStringBoolean(mount),
|
|
303
302
|
shared: parseOptionalBoolean(shared),
|
|
@@ -318,10 +317,10 @@ const parseDrive = (drive) => {
|
|
|
318
317
|
};
|
|
319
318
|
}
|
|
320
319
|
case "tar": {
|
|
321
|
-
const {
|
|
320
|
+
const { extra_size, filename, format, mount, shared, user } = drive;
|
|
322
321
|
return {
|
|
323
322
|
builder: "tar",
|
|
324
|
-
extraSize: parseBytes(
|
|
323
|
+
extraSize: parseBytes(extra_size, 0),
|
|
325
324
|
filename: parseRequiredString(filename, "filename"),
|
|
326
325
|
format: parseFormat(format),
|
|
327
326
|
mount: parseOptionalStringBoolean(mount),
|
|
@@ -359,7 +358,10 @@ const parseDrives = (config) => {
|
|
|
359
358
|
return drives;
|
|
360
359
|
};
|
|
361
360
|
export const parse = (str) => {
|
|
362
|
-
|
|
361
|
+
let toml = {};
|
|
362
|
+
for (const s of str) {
|
|
363
|
+
toml = mergeTomlTables(toml, parseToml(s));
|
|
364
|
+
}
|
|
363
365
|
const config = {
|
|
364
366
|
drives: parseDrives(toml.drives),
|
|
365
367
|
machine: parseMachine(toml.machine),
|
|
@@ -367,3 +369,50 @@ export const parse = (str) => {
|
|
|
367
369
|
};
|
|
368
370
|
return config;
|
|
369
371
|
};
|
|
372
|
+
/**
|
|
373
|
+
* Checks if a value is a plain object (TOML table)
|
|
374
|
+
*/
|
|
375
|
+
function isTomlTable(value) {
|
|
376
|
+
return (typeof value === "object" &&
|
|
377
|
+
value !== null &&
|
|
378
|
+
!Array.isArray(value) &&
|
|
379
|
+
!("toISOString" in value)); // Check for TomlDate (has toISOString method)
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Recursively merges two TOML table objects
|
|
383
|
+
* Values from 'other' take precedence over 'base'
|
|
384
|
+
*
|
|
385
|
+
* @param base - The base TOML table
|
|
386
|
+
* @param other - The TOML table to merge into base (takes precedence)
|
|
387
|
+
* @returns A new merged TOML table
|
|
388
|
+
*/
|
|
389
|
+
export function mergeTomlTables(base, other) {
|
|
390
|
+
const result = { ...base };
|
|
391
|
+
for (const [key, otherValue] of Object.entries(other)) {
|
|
392
|
+
const baseValue = result[key];
|
|
393
|
+
// If both values are tables, merge them recursively
|
|
394
|
+
if (isTomlTable(baseValue) && isTomlTable(otherValue)) {
|
|
395
|
+
result[key] = mergeTomlTables(baseValue, otherValue);
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
// For all other cases, other value takes precedence
|
|
399
|
+
result[key] = otherValue;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return result;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Merges two TOML values of any type
|
|
406
|
+
*
|
|
407
|
+
* @param base - The base TOML value
|
|
408
|
+
* @param other - The TOML value to merge into base (takes precedence)
|
|
409
|
+
* @returns The merged TOML value
|
|
410
|
+
*/
|
|
411
|
+
export function mergeTomlValues(base, other) {
|
|
412
|
+
// If both are tables, merge recursively
|
|
413
|
+
if (isTomlTable(base) && isTomlTable(other)) {
|
|
414
|
+
return mergeTomlTables(base, other);
|
|
415
|
+
}
|
|
416
|
+
// For arrays, replaces entirely
|
|
417
|
+
return other;
|
|
418
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cartesi-machine.d.ts","sourceRoot":"","sources":["../../src/exec/cartesi-machine.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"cartesi-machine.d.ts","sourceRoot":"","sources":["../../src/exec/cartesi-machine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAEH,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAClC,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,eAAe,OAAuB,CAAC;AAEpD,eAAO,MAAM,IAAI,GACb,MAAM,SAAS,MAAM,EAAE,EACvB,SAAS,0BAA0B;;;GACmB,CAAC;AAE3D,eAAO,MAAM,OAAO,GAChB,UAAU,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAgBvB,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parse, Range } from "semver";
|
|
2
2
|
import { execaDockerFallback, } from "./util.js";
|
|
3
3
|
export const requiredVersion = new Range("^0.19.0");
|
|
4
|
-
export const boot =
|
|
5
|
-
return execaDockerFallback("cartesi-machine", args, options);
|
|
6
|
-
};
|
|
4
|
+
export const boot = (args, options) => execaDockerFallback("cartesi-machine", args, options);
|
|
7
5
|
export const version = async (options) => {
|
|
8
6
|
const { image } = options || {};
|
|
9
7
|
try {
|
|
@@ -14,7 +12,7 @@ export const version = async (options) => {
|
|
|
14
12
|
}
|
|
15
13
|
return null;
|
|
16
14
|
}
|
|
17
|
-
catch
|
|
15
|
+
catch {
|
|
18
16
|
return null;
|
|
19
17
|
}
|
|
20
18
|
};
|
package/dist/exec/genext2fs.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ export declare const empty: (options: {
|
|
|
5
5
|
cwd?: string;
|
|
6
6
|
size: number;
|
|
7
7
|
output: string;
|
|
8
|
-
} & DockerFallbackOptions) => Promise<
|
|
8
|
+
} & DockerFallbackOptions) => Promise<import("execa").Result<import("execa").Options & {
|
|
9
|
+
image?: string;
|
|
10
|
+
forceDocker?: false;
|
|
11
|
+
}>>;
|
|
9
12
|
export declare const fromDirectory: (options: {
|
|
10
13
|
cwd?: string;
|
|
11
14
|
extraSize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genext2fs.d.ts","sourceRoot":"","sources":["../../src/exec/genext2fs.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"genext2fs.d.ts","sourceRoot":"","sources":["../../src/exec/genext2fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,KAAK,qBAAqB,EAAuB,MAAM,WAAW,CAAC;AAI5E,eAAO,MAAM,eAAe,EAAE,KAA2B,CAAC;AAU1D,eAAO,MAAM,KAAK,GACd,SAAS;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB;;;GAgB5B,CAAC;AAEF,eAAO,MAAM,aAAa,GACtB,SAAS;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB;;;GAS5B,CAAC;AAEF,eAAO,MAAM,OAAO,GAChB,SAAS;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB;;;GAS5B,CAAC;AAEF,eAAO,MAAM,OAAO,GAChB,UAAU,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAevB,CAAC"}
|
package/dist/exec/genext2fs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parse, Range } from "semver";
|
|
2
2
|
import { execaDockerFallback } from "./util.js";
|
|
3
3
|
const BLOCK_SIZE = 4096; // fixed at 4k
|
|
4
4
|
export const requiredVersion = new Range("^1.5.6");
|
|
@@ -9,10 +9,10 @@ const baseArgs = (options) => [
|
|
|
9
9
|
"--readjustment",
|
|
10
10
|
`+${options.extraBlocks}`,
|
|
11
11
|
];
|
|
12
|
-
export const empty =
|
|
12
|
+
export const empty = (options) => {
|
|
13
13
|
const { size, output } = options;
|
|
14
14
|
const blocks = Math.ceil(size / BLOCK_SIZE); // size in blocks
|
|
15
|
-
|
|
15
|
+
return execaDockerFallback("xgenext2fs", [
|
|
16
16
|
"--block-size",
|
|
17
17
|
BLOCK_SIZE.toString(),
|
|
18
18
|
"--faketime",
|
|
@@ -21,12 +21,12 @@ export const empty = async (options) => {
|
|
|
21
21
|
output,
|
|
22
22
|
], options);
|
|
23
23
|
};
|
|
24
|
-
export const fromDirectory =
|
|
24
|
+
export const fromDirectory = (options) => {
|
|
25
25
|
const { cwd, extraSize, image, input, output } = options;
|
|
26
26
|
const extraBlocks = Math.ceil(extraSize / BLOCK_SIZE);
|
|
27
27
|
return execaDockerFallback("xgenext2fs", [...baseArgs({ extraBlocks }), "--root", input, output], { cwd, image });
|
|
28
28
|
};
|
|
29
|
-
export const fromTar =
|
|
29
|
+
export const fromTar = (options) => {
|
|
30
30
|
const { cwd, extraSize, image, input, output } = options;
|
|
31
31
|
const extraBlocks = Math.ceil(extraSize / BLOCK_SIZE);
|
|
32
32
|
return execaDockerFallback("xgenext2fs", [...baseArgs({ extraBlocks }), "--tarball", input, output], { cwd, image });
|
package/dist/exec/index.d.ts
CHANGED
package/dist/exec/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exec/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exec/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC"}
|
package/dist/exec/index.js
CHANGED
package/dist/exec/rollups.js
CHANGED
package/dist/exec/util.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Options } from "execa";
|
|
2
|
-
import { type SpawnSyncOptions } from "node:child_process";
|
|
3
2
|
export type DockerFallbackOptions = {
|
|
4
3
|
image: string;
|
|
5
4
|
forceDocker: true;
|
|
@@ -19,18 +18,4 @@ export declare const execaDockerFallback: (command: string, args: readonly strin
|
|
|
19
18
|
image?: string;
|
|
20
19
|
forceDocker?: false;
|
|
21
20
|
}>>;
|
|
22
|
-
/**
|
|
23
|
-
* Calls spawnSync and falls back to docker run if command (on the host) fails
|
|
24
|
-
* @param command command to be executed
|
|
25
|
-
* @param args arguments to be passed to the command
|
|
26
|
-
* @param options execution options
|
|
27
|
-
* @returns return of execa
|
|
28
|
-
*/
|
|
29
|
-
export type SpawnOptionsDockerFallback = SpawnSyncOptions & DockerFallbackOptions;
|
|
30
|
-
export declare const spawnSyncDockerFallback: (command: string, args: readonly string[], options: SpawnOptionsDockerFallback) => import("child_process").SpawnSyncReturns<string | Buffer<ArrayBufferLike>> | {
|
|
31
|
-
error: {
|
|
32
|
-
code: string;
|
|
33
|
-
};
|
|
34
|
-
stdout: string;
|
|
35
|
-
};
|
|
36
21
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/exec/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/exec/util.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/exec/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AAGxD,MAAM,MAAM,qBAAqB,GAC3B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,IAAI,CAAA;CAAE,GACpC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,qBAAqB,CAAC;AACzE,eAAO,MAAM,mBAAmB,GAC5B,SAAS,MAAM,EACf,MAAM,SAAS,MAAM,EAAE,EACvB,SAAS,0BAA0B;YAbvB,MAAM;kBAAgB,KAAK;GA6C1C,CAAC"}
|
package/dist/exec/util.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ExecaError, execa } from "execa";
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
2
|
import os from "node:os";
|
|
4
3
|
export const execaDockerFallback = async (command, args, options) => {
|
|
5
4
|
try {
|
|
@@ -13,9 +12,6 @@ export const execaDockerFallback = async (command, args, options) => {
|
|
|
13
12
|
catch (error) {
|
|
14
13
|
if (error instanceof ExecaError) {
|
|
15
14
|
if (error.code === "ENOENT" && options.image) {
|
|
16
|
-
if (!options.forceDocker) {
|
|
17
|
-
console.warn(`error executing '${command}', falling back to docker execution using image '${options.image}'`);
|
|
18
|
-
}
|
|
19
15
|
const userInfo = os.userInfo();
|
|
20
16
|
const dockerOpts = [
|
|
21
17
|
"--volume",
|
|
@@ -29,48 +25,7 @@ export const execaDockerFallback = async (command, args, options) => {
|
|
|
29
25
|
];
|
|
30
26
|
return await execa("docker", ["run", ...dockerOpts, options.image, command, ...args], options);
|
|
31
27
|
}
|
|
32
|
-
console.error(`error executing '${command}'`, error);
|
|
33
28
|
}
|
|
34
29
|
throw error;
|
|
35
30
|
}
|
|
36
31
|
};
|
|
37
|
-
export const spawnSyncDockerFallback = (command, args, options) => {
|
|
38
|
-
const result = options.forceDocker
|
|
39
|
-
? { error: { code: "ENOENT" }, stdout: "" }
|
|
40
|
-
: spawnSync(command, args, options);
|
|
41
|
-
if (result.error) {
|
|
42
|
-
const code = result.error.code;
|
|
43
|
-
if (code === "ENOENT" && options.image) {
|
|
44
|
-
if (!options.forceDocker) {
|
|
45
|
-
console.warn(`error executing '${command}', falling back to docker execution using image '${options.image}'`);
|
|
46
|
-
}
|
|
47
|
-
const userInfo = os.userInfo();
|
|
48
|
-
const dockerOpts = [
|
|
49
|
-
"--volume",
|
|
50
|
-
`${options.cwd}:/work`,
|
|
51
|
-
"--workdir",
|
|
52
|
-
"/work",
|
|
53
|
-
"--interactive",
|
|
54
|
-
"--rm",
|
|
55
|
-
"--user",
|
|
56
|
-
`${userInfo.uid}:${userInfo.gid}`,
|
|
57
|
-
];
|
|
58
|
-
const dockerArgs = [
|
|
59
|
-
"run",
|
|
60
|
-
...dockerOpts,
|
|
61
|
-
options.image,
|
|
62
|
-
command,
|
|
63
|
-
...args,
|
|
64
|
-
];
|
|
65
|
-
const dockerResult = spawnSync("docker", dockerArgs, options);
|
|
66
|
-
if (dockerResult.error) {
|
|
67
|
-
console.error(`error executing '${command}'`, dockerResult.error);
|
|
68
|
-
throw dockerResult.error;
|
|
69
|
-
}
|
|
70
|
-
return dockerResult;
|
|
71
|
-
}
|
|
72
|
-
console.error(`error executing '${command}'`, result.error);
|
|
73
|
-
throw result.error;
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
};
|
package/dist/machine.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { Config, ImageInfo } from "./config.js";
|
|
2
|
-
|
|
2
|
+
import type { ExecaOptionsDockerFallback } from "./exec/util.js";
|
|
3
|
+
export type BootMachineOptions = {
|
|
4
|
+
finalHash?: boolean;
|
|
5
|
+
interactive?: boolean;
|
|
6
|
+
store?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const bootMachine: (config: Config, info: ImageInfo | undefined, bootOptions: BootMachineOptions, options?: ExecaOptionsDockerFallback) => Promise<import("execa").Result<import("execa").Options & {
|
|
3
9
|
image?: string;
|
|
4
10
|
forceDocker?: false;
|
|
5
11
|
}>>;
|
package/dist/machine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAmBjE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,WAAW,GACpB,QAAQ,MAAM,EACd,MAAM,SAAS,GAAG,SAAS,EAC3B,aAAa,kBAAkB,EAC/B,UAAU,0BAA0B;;;GA+FvC,CAAC"}
|
package/dist/machine.js
CHANGED
|
@@ -15,11 +15,11 @@ const flashDrive = (label, drive) => {
|
|
|
15
15
|
// don't specify start and length
|
|
16
16
|
return `--flash-drive=${vars.join(",")}`;
|
|
17
17
|
};
|
|
18
|
-
export const bootMachine =
|
|
18
|
+
export const bootMachine = (config, info, bootOptions, options) => {
|
|
19
19
|
const { machine } = config;
|
|
20
|
-
const { assertRollingTemplate,
|
|
20
|
+
const { assertRollingTemplate, maxMCycle, noRollup, ramLength, ramImage, useDockerEnv, useDockerWorkdir, user, } = machine;
|
|
21
21
|
// list of environment variables of docker image
|
|
22
|
-
const env = info?.env ?? [];
|
|
22
|
+
const env = useDockerEnv ? (info?.env ?? []) : [];
|
|
23
23
|
const envs = env.map((variable) => `--env=${variable}`);
|
|
24
24
|
// check if we need a rootfstype boot arg
|
|
25
25
|
const root = config.drives.root;
|
|
@@ -33,10 +33,15 @@ export const bootMachine = async (config, info, destination) => {
|
|
|
33
33
|
// bootargs from config string array
|
|
34
34
|
const bootargs = machine.bootargs.map((arg) => `--append-bootargs="${arg}"`);
|
|
35
35
|
// entrypoint from config or image info (Docker ENTRYPOINT + CMD)
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
let entrypoint;
|
|
37
|
+
if (machine.entrypoint) {
|
|
38
|
+
entrypoint = machine.entrypoint;
|
|
39
|
+
}
|
|
40
|
+
else if (info && (info.entrypoint.length > 0 || info.cmd.length > 0)) {
|
|
41
|
+
entrypoint = [...info.entrypoint, ...info.cmd].join(" ");
|
|
42
|
+
}
|
|
38
43
|
if (!entrypoint) {
|
|
39
|
-
throw new Error("Undefined machine entrypoint");
|
|
44
|
+
throw new Error("Undefined machine entrypoint. Please define an entrypoint in your cartesi.toml config or in your Dockerfile.");
|
|
40
45
|
}
|
|
41
46
|
const flashDrives = Object.entries(config.drives).map(([label, drive]) => flashDrive(label, drive));
|
|
42
47
|
// command to change working directory if WORKDIR is defined
|
|
@@ -44,20 +49,21 @@ export const bootMachine = async (config, info, destination) => {
|
|
|
44
49
|
...bootargs,
|
|
45
50
|
...envs,
|
|
46
51
|
...flashDrives,
|
|
47
|
-
`--ram-image=${ramImage}`,
|
|
48
52
|
`--ram-length=${ramLength}`,
|
|
49
|
-
`--append-entrypoint=${entrypoint}`,
|
|
50
53
|
];
|
|
54
|
+
if (ramImage) {
|
|
55
|
+
args.push(`--ram-image=${ramImage}`);
|
|
56
|
+
}
|
|
51
57
|
if (assertRollingTemplate) {
|
|
52
58
|
args.push("--assert-rolling-template");
|
|
53
59
|
}
|
|
54
|
-
if (finalHash) {
|
|
60
|
+
if (bootOptions.finalHash) {
|
|
55
61
|
args.push("--final-hash");
|
|
56
62
|
}
|
|
57
|
-
if (info?.workdir) {
|
|
63
|
+
if (useDockerWorkdir && info?.workdir) {
|
|
58
64
|
args.push(`--workdir="${info.workdir}"`);
|
|
59
65
|
}
|
|
60
|
-
if (interactive) {
|
|
66
|
+
if (bootOptions.interactive) {
|
|
61
67
|
args.push("-it");
|
|
62
68
|
}
|
|
63
69
|
if (noRollup) {
|
|
@@ -66,15 +72,16 @@ export const bootMachine = async (config, info, destination) => {
|
|
|
66
72
|
if (maxMCycle) {
|
|
67
73
|
args.push(`--max-mcycle=${maxMCycle.toString()}`);
|
|
68
74
|
}
|
|
69
|
-
if (store) {
|
|
70
|
-
args.push(`--store=${store}`);
|
|
75
|
+
if (bootOptions.store) {
|
|
76
|
+
args.push(`--store=${bootOptions.store}`);
|
|
71
77
|
}
|
|
72
78
|
if (user) {
|
|
73
79
|
args.push(`--user=${user}`);
|
|
74
80
|
}
|
|
81
|
+
args.push("--");
|
|
82
|
+
args.push(entrypoint);
|
|
75
83
|
return cartesiMachine.boot(args, {
|
|
76
|
-
cwd: destination,
|
|
77
84
|
image: config.sdk,
|
|
78
|
-
|
|
85
|
+
...options,
|
|
79
86
|
});
|
|
80
87
|
};
|
package/dist/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA6B,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACH,KAAK,OAA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C;AAEF,eAAO,MAAM,UAAU,GAAI,SAAS,EAChC,QAAQ,gBAAgB,CAAC,SAAS,CAAC,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,EACnE,UAAU,OAAO,GAAG,SAAS,KAC9B,OAAO,CAAC,SAAS,CAsBnB,CAAC;AAOF,eAAO,MAAM,SAAS,GACjB,KAAK;;gBAJM,MAAM;;;CAoBrB,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAU,SAAS;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,KAAG,OAAO,CAAC,OAAO,CAoBlB,CAAC"}
|
package/dist/prompts.js
CHANGED
|
@@ -91,7 +91,7 @@ export const abiParamsInput = async (config) => {
|
|
|
91
91
|
parseAbiParameters(value);
|
|
92
92
|
return true;
|
|
93
93
|
}
|
|
94
|
-
catch
|
|
94
|
+
catch {
|
|
95
95
|
return "Invalid ABI parameters";
|
|
96
96
|
}
|
|
97
97
|
},
|
|
@@ -121,7 +121,7 @@ export const abiParamsInput = async (config) => {
|
|
|
121
121
|
BigInt(value);
|
|
122
122
|
return true;
|
|
123
123
|
}
|
|
124
|
-
catch
|
|
124
|
+
catch {
|
|
125
125
|
return "Invalid number";
|
|
126
126
|
}
|
|
127
127
|
},
|
|
@@ -147,7 +147,6 @@ export const selectAuto = (config, context) => {
|
|
|
147
147
|
const list = config.discardDisabled
|
|
148
148
|
? choices.filter((c) => !(c instanceof Separator) && !c.disabled)
|
|
149
149
|
: choices;
|
|
150
|
-
const a = choices.filter((c) => c.type !== "separator");
|
|
151
150
|
if (list.length === 1) {
|
|
152
151
|
const choice = list[0];
|
|
153
152
|
if (!(choice instanceof Separator)) {
|