moved @zk-kit and poseidon dependencies to node_modules - refacto/clean smt.circom

This commit is contained in:
turnoffthiscomputer
2025-01-14 23:49:46 +01:00
parent 2426f329ab
commit 5fdb2ab4bd
18 changed files with 83 additions and 25363 deletions

View File

@@ -45,9 +45,9 @@ template VC_AND_DISCLOSE( nLevels,FORBIDDEN_COUNTRIES_LIST_LENGTH) {
disclose.majority <== majority;
// generate scope nullifier
component poseidon_nullifier = PoseidonHash(2);
poseidon_nullifier.in[0] <== secret;
poseidon_nullifier.in[1] <== scope;
component poseidon_nullifier = Poseidon(2);
poseidon_nullifier.inputs[0] <== secret;
poseidon_nullifier.inputs[1] <== scope;
signal output nullifier <== poseidon_nullifier.out;
signal output revealedData_packed[3] <== disclose.revealedData_packed;
signal output older_than[2] <== disclose.older_than;

View File

@@ -4,7 +4,8 @@ include "circomlib/circuits/bitify.circom";
include "../utils/circomlib/hasher/shaBytes/shaBytesDynamic.circom";
include "circomlib/circuits/comparators.circom";
include "../utils/circomlib/hasher/hash.circom";
include "../utils/circomlib/merkle-trees/binary-merkle-root.circom";
include "circomlib/circuits/poseidon.circom";
include "@zk-kit/binary-merkle-root.circom/src/binary-merkle-root.circom";
include "../utils/passport/customHashers.circom";
include "../utils/passport/signatureAlgorithm.circom";
include "../utils/passport/signatureVerifier.circom";
@@ -58,6 +59,6 @@ template OPENPASSPORT_DSC(signatureAlgorithm, n_dsc, k_dsc, n_csca, k_csca, max_
// blinded dsc commitment
signal pubkeyHash <== CustomHasher(k_dsc)(dsc_pubKey);
signal output blinded_dsc_commitment <== PoseidonHash(2)([secret, pubkeyHash]);
signal output blinded_dsc_commitment <== Poseidon(2)([secret, pubkeyHash]);
}

View File

@@ -4,7 +4,7 @@ include "../utils/passport/customHashers.circom";
include "../utils/passport/computeCommitment.circom";
include "../utils/passport/signatureAlgorithm.circom";
include "../utils/passport/date/isValid.circom";
include "../utils/circomlib/hasher/poseidon/poseidon.circom";
include "circomlib/circuits/poseidon.circom";
include "../utils/passport/passportVerifier.circom";
include "../utils/passport/disclose/disclose.circom";
include "../utils/passport/disclose/proveCountryIsNotInList.circom";
@@ -69,9 +69,9 @@ template OPENPASSPORT_PROVE(DG_HASH_ALGO, ECONTENT_HASH_ALGO, signatureAlgorithm
// nulifier
component passportDataHashed = CustomHasher(HASH_LEN_BYTES);
passportDataHashed.in <== signedAttrShaBytes;
component poseidon_hasher = PoseidonHash(2);
poseidon_hasher.in[0] <== passportDataHashed.out;
poseidon_hasher.in[1] <== scope;
component poseidon_hasher = Poseidon(2);
poseidon_hasher.inputs[0] <== passportDataHashed.out;
poseidon_hasher.inputs[1] <== scope;
signal output nullifier <== poseidon_hasher.out;
// DISCLOSE (optional)
@@ -115,6 +115,6 @@ template OPENPASSPORT_PROVE(DG_HASH_ALGO, ECONTENT_HASH_ALGO, signatureAlgorithm
signal output commitment <== commitmentPrivate * selectorModeCommitment;
// // blinded dsc commitment
signal pubkeyHash <== CustomHasher(kScaled)(pubKey);
signal blindedDscCommitmenPrivate <== PoseidonHash(2)([dsc_secret, pubkeyHash]);
signal blindedDscCommitmenPrivate <== Poseidon(2)([dsc_secret, pubkeyHash]);
signal output blinded_dsc_commitment <== blindedDscCommitmenPrivate * selectorModeBlindedDscCommitment;
}

View File

@@ -9,7 +9,6 @@ include "./sha2/sha224/sha224HashBits.circom";
include "./sha2/sha256/sha256HashBits.circom";
include "./sha2/sha384/sha384HashBits.circom";
include "./sha2/sha512/sha512HashBits.circom";
include "./poseidon/poseidon.circom";
//------------------------------------------------------------------------------------------------------------------------------------------------------------
// Here is secure implementation of sha-1 and sha-2 hash algoritms.
@@ -97,21 +96,4 @@ template ShaHashBits(LEN, ALGO){
hash512.in <== in;
hash512.out ==> out;
}
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------
// Here is secure implementation of Poseidon hash algoritm.
// LEN in lenght of input vector
// Poseidon works with vectors, not just nums or bits, so use 1 element arr in case of one number
// Max LEN is 16, but if u want to connect this to solidity smart contracts, remember that they have only Poseidon(6)
// U can use this for verification: https://poseidon-hash.online/
template PoseidonHash(LEN){
assert (LEN <= 16);
assert (LEN > 0);
signal input in[LEN];
signal output out;
component poseidon = Poseidon(LEN);
poseidon.in <== in;
out <== poseidon.out;
}
}

View File

@@ -1,216 +0,0 @@
pragma circom 2.1.6;
include "./poseidonConstants.circom";
include "../../int/arithmetic.circom";
// Poseidon hash for less than 16 inputs
//--------------------------------------------------------------------------------------------------------------------------------------------------------
// Next templates are helpers, don`t use them not in poseidon hash without understanding what are u doing!
// Use Poseidon() below to get poseidon hash!
template Sigma() {
signal input in;
signal output out;
signal in2;
signal in4;
in2 <== in * in;
in4 <== in2 * in2;
out <== in4 * in;
}
template Ark(t, C, r) {
signal input in[t];
signal output out[t];
for (var i = 0; i < t; i++) {
out[i] <== in[i] + C[i + r];
}
}
template Mix(t, M) {
signal input in[t];
signal output out[t];
component sum[t];
for (var i = 0; i < t; i++) {
sum[i] = GetSumOfNElements(t);
for (var j = 0; j < t; j++) {
sum[i].in[j] <== M[j][i] * in[j];
}
out[i] <== sum[i].out;
}
}
template MixLast(t, M, s) {
signal input in[t];
signal output out;
component sum = GetSumOfNElements(t);
for (var j = 0; j < t; j++) {
sum.in[j] <== M[j][s] * in[j];
}
out <== sum.out;
}
template MixS(t, S, r) {
signal input in[t];
signal output out[t];
component sum = GetSumOfNElements(t);
for (var i = 0; i < t; i++) {
sum.in[i] <== S[(t * 2 - 1) * r + i] * in[i];
}
out[0] <== sum.out;
for (var i = 1; i < t; i++) {
out[i] <== in[i] + in[0] * S[(t * 2 - 1) * r + t + i - 1];
}
}
template PoseidonEx(nInputs, nOuts) {
signal input inputs[nInputs];
signal input initialState;
signal output out[nOuts];
var N_ROUNDS_P[16] = [56, 57, 56, 60, 60, 63, 64, 63, 60, 66, 60, 65, 70, 60, 64, 68];
var t = nInputs + 1;
var nRoundsF = 8;
var nRoundsP = N_ROUNDS_P[t - 2];
var C[t * nRoundsF + nRoundsP] = POSEIDON_C(t);
var S[ N_ROUNDS_P[t - 2] * (t * 2 - 1) ] = POSEIDON_S(t);
var M[t][t] = POSEIDON_M(t);
var P[t][t] = POSEIDON_P(t);
component ark[nRoundsF];
component sigmaF[nRoundsF][t];
component sigmaP[nRoundsP];
component mix[nRoundsF - 1];
component mixS[nRoundsP];
component mixLast[nOuts];
ark[0] = Ark(t, C, 0);
for (var j = 0; j < t; j++) {
if (j > 0) {
ark[0].in[j] <== inputs[j - 1];
} else {
ark[0].in[j] <== initialState;
}
}
for (var r = 0; r < nRoundsF \ 2 - 1; r++) {
for (var j = 0; j < t; j++) {
sigmaF[r][j] = Sigma();
if (r == 0) {
sigmaF[r][j].in <== ark[0].out[j];
} else {
sigmaF[r][j].in <== mix[r - 1].out[j];
}
}
ark[r + 1] = Ark(t, C, (r + 1) * t);
for (var j = 0; j < t; j++) {
ark[r + 1].in[j] <== sigmaF[r][j].out;
}
mix[r] = Mix(t,M);
for (var j = 0; j < t; j++) {
mix[r].in[j] <== ark[r + 1].out[j];
}
}
for (var j = 0; j < t; j++) {
sigmaF[nRoundsF \ 2 - 1][j] = Sigma();
sigmaF[nRoundsF \ 2 - 1][j].in <== mix[nRoundsF \ 2 - 2].out[j];
}
ark[nRoundsF \ 2] = Ark(t, C, (nRoundsF \ 2) * t);
for (var j = 0; j < t; j++) {
ark[nRoundsF \ 2].in[j] <== sigmaF[nRoundsF \ 2 - 1][j].out;
}
mix[nRoundsF \ 2 - 1] = Mix(t,P);
for (var j = 0; j < t; j++) {
mix[nRoundsF \ 2 - 1].in[j] <== ark[nRoundsF \ 2].out[j];
}
for (var r = 0; r < nRoundsP; r++) {
sigmaP[r] = Sigma();
if (r == 0) {
sigmaP[r].in <== mix[nRoundsF \ 2 - 1].out[0];
} else {
sigmaP[r].in <== mixS[r - 1].out[0];
}
mixS[r] = MixS(t, S, r);
for (var j = 0; j < t; j++) {
if (j == 0) {
mixS[r].in[j] <== sigmaP[r].out + C[(nRoundsF \ 2 + 1) * t + r];
} else {
if (r == 0) {
mixS[r].in[j] <== mix[nRoundsF \ 2 - 1].out[j];
} else {
mixS[r].in[j] <== mixS[r - 1].out[j];
}
}
}
}
for (var r = 0; r < nRoundsF \ 2 - 1; r++) {
for (var j = 0; j < t; j++) {
sigmaF[nRoundsF \ 2 + r][j] = Sigma();
if (r == 0) {
sigmaF[nRoundsF \ 2 + r][j].in <== mixS[nRoundsP - 1].out[j];
} else {
sigmaF[nRoundsF \ 2 + r][j].in <== mix[nRoundsF \ 2 + r - 1].out[j];
}
}
ark[ nRoundsF \ 2 + r + 1] = Ark(t, C, (nRoundsF \ 2 + 1) * t + nRoundsP + r * t);
for (var j = 0; j < t; j++) {
ark[nRoundsF \ 2 + r + 1].in[j] <== sigmaF[nRoundsF \ 2 + r][j].out;
}
mix[nRoundsF \ 2 + r] = Mix(t,M);
for (var j = 0; j < t; j++) {
mix[nRoundsF \ 2 + r].in[j] <== ark[nRoundsF \ 2 + r + 1].out[j];
}
}
for (var j = 0; j < t; j++) {
sigmaF[nRoundsF - 1][j] = Sigma();
sigmaF[nRoundsF - 1][j].in <== mix[nRoundsF - 2].out[j];
}
for (var i = 0; i < nOuts; i++) {
mixLast[i] = MixLast(t,M,i);
for (var j = 0; j < t; j++) {
mixLast[i].in[j] <== sigmaF[nRoundsF - 1][j].out;
}
out[i] <== mixLast[i].out;
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------
// Secured version of Poseidon hash circomlib implementation
// Use this template to calculate to calculate Poseidon hash of your vector (1 elememnt array for one num)
template Poseidon(nInputs) {
signal input in[nInputs];
signal output out;
component pEx = PoseidonEx(nInputs, 1);
pEx.initialState <== 0;
for (var i = 0; i < nInputs; i++) {
pEx.inputs[i] <== in[i];
}
out <== pEx.out[0];
}

View File

@@ -1,45 +0,0 @@
pragma circom 2.1.6;
include "../../circomlib/hasher/hash.circom";
include "circomlib/circuits/comparators.circom";
include "../../circomlib/mux/mux1.circom";
// This circuit is designed to calculate the root of a binary Merkle
// tree given a leaf, its depth, and the necessary sibling
// information (aka proof of membership).
// A circuit is designed without the capability to iterate through
// a dynamic array. To address this, a parameter with the static maximum
// tree depth is defined (i.e. 'MAX_DEPTH'). And additionally, the circuit
// receives a dynamic depth as an input, which is utilized in calculating the
// true root of the Merkle tree. The actual depth of the Merkle tree
// may be equal to or less than the static maximum depth.
// NOTE: This circuit will successfully verify `out = 0` for `depth > MAX_DEPTH`.
// Make sure to enforce `depth <= MAX_DEPTH` outside the circuit.
template BinaryMerkleRoot(MAX_DEPTH) {
signal input leaf, depth, indices[MAX_DEPTH], siblings[MAX_DEPTH];
signal output out;
signal nodes[MAX_DEPTH + 1];
nodes[0] <== leaf;
signal roots[MAX_DEPTH];
var root = 0;
for (var i = 0; i < MAX_DEPTH; i++) {
var isDepth = IsEqual()([depth, i]);
roots[i] <== isDepth * nodes[i];
root += roots[i];
var c[2][2] = [ [nodes[i], siblings[i]], [siblings[i], nodes[i]] ];
var childNodes[2] = MultiMux1(2)(c, indices[i]);
nodes[i + 1] <== PoseidonHash(2)(childNodes);
}
var isDepth = IsEqual()([depth, MAX_DEPTH]);
out <== root + isDepth * nodes[MAX_DEPTH];
}

View File

@@ -1,66 +0,0 @@
pragma circom 2.1.9;
include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/bitify.circom";
// Computes the first n common bits of the hashes
template CommonBitsLengthFromEnd() {
signal input bits1[256];
signal input bits2[256];
signal output out;
component iseq[256];
signal pop[256];
pop[255] <== IsEqual()([bits1[255], bits2[255]]);
for (var i = 254; i >= 0; i--) {
var temp = bits2[i] - bits1[i];
iseq[i] = IsEqual();
bits1[i] ==> iseq[i].in[0];
bits2[i] ==> iseq[i].in[1];
pop[i] <== iseq[i].out*pop[i+1];
}
var added = 0;
for(var i = 0; i<256;i++){
added += pop[i];
}
added ==> out;
}
// Computes length of an array when array is padded with 0;s from end and the last element after which padding starts is not 0, 0's might come in between.
template SiblingsLength() {
signal input siblings[256];
signal output length;
// Siblings can be like (1,2,3,0,0,4,5,0,0...all 0 till 256[the padded 0 ones])
// We need to get the length , i.e 7 in this case
var foo[256];
for(var i = 0; i<256; i++){
foo[i] = 0;
}
foo[255] = siblings[255];
for(var i = 256-2; i>=0; i--){
foo[i] = siblings[i] + foo[i+1];
}
// convert to (15,14,12,9,9,9,5,0,0,0..), this takes out the middle 0's
var total = 0;
signal pop[256];
component iszero[256];
for(var i = 0; i<256; i++){
iszero[i] = IsZero();
foo[i] ==> iszero[i].in;
pop[i] <== iszero[i].out;
}
for(var i = 0; i<256; i++){
total += pop[i];
}
256-total ==> length;
}

View File

@@ -1,37 +1,45 @@
pragma circom 2.1.9;
include "../hasher/hash.circom";
include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/bitify.circom";
include "@zk-email/circuits/utils/array.circom";
include "binary-merkle-root.circom";
include "getCommonLength.circom";
include "@zk-kit/binary-merkle-root.circom/src/binary-merkle-root.circom";
include "circomlib/circuits/poseidon.circom";
/// @title SMTVerify
/// @notice Verifies inclusion or non-inclusion of a value in a Sparse Merkle Tree
/// @param nLength Maximum depth of the tree
/// @input virtualValue The value to verify (user's input value)
/// @input value The value stored in the tree at the path
/// @input root The root of the Sparse Merkle Tree
/// @input siblings Array of sibling nodes
/// @input mode Verification mode (0 for non-inclusion, 1 for inclusion)
/// @output out 1 if verification succeeds, 0 otherwise
template SMTVerify(nLength) {
signal input virtualValue; // value from user's data
signal input value; // value included in the tree
signal input virtualValue;
signal input value;
signal input root;
signal input siblings[nLength];
signal input mode; // 0 for non inclusion, 1 for inclusion
signal depth <== SiblingsLength()(siblings);
signal input mode;
signal depth <-- getSiblingsLength(siblings); // no need to constraint this as bad input will give the wrong root
// Calulate the path
// Calculate path
signal path[nLength];
signal path_in_bits_reversed[nLength] <== Num2Bits(256)(virtualValue);
var path_in_bits[nLength];
for (var i = 0; i < nLength; i++) {
path_in_bits[i] = path_in_bits_reversed[nLength-1-i];
}
// Shift the path to the left by depth to make it compatible for BinaryMerkleRoot function
component ct1 = VarShiftLeft(nLength,nLength);
ct1.in <== path_in_bits;
ct1.shift <== (nLength-depth);
path <== ct1.out;
component pathShifter = VarShiftLeft(nLength, nLength);
pathShifter.in <== path_in_bits;
pathShifter.shift <== (nLength - depth);
path <== pathShifter.out;
// Closest_key to leaf
signal leaf <== PoseidonHash(3)([value, 1, 1]); // compute the leaf from the value
signal leaf <== Poseidon(3)([value, 1, 1]); // compute the leaf from the value
signal isClosestZero <== IsEqual()([value,0]); // check if the inital value is 0, in that case the leaf will be 0 too, not Hash(0,1,1);
signal leafOrZero <== leaf * (1 - isClosestZero);
@@ -40,10 +48,26 @@ template SMTVerify(nLength) {
signal computedRootIsValid <== IsEqual()([computedRoot,root]);
// check is leaf equals virtual leaf
signal virtualLeaf <== PoseidonHash(3)([virtualValue, 1,1]);
signal virtualLeaf <== Poseidon(3)([virtualValue, 1,1]);
signal areLeafAndVirtualLeafEquals <== IsEqual()([virtualLeaf, leaf]);
signal isInclusionOrNonInclusionValid <== IsEqual()([mode,areLeafAndVirtualLeafEquals]);
signal output out <== computedRootIsValid * isInclusionOrNonInclusionValid;
}
/// @title SiblingsLength
/// @notice Computes the effective length of a Merkle proof siblings array by finding the last non-zero element
/// @dev Handles arrays that may have zeros in between valid elements
/// @input siblings[256] Array of sibling nodes in a Merkle proof
/// @output length The effective length of the siblings array (position of last non-zero element)
function getSiblingsLength(siblings) {
var length;
for (var i = 0; i < 256; i++) {
if (siblings[i] != 0) {
length = i;
}
}
return length + 1;
}

View File

@@ -1,6 +1,6 @@
pragma circom 2.1.9;
include "../circomlib/hasher/hash.circom";
include "circomlib/circuits/poseidon.circom";
include "@zk-email/circuits/utils/bytes.circom";
include "./customHashers.circom";
@@ -13,19 +13,19 @@ template ComputeCommitment() {
signal input dg2_hash[64];
signal output out;
component poseidon_hasher = PoseidonHash(7);
poseidon_hasher.in[0] <== secret;
poseidon_hasher.in[1] <== attestation_id;
poseidon_hasher.in[2] <== leaf;
component poseidon_hasher = Poseidon(7);
poseidon_hasher.inputs[0] <== secret;
poseidon_hasher.inputs[1] <== attestation_id;
poseidon_hasher.inputs[2] <== leaf;
signal dg1_packed[3] <== PackBytes(93)(dg1);
for (var i = 0; i < 3; i++) {
poseidon_hasher.in[i + 3] <== dg1_packed[i];
poseidon_hasher.inputs[i + 3] <== dg1_packed[i];
}
signal dg2Hash2 <== CustomHasher(64)(dg2_hash);
poseidon_hasher.in[6] <== dg2Hash2;
poseidon_hasher.inputs[6] <== dg2Hash2;
out <== poseidon_hasher.out;
}

View File

@@ -1,6 +1,6 @@
pragma circom 2.1.9;
include "../circomlib/bigInt/bigIntFunc.circom";
include "../circomlib/hasher/hash.circom";
include "circomlib/circuits/poseidon.circom";
template CustomHasher(k) {
signal input in[k];
@@ -9,22 +9,22 @@ template CustomHasher(k) {
component hash[rounds];
for (var i = 0; i < rounds ; i ++){
hash[i] = PoseidonHash(16);
hash[i] = Poseidon(16);
}
for (var i = 0; i < rounds ; i ++){
for (var j = 0; j < 16 ; j ++){
if (i * 16 + j < k){
hash[i].in[j] <== in[i * 16 + j];
hash[i].inputs[j] <== in[i * 16 + j];
} else {
hash[i].in[j] <== 0;
hash[i].inputs[j] <== 0;
}
}
}
component finalHash = PoseidonHash(rounds);
component finalHash = Poseidon(rounds);
for (var i = 0 ; i < rounds ; i++) {
finalHash.in[i] <== hash[i].out;
finalHash.inputs[i] <== hash[i].out;
}
signal output out <== finalHash.out;
}

View File

@@ -1,7 +1,7 @@
pragma circom 2.1.9;
include "@zk-email/circuits/utils/bytes.circom";
include "../../circomlib/merkle-trees/binary-merkle-root.circom";
include "@zk-kit/binary-merkle-root.circom/src/binary-merkle-root.circom";
include "../computeCommitment.circom";
template VERIFY_COMMITMENT( nLevels) {

View File

@@ -1,6 +1,6 @@
pragma circom 2.1.9;
include "../../circomlib/hasher/hash.circom";
include "circomlib/circuits/poseidon.circom";
include "../../circomlib/merkle-trees/smt.circom";
template OFAC_NAME() {
@@ -13,14 +13,14 @@ template OFAC_NAME() {
component poseidon_hasher[3];
for (var j = 0; j < 3; j++) {
poseidon_hasher[j] = PoseidonHash(13);
poseidon_hasher[j] = Poseidon(13);
for (var i = 0; i < 13; i++) {
poseidon_hasher[j].in[i] <== dg1[10 + 13 * j + i];
poseidon_hasher[j].inputs[i] <== dg1[10 + 13 * j + i];
}
}
signal name_hash <== PoseidonHash(3)([poseidon_hasher[0].out, poseidon_hasher[1].out, poseidon_hasher[2].out]);
signal name_hash <== Poseidon(3)([poseidon_hasher[0].out, poseidon_hasher[1].out, poseidon_hasher[2].out]);
signal output ofacCheckResult <== SMTVerify(256)(name_hash, smt_leaf_value, smt_root, smt_siblings, 0);
}

View File

@@ -1,6 +1,6 @@
pragma circom 2.1.9;
include "../../circomlib/hasher/hash.circom";
include "circomlib/circuits/poseidon.circom";
include "../../circomlib/merkle-trees/smt.circom";
template OFAC_NAME_DOB() {
@@ -13,22 +13,22 @@ template OFAC_NAME_DOB() {
// Name Hash
component poseidon_hasher[3];
for (var j = 0; j < 3; j++) {
poseidon_hasher[j] = PoseidonHash(13);
poseidon_hasher[j] = Poseidon(13);
for (var i = 0; i < 13; i++) {
poseidon_hasher[j].in[i] <== dg1[10 + 13 * j + i];
poseidon_hasher[j].inputs[i] <== dg1[10 + 13 * j + i];
}
}
signal name_hash <== PoseidonHash(3)([poseidon_hasher[0].out, poseidon_hasher[1].out, poseidon_hasher[2].out]);
signal name_hash <== Poseidon(3)([poseidon_hasher[0].out, poseidon_hasher[1].out, poseidon_hasher[2].out]);
// Dob hash
component pos_dob = PoseidonHash(6);
component pos_dob = Poseidon(6);
for(var i = 0; i < 6; i++) {
pos_dob.in[i] <== dg1[62 + i];
pos_dob.inputs[i] <== dg1[62 + i];
}
// NameDob hash
signal name_dob_hash <== PoseidonHash(2)([pos_dob.out, name_hash]);
signal name_dob_hash <== Poseidon(2)([pos_dob.out, name_hash]);
signal output ofacCheckResult <== SMTVerify(256)(name_dob_hash, smt_leaf_value, smt_root, smt_siblings, 0);
}

View File

@@ -1,6 +1,5 @@
pragma circom 2.1.9;
include "../../circomlib/hasher/hash.circom";
include "../../circomlib/merkle-trees/smt.circom";
template OFAC_PASSPORT_NUMBER() {
@@ -12,9 +11,9 @@ template OFAC_PASSPORT_NUMBER() {
signal input smt_siblings[256];
signal output proofLevel <== 3;
component poseidon_hasher = PoseidonHash(9);
component poseidon_hasher = Poseidon(9);
for (var i = 0; i < 9; i++) {
poseidon_hasher.in[i] <== dg1[49 + i];
poseidon_hasher.inputs[i] <== dg1[49 + i];
}
signal output ofacCheckResult <== SMTVerify(256)(poseidon_hasher.out, smt_leaf_value, smt_root, smt_siblings, 0);
}

View File

@@ -1,6 +1,6 @@
pragma circom 2.1.5;
include "circom-dl/circuits/hasher/hash.circom";
include "circomlib/circuits/poseidon.circom";
include "../../other/smt.circom";
template ValidateCountry(nLevels) {
@@ -11,7 +11,7 @@ template ValidateCountry(nLevels) {
// Country hash aka key
component poseidon_hasher = PoseidonHash(6);
component poseidon_hasher = Poseidon(6);
for (var i = 0; i < 6; i++) {
poseidon_hasher.inputs[i] <== host_user[i];
}

View File

@@ -24,7 +24,7 @@
"@zk-email/circuits": "^6.1.1",
"@zk-email/helpers": "^6.1.1",
"@zk-email/zk-regex-circom": "^1.2.1",
"@zk-kit/binary-merkle-root.circom": "^1.0.0-beta",
"@zk-kit/binary-merkle-root.circom": "^1.0.0",
"@zk-kit/circuits": "^1.0.0-beta",
"asn1": "^0.2.6",
"asn1.js": "^5.4.1",

View File

@@ -936,7 +936,7 @@ __metadata:
languageName: node
linkType: hard
"@zk-kit/binary-merkle-root.circom@npm:^1.0.0-beta":
"@zk-kit/binary-merkle-root.circom@npm:^1.0.0":
version: 1.0.0
resolution: "@zk-kit/binary-merkle-root.circom@npm:1.0.0"
dependencies:
@@ -1565,7 +1565,7 @@ __metadata:
"@zk-email/circuits": "npm:^6.1.1"
"@zk-email/helpers": "npm:^6.1.1"
"@zk-email/zk-regex-circom": "npm:^1.2.1"
"@zk-kit/binary-merkle-root.circom": "npm:^1.0.0-beta"
"@zk-kit/binary-merkle-root.circom": "npm:^1.0.0"
"@zk-kit/circuits": "npm:^1.0.0-beta"
asn1: "npm:^0.2.6"
asn1.js: "npm:^5.4.1"