A Rust library for creating solvers in the OP Stack's dispute protocol

Related tags

Cryptography durin
Overview

durinci license

A framework for building solvers for the OP Stack's dispute protocol.

Note
WIP

Overview

  • durin-primitives - Contains primitive types and traits used by other solvers within durin as well as agents utilizing the solvers.
  • durin-fault - Contains an implementation of a solver for Optimism's FaultDisputeGame.

What's a Solver?

The OP Stack contains a dispute protocol that allows developers to implement Dispute Games, simple primitives that allow the creation of a Claim, a 32-byte commitment to a piece of information, and a method to resolve this Claim to true or false.

A Dispute Game has many possible implementations - for Optimism's purposes, the primary usecase for such a game is to dispute claims about the state of an OP Stack chain on L1. The solution for this was the FaultDisputeGame, an implementation of a Dispute Game that allows participants to bisect an instruction trace to find the exact instruction that they and their opponent diverge, and execute a single instruction on-chain via an emulated VM (such as MIPS for Cannon or RISC-V for Asterisc) to prove their opponent wrong.

This is only one possible implementation of a Dispute Game - the OP Stack's dispute protocol allows for arbitrary implementations of this primitive. The durin framework allows developers to create solvers for their own implementation of a Dispute Game and use them within simulations, challenge agents, testing, and more.

Creating a Solver

  1. Create a new crate for your solver under the crates directory.
  2. Add durin-primitives as a dependency to your crate.
    1. Implement the DisputeGame trait to model the state of your dispute.
    2. Implement the DisputeSolver trait on your solver struct.
    3. Create Rules for your solver.

What's a Rule?

A Rule is an isolated invariant check on a DisputeGame's state that can be used to determine if a solver's suggested state transitions hold the state's invariants. The durin-primitives trait exports the Rule type as well as the chain_rules macro, which can be used to apply multiple rules on top of each other when asserting pre or post conditions for the game's state transitions.

As the solvers within durin are meant to be consumed by agents who act on their suggestions, it is critical that the state invariants of the respective games are upheld. Rules allow developers to easily define the expected behavior of the state transitions, check their invariants, and assert that their solver's suggestions are valid with respect to the state's invariants.

rules

You might also like...
Ecoball Node is the Official Rust implementation of the Ecoball protocol.

Ecoball Node is the Official Rust implementation of the Ecoball protocol. It is a fork of OpenEthereum - https://github.com/openethereum/

A rust implementation of the ABCI protocol for tendermint core

🚨 DEPRECATED 🚨 This repo has been deprecated. Development work continues as the "abci" crate of informalsystems/tendermint-rs. Please reference that

Open source Rust implementation of the Witnet decentralized oracle protocol, including full node and wallet backend  👁️🦀
Open source Rust implementation of the Witnet decentralized oracle protocol, including full node and wallet backend 👁️🦀

witnet-rust is an open source implementation of the Witnet Decentralized Oracle Network protocol written in Rust. Components witnet-rust implements ma

The Rust implementation of Conflux protocol.

Conflux-Rust Conflux-rust is a Rust-based implementation of the Conflux protocol. It is fast and reliable. Please follow the Conflux Documentation to

Next-generation implementation of Ethereum protocol (
Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture.

🧬 Martinez 🧬 Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture. Why run Martinez? Look at

Prost is a Protocol Buffers implementation for the Rust Language.

PROST! prost is a Protocol Buffers implementation for the Rust Language. prost generates simple, idiomatic Rust code from proto2 and proto3 files. Com

Rust implementation of the Inter-Blockchain Communication (IBC) protocol.

ibc-rs Rust implementation of the Inter-Blockchain Communication (IBC) protocol. This project hosts the ibc rust crate which defines the main data str

Pure Rust implementation of components of the Secure Shell (SSH) protocol

RustCrypto: SSH Pure Rust implementation of components of the Secure Shell (SSH) protocol. Crates Name crates.io Docs Description ssh—encoding Decoder

Rust implementation of the Matter protocol. Status: Experimental

matter-rs: The Rust Implementation of Matter Build Building the library: $ cd matter $ cargo build Building the example: $ cd matter $ RUST_LOG="matt

Comments
  • Import does not compile

    Import does not compile

    Stack trace:

     ~/Code/DisputeGameSimulations │ on honest_agent !4 ?1 cargo run                        │ took 8s │ 
       Compiling durin-fault v0.0.1 (https://github.com/anton-rs/durin.git#a3189f69)
    error[E0599]: no function or associated item named `encode_single` found for struct `alloy_sol_types::sol_data::Uint` in the current scope
      --> /.cargo/git/checkouts/durin-59d0f5ca5f552eb9/a3189f6/crates/fault/src/providers/alphabet.rs:41:60
       |
    41 |         let mut prestate_hash = keccak256(<sol!(uint256)>::encode_single(&prestate));
       |                                                            ^^^^^^^^^^^^^ function or associated item not found in `Uint<256>`
    
    error[E0599]: no function or associated item named `encode` found for tuple `(alloy_sol_types::sol_data::Uint<256>, alloy_sol_types::sol_data::Uint<256>)` in the current scope
      --> /.cargo/git/checkouts/durin-59d0f5ca5f552eb9/a3189f6/crates/fault/src/providers/alphabet.rs:61:67
       |
    61 |         let mut state_hash = keccak256(AlphabetClaimConstruction::encode(&state_sol));
       |                                                                   ^^^^^^ function or associated item not found in `(Uint<256>, Uint<256>)`
    
    For more information about this error, try `rustc --explain E0599`.
    error: could not compile `durin-fault` (lib) due to 2 previous errors
    

    looks like a dependency version thing. I'll check it out try to ship a fix PR today

    opened by 0xJepsen 0
Owner
Anton Systems
Anton Systems
An efficient, robust, and generalized batch submission service for rollup stacks written in pure rust.

archon is an efficient, robust, and generalized batch submission service for rollup stacks written in pure rust. Note Archon is primarily tested again

refcell.eth 75 Apr 2, 2023
Metaplex is a protocol built on top of Solana that allows: Creating/Minting non-fungible tokens;

Metaplex is a protocol built on top of Solana that allows: Creating/Minting non-fungible tokens; Starting a variety of auctions for primary/secondary

Metaplex Foundation 3.2k Jan 4, 2023
An extensible open-source framework for creating private/permissioned blockchain applications

Exonum Status: Project info: Community: Exonum is an extensible open-source framework for creating blockchain applications. Exonum can be used to crea

Exonum 1.2k Jan 1, 2023
An application for creating encrypted vaults for the GNOME desktop.

Vaults An application for creating encrypted vaults for the GNOME desktop. It currently uses gocryptfs and CryFS for encryption. Please always keep a

Martin Pobaschnig 51 Dec 17, 2022
A framework for creating PoC's for Solana Smart Contracts in a painless and intuitive way

Solana PoC Framework DISCLAIMER: any illegal usage of this framework is heavily discouraged. Most projects on Solana offer a more than generous bug bo

Neodyme 165 Dec 18, 2022
In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

陈年旧事。 73 Jan 1, 2023
Official Rust implementation of the Nimiq protocol

Nimiq Core implementation in Rust (core-rs) Rust implementation of the Nimiq Blockchain Core Nimiq is a frictionless payment protocol for the web. Thi

Nimiq 72 Sep 23, 2022
Rust implementation of Zcash protocol

The Parity Zcash client. Gitter Blog: Parity teams up with Zcash Foundation for Parity Zcash client Installing from source Installing the snap Running

Parity Technologies 183 Sep 8, 2022
A prototype implementation of the Host Identity Protocol v2 for bare-metal systems, written in pure-rust.

Host Identity Protocol for bare-metal systems, using Rust I've been evaluating TLS replacements in constrained environments for a while now. Embedded

null 31 Dec 12, 2022
A Rust implementation of the Message Layer Security group messaging protocol

Molasses An extremely early implementation of the Message Layer Security group messaging protocol. This repo is based on draft 4 of the MLS protocol s

Trail of Bits 109 Dec 13, 2022