Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cartesi Rollups v2 #116

Merged
merged 3 commits into from
Mar 17, 2025
Merged

Cartesi Rollups v2 #116

merged 3 commits into from
Mar 17, 2025

Conversation

endersonmaia
Copy link
Contributor

@endersonmaia endersonmaia commented Oct 29, 2024

This is support for Rollups V2.
The run command has been deprecated and replaced by two separate steps: rollups start and rollups deploy.

The following are the new commands:

$ cartesi rollups --help
Usage: cartesi rollups [options] [command]

Options:
  -h, --help        display help for command

Commands:
  start [options]   Start a local rollups node environment.
  status [options]  Shows the status of a local rollups node environment.
  stop [options]    Stop a local rollups node environment.
  deploy [options]  Deploy a rollups application to a rollups node.

ps: deploy (not rollups deploy) will probably be deprecated. Or we may use a cartesi.toml property to redirect commands from <root> to either rollups or (upcoming) coprocessor.

The following flow works for me. Please help test.

// start server in detached mode
cartesi rollups start -d -v

// check if server is running
cartesi rollups status

// create a new deroll v2 project
npm init @deroll/app@2.0.0-alpha.0

// inside the dapp...
cartesi build
cartesi rollups deploy

// send an input
cartesi send

// stop the server
cartesi rollups stop

Copy link

changeset-bot bot commented Oct 29, 2024

🦋 Changeset detected

Latest commit: 24ad87e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cartesi/cli Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 29, 2024

Coverage Report for ./apps/cli

Status Category Percentage Covered / Total
🔵 Lines 28.14% 293 / 1041
🔵 Statements 28.24% 298 / 1055
🔵 Functions 30.17% 51 / 169
🔵 Branches 26.19% 121 / 462
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/cli/src/base.ts 0% 0% 0% 0% 25-134
apps/cli/src/config.ts 89.5% 82.02% 96.77% 89.3% 66-67, 215, 222, 231, 246-249, 260, 269, 271, 280, 318, 328-332, 344
apps/cli/src/index.ts 0% 0% 0% 0% 18-58
apps/cli/src/wallet.ts 0% 0% 0% 0% 39-322
apps/cli/src/commands/address-book.ts 0% 0% 0% 0% 5-40
apps/cli/src/commands/build.ts 0% 0% 0% 0% 16-91
apps/cli/src/commands/clean.ts 0% 100% 0% 0% 5-9
apps/cli/src/commands/create.ts 0% 0% 0% 0% 7-65
apps/cli/src/commands/deploy.ts 0% 100% 0% 0% 5-18
apps/cli/src/commands/doctor.ts 0% 0% 0% 0% 7-135
apps/cli/src/commands/hash.ts 0% 0% 0% 0% 5-24
apps/cli/src/commands/rollups.ts 0% 100% 0% 0% 7-21
apps/cli/src/commands/run.ts 0% 100% 0% 0% 4-13
apps/cli/src/commands/send.ts 0% 0% 0% 0% 13-100
apps/cli/src/commands/shell.ts 0% 0% 0% 0% 8-55
apps/cli/src/commands/deploy/build.ts 0% 100% 0% 0% 4-10
apps/cli/src/commands/rollups/deploy.ts 0% 0% 0% 0% 29-320
apps/cli/src/commands/rollups/start.ts 0% 0% 0% 0% 8-190
apps/cli/src/commands/rollups/status.ts 0% 0% 0% 0% 8-46
apps/cli/src/commands/rollups/stop.ts 0% 100% 0% 0% 7-28
apps/cli/src/commands/send/erc20.ts 0% 0% 0% 0% 25-109
apps/cli/src/commands/send/erc721.ts 0% 0% 0% 0% 17-103
apps/cli/src/commands/send/ether.ts 0% 0% 0% 0% 12-49
apps/cli/src/commands/send/generic.ts 0% 0% 0% 0% 19-140
apps/cli/src/exec/rollups.ts 0% 0% 0% 0% 18-61
Generated in workflow #360 for commit 24ad87e by the Vitest Coverage Report Action

@endersonmaia endersonmaia force-pushed the feature/cli-run-v2 branch 3 times, most recently from d8e88da to 1b2868f Compare November 4, 2024 15:30
@endersonmaia endersonmaia force-pushed the feature/cli-run-v2 branch 3 times, most recently from bd0df04 to f54fe46 Compare January 27, 2025 19:16
@endersonmaia endersonmaia force-pushed the feature/cli-run-v2 branch 4 times, most recently from b4e999f to 78b5056 Compare February 4, 2025 14:11
@endersonmaia endersonmaia force-pushed the feature/cli-run-v2 branch 2 times, most recently from a82afdd to a7e55c5 Compare February 27, 2025 13:18
@tuler tuler force-pushed the feature/cli-run-v2 branch 3 times, most recently from 8d2a41d to f3b6918 Compare March 4, 2025 16:54
@tuler tuler changed the title cartesi run to rollups-node:2.x Rollups v2 Mar 4, 2025
@tuler tuler marked this pull request as ready for review March 4, 2025 21:01
@tuler tuler changed the title Rollups v2 rollups v2 Mar 4, 2025
@tuler
Copy link
Member

tuler commented Mar 4, 2025

$ cartesi rollups start --help
Usage: cartesi rollups start [options]

Start a local rollups node environment.

Options:
  --block-time <number>     interval between blocks (in seconds) (default: 5)
  --default-block <string>  default block to be used when fetching new blocks. (choices: "latest", "safe", "pending", "finalized", default: "finalized")
  --cpus <number>           number of cpu limits for the rollups-node
  --memory <number>         memory limit for the rollups-node in MB
  --project-name <string>   name of environment (default: "cartesi-rollups")
  --services <string>       optional services to start, comma separated list from [bundler, explorer, graphql, paymaster] (default: [])
  -p, --port <number>       port to listen on (default: 8080)
  -d, --detach              run in detached mode (default: false)
  --dry-run                 show the docker compose configuration (default: false)
  -v, --verbose             verbose output (default: false)
  -h, --help                display help for command

@tuler
Copy link
Member

tuler commented Mar 4, 2025

$ cartesi rollups stop --help 
Usage: cartesi rollups stop [options]

Stop a local rollups node environment.

Options:
  --project-name <project-name>  Project name (default: "cartesi-rollups")
  -h, --help                     display help for command

@tuler
Copy link
Member

tuler commented Mar 4, 2025

$ cartesi rollups stop --help 
Usage: cartesi rollups stop [options]

Stop a local rollups node environment.

Options:
  --project-name <project-name>  Project name (default: "cartesi-rollups")
  -h, --help                     display help for command
➜  test2 cartesi-dev rollups status --help
Usage: cartesi rollups status [options]

Shows the status of a local rollups node environment.

Options:
  --project-name <string>  name of environment (default: "cartesi-rollups")
  --json                   output in JSON format
  -h, --help               display help for command

@tuler
Copy link
Member

tuler commented Mar 4, 2025

$ cartesi rollups deploy --help
Usage: cartesi rollups deploy [options]

Deploy a rollups application to a rollups node.

Options:
  --chain-id <id>                Chain ID (default: 31337)
  --rpc-url <url>                RPC URL
  --mnemonic <phrase>            Mnemonic passphrase
  --mnemonic-index <index>       Mnemonic account index (default: 0)
  --project-name <string>        name of environment (default: "cartesi-rollups")
  --name <string>                application name
  --authority-owner <address>    authority owner
  --application-owner <address>  application owner
  --epoch-length <number>        length of an epoch (in blocks) (default: 720)
  --salt <hash>                  salt for deployment (default: "0x0000000000000000000000000000000000000000000000000000000000000000")
  --json                         output in JSON format
  -h, --help                     display help for command

@tuler tuler changed the title rollups v2 Cartesi Rollups v2 Mar 5, 2025
@tuler tuler force-pushed the feature/cli-run-v2 branch from 44df851 to 1297ea6 Compare March 5, 2025 22:17
Copy link
Contributor Author

@endersonmaia endersonmaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this PR is mine, I can't request changes.

@tuler tuler force-pushed the feature/cli-run-v2 branch 2 times, most recently from 39558cf to d496299 Compare March 6, 2025 18:31
Copy link
Contributor Author

@endersonmaia endersonmaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The send behavior is still weird.

Even if I define the --dapp argument, it will override with the address of the dapp from the directory I'm calling the command from.

--dapp should take precedence

@tuler
Copy link
Member

tuler commented Mar 6, 2025

--dapp should take precedence

I think this is commander bug. Opened an issue at tj/commander.js#2335

@tuler
Copy link
Member

tuler commented Mar 7, 2025

I think this is commander bug. Opened an issue at tj/commander.js#2335

Problem solved.

ps: there are two ways of structuring commands and subcommands in commander.

  1. .command(name).
  2. .addCommand(new Command(name))

I was using (1), but switched to (2).

@tuler
Copy link
Member

tuler commented Mar 7, 2025

Need to check why the graphql container is continuously printing:

WRN No raw input references found

Copy link
Contributor Author

@endersonmaia endersonmaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... send --dapp= is working as expected

@endersonmaia endersonmaia requested a review from tuler March 7, 2025 14:00
@endersonmaia
Copy link
Contributor Author

@tuler I think we're good to go

@tuler
Copy link
Member

tuler commented Mar 7, 2025

Regarding the start + start issue, I was thinking of an elegant way to handle it without checking first if it's running.

What happens now is that docker compose up, when executed again, "reapplies" the services, which is usually harmless. But the one-shot containers get reexecutes, and the one which creates the graphql database fails because the database already exists.

The solutions to create only if exists are all ugly and not elegant.

@endersonmaia
Copy link
Contributor Author

@tuler I think we're good to go

except that we need a rollups-node v2 release 🫠

@tuler tuler force-pushed the feature/cli-run-v2 branch 2 times, most recently from b295744 to 48ddef2 Compare March 14, 2025 20:31
@tuler
Copy link
Member

tuler commented Mar 15, 2025

Applied the idea of #151 but without the extends, just using an env var for the SDK image name.

@tuler tuler force-pushed the feature/cli-run-v2 branch 2 times, most recently from caf7a2f to c2a395d Compare March 15, 2025 16:05
@tuler tuler force-pushed the feature/cli-run-v2 branch from b999336 to 24ad87e Compare March 17, 2025 14:09
@tuler tuler merged commit 0b7f523 into prerelease/v2-alpha Mar 17, 2025
3 checks passed
@tuler tuler deleted the feature/cli-run-v2 branch March 17, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants