Giter Club home page Giter Club logo

circom-plus's Introduction

circom-plus

Like GoPlus vs Go, we build circom-plus as a DSL based on circom to impove circuit developer productivity.

Goal

  1. Less boilerplate.

Current Status

We are in early stage. Codes here are very unstable.

We are using much magic here like regex replace rather than lexicon/parse now.

circom-plus's People

Contributors

lispc avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

pinkdiamond1

circom-plus's Issues

Circom could not generate correct code in some circuits which is obvious correct

For following circuit:

include "../circomlib/circuits/sha256/sha256.circom";

template Sha256Wrap(nBits) {

    signal input bits[nBits];

    var bitPadding = 8 - nBits % 8;
    if (bitPadding == 8){
        bitPadding = 0;
    }

    var hashBits = nBits + bitPadding;
    component hasher = Sha256(hashBits);

    for (var i = 0; i < nBits; i++){
        hasher.in[i] <== bits[i];
    }
    assert(nBits == 5);
    for (var i = nBits; i < hashBits; i++){
        hasher.in[i] <== 0;
    }    
}

component main = Sha256Wrap(5);

The code generated by circom would not run correctly: for native backend, it halt forever before load input successfully and for WASM backend it simply prompt "Constraint doesn't match"

For some similar circuit, the natvie backend may also complain that some signal has been assigned before being used.

However, code would run well if we simply change the last 'nBits' into the value (5) it should be in this circuit:

assert(nBits == 5);
for (var i = 5; i < hashBits; i++){
hasher.in[i] <== 0;
}

such issue keeps until at least 0.5.45, the latest version when this issue has been put.

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.