Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/clean-boxes-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/sdk": patch
---

switching back chainId from 13370 to 31337
5 changes: 5 additions & 0 deletions .changeset/good-turkeys-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

migrate format from prettier to biome
5 changes: 5 additions & 0 deletions .changeset/neat-meals-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

switching back chainId from 13370 to 31337
2 changes: 1 addition & 1 deletion .github/workflows/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
version: v1.4.3

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

- name: Build
run: bun run build --filter @cartesi/cli
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
version: v1.4.3

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

- name: Build
run: bun run build --filter @cartesi/devnet
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0

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

- name: Lint
run: bun run lint
2 changes: 1 addition & 1 deletion .github/workflows/paymaster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
version: v1.4.3

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

- name: Build
run: bun run build --filter @cartesi/mock-verifying-paymaster
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
version: v1.4.3

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

- name: Build
run: bun run build
Expand Down
8 changes: 0 additions & 8 deletions .prettierignore

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "biomejs.biome"
}
}
8 changes: 2 additions & 6 deletions apps/cli/biome.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"extends": ["../../biome.json"],
"root": false,
"extends": "//",
"linter": {
"rules": {
"complexity": {
"noBannedTypes": "off"
}
}
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
}
3 changes: 0 additions & 3 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"yaml": "^2.8.2"
},
"devDependencies": {
"@biomejs/biome": "^2.2.4",
"@cartesi/devnet": "2.0.0-alpha.9",
"@cartesi/rollups": "2.1.1",
"@types/bun": "^1.3.5",
Expand Down Expand Up @@ -69,8 +68,6 @@
"codegen": "run-p codegen:wagmi",
"codegen:wagmi": "wagmi generate",
"compile": "bun build.ts",
"lint": "biome lint",
"posttest": "bun lint",
"test": "vitest"
},
"engines": {
Expand Down
26 changes: 15 additions & 11 deletions apps/cli/src/compose/explorer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { anvil } from "viem/chains";
import type { ComposeFile, Config, Service } from "../types/compose.js";
import { DEFAULT_HEALTHCHECK } from "./common.js";

Expand Down Expand Up @@ -75,19 +76,21 @@ export const squidProcessorService = (options: ServiceOptions): Service => {
const databasePassword = options.databasePassword;
const databaseHost = options.databaseHost ?? "database";
const databasePort = options.databasePort ?? 5432;
const chain = anvil;
const environment: Record<string, string | number> = {
DB_HOST: databaseHost,
DB_NAME: "explorer",
DB_PASS: databasePassword,
DB_PORT: databasePort.toString(),
CHAIN_IDS: chain.id.toString(),
};
environment[`RPC_URL_${chain.id}`] = `http://anvil:8545`;
environment[`BLOCK_CONFIRMATIONS_${chain.id}`] = 0;
environment[`GENESIS_BLOCK_${chain.id}`] = 1;

return {
image: `cartesi/rollups-explorer-api:${imageTag}`,
environment: {
DB_HOST: databaseHost,
DB_NAME: "explorer",
DB_PASS: databasePassword,
DB_PORT: databasePort.toString(),
CHAIN_IDS: "13370",
RPC_URL_13370: "http://anvil:8545",
BLOCK_CONFIRMATIONS_13370: 0,
GENESIS_BLOCK_13370: 1,
},
environment,
command: ["sqd", "process:prod"],
depends_on: {
database: { condition: "service_healthy" },
Expand All @@ -106,8 +109,9 @@ export const explorerService = (options: ServiceOptions): Service => {
return {
image: `cartesi/rollups-explorer:${imageTag}`,
environment: {
NODE_RPC_URL: nodeRpcUrl,
CHAIN_ID: 31337,
EXPLORER_API_URL: explorerApiUrl,
NODE_RPC_URL: nodeRpcUrl,
},
expose: ["3000"],
depends_on: {
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/src/compose/node.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { anvil } from "viem/chains";
import {
daveAppFactoryAddress,
inputBoxAddress,
Expand Down Expand Up @@ -60,7 +61,7 @@ const service = (options: ServiceOptions): Service => {
CARTESI_AUTH_MNEMONIC: mnemonic,
CARTESI_BLOCKCHAIN_DEFAULT_BLOCK: defaultBlock,
CARTESI_BLOCKCHAIN_HTTP_ENDPOINT: "http://anvil:8545",
CARTESI_BLOCKCHAIN_ID: "13370",
CARTESI_BLOCKCHAIN_ID: anvil.id.toString(),
CARTESI_BLOCKCHAIN_WS_ENDPOINT: "ws://anvil:8545",
CARTESI_CONTRACTS_DAVE_APP_FACTORY_ADDRESS: daveAppFactoryAddress,
CARTESI_CONTRACTS_INPUT_BOX_ADDRESS: inputBoxAddress,
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class InvalidStringArrayError extends Error {
*/
const DEFAULT_FORMAT = "ext2";
const DEFAULT_RAM = "128Mi";
export const DEFAULT_SDK_VERSION = "0.12.0-alpha.30";
export const DEFAULT_SDK_VERSION = "0.12.0-alpha.31";
export const DEFAULT_SDK_IMAGE = "cartesi/sdk";
export const PREFERRED_PORT = 6751;

Expand Down
1 change: 0 additions & 1 deletion apps/cli/src/exec/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * as cartesiMachine from "./cartesi-machine.js";
export * as genext2fs from "./genext2fs.js";
export * as mksquashfs from "./mksquashfs.js";

4 changes: 2 additions & 2 deletions apps/cli/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import {
publicActions,
walletActions,
} from "viem";
import { cannon } from "viem/chains";
import { anvil } from "viem/chains";
import { getProjectName } from "./base.js";
import { PREFERRED_PORT } from "./config.js";
import { getProjectPort } from "./exec/rollups.js";

export const cartesi = defineChain({
...cannon,
...anvil,
name: "Cartesi Devnet",
testnet: true,
});
Expand Down
15 changes: 9 additions & 6 deletions apps/cli/wagmi.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { type Plugin, defineConfig } from "@wagmi/cli";
import { readFileSync, readdirSync } from "node:fs";
import path from "node:path";

interface CannonOptions {
interface DeploymentsOptions {
directory: string;
includes?: RegExp[];
excludes?: RegExp[];
}

const shouldIncludeFile = (name: string, config: CannonOptions): boolean => {
const shouldIncludeFile = (
name: string,
config: DeploymentsOptions,
): boolean => {
if (config.excludes) {
// if there is a list of excludes, then if the name matches any of them, then exclude
for (const exclude of config.excludes) {
Expand All @@ -30,11 +33,11 @@ const shouldIncludeFile = (name: string, config: CannonOptions): boolean => {
return true;
};

const cannonDeployments = (config: CannonOptions): Plugin => {
const deployments = (config: DeploymentsOptions): Plugin => {
return {
name: "cannon",
name: "cartesi",
contracts: () => {
// list all files exported by cannon in directory
// list all files exported by devnet in directory
const files = readdirSync(config.directory).filter((file) =>
shouldIncludeFile(file, config),
);
Expand All @@ -60,7 +63,7 @@ const cannonDeployments = (config: CannonOptions): Plugin => {
export default defineConfig({
out: "src/contracts.ts",
plugins: [
cannonDeployments({
deployments({
directory: "node_modules/@cartesi/devnet/deployments",
}),
],
Expand Down
10 changes: 9 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
}
},
"formatter": {
"enabled": false
"enabled": true,
"includes": ["**", "!.changeset/pre.json"],
"indentStyle": "space",
"indentWidth": 4
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
}
4 changes: 1 addition & 3 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
"@biomejs/biome": "^2.3.11",
"@changesets/cli": "^2.29.8",
"@types/bun": "^1.3.5",
"prettier": "^3.7.4",
"turbo": "^2.7.4",
},
},
"apps/cli": {
"name": "@cartesi/cli",
"version": "2.0.0-alpha.23",
"version": "2.0.0-alpha.24",
"bin": {
"cartesi": "./dist/index.js",
},
Expand Down Expand Up @@ -45,7 +44,6 @@
"yaml": "^2.8.2",
},
"devDependencies": {
"@biomejs/biome": "^2.2.4",
"@cartesi/devnet": "2.0.0-alpha.9",
"@cartesi/rollups": "2.1.1",
"@types/bun": "^1.3.5",
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
"build": "turbo run build",
"clean": "turbo run clean",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{cjs,css,json,md,mjs,ts,tsx}\"",
"lint": "biome ci",
"publish-packages": "bun changeset publish && git push --follow-tags",
"test": "turbo test"
},
"devDependencies": {
"@biomejs/biome": "^2.3.11",
"@changesets/cli": "^2.29.8",
"@types/bun": "^1.3.5",
"prettier": "^3.7.4",
"turbo": "^2.7.4"
},
"packageManager": "bun@1.3.5",
"packageManager": "bun@1.3.6",
"workspaces": [
"apps/*",
"packages/*"
Expand Down
13 changes: 5 additions & 8 deletions packages/mock-verifying-paymaster/src/relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const handleMethodV06 = async (
if (estimateGas) {
let gasEstimates:
| EstimateUserOperationGasReturnType<ENTRYPOINT_ADDRESS_V06_TYPE>
| undefined = undefined;
| undefined;
try {
gasEstimates = await altoBundlerV06.estimateUserOperationGas({
userOperation: op,
Expand Down Expand Up @@ -171,7 +171,7 @@ const handleMethodV07 = async (
if (estimateGas) {
let gasEstimates:
| EstimateUserOperationGasReturnType<ENTRYPOINT_ADDRESS_V07_TYPE>
| undefined = undefined;
| undefined;
try {
gasEstimates = await altoBundlerV07.estimateUserOperationGas({
userOperation: op,
Expand Down Expand Up @@ -445,12 +445,9 @@ export const createRpcHandler = (
console.log(`JSON.stringify(err): ${util.inspect(err)}`);

const error = {
// biome-ignore lint/suspicious/noExplicitAny:
message: (err as any).message,
// biome-ignore lint/suspicious/noExplicitAny:
data: (err as any).data,
// biome-ignore lint/suspicious/noExplicitAny:
code: (err as any).code ?? -32603,
message: (err as unknown as { message: string }).message,
data: (err as unknown as { data: unknown }).data,
code: (err as unknown as { code: number }).code ?? -32603,
};

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/devnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
set -e
jq -rs '. | map({contractName,address}) | unique_by(.address) | sort_by(.contractName) | .[] | "\(.address) \(.contractName)"' /usr/share/cartesi/deployments/*.json
exec anvil --chain-id 13370 --load-state /usr/share/cartesi/anvil_state.json "$@"
exec anvil --load-state /usr/share/cartesi/anvil_state.json "$@"
1 change: 0 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"cache": false,
"persistent": true
},
"lint": {},
"start": {
"dependsOn": ["^build"]
},
Expand Down
Loading