Dave is a permissionless, interactive fraud-proof system. This repo contains the Dave software suite for rollups:
- Solidity smart contracts;
- validator node in Rust;
- Lua reference client and adversarial test actors;
- dispute algorithm specification.
Our fraud-proof system is called Dave. Just Dave. It's neither an acronym nor an abbreviation, but a name. Like most names, it should be written in lower case with an initial capital, that is, "Dave".
Dave is permissionless. This means anyone can participate in the consensus. Since anyone can participate, there's the possibility of Sybil attacks, where an attacker can generate an army of fake personas and try to shift the consensus in their favour.
Dave targets one-of-N security: under the protocol's stated correctness, clock, and censorship assumptions, one correct validator can prevent an incorrect result. It does not matter how many other validators are adversarial. The implemented PRT guarantees, assumptions, and non-claims are documented in the dispute-game specification.
Dave is inspired by the David vs. Goliath archetype.
Dave uses the Cartesi Machine as its execution environment. The Cartesi Machine is a RISC-V emulator. Its onchain implementation can be found here. The Cartesi Machine state-transition function is implemented in two layers: the big-machine and the micro-architecture. The former implements the RV64GC ISA, while the latter implements the much smaller RV64I ISA. Using a technique called machine swapping and leveraging good compilers, we implement in Solidity only the micro-architecture's state-transition function, while the execution environment can support a much larger set of extensions.
Nevertheless, Dave was designed to be agnostic on its execution environment. As long as one can provide a self-contained state-transition function, Dave will work.
The first implementation of Dave is based on the Permissionless Refereed Tournaments (PRT) primitive. The paper can be found here. Under the paper's model, maximum delay and defender expense grow logarithmically with the number of Sybils, while validator hardware and bond requirements remain bounded. This repository implements a related recursive tournament variant; its local bounds and executable evidence do not yet amount to a general recursive attacker-versus-correct delay theorem. See the implemented delay model before applying the paper's asymptotic claim to a deployment.
Although delay grows logarithmically in the Permissionless Refereed Tournaments (PRT) algorithm, the constant multiplying this logarithm is high, harming its liveness.
The second implementation of Dave will be based on the eponymous Dave algorithm, which improves the liveness of PRT, while maintaining its attractive security and decentralization properties. We've published our initial research here, and presented our findings at Devcon 24 here.
This repository offers two development setups for Dave: one running inside a Docker container and one running natively (outside Docker). Choose the setup that best fits your workflow.
Dependencies:
- git
- Docker
- just
- curl
- sha256sum
Setup Steps:
-
Clone the Repository: Ensure you have cloned the repository to your local machine.
-
Initialize the Docker Environment: Run the following command to prepare the pinned emulator sources and build the Docker environment (it will take a while). This does not first build an unused emulator library on the host.
just setup-docker
-
Execute Commands Inside Docker: To run any command within the Docker container, prefix your command as follows:
just run-dockered <command>
If you prefer running Dave natively on your machine, you'll need additional dependencies.
Additional Dependencies:
- A C++ compiler
- GNU make
- foundry
- The Cartesi Machine CLI for building and running test programs
- Lua 5.4
- Rust
xgenext2fs, only to build the honeypot machine image (the honeypot project generates its rootfs from a tarball with it)
The lists above are the big pieces; the doctor commands below check the smaller build and test prerequisites as well.
Setup Steps:
-
Clone the Repository: Make sure the repository is cloned locally.
-
Initialize the Local Environment: Choose the Cartesi Machine library provider, then run the setup command:
- A Nix or packaged provider sets
LIBCARTESI_PATHto the absolute directory containinglibcartesi.a. SetINCLUDECARTESI_PATHto the absolute directory containingcm.handcm-version.hwhen the headers are not in the conventional siblinginclude/cartesi-machinedirectory. - With
LIBCARTESI_PATHunset, setup prepares the pinned v0.21 emulator sources and Boost headers and builds the library natively withslirp=no.
just setup-local
Any set
LIBCARTESI_PATHselects the external provider; an empty or invalid value is an error rather than a request to fall back to source. See the machine integration guide for the release and intermediary-commit workflows. - A Nix or packaged provider sets
At any point, run:
just doctor # build and pre-commit-check readiness
just doctor-e2e # machine images, devnet, and E2E state
just doctor-all # both scopesEach command prints the fix for anything missing. Keeping E2E artifacts out of
the base doctor prevents an otherwise build-ready checkout from appearing
permanently unhealthy. just --list shows every available recipe, and
just check is the pre-commit gate.
The repository includes end-to-end tests for PRT Dave:
- Rollups test harness: Follow the instructions in the end-to-end test README.
The knowledge base lives in docs/ - start with docs/README.md. It covers the commitment construction (computation-hash), the epoch and dispute lifecycle, the node architecture, the test harness, and the build system. Agent-facing context and repo conventions are in AGENTS.md.
Thank you for your interest in Cartesi! Head over to our Contributing Guidelines for instructions on how to sign our Contributors Agreement and get started with Cartesi!
Please note we have a Code of Conduct, please follow it in all your interactions with the project.
The repository and all contributions are licensed under APACHE 2.0. Please review our LICENSE file.
