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

Specify Cartesi CLI version in package.json #137

Merged
merged 2 commits into from
Aug 13, 2024
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
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
env:
PNPM_VERSION: 9
NODE_VERSION: 18
CARTESI_CLI_VERSION: 0.16.0
CARTESI_MACHINE_IMAGE_NAME: bug-buster-machine
CARTESI_NODE_IMAGE_NAME: bug-buster-node
REGISTRY: ghcr.io/${{ github.repository_owner }}
Expand Down Expand Up @@ -73,16 +72,16 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'

- name: Install Cartesi CLI
run: pnpm add -g @cartesi/cli@${{ env.CARTESI_CLI_VERSION }}
- name: Install Node.js dependencies
run: pnpm i

- name: Build Cartesi Machine image
run: cartesi build --from-image "${{ steps.build_machine.outputs.imageid }}"
run: pnpm exec cartesi build --from-image "${{ steps.build_machine.outputs.imageid }}"

- name: Build Cartesi Node image
id: build_node
run: |
cartesi deploy build --json | \
pnpm exec cartesi deploy build --json | \
jq -r '"image=\(.image)"' >> "$GITHUB_OUTPUT"

- name: Create tags for Cartesi Node image
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.cartesi
.cartesi.env
node_modules
frontend/node_modules/**
frontend/.next/**
frontend/src/hooks/contracts.tsx
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
all: bounties test-image image

image:
cartesi build
all: bounties test-image

bounties:
$(MAKE) -C tests/bounties
Expand All @@ -12,9 +9,6 @@ test-image:
test:
docker run -v $(shell pwd):/mnt --rm -it bug-buster-test-image lua5.4 tests/tests.lua

run:
cartesi run

run-frontend-dev:
cd frontend && pnpm dev

Expand Down
46 changes: 33 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ For your purposes, not all dependencies may be required.
To help you figure out which dependencies you actually need, here is a table of dependencies for each part of the code base.

| Dependency | Version | Presentation | Back-end | Examples | Tests | Populate | CLI | Front-end |
| :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
| `docker` | 26.1 | ☑️ | ☑️ | ☑️ | ☑️ | | | |
| `go` | 1.21.1 | | | | | ☑️ | ☑️ | |
| `jq` | 1.6 | | | | | ☑️ | | |
| `pnpm` | 9.x | | | | | | | ☑️ |
| `cartesi` | 0.14.0 | | ☑️ | | ☑️ | | | |
| :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
| `docker` | 26.1 | :o: | :o: | :o: | :o: | | | |
| `go` | 1.21.1 | | | | | :o: | :o: | |
| `foundry` | nightly | | | | | :o: | :o: | |
| `jq` | 1.6 | | | | | :o: | | |
| `pnpm` | 9.x | | :o: | | :o: | :o: | | :o: |

## Presentation

Expand Down Expand Up @@ -66,12 +66,20 @@ Along with following exploits:

## Back-end

### Set up

First, you need to install the Cartesi CLI with `pnpm`.

```sh
pnpm i
```

### Building the Cartesi Machine image

#### From source

```sh
cartesi build
pnpm build
```

#### From a tagged image
Expand All @@ -86,18 +94,25 @@ docker pull --platform linux/riscv64 ghcr.io/crypto-bug-hunters/bug-buster-machi
Then, you can build the Cartesi Machine image like so.

```sh
cartesi build --from-image ghcr.io/crypto-bug-hunters/bug-buster-machine:$VERSION
pnpm exec cartesi build --from-image ghcr.io/crypto-bug-hunters/bug-buster-machine:$VERSION
```

### Running the Cartesi Node

```
cartesi run
pnpm start
```

## Tests

Before running tests, make sure you built the image and bounties, you can build them with `make all`.
Make sure you first built the machine image and bounties.
Then, build the test image.

```sh
make test-image
```

Now, you may run the tests.

```sh
make test
Expand Down Expand Up @@ -130,13 +145,18 @@ go run ./cli send dapp-address
go run ./cli send bounty \
-n "Lua Bounty" \
-d "Description of Lua bounty" \
-c ./tests/bounties/lua-bounty/lua-5.4.3-bounty_riscv64.tar.xz
-c ./tests/bounties/lua-bounty/lua-5.4.3-bounty_riscv64.tar.xz \
-t 0x92C6bcA388E99d6B304f1Af3c3Cd749Ff0b591e2
```

### Sending sponsor

```sh
go run ./cli send sponsor -b 0 -n "Sponsor Name" -v 0.05
go run ./cli send sponsor \
-b 0 \
-n "Sponsor Name" \
-t 0x92C6bcA388E99d6B304f1Af3c3Cd749Ff0b591e2 \
-v 5000000
```

### Sending exploit
Expand Down Expand Up @@ -190,7 +210,7 @@ With this very tight schedule, some of the features were left out for later impl
Below are some of those features.

- Support ENS
- Support other types of assets (ERC-20, ERC-721, and ERC-1155)
- Support other types of assets (Ether, ERC-721, and ERC-1155)
- Support syntax highlight on code blocks
- Add optional one-time setup phase for applications
- Add option to download bounty bundle
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "bug-buster",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "cartesi build",
"start": "cartesi run --disable-bundler --disable-paymaster"
},
"devDependencies": {
"@cartesi/cli": "0.16.0"
}
}
Loading