GithubHelp home page GithubHelp logo

violetsakura777 / cannon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ethereum-optimism/cannon

0.0 0.0 0.0 12.31 MB

On chain interactive fault prover for Ethereum

License: MIT License

Shell 0.50% JavaScript 12.08% Python 1.24% Go 14.30% Assembly 28.48% Makefile 1.29% Solidity 42.11%

cannon's Introduction

cannon


The cannon (cannon cannon cannon) is an on chain interactive dispute engine implementing EVM-equivalent fault proofs.

It's half geth, half MIPS, and whole awesome.

  • It's Go code
  • ...that runs an EVM
  • ...emulating a MIPS machine
  • ...running compiled Go code
  • ...that runs an EVM

For more information on Cannon's inner workings, check this overview.

Directory Layout

minigeth -- A standalone "geth" capable of computing a block transition
mipigo -- minigeth compiled for MIPS. Outputs a MIPS binary that's run and mapped at 0x0
mipsevm -- A MIPS runtime in the EVM (works with contracts)
contracts -- A Merkleized MIPS processor on chain + the challenge logic

Building

Pre-requisites: Go, Node.js, Make, and CMake.

make build
make test # verify everything works correctly

Examples

The script files demo/challenge_simple.sh and demo/challenge_fault.sh present two example scenarios demonstrating the whole process of a fault proof, including the challenge game and single step verification.

  • In the simple challenge, the challenger uses the wrong block data in his challenge.
  • In the fault scenario, fault injection is used to alter the challenger's memory at a specific step of the execution.

In both cases, the challenger fails to challenge the block. Refer to the documentation string at the top of these file for more details regarding the scenario.

State Oracle API

On chain / in MIPS, we have two simple oracles

  • InputHash() -> hash
  • Preimage(hash) -> value

We generate the Preimages in x86 using geth RPC

  • PrefetchAccount
  • PrefetchStorage
  • PrefetchCode
  • PrefetchBlock

These are NOP in the VM

License

Most of this code is MIT licensed, minigeth is LGPL3.

Note: This code is unaudited. It in NO WAY should be used to secure any money until a lot more testing and auditing are done. I have deployed this nowhere, have advised against deploying it, and make no guarantees of security of ANY KIND.

cannon's People

Contributors

geohot avatar norswap avatar han0110 avatar maurelian avatar willemolding avatar 0xrin1 avatar shazow avatar tynes avatar ben-chain avatar cfromknecht avatar avahowell avatar snario avatar sblowpckcr avatar rootulp avatar mariobyn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.