Skip to content

prototyp3-dev/rollups_v2_tests

Repository files navigation

Cartesi DApp Test Suite

Template DApps and load-testing tools for the Cartesi Rollups SDK. Includes a Python template, a JavaScript template, and a Locust-based load tester.

Prerequisites

  • Docker (with RISC-V emulation support via binfmt)
  • npm
  • pipenv (for the plotting script)
  • Cartesi CLI:
npm install -g @cartesi/cli@2.0.0-alpha.32

DApp Templates

Both templates implement the same Cartesi Rollup polling loop: the app posts to /finish to receive the next input, handles it, then posts again. They differ only in runtime (Python vs Node.js).

Python — py_simple_dapp

cd py_simple_dapp
cartesi build   # builds RISC-V machine drive via Docker
cartesi run     # starts local Cartesi node

Send an input:

cartesi send "Hello World" --encoding string

JavaScript — js_simple_dapp

cd js_simple_dapp
cartesi build
cartesi run

The JS source (src/index.js) is bundled with esbuild during cartesi build.

E2E Tests

Each DApp has a test_e2e.sh that starts the node, sends a "Hello World" input, confirms it was processed, records the result, and cleans up:

bash py_simple_dapp/test_e2e.sh
bash js_simple_dapp/test_e2e.sh

Results are appended to test_results.csv (commit hash, run counter, elapsed ms). To plot them, install dependencies once and then run:

pipenv install
pipenv run python plot_results.py

Load Tester — simple-load-test

Sends Ethereum transactions to a Cartesi InputBox contract via Locust to stress-test a live rollup node.

cd simple-load-test
python3 -m venv .venv && . .venv/bin/activate
pip3 install -r requirements.txt

Copy .env and fill in your values:

RPC_URL=
PRIVATE_KEY=       # funds user wallets
MNEMONIC=          # one derived wallet per simulated user
INPUTBOX_ADDRESS=
APP_ADDRESS=

Run:

ENV_FILE=.env locust --tags short --loglevel info --run-time 20m --spawn-rate 0.016 --users 20

A web UI is available at http://0.0.0.0:8089. Add --headless to skip it.

About

A project with some tests for the Cartesi Rollups v2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors