From 9d09d94dcfa4e61adb6e2e70158dd8bc98ce5484 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Mon, 9 Mar 2026 13:57:23 -0300 Subject: [PATCH] feat(cli): default to authority consensus --- .changeset/great-jeans-bake.md | 5 +++++ apps/cli/src/commands/run.ts | 8 ++++---- apps/cli/src/compose/node.ts | 17 ++++++++++++----- apps/cli/src/exec/rollups.ts | 3 +++ 4 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 .changeset/great-jeans-bake.md diff --git a/.changeset/great-jeans-bake.md b/.changeset/great-jeans-bake.md new file mode 100644 index 00000000..ac1a87a9 --- /dev/null +++ b/.changeset/great-jeans-bake.md @@ -0,0 +1,5 @@ +--- +"@cartesi/cli": patch +--- + +make Authority the default consensus mode diff --git a/apps/cli/src/commands/run.ts b/apps/cli/src/commands/run.ts index f9047fc3..d4e881b7 100755 --- a/apps/cli/src/commands/run.ts +++ b/apps/cli/src/commands/run.ts @@ -194,8 +194,8 @@ export const createRunCommand = () => { .description("Run a local cartesi node for the application.") .addOption( new Option( - "--authority", - "deploy application with authority consensus", + "--prt", + "deploy application with PRT consensus", ).default(false), ) .addOption( @@ -264,7 +264,7 @@ export const createRunCommand = () => { .option("-v, --verbose", "verbose output", false) .action(async (options, program) => { const { - authority, + prt, blockTime, cpus, defaultBlock, @@ -313,6 +313,7 @@ export const createRunCommand = () => { memory, port, projectName, + prt, runtimeVersion, services, verbose, @@ -342,7 +343,6 @@ export const createRunCommand = () => { // deploy the application let deployment: RollupsDeployment | undefined; let salt = 0; - const prt = !authority; const hash = getMachineHash(); if (hash) { deployment = await deploy({ diff --git a/apps/cli/src/compose/node.ts b/apps/cli/src/compose/node.ts index b5e04fc8..9f1e8fb1 100644 --- a/apps/cli/src/compose/node.ts +++ b/apps/cli/src/compose/node.ts @@ -18,6 +18,7 @@ type ServiceOptions = { memory?: number; mnemonic?: string; imageTag?: string; + prt?: boolean; }; // Rollups Node service @@ -31,12 +32,16 @@ const service = (options: ServiceOptions): Service => { const mnemonic = options.mnemonic ?? "test test test test test test test test test test test junk"; + const prt = options.prt ?? false; const chainId = (options.forkChainId ?? 31337) as keyof typeof daveAppFactoryAddress; - const chainDaveAppFactoryAddress = daveAppFactoryAddress[chainId]; - if (!chainDaveAppFactoryAddress) { - throw new Error(`Unsupported fork chain ${chainId}`); + let chainDaveAppFactoryAddress: string | undefined; + if (prt) { + chainDaveAppFactoryAddress = daveAppFactoryAddress[chainId]; + if (!chainDaveAppFactoryAddress) { + throw new Error(`Unsupported fork chain ${chainId}`); + } } return { @@ -72,8 +77,10 @@ const service = (options: ServiceOptions): Service => { CARTESI_BLOCKCHAIN_HTTP_ENDPOINT: "http://anvil:8545", CARTESI_BLOCKCHAIN_ID: anvil.id.toString(), CARTESI_BLOCKCHAIN_WS_ENDPOINT: "ws://anvil:8545", - CARTESI_CONTRACTS_DAVE_APP_FACTORY_ADDRESS: - chainDaveAppFactoryAddress, + ...(chainDaveAppFactoryAddress && { + CARTESI_CONTRACTS_DAVE_APP_FACTORY_ADDRESS: + chainDaveAppFactoryAddress, + }), CARTESI_CONTRACTS_INPUT_BOX_ADDRESS: inputBoxAddress, CARTESI_CONTRACTS_SELF_HOSTED_APPLICATION_FACTORY_ADDRESS: selfHostedApplicationFactoryAddress, diff --git a/apps/cli/src/exec/rollups.ts b/apps/cli/src/exec/rollups.ts index 383137cb..6729f197 100644 --- a/apps/cli/src/exec/rollups.ts +++ b/apps/cli/src/exec/rollups.ts @@ -248,6 +248,7 @@ export const startEnvironment = async (options: { memory?: number; port: number; projectName: string; + prt?: boolean; runtimeVersion: string; services: string[]; verbose: boolean; @@ -262,6 +263,7 @@ export const startEnvironment = async (options: { memory, port, projectName, + prt, runtimeVersion, services, verbose, @@ -292,6 +294,7 @@ export const startEnvironment = async (options: { imageTag: runtimeVersion, logLevel: verbose ? "debug" : "info", memory, + prt, }), proxy({ imageTag: "v3.3.4", port }), ];