@cartesi/cli 2.0.0-alpha.2 → 2.0.0-alpha.20

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.
Files changed (170) hide show
  1. package/dist/base.d.ts +28 -0
  2. package/dist/base.d.ts.map +1 -0
  3. package/dist/base.js +109 -0
  4. package/dist/builder/directory.d.ts +2 -2
  5. package/dist/builder/directory.d.ts.map +1 -1
  6. package/dist/builder/directory.js +5 -3
  7. package/dist/builder/docker.d.ts +2 -2
  8. package/dist/builder/docker.d.ts.map +1 -1
  9. package/dist/builder/docker.js +39 -37
  10. package/dist/builder/empty.d.ts +1 -1
  11. package/dist/builder/empty.d.ts.map +1 -1
  12. package/dist/builder/empty.js +1 -1
  13. package/dist/builder/none.d.ts +1 -1
  14. package/dist/builder/none.d.ts.map +1 -1
  15. package/dist/builder/none.js +1 -1
  16. package/dist/builder/tar.d.ts +1 -1
  17. package/dist/builder/tar.d.ts.map +1 -1
  18. package/dist/builder/tar.js +1 -1
  19. package/dist/commands/address-book.d.ts +5 -8
  20. package/dist/commands/address-book.d.ts.map +1 -1
  21. package/dist/commands/address-book.js +18 -14
  22. package/dist/commands/build.d.ts +7 -11
  23. package/dist/commands/build.d.ts.map +1 -1
  24. package/dist/commands/build.js +82 -58
  25. package/dist/commands/clean.d.ts +2 -7
  26. package/dist/commands/clean.d.ts.map +1 -1
  27. package/dist/commands/clean.js +9 -10
  28. package/dist/commands/create.d.ts +6 -15
  29. package/dist/commands/create.d.ts.map +1 -1
  30. package/dist/commands/create.js +25 -54
  31. package/dist/commands/deploy/build.d.ts +2 -14
  32. package/dist/commands/deploy/build.d.ts.map +1 -1
  33. package/dist/commands/deploy/build.js +8 -61
  34. package/dist/commands/deploy.d.ts +3 -0
  35. package/dist/commands/deploy.d.ts.map +1 -0
  36. package/dist/commands/deploy.js +12 -0
  37. package/dist/commands/deposit/erc1155.d.ts +18 -0
  38. package/dist/commands/deposit/erc1155.d.ts.map +1 -0
  39. package/dist/commands/deposit/erc1155.js +254 -0
  40. package/dist/commands/deposit/erc20.d.ts +10 -0
  41. package/dist/commands/deposit/erc20.d.ts.map +1 -0
  42. package/dist/commands/deposit/erc20.js +125 -0
  43. package/dist/commands/deposit/erc721.d.ts +10 -0
  44. package/dist/commands/deposit/erc721.d.ts.map +1 -0
  45. package/dist/commands/deposit/erc721.js +143 -0
  46. package/dist/commands/deposit/ether.d.ts +10 -0
  47. package/dist/commands/deposit/ether.d.ts.map +1 -0
  48. package/dist/commands/deposit/ether.js +65 -0
  49. package/dist/commands/deposit.d.ts +9 -0
  50. package/dist/commands/deposit.d.ts.map +1 -0
  51. package/dist/commands/deposit.js +37 -0
  52. package/dist/commands/doctor.d.ts +2 -12
  53. package/dist/commands/doctor.d.ts.map +1 -1
  54. package/dist/commands/doctor.js +90 -91
  55. package/dist/commands/hash.d.ts +4 -9
  56. package/dist/commands/hash.d.ts.map +1 -1
  57. package/dist/commands/hash.js +14 -14
  58. package/dist/commands/logs.d.ts +9 -0
  59. package/dist/commands/logs.d.ts.map +1 -0
  60. package/dist/commands/logs.js +34 -0
  61. package/dist/commands/run.d.ts +14 -20
  62. package/dist/commands/run.d.ts.map +1 -1
  63. package/dist/commands/run.js +193 -182
  64. package/dist/commands/send.d.ts +10 -0
  65. package/dist/commands/send.d.ts.map +1 -0
  66. package/dist/commands/send.js +130 -0
  67. package/dist/commands/shell.d.ts +6 -14
  68. package/dist/commands/shell.d.ts.map +1 -1
  69. package/dist/commands/shell.js +34 -51
  70. package/dist/commands/status.d.ts +6 -0
  71. package/dist/commands/status.d.ts.map +1 -0
  72. package/dist/commands/status.js +50 -0
  73. package/dist/compose/default.env +36 -0
  74. package/dist/compose/docker-compose-anvil.yaml +39 -0
  75. package/dist/compose/docker-compose-bundler.yaml +71 -0
  76. package/dist/{node → compose}/docker-compose-database.yaml +4 -2
  77. package/dist/compose/docker-compose-explorer.yaml +96 -0
  78. package/dist/compose/docker-compose-graphql.yaml +38 -0
  79. package/dist/compose/docker-compose-node-cpus.yaml +6 -0
  80. package/dist/compose/docker-compose-node-memory.yaml +6 -0
  81. package/dist/compose/docker-compose-node.yaml +50 -0
  82. package/dist/compose/docker-compose-passkey-server.yaml +37 -0
  83. package/dist/compose/docker-compose-paymaster.yaml +40 -0
  84. package/dist/compose/docker-compose-proxy.yaml +24 -0
  85. package/dist/config.d.ts +30 -9
  86. package/dist/config.d.ts.map +1 -1
  87. package/dist/config.js +93 -53
  88. package/dist/contracts.d.ts +1695 -1636
  89. package/dist/contracts.d.ts.map +1 -1
  90. package/dist/contracts.js +632 -592
  91. package/dist/exec/cartesi-machine.d.ts +2 -2
  92. package/dist/exec/cartesi-machine.d.ts.map +1 -1
  93. package/dist/exec/cartesi-machine.js +3 -5
  94. package/dist/exec/genext2fs.d.ts +6 -3
  95. package/dist/exec/genext2fs.d.ts.map +1 -1
  96. package/dist/exec/genext2fs.js +5 -5
  97. package/dist/exec/index.d.ts +0 -1
  98. package/dist/exec/index.d.ts.map +1 -1
  99. package/dist/exec/index.js +0 -1
  100. package/dist/exec/mksquashfs.d.ts +2 -2
  101. package/dist/exec/mksquashfs.d.ts.map +1 -1
  102. package/dist/exec/mksquashfs.js +4 -2
  103. package/dist/exec/rollups.d.ts +105 -0
  104. package/dist/exec/rollups.d.ts.map +1 -0
  105. package/dist/exec/rollups.js +383 -0
  106. package/dist/exec/util.d.ts +1 -16
  107. package/dist/exec/util.d.ts.map +1 -1
  108. package/dist/exec/util.js +3 -50
  109. package/dist/index.d.ts +2 -1
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +57 -1
  112. package/dist/machine.d.ts +8 -2
  113. package/dist/machine.d.ts.map +1 -1
  114. package/dist/machine.js +26 -16
  115. package/dist/prompts.d.ts +13 -2
  116. package/dist/prompts.d.ts.map +1 -1
  117. package/dist/prompts.js +60 -26
  118. package/dist/template.d.ts +3 -0
  119. package/dist/template.d.ts.map +1 -0
  120. package/dist/template.js +16 -0
  121. package/dist/wallet.d.ts +9222 -21
  122. package/dist/wallet.d.ts.map +1 -1
  123. package/dist/wallet.js +35 -198
  124. package/package.json +39 -57
  125. package/bin/dev.cmd +0 -3
  126. package/bin/dev.js +0 -25
  127. package/bin/run.cmd +0 -3
  128. package/bin/run.js +0 -8
  129. package/dist/baseCommand.d.ts +0 -22
  130. package/dist/baseCommand.d.ts.map +0 -1
  131. package/dist/baseCommand.js +0 -92
  132. package/dist/commands/deploy/index.d.ts +0 -12
  133. package/dist/commands/deploy/index.d.ts.map +0 -1
  134. package/dist/commands/deploy/index.js +0 -78
  135. package/dist/commands/send/erc20.d.ts +0 -14
  136. package/dist/commands/send/erc20.d.ts.map +0 -1
  137. package/dist/commands/send/erc20.js +0 -70
  138. package/dist/commands/send/erc721.d.ts +0 -14
  139. package/dist/commands/send/erc721.d.ts.map +0 -1
  140. package/dist/commands/send/erc721.js +0 -73
  141. package/dist/commands/send/ether.d.ts +0 -13
  142. package/dist/commands/send/ether.d.ts.map +0 -1
  143. package/dist/commands/send/ether.js +0 -32
  144. package/dist/commands/send/generic.d.ts +0 -15
  145. package/dist/commands/send/generic.d.ts.map +0 -1
  146. package/dist/commands/send/generic.js +0 -119
  147. package/dist/commands/send/index.d.ts +0 -28
  148. package/dist/commands/send/index.d.ts.map +0 -1
  149. package/dist/commands/send/index.js +0 -102
  150. package/dist/exec/crane.d.ts +0 -15
  151. package/dist/exec/crane.d.ts.map +0 -1
  152. package/dist/exec/crane.js +0 -17
  153. package/dist/flags.d.ts +0 -17
  154. package/dist/flags.d.ts.map +0 -1
  155. package/dist/flags.js +0 -28
  156. package/dist/node/DockerfileDeploy.txt +0 -4
  157. package/dist/node/default.env +0 -27
  158. package/dist/node/docker-compose-anvil.yaml +0 -50
  159. package/dist/node/docker-compose-bundler.yaml +0 -57
  160. package/dist/node/docker-compose-envfile.yaml +0 -4
  161. package/dist/node/docker-compose-explorer.yaml +0 -88
  162. package/dist/node/docker-compose-host.yaml +0 -30
  163. package/dist/node/docker-compose-paymaster.yaml +0 -33
  164. package/dist/node/docker-compose-prompt.yaml +0 -17
  165. package/dist/node/docker-compose-proxy.yaml +0 -48
  166. package/dist/node/docker-compose-snapshot-volume.yaml +0 -8
  167. package/dist/node/docker-compose-validator-cpus.yaml +0 -6
  168. package/dist/node/docker-compose-validator-memory.yaml +0 -6
  169. package/dist/node/docker-compose-validator.yaml +0 -59
  170. package/oclif.manifest.json +0 -876
@@ -0,0 +1,130 @@
1
+ import { Command, Option } from "@commander-js/extra-typings";
2
+ import ora from "ora";
3
+ import { encodeAbiParameters, getAddress, isAddress, isHex, parseAbiParameters, stringToHex, } from "viem";
4
+ import { getProjectName } from "../base.js";
5
+ import { inputBoxAbi, inputBoxAddress } from "../contracts.js";
6
+ import { bytesInput, getInputApplicationAddress } from "../prompts.js";
7
+ import { connect } from "../wallet.js";
8
+ const getInput = async (input, options) => {
9
+ const { encoding } = options;
10
+ if (input) {
11
+ if (encoding === "hex") {
12
+ // validate if is a hex value
13
+ if (!isHex(input)) {
14
+ throw new Error("input encoded as hex must start with 0x");
15
+ }
16
+ return input;
17
+ }
18
+ if (encoding === "string") {
19
+ // encode UTF-8 string as hex
20
+ return stringToHex(input);
21
+ }
22
+ if (encoding === "abi") {
23
+ const abiParams = options.abiParams;
24
+ if (!abiParams) {
25
+ throw new Error("Undefined input-abi-params");
26
+ }
27
+ const abiParameters = parseAbiParameters(abiParams);
28
+ // TODO: decode values
29
+ const values = input.split(",").map((v, index) => {
30
+ if (index >= abiParameters.length) {
31
+ throw new Error(`Too many values, expected ${abiParameters.length} values based on --input-abi-params '${abiParams}', parsing value at index ${index} from input '${input}'`);
32
+ }
33
+ const param = abiParameters[index];
34
+ switch (param.type) {
35
+ case "string":
36
+ return v;
37
+ case "bool":
38
+ if (v === "true")
39
+ return true;
40
+ if (v === "false")
41
+ return false;
42
+ throw new Error(`Invalid boolean value: ${v}`);
43
+ case "uint":
44
+ case "uint8":
45
+ case "uint16":
46
+ case "uint32":
47
+ case "uint64":
48
+ case "uint128":
49
+ case "uint256":
50
+ try {
51
+ return BigInt(v);
52
+ }
53
+ catch {
54
+ throw new Error(`Invalid uint value: ${v}`);
55
+ }
56
+ case "bytes":
57
+ if (isHex(v)) {
58
+ return v;
59
+ }
60
+ throw new Error(`Invalid bytes value: ${v}`);
61
+ case "address":
62
+ if (isAddress(v)) {
63
+ return getAddress(v);
64
+ }
65
+ throw new Error(`Invalid address value: ${v}`);
66
+ default:
67
+ throw new Error(`Unsupported type ${param.type}`);
68
+ }
69
+ });
70
+ if (values.length !== abiParameters.length) {
71
+ throw new Error(`Not enough values, expected ${abiParameters.length} values based on --input-abi-params '${abiParams}', parsed ${values.length} values from input '${input}'`);
72
+ }
73
+ return encodeAbiParameters(abiParameters, values);
74
+ }
75
+ if (isHex(input)) {
76
+ // encoding not specified, if starts with 0x, assume hex
77
+ return input;
78
+ }
79
+ // encode UTF-8 string as hex
80
+ return stringToHex(input);
81
+ }
82
+ return undefined;
83
+ };
84
+ export const createSendCommand = () => {
85
+ const command = new Command("send")
86
+ .description("Send input to the application")
87
+ .argument("[input]", "input payload")
88
+ .option("--from <address>", "input sender address")
89
+ .option("--application <address>", "application address")
90
+ .addOption(new Option("--encoding <encoding>", "input encoding").choices([
91
+ "hex",
92
+ "string",
93
+ "abi",
94
+ ]))
95
+ .option("--abi-params <abi-params>", "input abi params")
96
+ .option("--project-name <string>", "name of project (used by docker compose and cartesi-rollups-node)")
97
+ .option("--rpc-url <url>", "RPC URL of the Cartesi Devnet")
98
+ .action(async (input, options) => {
99
+ const { application, from } = options;
100
+ const projectName = getProjectName(options);
101
+ // connect to anvil
102
+ const testClient = await connect(options);
103
+ // the input sender, impersonated
104
+ const account = from && isAddress(from)
105
+ ? getAddress(from)
106
+ : (await testClient.getAddresses())[0];
107
+ // get dapp address from local node, or ask
108
+ const applicationAddress = await getInputApplicationAddress({
109
+ application,
110
+ projectName,
111
+ });
112
+ const payload = (await getInput(input, options)) ||
113
+ (await bytesInput({
114
+ encoding: options.encoding,
115
+ message: "Input",
116
+ }));
117
+ const { request } = await testClient.simulateContract({
118
+ address: inputBoxAddress,
119
+ abi: inputBoxAbi,
120
+ account,
121
+ args: [applicationAddress, payload],
122
+ functionName: "addInput",
123
+ });
124
+ const hash = await testClient.writeContract(request);
125
+ const progress = ora("Sending input...").start();
126
+ await testClient.waitForTransactionReceipt({ hash });
127
+ progress.succeed(`Input sent: ${hash}`);
128
+ });
129
+ return command;
130
+ };
@@ -1,15 +1,7 @@
1
- import { BaseCommand } from "../baseCommand.js";
2
- export default class Shell extends BaseCommand<typeof Shell> {
3
- static description: string;
4
- static examples: string[];
5
- static args: {
6
- image: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
7
- };
8
- static flags: {
9
- command: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- config: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
- "run-as-root": import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
12
- };
13
- run(): Promise<void>;
14
- }
1
+ import { Command } from "@commander-js/extra-typings";
2
+ export declare const createShellCommand: () => Command<[], {
3
+ command: string;
4
+ config: string[];
5
+ runAsRoot: boolean;
6
+ }, {}>;
15
7
  //# sourceMappingURL=shell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/commands/shell.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW,CAAC,OAAO,KAAK,CAAC;IACxD,MAAM,CAAC,WAAW,SAAqD;IAEvE,MAAM,CAAC,QAAQ,WAA2C;IAE1D,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,KAAK;;;;MAgBV;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2CpC"}
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/commands/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAOtD,eAAO,MAAM,kBAAkB;;;;MAuD9B,CAAC"}
@@ -1,65 +1,48 @@
1
- import { Args, Flags } from "@oclif/core";
1
+ import { Command } from "@commander-js/extra-typings";
2
+ import { ExecaError } from "execa";
2
3
  import fs from "fs-extra";
3
- import path from "path";
4
- import { BaseCommand } from "../baseCommand.js";
4
+ import path from "node:path";
5
+ import { getApplicationConfig, getContextPath } from "../base.js";
5
6
  import { bootMachine } from "../machine.js";
6
- class Shell extends BaseCommand {
7
- async run() {
8
- const { flags } = await this.parse(Shell);
7
+ export const createShellCommand = () => {
8
+ return new Command("shell")
9
+ .option("--command <command>", "shell command to run", "/bin/sh")
10
+ .option("-c, --config <config>", "path to the configuration file", (value, prev) => prev.concat([value]), ["cartesi.toml"])
11
+ .option("--run-as-root", "run as root user", false)
12
+ .action(async (options) => {
13
+ const { command, runAsRoot } = options;
9
14
  // get application configuration from 'cartesi.toml'
10
- const config = this.getApplicationConfig(flags.config);
15
+ const config = getApplicationConfig(options.config);
11
16
  // destination directory for image and intermediate files
12
- const destination = path.resolve(this.getContextPath());
17
+ const destination = path.resolve(getContextPath());
13
18
  // check if all drives are built
14
19
  for (const [name, drive] of Object.entries(config.drives)) {
15
20
  const filename = `${name}.${drive.format}`;
16
- const pathname = this.getContextPath(filename);
21
+ const pathname = getContextPath(filename);
17
22
  if (!fs.existsSync(pathname)) {
18
- throw new Error(`drive '${name}' not built, run '${this.config.bin} build'`);
23
+ throw new Error(`drive '${name}' not built, run 'build'`);
19
24
  }
20
25
  }
21
26
  // create shell entrypoint
22
- const info = {
23
- cmd: [],
24
- entrypoint: [this.flags.command],
25
- env: [],
26
- workdir: "/",
27
- };
28
- // start with interactive mode on
29
- config.machine.interactive = true;
30
- // interactive mode can't have final hash
31
- config.machine.finalHash = false;
32
- // do not store machine in interactive mode
33
- config.machine.store = undefined;
27
+ config.machine.entrypoint = command;
34
28
  // run as root if flag is set
35
- config.machine.user = flags["run-as-root"] ? "root" : undefined;
29
+ config.machine.user = runAsRoot ? "root" : undefined;
36
30
  // boot machine
37
- await bootMachine(config, info, destination);
38
- }
39
- }
40
- Shell.description = "Start a shell in cartesi machine of application";
41
- Shell.examples = ["<%= config.bin %> <%= command.id %>"];
42
- Shell.args = {
43
- image: Args.string({
44
- description: "image ID|name",
45
- required: false,
46
- }),
47
- };
48
- Shell.flags = {
49
- command: Flags.string({
50
- default: "/bin/sh",
51
- description: "shell command to run",
52
- summary: "shell to run",
53
- }),
54
- config: Flags.file({
55
- char: "c",
56
- default: "cartesi.toml",
57
- summary: "path to the configuration file",
58
- }),
59
- "run-as-root": Flags.boolean({
60
- default: false,
61
- description: "run as root user",
62
- summary: "run the cartesi machine as the root user",
63
- }),
31
+ try {
32
+ await bootMachine(config, undefined, { interactive: true }, // start with interactive mode on
33
+ {
34
+ cwd: destination,
35
+ stdio: "inherit",
36
+ });
37
+ }
38
+ catch (error) {
39
+ if (error instanceof ExecaError) {
40
+ // just continue gracefully
41
+ if (error.exitCode === 130) {
42
+ return;
43
+ }
44
+ throw error;
45
+ }
46
+ }
47
+ });
64
48
  };
65
- export default Shell;
@@ -0,0 +1,6 @@
1
+ import { Command } from "@commander-js/extra-typings";
2
+ export declare const createStatusCommand: () => Command<[], {
3
+ projectName?: string | undefined;
4
+ json?: true | undefined;
5
+ }, {}>;
6
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAMtD,eAAO,MAAM,mBAAmB;;;MAuD/B,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { Command } from "@commander-js/extra-typings";
2
+ import chalk from "chalk";
3
+ import Table from "cli-table3";
4
+ import { getProjectName, getServiceState } from "../base.js";
5
+ import { getDeployments } from "../exec/rollups.js";
6
+ export const createStatusCommand = () => {
7
+ return new Command("status")
8
+ .description("Shows the status of a local environment.")
9
+ .configureHelp({ showGlobalOptions: true })
10
+ .option("--project-name <string>", "name of project (used by docker compose and cartesi-rollups-node)")
11
+ .option("--json", "output in JSON format")
12
+ .action(async (options) => {
13
+ const { json } = options;
14
+ const projectName = getProjectName(options);
15
+ const status = await getServiceState({
16
+ projectName,
17
+ service: "rollups-node",
18
+ });
19
+ const deployments = await getDeployments({
20
+ projectName,
21
+ });
22
+ if (json) {
23
+ process.stdout.write(JSON.stringify({
24
+ status,
25
+ deployments,
26
+ }));
27
+ }
28
+ else {
29
+ console.log(`${chalk.cyan(projectName)} is ${status === "running" ? chalk.green("running") : chalk.red("not running")}`);
30
+ if (status === "running") {
31
+ if (deployments.length === 0) {
32
+ console.log(chalk.red("no applications deployed"));
33
+ }
34
+ else {
35
+ // print as a table
36
+ const table = new Table({
37
+ head: ["Machine", "Address", "State"],
38
+ style: { border: [], head: [] },
39
+ });
40
+ table.push(...deployments.map((deployment) => [
41
+ deployment.templateHash,
42
+ deployment.address,
43
+ deployment.state,
44
+ ]));
45
+ console.log(table.toString());
46
+ }
47
+ }
48
+ }
49
+ });
50
+ };
@@ -0,0 +1,36 @@
1
+ # cartesi/rollups-node
2
+
3
+ #logs
4
+ CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-info}"
5
+
6
+ # features
7
+ CARTESI_FEATURE_INPUT_READER_ENABLED="${CARTESI_FEATURE_INPUT_READER_ENABLED:-true}"
8
+ CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED="${CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED:-true}"
9
+ CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED="${CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED:-true}"
10
+ CARTESI_SNAPSHOTS_DIR="/var/lib/cartesi-rollups-node/snapshots"
11
+
12
+ # rollups
13
+ CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES="${CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES:-3}"
14
+ CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY="${CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY:-3}"
15
+ CARTESI_ADVANCER_POLLING_INTERVAL="${CARTESI_ADVANCER_POLLING_INTERVAL:-3}"
16
+ CARTESI_VALIDATOR_POLLING_INTERVAL="${CARTESI_VALIDATOR_POLLING_INTERVAL:-3}"
17
+ CARTESI_CLAIMER_POLLING_INTERVAL="${CARTESI_CLAIMER_POLLING_INTERVAL:-3}"
18
+ CARTESI_MAX_STARTUP_TIME="${CARTESI_MAX_STARTUP_TIME:-15}"
19
+
20
+ # blockchain
21
+ CARTESI_BLOCKCHAIN_ID="${CARTESI_BLOCKCHAIN_ID:-13370}"
22
+ CARTESI_BLOCKCHAIN_HTTP_ENDPOINT="${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT:-http://anvil:8545}"
23
+ CARTESI_BLOCKCHAIN_WS_ENDPOINT="${CARTESI_BLOCKCHAIN_WS_ENDPOINT:-ws://anvil:8545}"
24
+ CARTESI_BLOCKCHAIN_DEFAULT_BLOCK="${CARTESI_BLOCKCHAIN_DEFAULT_BLOCK:-latest}"
25
+
26
+ # contracts
27
+ CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS:-0xc7006f70875BaDe89032001262A846D3Ee160051}"
28
+ CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS="${CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS:-0xC7003566dD09Aa0fC0Ce201aC2769aFAe3BF0051}"
29
+ CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="${CARTESI_CONTRACTS_INPUT_BOX_ADDRESS:-0xc70074BDD26d8cF983Ca6A5b89b8db52D5850051}"
30
+ CARTESI_CONTRACTS_SELF_HOSTED_APPLICATION_FACTORY_ADDRESS="${CARTESI_CONTRACTS_SELF_HOSTED_APPLICATION_FACTORY_ADDRESS:-0xc700285Ab555eeB5201BC00CFD4b2CC8DED90051}"
31
+
32
+ # auth
33
+ CARTESI_AUTH_MNEMONIC="${CARTESI_AUTH_MNEMONIC:-test test test test test test test test test test test junk}"
34
+
35
+ # postgres
36
+ CARTESI_DATABASE_CONNECTION="postgres://postgres:password@database:5432/rollupsdb?sslmode=disable"
@@ -0,0 +1,39 @@
1
+ configs:
2
+ anvil_proxy:
3
+ content: |
4
+ http:
5
+ routers:
6
+ anvil:
7
+ rule: "PathPrefix(`/anvil`)"
8
+ middlewares:
9
+ - "remove-anvil-prefix"
10
+ service: anvil
11
+ middlewares:
12
+ remove-anvil-prefix:
13
+ replacePathRegex:
14
+ regex: "^/anvil(.*)"
15
+ replacement: "$1"
16
+ services:
17
+ anvil:
18
+ loadBalancer:
19
+ servers:
20
+ - url: "http://anvil:8545"
21
+
22
+ services:
23
+ anvil:
24
+ image: ${CARTESI_SDK_IMAGE}
25
+ command: ["devnet", "--block-time", "${CARTESI_BLOCK_TIME:-2}"]
26
+ healthcheck:
27
+ test: ["CMD", "eth_isready"]
28
+ start_period: 10s
29
+ start_interval: 200ms
30
+ interval: 10s
31
+ timeout: 1s
32
+ retries: 5
33
+ environment:
34
+ ANVIL_IP_ADDR: 0.0.0.0
35
+
36
+ proxy:
37
+ configs:
38
+ - source: anvil_proxy
39
+ target: /etc/traefik/conf.d/anvil.yaml
@@ -0,0 +1,71 @@
1
+ configs:
2
+ bundler_proxy:
3
+ content: |
4
+ http:
5
+ routers:
6
+ bundler:
7
+ rule: "PathPrefix(`/bundler`)"
8
+ middlewares:
9
+ - "cors"
10
+ - "remove-bundler-prefix"
11
+ service: bundler
12
+ middlewares:
13
+ cors:
14
+ headers:
15
+ accessControlAllowMethods:
16
+ - GET
17
+ - OPTIONS
18
+ - PUT
19
+ accessControlAllowHeaders: "*"
20
+ accessControlAllowOriginList:
21
+ - "*"
22
+ accessControlMaxAge: 100
23
+ addVaryHeader: true
24
+ remove-bundler-prefix:
25
+ replacePathRegex:
26
+ regex: "^/bundler/(.*)"
27
+ replacement: "/$1"
28
+ services:
29
+ bundler:
30
+ loadBalancer:
31
+ servers:
32
+ - url: "http://bundler:4337"
33
+
34
+ services:
35
+ bundler:
36
+ image: ${CARTESI_SDK_IMAGE}
37
+ command:
38
+ - "alto"
39
+ - "--entrypoints"
40
+ - "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789,0x0000000071727De22E5E9d8BAf0edAc6f37da032"
41
+ - "--log-level"
42
+ - "info"
43
+ - "--rpc-url"
44
+ - "http://anvil:8545"
45
+ - "--min-executor-balance"
46
+ - "0"
47
+ - "--utility-private-key"
48
+ - "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97"
49
+ - "--executor-private-keys"
50
+ - "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6,0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356,0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e,0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba,0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"
51
+ - "--safe-mode"
52
+ - "false"
53
+ - "--port"
54
+ - "4337"
55
+ - "--public-client-log-level"
56
+ - "error"
57
+ - "--wallet-client-log-level"
58
+ - "error"
59
+ - "--enable-debug-endpoints"
60
+ healthcheck:
61
+ test: ["CMD", "curl", "-fsS", "http://127.0.0.1:4337/health"]
62
+ start_period: 10s
63
+ start_interval: 200ms
64
+ interval: 10s
65
+ timeout: 1s
66
+ retries: 5
67
+
68
+ proxy:
69
+ configs:
70
+ - source: bundler_proxy
71
+ target: /etc/traefik/conf.d/bundler.yaml
@@ -1,10 +1,12 @@
1
1
  services:
2
2
  database:
3
- image: postgres:15-alpine
3
+ image: cartesi/rollups-database:${CARTESI_SDK_VERSION}
4
4
  healthcheck:
5
5
  test: ["CMD-SHELL", "pg_isready -U postgres || exit 1"]
6
+ start_period: 10s
7
+ start_interval: 200ms
6
8
  interval: 10s
7
- timeout: 5s
9
+ timeout: 1s
8
10
  retries: 5
9
11
  environment:
10
12
  - POSTGRES_PASSWORD=password
@@ -0,0 +1,96 @@
1
+ x-explorer_db_env: &explorer_db_env
2
+ DB_NAME: explorer
3
+ DB_PORT: 5432
4
+ DB_HOST: database
5
+ DB_PASS: password
6
+
7
+ configs:
8
+ explorer_api_proxy:
9
+ content: |
10
+ http:
11
+ routers:
12
+ explorer-api:
13
+ rule: "PathPrefix(`/explorer-api`)"
14
+ middlewares:
15
+ - "remove-explorer-api-prefix"
16
+ service: explorer-api
17
+ middlewares:
18
+ remove-explorer-api-prefix:
19
+ replacePathRegex:
20
+ regex: "^/explorer-api/(.*)"
21
+ replacement: "/$1"
22
+ services:
23
+ explorer-api:
24
+ loadBalancer:
25
+ servers:
26
+ - url: "http://explorer_api:4350"
27
+ explorer_proxy:
28
+ content: |
29
+ http:
30
+ routers:
31
+ explorer:
32
+ rule: "PathPrefix(`/explorer`)"
33
+ service: explorer
34
+ services:
35
+ explorer:
36
+ loadBalancer:
37
+ servers:
38
+ - url: "http://explorer:3000"
39
+
40
+ services:
41
+ explorer_api:
42
+ image: cartesi/rollups-explorer-api:1.0.0
43
+ environment:
44
+ <<: *explorer_db_env
45
+ GQL_PORT: 4350
46
+ expose:
47
+ - 4350
48
+ command: ["sqd", "serve:prod"]
49
+ healthcheck:
50
+ test:
51
+ [
52
+ "CMD",
53
+ "wget",
54
+ "--spider",
55
+ "-q",
56
+ "http://127.0.0.1:4350/graphql?query=%7B__typename%7D",
57
+ ]
58
+ start_period: 10s
59
+ start_interval: 200ms
60
+ interval: 10s
61
+ timeout: 1s
62
+ retries: 5
63
+ depends_on:
64
+ database:
65
+ condition: service_healthy
66
+
67
+ squid_processor:
68
+ image: cartesi/rollups-explorer-api:1.0.0
69
+ environment:
70
+ <<: *explorer_db_env
71
+ CHAIN_IDS: ${CARTESI_BLOCKCHAIN_ID:-13370}
72
+ RPC_URL_13370: ${RPC_URL:-http://anvil:8545}
73
+ BLOCK_CONFIRMATIONS_13370: 0
74
+ GENESIS_BLOCK_13370: 1
75
+ command: ["sqd", "process:prod"]
76
+ depends_on:
77
+ database:
78
+ condition: service_healthy
79
+
80
+ explorer:
81
+ image: cartesi/rollups-explorer:1.3.3
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"
85
+ expose:
86
+ - 3000
87
+ depends_on:
88
+ database:
89
+ condition: service_healthy
90
+
91
+ proxy:
92
+ configs:
93
+ - source: explorer_proxy
94
+ target: /etc/traefik/conf.d/explorer.yaml
95
+ - source: explorer_api_proxy
96
+ target: /etc/traefik/conf.d/explorer-api.yaml
@@ -0,0 +1,38 @@
1
+ configs:
2
+ graphql_proxy:
3
+ content: |
4
+ http:
5
+ routers:
6
+ graphql:
7
+ rule: "PathPrefix(`/graphql`)"
8
+ service: graphql
9
+ services:
10
+ graphql:
11
+ loadBalancer:
12
+ servers:
13
+ - url: "http://graphql:8080"
14
+
15
+ services:
16
+ graphql:
17
+ image: ${CARTESI_SDK_IMAGE}
18
+ environment:
19
+ CARTESI_GRAPHQL_DATABASE_CONNECTION: postgres://postgres:password@database:5432/graphql?sslmode=disable
20
+ CARTESI_DATABASE_CONNECTION: postgres://postgres:password@database:5432/rollupsdb?sslmode=disable
21
+ expose:
22
+ - 8080
23
+ command: ["cartesi-rollups-graphql"]
24
+ healthcheck:
25
+ test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8080/health"]
26
+ start_period: 10s
27
+ start_interval: 200ms
28
+ interval: 10s
29
+ timeout: 1s
30
+ retries: 5
31
+ depends_on:
32
+ database:
33
+ condition: service_healthy
34
+
35
+ proxy:
36
+ configs:
37
+ - source: graphql_proxy
38
+ target: /etc/traefik/conf.d/graphql.yaml
@@ -0,0 +1,6 @@
1
+ services:
2
+ rollups-node:
3
+ deploy:
4
+ resources:
5
+ limits:
6
+ cpus: "${CARTESI_ROLLUPS_NODE_CPUS}"
@@ -0,0 +1,6 @@
1
+ services:
2
+ rollups-node:
3
+ deploy:
4
+ resources:
5
+ limits:
6
+ memory: "${CARTESI_ROLLUPS_NODE_MEMORY}M"