Code Monkey home page Code Monkey logo

bellpepper-gadgets's Introduction

Bellpepper Gadgets

This is intended to be a gadget library for bellpepper.

License

MIT

bellpepper-gadgets's People

Contributors

avras avatar dependabot[bot] avatar huitseeker avatar nramsrud avatar porcuquine avatar samuelburnham avatar sh0g0-1758 avatar tchataigner avatar varunthakore avatar wwared avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bellpepper-gadgets's Issues

Review `bellpepper*` and `arecibo` dependencies

In #33 I had to have the triplet bellpepper, bellpepper-core and arecibo as dependencies, and I got a bit lost in how they are managed.

Looking at a some projects having those as dependency, it seems that most of them have adopted the "fork" approach that let's us quickly pull updates (lurk-rs, circom-scotia, arecibo, ...) while others (such as this one) have opted for a fixed crate version.

I think we would probably gain to try and unify the way we import those dependencies.

As @huitseeker suggested I tried various triplets of dependencies and it seems that the one that worked for me is bellpepper = 0.4.1 bellpepper-core as fork and arecibo as fork. We could use this as a global approach.

Unsatisfied constraints with field emulation gadgets

There might be an issue with the field emulation library. The tests associated with bls12-381 emulation with pasta fields pass. However, when I changed the field from bls12-381's base field to BN254's base field (and adjusted EmulatedFieldParams trait appropriately), the tests fail in the following manner (similar errors for other tests).

---- fields::bn_fp::tests::test_random_add stdout ----
fail: "a+b = c/a = b/check limbs equality/right shift to get carry 0/enforce equality between input value and weighted sum of higher order bits"
Some("a+b = c/a = b/check limbs equality/right shift to get carry 0/enforce equality between input value and weighted sum of higher order bits")
fail: "a+b = c/a = b/check limbs equality/right shift to get carry 0/enforce equality between input value and weighted sum of higher order bits"
thread 'fields::bn_fp::tests::test_random_add' panicked at crates/bls12381/src/fields/bn_fp.rs:279:9:
assertion failed: cs.is_satisfied()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here's what the trait implementation looks like:

use halo2curves::bn256::Fq as BnFp;

pub struct Bn254FpParams;

impl EmulatedFieldParams for Bn254FpParams {
    fn num_limbs() -> usize {
        4
    }

    fn bits_per_limb() -> usize {
        64
    }

    fn modulus() -> BigInt {
        BigInt::parse_bytes(
            b"30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47",             
            16,
        )
        .unwrap()
    }

    fn is_modulus_pseudo_mersenne() -> bool {
        false
    }

    fn pseudo_mersenne_params() -> Option<PseudoMersennePrime> {
        None
    }
}

pub type Bn254Fp<F> = EmulatedFieldElement<F, Bn254FpParams>;

CI: this uses actions-rs

- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --check
- name: cargo clippy
run: cargo xclippy -D warnings
msrv:
runs-on: ubuntu-latest
strategy:
matrix:
package:
- "emulated"
- "uint64"
- "chunk"
- "sha1"
- "sha512"
- "ed25519"
- "keccak"
- "bls12381"
- "merkle-inclusion"
steps:
- uses: actions/checkout@v4
- name: Install rustup
uses: actions-rs/toolchain@v1

actions-rs is obsolete for our toolchain and should be phased out

Add a constraint count test for keccak / sha3

Host bls12_381 fork under lurk-lab github organization

The bls12_381 crate does not export some internal items that are used in the bellpepper-bls12381 gadget. Currently this fork lives (temporarily) at wrinqle/bls12_381

We should get rid of this git dependency, doing one of:

  • Make a "proper" fork that exposes the necessary items and publish it on crates.io/put it under the lurk-lab github organization
  • Replace the bls12_381 native dependency with something like blst (or anything else that exposes enough internals) instead (this would be a non-trivial change: we make use of many internal functions for some tests)

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.