Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cba6827
chore: temporary ci wiring for the pr-built sdk images
brunomenezes Oct 3, 2026
e338838
fix(cli): accept a 0x-prefixed cartesi-machine stored hash
brunomenezes Oct 3, 2026
46534bb
chore(cli): require cartesi-machine 0.21.0
brunomenezes Oct 3, 2026
34ea216
test(cli): allow overriding the sdk image used in integration tests
brunomenezes Oct 3, 2026
9a1b4fb
test(cli): build temporary apps with the sdk image the readers use
brunomenezes Oct 3, 2026
d197f4c
ci(cli): re-run the cli suite when the sdk image changes
brunomenezes Oct 3, 2026
4299138
refactor(cli): generate contracts with @cartesi/wagmi-plugin
brunomenezes Aug 19, 2026
61cda1f
feat(cli): add TestUsdc, RefundOutputBuilder and UsdWithdrawalOutputB…
brunomenezes Aug 19, 2026
e1531a1
fix(cli): use the renamed portal deposit function names
brunomenezes Sep 29, 2026
8d67ef2
fix(cli): probe portals with version in fork validation
brunomenezes Sep 29, 2026
1336128
fix(cli): pass the new calculateDaveAppAddress arguments
brunomenezes Sep 29, 2026
05eef36
test(cli): assert the probed function names in fork validation
brunomenezes Sep 29, 2026
0ce5776
chore(cli): bump @cartesi/wagmi-plugin to 1.0.0-alpha.7
brunomenezes Sep 29, 2026
86ab56f
chore(cli): exclude the PRT internal contracts from codegen
brunomenezes Oct 2, 2026
79aff44
refactor(cli): widen application status and expose reason from app list
brunomenezes Sep 24, 2026
9da58b0
test(cli): cover app list parsing in exec/rollups
brunomenezes Sep 24, 2026
0e42d85
feat(cli): warn when an application leaves the OK state during run
brunomenezes Sep 24, 2026
024cb5d
feat(cli): highlight non-OK application states in the status command
brunomenezes Sep 24, 2026
dcad8df
fix(cli): bound the wait for healthy services
brunomenezes Sep 24, 2026
7747254
fix(cli): stop waiting when a service container has exited
brunomenezes Sep 24, 2026
190f728
feat(cli): always pass the PRT auth mnemonic to the node
brunomenezes Sep 24, 2026
d28d47f
feat(cli): allow overriding the node's PRT auth variables
brunomenezes Sep 24, 2026
8df694c
test(cli): cover node startup against the compose environment
brunomenezes Oct 2, 2026
1080a3e
feat(cli): allow overriding the node's claimer auth variables
brunomenezes Oct 3, 2026
87d2983
fix(cli): pass the claim staging period for every consensus type
brunomenezes Oct 3, 2026
8af23be
fix(cli): hash the machine snapshot with the project sdk image
brunomenezes Oct 2, 2026
b805479
ci(cli): stop installing foundry in the cli workflow
brunomenezes Oct 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brave-foxes-climb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Pass `--claim-staging-period` to the node for every consensus type. It was dropped when deploying with `--prt`, so a value given alongside that flag was silently ignored.
5 changes: 5 additions & 0 deletions .changeset/busy-bags-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Add `TestUsdc` to the devnet address book, and `RefundOutputBuilder` and `UsdWithdrawalOutputBuilderFactory` to the common one.
5 changes: 5 additions & 0 deletions .changeset/busy-olives-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Read the machine snapshot hash with the project's SDK image. Without a local `cartesi-machine-stored-hash`, `cartesi run`, `cartesi hash` and the commands that look up the deployed application read the snapshot in the default SDK image, whose emulator may not load a snapshot built by the `sdk` configured in `cartesi.toml`.
5 changes: 5 additions & 0 deletions .changeset/eleven-actors-spend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Fix `cartesi deposit` for ERC-20, ERC-721 and ERC-1155 against the renamed portal functions.
5 changes: 5 additions & 0 deletions .changeset/great-doors-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Warn in `cartesi run` when the application stops being healthy, reporting the node's reason instead of letting it go quiet while inputs keep being accepted on-chain.
5 changes: 5 additions & 0 deletions .changeset/lemon-geese-wander.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Allow the node's six `CARTESI_AUTH_*` claimer variables to be overridden from the host environment, matching the PRT set. Without `CARTESI_AUTH_KIND` only plain-mnemonic signing was reachable.
5 changes: 5 additions & 0 deletions .changeset/lucky-birds-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Colour the application status in `cartesi status`, distinguishing the recoverable `FAILED` state from the terminal ones, and print the node's reason beneath the table.
5 changes: 5 additions & 0 deletions .changeset/olive-games-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Stop waiting for a service whose container has exited, so a crash loop reports immediately instead of retrying until the timeout.
5 changes: 5 additions & 0 deletions .changeset/olive-moons-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Recognize the four terminal application states the node reports (`GUEST_EXCEPTION`, `MACHINE_HALTED`, `MCYCLE_OVERFLOW`, `UNEXPECTED_YIELD`) and surface the node's `reason` diagnostic alongside them.
5 changes: 5 additions & 0 deletions .changeset/quiet-pugs-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Bound the wait for services to become healthy. The backoff had no upper limit, so a service that never started held `cartesi run` for up to 19 hours instead of failing.
5 changes: 5 additions & 0 deletions .changeset/rotten-roses-write.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Fix fork validation against rollups-contracts 3.0.0-alpha.10 and dave 3.0.0-alpha.5.
5 changes: 5 additions & 0 deletions .changeset/shiny-hounds-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Pass the devnet mnemonic to the node as `CARTESI_PRT_AUTH_MNEMONIC`. The node starts its PRT service on every run and, with claim submission enabled by default, that service requires its own signer, for which PRT has no default.
5 changes: 5 additions & 0 deletions .changeset/thick-experts-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Generate contracts from the rollups-contracts and dave releases instead of `@cartesi/devnet`.
5 changes: 5 additions & 0 deletions .changeset/tidy-pears-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

Allow the node's six `CARTESI_PRT_AUTH_*` variables to be overridden from the host environment.
30 changes: 25 additions & 5 deletions .github/workflows/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
paths:
- ".github/workflows/cli.yaml"
- "apps/cli/**"
- "packages/sdk/**"
- "packages/tsconfig/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
Expand All @@ -18,6 +19,12 @@ jobs:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
# TEMPORARY: run the integration tests against the SDK image sdk.yaml
# builds for this PR, instead of the released cartesi/sdk version.
CARTESI_TEST_SDK: ghcr.io/cartesi/sdk:pr-${{ github.event.number }}
# TEMPORARY: compose parameterises only the image tag, never the
# cartesi/ prefix, so the PR images are retagged below and picked by tag.
CARTESI_TEST_RUNTIME_VERSION: pr-${{ github.event.number }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -30,17 +37,30 @@ jobs:

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1.9.1
with:
version: v1.4.3

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Build
run: bun run build --filter @cartesi/cli

# TEMPORARY: needed to pull the PR-tagged SDK image referenced by CARTESI_TEST_SDK.
- name: Login to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# TEMPORARY: docker compose resolves cartesi/<name>:<tag> from Docker Hub,
# which has no PR tags, so the ghcr images are retagged locally.
- name: Retag the PR-built images for docker compose
run: |
for t in sdk rollups-runtime rollups-database; do
docker pull "ghcr.io/cartesi/$t:pr-${{ github.event.number }}"
docker tag "ghcr.io/cartesi/$t:pr-${{ github.event.number }}" \
"cartesi/$t:pr-${{ github.event.number }}"
done

- name: Test
run: bun test apps/cli/

Expand Down
3 changes: 1 addition & 2 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"yaml": "^2.8.2"
},
"devDependencies": {
"@cartesi/devnet": "2.0.0-alpha.14",
"@sunodo/wagmi-plugin-hardhat-deploy": "^0.4.0",
"@cartesi/wagmi-plugin": "1.0.0-alpha.7",
"@types/bun": "^1.3.6",
"@types/bytes": "^3.1.5",
"@types/fs-extra": "^11.0.4",
Expand Down
39 changes: 36 additions & 3 deletions apps/cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ import {
erc721PortalAddress,
etherPortalAddress,
inputBoxAddress,
refundOutputBuilderAddress,
selfHostedApplicationFactoryAddress,
testFungibleTokenAddress,
testMultiTokenAddress,
testNonFungibleTokenAddress,
testUsdcAddress,
testUsdWithdrawalOutputBuilderAddress,
usdWithdrawalOutputBuilderFactoryAddress,
} from "./contracts.js";
import { cartesiMachineStoredHash } from "./exec";
import { getApplicationAddress, getForkConfig } from "./exec/rollups.js";
Expand All @@ -37,11 +40,34 @@ export const getContextPath = (...paths: string[]): string => {
return path.join(".cartesi", ...paths);
};

export const getMachineHash = async (): Promise<Hash | undefined> => {
// read hash of the cartesi machine snapshot, if one exists
/**
* SDK image of the project, which built its machine snapshot
*/
const getProjectSdk = (): string | undefined => {
try {
return getApplicationConfig(["cartesi.toml"]).sdk;
} catch {
// an invalid config is reported by the commands that build with it
return undefined;
}
};

/**
* Read the hash of the cartesi machine snapshot, if one exists. Without a
* local cartesi-machine-stored-hash, it runs in the SDK image the snapshot was
* built with, as an emulator of another version may not load it.
* @param options sdk image of the project, read from cartesi.toml if not given
*/
export const getMachineHash = async (options?: {
sdk?: string;
}): Promise<Hash | undefined> => {
const imagePath = getContextPath("image");
if (fs.existsSync(imagePath)) {
return await cartesiMachineStoredHash.computeHash(imagePath);
const image = options?.sdk ?? getProjectSdk();
return await cartesiMachineStoredHash.computeHash(
imagePath,
image ? { image } : undefined,
);
}
return undefined;
};
Expand Down Expand Up @@ -118,6 +144,7 @@ export const getAddressBook = async (options: {
TestToken: testFungibleTokenAddress,
TestNFT: testNonFungibleTokenAddress,
TestMultiToken: testMultiTokenAddress,
TestUsdc: testUsdcAddress,
TestUsdWithdrawalOutputBuilder: testUsdWithdrawalOutputBuilderAddress,
};

Expand All @@ -132,7 +159,10 @@ export const getAddressBook = async (options: {
ERC721Portal: erc721PortalAddress,
EtherPortal: etherPortalAddress,
InputBox: inputBoxAddress,
RefundOutputBuilder: refundOutputBuilderAddress,
SelfHostedApplicationFactory: selfHostedApplicationFactoryAddress,
UsdWithdrawalOutputBuilderFactory:
usdWithdrawalOutputBuilderFactoryAddress,
};

// gather all contracts, depending whether is fork or devnet
Expand Down Expand Up @@ -166,6 +196,9 @@ export const getServiceInfo = async (options: {
"--project-name",
projectName,
"ps",
// --all so an exited container is still reported, instead of the
// service simply vanishing from the output
"--all",
service,
"--format",
"json",
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/src/commands/deposit/erc1155.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const createErc1155SingleCommand = () => {
abi: erc1155SinglePortalAbi,
account,
address: erc1155SinglePortalAddress,
functionName: "depositSingleERC1155Token",
functionName: "depositSingleErc1155Token",
args: [
token.address,
application,
Expand Down Expand Up @@ -311,7 +311,7 @@ export const createErc1155BatchCommand = () => {
abi: erc1155BatchPortalAbi,
account,
address: erc1155BatchPortalAddress,
functionName: "depositBatchERC1155Token",
functionName: "depositBatchErc1155Token",
args: [
token.address,
application,
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/deposit/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const createErc20Command = () => {
abi: erc20PortalAbi,
account,
address: erc20PortalAddress,
functionName: "depositERC20Tokens",
functionName: "depositErc20Tokens",
args: [token.address, application, amount, execLayerData],
});

Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/deposit/erc721.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const createErc721Command = () => {
abi: erc721PortalAbi,
account,
address: erc721PortalAddress,
functionName: "depositERC721Token",
functionName: "depositErc721Token",
args: [
token.address,
application,
Expand Down
Loading
Loading