Skip to content

Fix all non-circom-code typos (readme, comments & tests) #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@

## Organisation

This respository contains 3 folders:
This repository contains 3 folders:

- `circuits`: it contains the implementation of different cryptographic primitives in circom language.
- `doc`: it contains some circuit schemes in ASCII (must be opened with Monodraw, an ASCII art editor for Mac).
- `test`: tests.
9 changes: 4 additions & 5 deletions circuits/README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
## Description

- This folder contains circuit templates for standard operations and many cryptographic primitives.
- Below you can find specifications of each function. In the representation of elements, there are three tyes:
- Below you can find specifications of each function. In the representation of elements, there are three types:
- Binary
- String
- Field element (the field is specified in each case. We consider 2 possible fields: Fp and Fr, where p... and r... .)
@@ -15,7 +15,7 @@
## Jordi

* compconstant - Returns 1 if `in` (expanded to binary array) > `ct`
* aliascheck - check if `in` (expanded to binary array) oveflowed its 254 bits (<= -1)
* aliascheck - check if `in` (expanded to binary array) overflowed its 254 bits (<= -1)
* babyjub - twisted Edwards curve 168700.x^2 + y^2 = 1 + 168696.x^2.y^2
* BabyAdd - (`xout`,`yout`) = (`x1`,`y1`) + (`x2`,`y2`)
* BabyDbl - (`xout`,`yout`) = 2*(`x`,`y`)
@@ -129,7 +129,7 @@ Arithmetic on [Baby Jubjub elliptic curve](https://github.com/barryWhiteHat/baby

- `BinSub(n)`

- DESCRIPTION: binary substraction.
- DESCRIPTION: binary subtraction.
- SCHEMA
- INPUT
- OUTPUT
@@ -688,8 +688,7 @@ Implementation of MiMC-7 hash in Fp being... (link to description of the hash)

### pedersen_old

Old version of the Pedersen hash (do not use any
more?).
Old version of the Pedersen hash (do not use anymore?).

### pedersen

2 changes: 1 addition & 1 deletion circuits/binsub.circom
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
*/

/*
This component creates a binary substraction.
This component creates a binary subtraction.


Main Constraint:
4 changes: 2 additions & 2 deletions circuits/binsum.circom
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
Binary Sum
==========

This component creates a binary sum componet of ops operands and n bits each operand.
This component creates a binary sum component of ops operands and n bits each operand.

e is Number of carries: Depends on the number of operands in the input.

@@ -34,7 +34,7 @@ Main Constraint:
===
out[0] * 2^0 + out[1] * 2^1 + + out[n+e-1] *2(n+e-1)

To waranty binary outputs:
To warranty binary outputs:

out[0] * (out[0] - 1) === 0
out[1] * (out[0] - 1) === 0
2 changes: 1 addition & 1 deletion circuits/eddsa.circom
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ template EdDSAVerifier(n) {
mulFix.e[i] <== S[i];
}

// Do the comparation left == right
// Do the comparison left == right

mulFix.out[0] === addRight.xout;
mulFix.out[1] === addRight.yout;
2 changes: 1 addition & 1 deletion circuits/eddsamimc.circom
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ template EdDSAMiMCVerifier() {
mulFix.e[i] <== snum2bits.out[i];
}

// Do the comparation left == right if enabled;
// Do the comparison left == right if enabled;

component eqCheckX = ForceEqualIfEnabled();
eqCheckX.enabled <== enabled;
2 changes: 1 addition & 1 deletion circuits/eddsamimcsponge.circom
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ template EdDSAMiMCSpongeVerifier() {
mulFix.e[i] <== snum2bits.out[i];
}

// Do the comparation left == right if enabled;
// Do the comparison left == right if enabled;

component eqCheckX = ForceEqualIfEnabled();
eqCheckX.enabled <== enabled;
2 changes: 1 addition & 1 deletion circuits/eddsaposeidon.circom
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ template EdDSAPoseidonVerifier() {
mulFix.e[i] <== snum2bits.out[i];
}

// Do the comparation left == right if enabled;
// Do the comparison left == right if enabled;

component eqCheckX = ForceEqualIfEnabled();
eqCheckX.enabled <== enabled;
4 changes: 2 additions & 2 deletions circuits/escalarmulfix.circom
Original file line number Diff line number Diff line change
@@ -37,10 +37,10 @@ include "babyjub.circom";

Then we calculate S1 = 2*2^246*B + (1 + a0)*B + (2^3 + a1)*B + .....+ (2^243 + a81)*B

And Finaly we compute the result: RES = SQ - Q
And finally we compute the result: RES = SQ - Q

As you can see the input of the adders cannot be equal nor zero, except for the last
substraction that it's done in montgomery.
subtraction that it's done in montgomery.

A good way to see it is that the accumulator input of the adder >= 2^247*B and the other input
is the output of the windows that it's going to be <= 2^246*B
2 changes: 1 addition & 1 deletion circuits/pedersen.circom
Original file line number Diff line number Diff line change
@@ -232,7 +232,7 @@ template Pedersen(n) {
}

/*
coponent packPoint = PackPoint();
component packPoint = PackPoint();

if (nSegments>1) {
packPoint.in[0] <== adders[nSegments-2].xout;
4 changes: 2 additions & 2 deletions circuits/smt/smtlevins.circom
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ This component finds the level where the oldInsert is done.
The rules are:

levIns[i] == 1 if its level and all the child levels have a sibling of 0 and
the parent level has a sibling != 0. Considere that the root level always has
the parent level has a sibling != 0. Consider that the root level always has
a parent with a sibling != 0.


@@ -78,7 +78,7 @@ template SMTLevIns(nLevels) {
signal input enabled;
signal input siblings[nLevels];
signal output levIns[nLevels];
signal done[nLevels-1]; // Indicates if the insLevel has aready been detected.
signal done[nLevels-1]; // Indicates if the insLevel has already been detected.

var i;

4 changes: 2 additions & 2 deletions circuits/smt/smtprocessor.circom
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@ Insert to a used leaf.
┗━━━━━━━┛ ┗━━━━━━━┛


Fnction
Function
fnc[0] fnc[1]
0 0 NOP
0 1 UPDATE
@@ -247,7 +247,7 @@ template SMTProcessor(nLevels) {
// topSwitcher.outL === oldRoot*enabled;
// topSwitcher.outR === newRoot*enabled;

// Ckeck keys are equal if updating
// Check keys are equal if updating
component areKeyEquals = IsEqual();
areKeyEquals.in[0] <== oldKey;
areKeyEquals.in[1] <== newKey;
2 changes: 1 addition & 1 deletion circuits/smt/smtprocessorlevel.circom
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ na 0 0

upd old1leaf new1leaf

H' is the Hash function with the inputs shifted acordingly.
H' is the Hash function with the inputs shifted accordingly.

*****/
pragma circom 2.0.0;
8 changes: 4 additions & 4 deletions circuits/smt/smtprocessorsm.circom
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
/***************************************************************************************************
Each level on a SMTProcessor has a state.

The state of the level depends on the state of te botom level and on `xor` and
The state of the level depends on the state of te bottom level and on `xor` and
`is0` signals.

`isOldLev` 1 when is the level where oldLeaf is.
@@ -33,16 +33,16 @@ are inserting/deleting in a leaf that contains an element.

The states are:

top: While the index bits of the old and new insex in the top level is the same, whe are in the top state.
top: While the index bits of the old and new index in the top level is the same, we are in the top state.
old0: When the we reach insert level, we go to old0 state
if `is0`=1.
btn: Once in insert level and `is0` =0 we go to btn or new1 level if xor=1
new1: This level is reached when xor=1. Here is where we insert/delete the hash of the
old and the new trees with just one element.
na: Not appliable. After processing it, we go to the na level.
na: Not applicable. After processing it, we go to the na level.


Fnction
Function
fnc[0] fnc[1]
0 0 NOP
0 1 UPDATE
2 changes: 1 addition & 1 deletion circuits/smt/smtverifierlevel.circom
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ iold old1leaf
inew new1leaf
na 0

H' is the Hash function with the inputs shifted acordingly.
H' is the Hash function with the inputs shifted accordingly.

*****/
pragma circom 2.0.0;
2 changes: 1 addition & 1 deletion test/binsub.js
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ describe("BinSub test", function () {
circuit = await wasm_tester(path.join(__dirname, "circuits", "binsub_test.circom"));
});

it("Should check variuos ege cases", async () => {
it("Should check various edge cases", async () => {
await checkSub(0,0, circuit);
await checkSub(1,0, circuit);
await checkSub(-1,0, circuit);
2 changes: 1 addition & 1 deletion test/eddsamimc.js
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ describe("EdDSA MiMC test", function () {
});


it("Test a dissabled circuit with a bad signature", async () => {
it("Test a disabled circuit with a bad signature", async () => {
const msg = F.e(1234);

const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex");
2 changes: 1 addition & 1 deletion test/eddsaposeidon.js
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ describe("EdDSA Poseidon test", function () {
});


it("Test a dissabled circuit with a bad signature", async () => {
it("Test a disabled circuit with a bad signature", async () => {
const msg = F.e(1234);

const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex");
4 changes: 2 additions & 2 deletions test/point2bits.js
Original file line number Diff line number Diff line change
@@ -17,12 +17,12 @@ describe("Point 2 bits test", function() {
circuit = await wasm_tester(path.join(__dirname, "circuits", "pointbits_loopback.circom"));
});

it("Should do the both convertions for 8Base", async () => {
it("Should do both conversions for 8Base", async () => {
const w = await circuit.calculateWitness({ in: [F.toObject(babyJub.Base8[0]), F.toObject(babyJub.Base8[1])]}, true);

await circuit.checkConstraints(w);
});
it("Should do the both convertions for Zero point", async () => {
it("Should do both conversions for Zero point", async () => {
const w = await circuit.calculateWitness({ in: [0, 1]}, true);

await circuit.checkConstraints(w);
2 changes: 1 addition & 1 deletion test/smtprocessor.js
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ describe("SMT Processor test", function () {
await testDelete(tree, 333, circuit);
});

it("Should test convination of adding and removing 3 elements", async () => {
it("Should test combination of adding and removing 3 elements", async () => {
const keys = [Fr.e(8), Fr.e(9), Fr.e(32)];
const values = [Fr.e(88), Fr.e(99), Fr.e(3232)];
const tree1 = await newMemEmptyTrie();