-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
92 changed files
with
1,480 additions
and
393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,6 @@ | |
[submodule "vendor/eos"] | ||
path = vendor/eos | ||
url = https://github.com/EOSIO/eos.git | ||
[submodule "vendor/constantine"] | ||
path = vendor/constantine | ||
url = [email protected]:metacraft-labs/constantine.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
pragma circom 2.1.5; | ||
|
||
include "../../../../node_modules/circomlib/circuits/comparators.circom"; | ||
include "../../../../node_modules/circomlib/circuits/bitify.circom"; | ||
|
||
template Selector(N) { | ||
signal input in[N]; | ||
signal input index; | ||
signal output out; | ||
|
||
signal sums[N + 1]; | ||
sums[0] <== 0; | ||
|
||
component eqs[N]; | ||
|
||
// For each item, check whether its index equals the input index. | ||
for (var i = 0; i < N; i ++) { | ||
eqs[i] = IsEqual(); | ||
eqs[i].in[0] <== i; | ||
eqs[i].in[1] <== index; | ||
|
||
// eqs[i].out is 1 if the index matches. As such, at most one input to | ||
sums[i + 1] <== sums[i] + eqs[i].out * in[i]; | ||
} | ||
|
||
// Returns 0 + 0 + ... + item | ||
out <== sums[N]; | ||
} | ||
|
||
template IsEqualArrays(N) { | ||
signal input in[2][N]; | ||
signal output out; | ||
|
||
signal isEqual[N]; | ||
var counter = 0; | ||
|
||
for(var i = 0; i < N; i++) { | ||
isEqual[i] <== IsEqual()([in[0][i], in[1][i]]); | ||
|
||
counter += isEqual[i]; | ||
} | ||
|
||
out <== IsEqual()([N, counter]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
pragma circom 2.1.5; | ||
|
||
include "../../../../node_modules/circomlib/circuits/comparators.circom"; | ||
include "../../../../node_modules/circomlib/circuits/bitify.circom"; | ||
|
||
template LessThanBitsCheck(n) { | ||
signal input in[2]; | ||
signal output out; | ||
|
||
signal bitCheck1[n] <== Num2Bits(n)(in[0]); | ||
|
||
signal bitCheck2[n] <== Num2Bits(n)(in[1]); | ||
|
||
out <== LessThan(n)(in); | ||
} | ||
|
||
template LessThanOrEqualBitsCheck(n) { | ||
signal input in[2]; | ||
signal output out; | ||
|
||
signal bitCheck1[n] <== Num2Bits(n)(in[0]); | ||
|
||
signal bitCheck2[n] <== Num2Bits(n)(in[1]); | ||
|
||
out <== LessEqThan(n)(in); | ||
} |
Oops, something went wrong.