arkworks-rs / r1cs-tutorial Goto Github PK
View Code? Open in Web Editor NEWTutorial for writing constraints in the `arkworks` framework
License: Apache License 2.0
Tutorial for writing constraints in the `arkworks` framework
License: Apache License 2.0
Can you update dependencies to latest version of arkworks?
There are many errors when updated version of dependencies to 0.4.2.
Pedersen Hash Improper Configuration
This tutorial's configuration of pedersen hash window
(https://github.com/arkworks-rs/r1cs-tutorial/blob/main/merkle_tree_example/src/common.rs#L18):
pub type TwoToOneHash = PedersenCRHCompressor<EdwardsProjective, TECompressor, TwoToOneWindow>;
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct TwoToOneWindow;
// `WINDOW_SIZE * NUM_WINDOWS` = 2 * 256 bits = enough for hashing two outputs.
impl pedersen::Window for TwoToOneWindow {
const WINDOW_SIZE: usize = 128;
const NUM_WINDOWS: usize = 4;
}
pub type LeafHash = PedersenCRHCompressor<EdwardsProjective, TECompressor, LeafWindow>;
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct LeafWindow;
// `WINDOW_SIZE * NUM_WINDOWS` = 2 * 256 bits = enough for hashing two outputs.
impl pedersen::Window for LeafWindow {
const WINDOW_SIZE: usize = 144;
const NUM_WINDOWS: usize = 4;
}
Which configure the window_size to N
, and the num_windows to 4
. This is not consistent with the arkworks test:
(https://github.com/arkworks-rs/crypto-primitives/blob/main/src/merkle_tree/mod.rs#L463).
From my understanding, this will introduce a potential security vulnerability.
Happy to create a PR if this is confirmed by arkworks devs.
The whole project cannot be compiled, due to ark-crypto-primitives
is always going to pull the latest commit from github.
But it compiled while I used specified commit
Platform:
rust: 1.52.1
os: ubuntu 20.04
Perhaps that Cargo.lock
file can avoid this situation.
The README for the merkle tree example in the R1CS tutorial incorrectly states that it will show how to invoke a SNARK when actually the example is only about generating the constraints and verifying satisfiability directly using the witness input itself. This is confusing for beginners trying to learn arkworks.
commit 5d3a902
Compare the README to the example code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.