Giter VIP home page Giter VIP logo

sv_circuit's Introduction

sv_circuit

Build Status

SIEVE circuit compositor.

Dependencies

sv_circuit is built using nix. It is recommended to use the Determinate Systems installer:

$ curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Running

Running without installing,

$ nix run github:trailofbits/sv_circuit

Building

$ nix build

Development Environment

To enter a shell with all dependencies,

$ nix develop

Phases are defined as Cargo hooks. Running a build phase manually,

$ cargoBuildHook
$ cargoCheckHook

However standard cargo commands apply, for compiling a release build and testing:

$ cargo build --release
$ cargo test

Distribution and Licensing

This research was developed with funding from the Defense Advanced Research Projects Agency (DARPA) under Agreement No. HR001120C0084.

The views, opinions, and/or findings expressed are those of the author(s) and should not be interpreted as representing the official views or policies of the Department of Defense or the U.S. Government.

DISTRIBUTION STATEMENT A: Approved for public release, distribution unlimited.

sv_circuit is licensed under the GNU AGPLv3 License. A copy of the terms can be found in the LICENSE file.

sv_circuit's People

Contributors

jleightcap avatar lisaoverall avatar dependabot[bot] avatar

Stargazers

 avatar Daniel avatar  avatar aweNousaku avatar Jevin Sweval avatar sudo rm -rf --no-preserve-root / avatar

Watchers

Jevin Sweval avatar James Cloos avatar  avatar David Pokora avatar Trent Brunson avatar Alex Useche avatar William Woodruff avatar Kelly Kaoudis avatar Tarun Bansal avatar Priyanka Bose avatar Greg Otto avatar alan avatar  avatar

sv_circuit's Issues

Add Phase 2 IR0+ backend

Updated terminology:

  • IR0 relation .rel -> IR0+ circuit
  • IR0 instance .ins -> IR0+ public_input
  • IR0 short witness .wit -> IR0+ private_input

Since we're not using any of the looping constructs or plugins yet, we're able to transform the Tiny86 NOP IR0 .rel into an IR0+-conformant circuit with string substitution. sed commands that accomplish this are below. NB: our NOP circuit does not use initial register file state, so we didn't need to substitute instance with public():

sed -i 's/short_witness/private()/g' ~/tiny86.rel
sed -i 's/@and/@mul/g' ~/tiny86.rel
sed -i 's/@xor/@add/g' ~/tiny86.rel
sed -i 's/@not(\(\$[0-9]\+\))/@addc(\1, <1>)/g' ~/tiny86.rel

Other changes:

  • For the first line of all the files, change version-1.0.0 to version-2.0.0-beta
  • The second line of the file is the resource type (circuit, public_input, private_input) followed by ;
  • Fields used by the circuit (zero-indexed) start in the third line of the file. For our purposes, IR0 field characteristic 2 degree 1 -> IR0+ @type field 2.
    • Right now, we only emit field-switching gates when targeting the reverie backend, so we can omit indices from private([field_index]) and public([field_index]), but if we were to transform circuits including multiple fields, we'd need to calculate {characteristic}^{degree} to perform the substitution correctly.

refactor to unpin nightly version regression to allow nightly versions newer than ~2022-11-01

rust nightly versions newer than approx. 2022-11-01 fail to compile;

error[E0310]: the parameter type `T` may not live long enough
   --> src/generic/circuit.rs:795:21
    |
795 |     type IntoIter = impl Iterator<Item = Operation<T>>;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `mcircuit::Operation<T>` will meet its required lifetime bounds
    |
help: consider adding an explicit lifetime bound...
    |
790 | impl<'a, T: 'a + WireValue + 'static> IntoIterator for &'a GenericCircuit<T>
    |                            +++++++++

For more information about this error, try `rustc --explain E0310`.
error: could not compile `sv_circuit` due to 3 previous errors

for now pinning rust compiler to a known good nightly in default.nix and using nix-shell --pure --run "cargo build". however, this annoying and likely to confuse anyone reasonably using 'bare' cargo build.

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.