diff --git a/.changeset/curvy-cougars-allow.md b/.changeset/curvy-cougars-allow.md new file mode 100644 index 00000000..2c12b7ed --- /dev/null +++ b/.changeset/curvy-cougars-allow.md @@ -0,0 +1,5 @@ +--- +"@cartesi/cli": minor +--- + +flags to disable optional services (explorer, bundler, paymaster) diff --git a/.changeset/neat-frogs-cover.md b/.changeset/neat-frogs-cover.md new file mode 100644 index 00000000..15cf3216 --- /dev/null +++ b/.changeset/neat-frogs-cover.md @@ -0,0 +1,5 @@ +--- +"@cartesi/cli": minor +--- + +account abstraction contracts information diff --git a/.changeset/sixty-pants-share.md b/.changeset/sixty-pants-share.md new file mode 100644 index 00000000..9c676397 --- /dev/null +++ b/.changeset/sixty-pants-share.md @@ -0,0 +1,5 @@ +--- +"@cartesi/cli": patch +--- + +remove workaround of anvil bug diff --git a/.changeset/tasty-hornets-brush.md b/.changeset/tasty-hornets-brush.md new file mode 100644 index 00000000..d09f6284 --- /dev/null +++ b/.changeset/tasty-hornets-brush.md @@ -0,0 +1,5 @@ +--- +"@cartesi/cli": minor +--- + +account abstraction services (bundler and paymaster) diff --git a/.changeset/tidy-trees-brake.md b/.changeset/tidy-trees-brake.md new file mode 100644 index 00000000..389ae28f --- /dev/null +++ b/.changeset/tidy-trees-brake.md @@ -0,0 +1,5 @@ +--- +"@cartesi/cli": patch +--- + +enable json output of cartesi deploy build diff --git a/.changeset/witty-lemons-decide.md b/.changeset/witty-lemons-decide.md new file mode 100644 index 00000000..d309665d --- /dev/null +++ b/.changeset/witty-lemons-decide.md @@ -0,0 +1,5 @@ +--- +"@cartesi/mock-verifying-paymaster": patch +--- + +printing contract address on startup diff --git a/apps/cli/src/baseCommand.ts b/apps/cli/src/baseCommand.ts index 3ec26f18..10faebdb 100644 --- a/apps/cli/src/baseCommand.ts +++ b/apps/cli/src/baseCommand.ts @@ -88,16 +88,26 @@ export abstract class BaseCommand extends Command { AuthorityHistoryPairFactory: authorityHistoryPairFactoryAddress, CartesiDAppFactory: cartesiDAppFactoryAddress, DAppAddressRelay: dAppAddressRelayAddress, + EntryPointV06: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + EntryPointV07: "0x0000000071727De22E5E9d8BAf0edAc6f37da032", ERC1155BatchPortal: erc1155BatchPortalAddress, ERC1155SinglePortal: erc1155SinglePortalAddress, ERC20Portal: erc20PortalAddress, ERC721Portal: erc721PortalAddress, EtherPortal: etherPortalAddress, InputBox: inputBoxAddress, + LightAccountFactory: "0x00004EC70002a32400f8ae005A26081065620D20", SelfHostedApplicationFactory: selfHostedApplicationFactoryAddress, + SimpleAccountFactory: "0x9406Cc6185a346906296840746125a0E44976454", + SmartAccountFactory: "0x000000a56Aaca3e9a4C479ea6b6CD0DbcB6634F5", + KernelFactoryV2: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3", + KernelFactoryV3: "0x6723b44Abeec4E71eBE3232BD5B455805baDD22f", + KernelFactoryV3_1: "0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419", TestToken: testTokenAddress, TestNFT: testNftAddress, TestMultiToken: testMultiTokenAddress, + VerifyingPaymasterV06: "0x28ec0633192d0cBd9E1156CE05D5FdACAcB93947", + VerifyingPaymasterV07: "0xc5c97885C67F7361aBAfD2B95067a5bBdA603608", }; // get dapp address diff --git a/apps/cli/src/commands/deploy/build.ts b/apps/cli/src/commands/deploy/build.ts index 34e65793..5812c04f 100644 --- a/apps/cli/src/commands/deploy/build.ts +++ b/apps/cli/src/commands/deploy/build.ts @@ -24,6 +24,8 @@ export default class DeployBuild extends BaseCommand { }), }; + public static enableJsonFlag = true; + private async buildRollupsImage(platform?: string) { const buildResult = tmpNameSync(); const imagePath = this.getContextPath("image"); @@ -53,7 +55,7 @@ export default class DeployBuild extends BaseCommand { return fs.readFileSync(buildResult, "utf8"); } - public async run(): Promise { + public async run() { const { flags } = await this.parse(DeployBuild); // print machine hash @@ -75,6 +77,6 @@ export default class DeployBuild extends BaseCommand { value: image, }); - return image; + return { image }; } } diff --git a/apps/cli/src/commands/run.ts b/apps/cli/src/commands/run.ts index 1b89ef73..f3364147 100644 --- a/apps/cli/src/commands/run.ts +++ b/apps/cli/src/commands/run.ts @@ -17,6 +17,24 @@ export default class Run extends BaseCommand { description: "interval between blocks (in seconds)", default: 5, }), + "disable-explorer": Flags.boolean({ + default: false, + description: + "disable local explorer service to save machine resources", + summary: "disable explorer service", + }), + "disable-bundler": Flags.boolean({ + default: false, + description: + "disable local bundler service to save machine resources", + summary: "disable bundler service", + }), + "disable-paymaster": Flags.boolean({ + default: false, + description: + "disable local paymaster service to save machine resources", + summary: "disable paymaster service", + }), "epoch-length": Flags.integer({ description: "length of an epoch (in blocks)", default: 720, @@ -99,7 +117,18 @@ export default class Run extends BaseCommand { composeFiles.push("docker-compose-anvil.yaml"); // explorer - composeFiles.push("docker-compose-explorer.yaml"); + if (!flags["disable-explorer"]) { + composeFiles.push("docker-compose-explorer.yaml"); + } + + // account abstraction + if (!flags["disable-bundler"]) { + composeFiles.push("docker-compose-bundler.yaml"); + } + if (!flags["disable-paymaster"] && !flags["disable-bundler"]) { + // only add paymaster if bundler is enabled + composeFiles.push("docker-compose-paymaster.yaml"); + } // load the no-backend compose file if (flags["no-backend"]) { diff --git a/apps/cli/src/commands/shell.ts b/apps/cli/src/commands/shell.ts index 7a703966..3c8a928b 100644 --- a/apps/cli/src/commands/shell.ts +++ b/apps/cli/src/commands/shell.ts @@ -33,7 +33,7 @@ export default class Shell extends BaseCommand { const ext2 = path.join(containerDir, path.basename(ext2Path)); const ramSize = "128Mi"; const driveLabel = "root"; - const sdkImage = "cartesi/sdk:0.9.0"; // XXX: how to resolve sdk version? + const sdkImage = "cartesi/sdk:0.10.0"; // XXX: how to resolve sdk version? const args = [ "run", "--interactive", diff --git a/apps/cli/src/node/docker-compose-anvil.yaml b/apps/cli/src/node/docker-compose-anvil.yaml index 02c0d783..8b507aa8 100644 --- a/apps/cli/src/node/docker-compose-anvil.yaml +++ b/apps/cli/src/node/docker-compose-anvil.yaml @@ -1,6 +1,6 @@ services: anvil: - image: cartesi/sdk:0.9.0 + image: cartesi/sdk:0.10.0 command: [ "devnet", @@ -19,7 +19,7 @@ services: - 8545:8545 dapp_deployer: - image: cartesi/sdk:0.9.0 + image: cartesi/sdk:0.10.0 restart: on-failure depends_on: anvil: diff --git a/apps/cli/src/node/docker-compose-bundler.yaml b/apps/cli/src/node/docker-compose-bundler.yaml new file mode 100644 index 00000000..3295d207 --- /dev/null +++ b/apps/cli/src/node/docker-compose-bundler.yaml @@ -0,0 +1,57 @@ +services: + alto: + image: cartesi/sdk:0.10.0 + command: + - "alto" + - "--entrypoints" + - "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789,0x0000000071727De22E5E9d8BAf0edAc6f37da032" + - "--log-level" + - "info" + - "--entrypoint-simulation-contract" + - "0x74Cb5e4eE81b86e70f9045036a1C5477de69eE87" + - "--rpc-url" + - "http://anvil:8545" + - "--min-executor-balance" + - "0" + - "--utility-private-key" + - "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" + - "--executor-private-keys" + - "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6,0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356,0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e,0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba,0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a" + - "--max-block-range" + - "10000" + - "--safe-mode" + - "false" + - "--port" + - "4337" + - "--public-client-log-level" + - "error" + - "--wallet-client-log-level" + - "error" + - "--polling-interval" + - "100" + - "--enable-debug-endpoints" + prompt: + image: debian:bookworm-slim + environment: + PROMPT_TXT_06_BUNDLER: "Bundler running at http://localhost:${CARTESI_LISTEN_PORT}/bundler/rpc" + + traefik-config-generator: + environment: + TRAEFIK_CONFIG_BUNDLER: | + http: + routers: + bundler: + rule: "PathPrefix(`/bundler`)" + middlewares: + - "remove-bundler-prefix" + service: bundler + middlewares: + remove-bundler-prefix: + replacePathRegex: + regex: "^/bundler/(.*)" + replacement: "/$1" + services: + bundler: + loadBalancer: + servers: + - url: "http://alto:4337" diff --git a/apps/cli/src/node/docker-compose-database.yaml b/apps/cli/src/node/docker-compose-database.yaml index 0b8bc704..fb661ab1 100644 --- a/apps/cli/src/node/docker-compose-database.yaml +++ b/apps/cli/src/node/docker-compose-database.yaml @@ -8,8 +8,3 @@ services: retries: 5 environment: - POSTGRES_PASSWORD=password - - database_creator: - depends_on: - database: - condition: service_healthy diff --git a/apps/cli/src/node/docker-compose-explorer.yaml b/apps/cli/src/node/docker-compose-explorer.yaml index 25d15c63..f73b2fb2 100644 --- a/apps/cli/src/node/docker-compose-explorer.yaml +++ b/apps/cli/src/node/docker-compose-explorer.yaml @@ -2,6 +2,9 @@ services: database_creator: image: postgres:15-alpine command: ["createdb", "squid"] + depends_on: + database: + condition: service_healthy environment: PGHOST: ${PGHOST:-database} PGPORT: ${PGPORT:-5432} @@ -30,7 +33,6 @@ services: CHAIN_ID: ${CHAIN_ID:-31337} RPC_URL_31337: ${RPC_URL:-http://anvil:8545} BLOCK_CONFIRMATIONS_31337: 0 - GENESIS_BLOCK_31337: 22 DB_NAME: ${PGDATABASE:-squid} DB_PORT: ${PGPORT:-5432} DB_HOST: ${PGHOST:-database} diff --git a/apps/cli/src/node/docker-compose-paymaster.yaml b/apps/cli/src/node/docker-compose-paymaster.yaml new file mode 100644 index 00000000..6829ed3a --- /dev/null +++ b/apps/cli/src/node/docker-compose-paymaster.yaml @@ -0,0 +1,33 @@ +services: + mock-verifying-paymaster: + image: cartesi/sdk:0.10.0 + command: "mock-verifying-paymaster" + environment: + - ALTO_RPC=http://alto:4337 + - ANVIL_RPC=http://anvil:8545 + + prompt: + image: debian:bookworm-slim + environment: + PROMPT_TXT_07_PAYMASTER: "Paymaster running at http://localhost:${CARTESI_LISTEN_PORT}/paymaster/" + + traefik-config-generator: + environment: + TRAEFIK_CONFIG_PAYMASTER: | + http: + routers: + paymaster: + rule: "PathPrefix(`/paymaster`)" + middlewares: + - "remove-paymaster-prefix" + service: paymaster + middlewares: + remove-paymaster-prefix: + replacePathRegex: + regex: "^/paymaster/(.*)" + replacement: "/$1" + services: + paymaster: + loadBalancer: + servers: + - url: "http://mock-verifying-paymaster:3000" diff --git a/packages/mock-verifying-paymaster/docker-compose.yaml b/packages/mock-verifying-paymaster/docker-compose.yaml index 0e6656bd..e38bfa1e 100644 --- a/packages/mock-verifying-paymaster/docker-compose.yaml +++ b/packages/mock-verifying-paymaster/docker-compose.yaml @@ -1,6 +1,6 @@ services: anvil: - image: cartesi/sdk:0.9.0 + image: cartesi/sdk:0.10.0 command: ["devnet", "--block-time", "${BLOCK_TIME:-5}"] healthcheck: test: ["CMD", "eth_isready"] @@ -13,7 +13,7 @@ services: - 8545:8545 alto: - image: cartesi/sdk:0.9.0 + image: cartesi/sdk:0.10.0 command: [ "alto", diff --git a/packages/mock-verifying-paymaster/src/index.ts b/packages/mock-verifying-paymaster/src/index.ts index e1c781d1..2e4049a5 100644 --- a/packages/mock-verifying-paymaster/src/index.ts +++ b/packages/mock-verifying-paymaster/src/index.ts @@ -50,7 +50,9 @@ const main = async () => { return reply.code(200).send({ message: "pong" }); }); - const service = await app.listen({ host: "0.0.0.0", port: 3000 }); + const service = await app.listen({ host: "0.0.0.0", port: 3001 }); + console.log(`VerifyingPaymasterV06: ${verifyingPaymasterV06.address}`); + console.log(`VerifyingPaymasterV07: ${verifyingPaymasterV07.address}`); console.log(`Service ready: ${service}`); };