Skip to content

Latest commit

 

History

History
178 lines (125 loc) · 6.7 KB

File metadata and controls

178 lines (125 loc) · 6.7 KB

Dave

Dave is a permissionless, interactive fraud-proof system. This repo contains the Dave software suite for rollups:

  • Solidity smart contracts;
  • validator node in Rust;
  • a Lua commitment oracle and adversarial test actors;
  • dispute algorithm specification.

What's in a name

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.


Execution Environment

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.


Algorithms

Permissionless Refereed Tournaments

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.

Dave fraud-proof algorithm

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.


Running Dave

Dave builds and runs natively.

Dependencies:

  • git
  • just
  • curl
  • sha256sum
  • A C++ compiler
  • GNU make
  • foundry
  • The Cartesi Machine CLI for building and running test programs
  • Lua 5.4
  • Rust
  • Docker, only for the KMS tests (just test-kms) and the honeypot machine image
  • xgenext2fs, only to build the honeypot machine image (the honeypot project generates its rootfs from a tarball with it)

The list above has the big pieces; the doctor commands below check the smaller build and test prerequisites as well.

Setup Steps:

  1. Clone the Repository: Make sure the repository is cloned locally.

  2. Initialize the Environment: Choose the Cartesi Machine library provider, then run the setup command:

    • A Nix or packaged provider sets LIBCARTESI_PATH to the absolute directory containing libcartesi.a. Set INCLUDECARTESI_PATH to the absolute directory containing cm.h and cm-version.h when the headers are not in the conventional sibling include/cartesi-machine directory.
    • With LIBCARTESI_PATH unset, setup prepares the pinned v0.21 emulator sources and Boost headers and builds the library natively with slirp=no.
    just setup-local

    Any set LIBCARTESI_PATH selects 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.

Checking your setup

At any point, run:

just doctor       # build/check readiness, including echo and yield images
just doctor-e2e   # full E2E images, devnet, and E2E state
just doctor-all   # both scopes

Each command prints the fix for anything missing. Keeping E2E artifacts out of the base doctor, except for the echo/yield images used by standard Rust tests, prevents an otherwise check-ready checkout from appearing permanently unhealthy. just --list shows every available recipe, and just check is the pre-commit gate.

Running Examples

The repository includes end-to-end tests for PRT Dave:


Documentation

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.


Contributing

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.


License

The repository and all contributions are licensed under APACHE 2.0. Please review our LICENSE file.


Dave