mirror of
https://github.com/selfxyz/self.git
synced 2026-01-10 07:08:10 -05:00
feat: add register eu id instances (#682)
* feat: add register eu id instances * feat: add new instances * chore: update scripts * chore: fix sig alg * chore: rm circuits
This commit is contained in:
1
.github/workflows/artifacts.yml
vendored
1
.github/workflows/artifacts.yml
vendored
@@ -61,6 +61,7 @@ jobs:
|
||||
run: |
|
||||
chmod +x circuits/scripts/build/build_cpp.sh && \
|
||||
./circuits/scripts/build/build_cpp.sh register &&
|
||||
./circuits/scripts/build/build_cpp.sh register_id &&
|
||||
./circuits/scripts/build/build_cpp.sh disclose &&
|
||||
./circuits/scripts/build/build_cpp.sh dsc
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER(256, 224, 44, 32, 7, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(160, 160, 27, 32, 7, 384, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(160, 160, 7, 64, 4, 384, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(160, 160, 3, 120, 35, 384, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(160, 256, 1, 120, 35, 384, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(224, 224, 30, 32, 7, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 224, 44, 32, 7, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER(256, 224, 44, 32, 7, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 21, 64, 4, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 37, 64, 6, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 8, 64, 4, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 23, 64, 6, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 13, 120, 35, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 43, 120, 35, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 4, 120, 35, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 19, 120, 35, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(256, 256, 46, 120, 35, 512, 128);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(384, 384, 22, 64, 6, 768, 256);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(384, 384, 38, 64, 8, 768, 256);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(384, 384, 9, 64, 6, 768, 256);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(384, 384, 45, 120, 35, 768, 256);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 10, 120, 35, 896, 256);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 29, 64, 8, 896, 256);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 41, 66, 8, 896, 256);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 15, 120, 35, 896, 256);
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../register_id.circom";
|
||||
|
||||
component main { public [ merkle_root ] } = REGISTER_ID(512, 512, 42, 120, 35, 896, 256);
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
# run from root
|
||||
# first argument should register | dsc | disclose
|
||||
if [[ $1 != "register" && $1 != "dsc" && $1 != "disclose" ]]; then
|
||||
echo "first argument should be register | dsc | disclose"
|
||||
if [[ $1 != "register" && $1 != "dsc" && $1 != "disclose" && $1 != "register_id" ]]; then
|
||||
echo "first argument should be register | dsc | disclose | register_id"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REGISTER_CIRCUITS=(
|
||||
# passport
|
||||
"register_sha1_sha1_sha1_ecdsa_brainpoolP224r1:true"
|
||||
"register_sha1_sha1_sha1_ecdsa_secp256r1:true"
|
||||
"register_sha1_sha1_sha1_rsa_65537_4096:true"
|
||||
"register_sha1_sha256_sha256_rsa_65537_4096:true"
|
||||
"register_sha224_sha224_sha224_ecdsa_brainpoolP224r1:true"
|
||||
"register_sha256_sha224_sha224_ecdsa_secp224r1:true"
|
||||
"register_sha256_sha256_sha224_ecdsa_secp224r1:true"
|
||||
"register_sha256_sha256_sha256_ecdsa_brainpoolP256r1:true"
|
||||
"register_sha256_sha256_sha256_ecdsa_brainpoolP384r1:true"
|
||||
"register_sha256_sha256_sha256_ecdsa_secp256r1:true"
|
||||
@@ -35,8 +37,39 @@ REGISTER_CIRCUITS=(
|
||||
"register_sha512_sha512_sha512_rsapss_65537_64_2048:true"
|
||||
)
|
||||
|
||||
REGISTER_ID_CIRCUITS=(
|
||||
# eu id
|
||||
"register_id_sha1_sha1_sha1_ecdsa_brainpoolP224r1:true"
|
||||
"register_id_sha1_sha1_sha1_ecdsa_secp256r1:true"
|
||||
"register_id_sha1_sha1_sha1_rsa_65537_4096:true"
|
||||
"register_id_sha1_sha256_sha256_rsa_65537_4096:true"
|
||||
"register_id_sha224_sha224_sha224_ecdsa_brainpoolP224r1:true"
|
||||
"register_id_sha256_sha224_sha224_ecdsa_secp224r1:true"
|
||||
"register_id_sha256_sha256_sha224_ecdsa_secp224r1:true"
|
||||
"register_id_sha256_sha256_sha256_ecdsa_brainpoolP256r1:true"
|
||||
"register_id_sha256_sha256_sha256_ecdsa_brainpoolP384r1:true"
|
||||
"register_id_sha256_sha256_sha256_ecdsa_secp256r1:true"
|
||||
"register_id_sha256_sha256_sha256_ecdsa_secp384r1:true"
|
||||
"register_id_sha256_sha256_sha256_rsa_3_4096:true"
|
||||
"register_id_sha256_sha256_sha256_rsa_65537_4096:true"
|
||||
"register_id_sha256_sha256_sha256_rsapss_3_32_2048:true"
|
||||
"register_id_sha256_sha256_sha256_rsapss_65537_32_2048:true"
|
||||
"register_id_sha256_sha256_sha256_rsapss_65537_32_3072:true"
|
||||
"register_id_sha256_sha256_sha256_rsapss_65537_64_2048:true"
|
||||
"register_id_sha384_sha384_sha384_ecdsa_brainpoolP384r1:true"
|
||||
"register_id_sha384_sha384_sha384_ecdsa_brainpoolP512r1:true"
|
||||
"register_id_sha384_sha384_sha384_ecdsa_secp384r1:true"
|
||||
"register_id_sha384_sha384_sha384_rsapss_65537_48_2048:true"
|
||||
"register_id_sha512_sha512_sha256_rsa_65537_4096:true"
|
||||
"register_id_sha512_sha512_sha512_ecdsa_brainpoolP512r1:true"
|
||||
"register_id_sha512_sha512_sha512_ecdsa_secp521r1:true"
|
||||
"register_id_sha512_sha512_sha512_rsa_65537_4096:true"
|
||||
"register_id_sha512_sha512_sha512_rsapss_65537_64_2048:true"
|
||||
)
|
||||
|
||||
DISCLOSE_CIRCUITS=(
|
||||
"vc_and_disclose:true"
|
||||
"vc_and_disclose_id:true"
|
||||
)
|
||||
|
||||
DSC_CIRCUITS=(
|
||||
@@ -66,6 +99,11 @@ if [[ $1 == "register" ]]; then
|
||||
output="output/register"
|
||||
mkdir -p $output
|
||||
basepath="./circuits/circuits/register/instances"
|
||||
elif [[ $1 == "register_id" ]]; then
|
||||
allowed_circuits=("${REGISTER_ID_CIRCUITS[@]}")
|
||||
output="output/register"
|
||||
mkdir -p $output
|
||||
basepath="./circuits/circuits/register_id/instances"
|
||||
elif [[ $1 == "dsc" ]]; then
|
||||
allowed_circuits=("${DSC_CIRCUITS[@]}")
|
||||
output="output/dsc"
|
||||
@@ -78,7 +116,7 @@ elif [[ $1 == "disclose" ]]; then
|
||||
basepath="./circuits/circuits/disclose"
|
||||
fi
|
||||
|
||||
pids=()
|
||||
pids=()
|
||||
for item in "${allowed_circuits[@]}"; do
|
||||
filename=$(echo "$item" | cut -d':' -f1)
|
||||
allowed=$(echo "$item" | cut -d':' -f2)
|
||||
@@ -89,7 +127,7 @@ for item in "${allowed_circuits[@]}"; do
|
||||
fi
|
||||
|
||||
while [[ ${#pids[@]} -ge 5 ]]; do
|
||||
new_pids=()
|
||||
new_pids=()
|
||||
for pid in "${pids[@]}"; do
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
new_pids+=("$pid")
|
||||
@@ -107,13 +145,13 @@ for item in "${allowed_circuits[@]}"; do
|
||||
circuit_name="${filename%.*}"
|
||||
(
|
||||
circom $filepath \
|
||||
-l "circuits/node_modules" \
|
||||
-l "circuits/node_modules/@zk-kit/binary-merkle-root.circom/src" \
|
||||
-l "circuits/node_modules/circomlib/circuits" \
|
||||
-l "node_modules" \
|
||||
-l "node_modules/@zk-kit/binary-merkle-root.circom/src" \
|
||||
-l "node_modules/circomlib/circuits" \
|
||||
--O1 -c --output $output && \
|
||||
cd $output/${circuit_name}_cpp && \
|
||||
make
|
||||
) &
|
||||
make
|
||||
) &
|
||||
pids+=($!)
|
||||
done
|
||||
|
||||
|
||||
158
circuits/scripts/build/build_r1cs_wasm.sh
Executable file
158
circuits/scripts/build/build_r1cs_wasm.sh
Executable file
@@ -0,0 +1,158 @@
|
||||
#!/bin/bash
|
||||
|
||||
# run from root
|
||||
# first argument should register | dsc | disclose
|
||||
if [[ $1 != "register" && $1 != "dsc" && $1 != "disclose" && $1 != "register_id" ]]; then
|
||||
echo "first argument should be register | dsc | disclose | register_id"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REGISTER_CIRCUITS=(
|
||||
# passport
|
||||
"register_sha1_sha1_sha1_ecdsa_brainpoolP224r1:true"
|
||||
"register_sha1_sha1_sha1_ecdsa_secp256r1:true"
|
||||
"register_sha1_sha1_sha1_rsa_65537_4096:true"
|
||||
"register_sha1_sha256_sha256_rsa_65537_4096:true"
|
||||
"register_sha224_sha224_sha224_ecdsa_brainpoolP224r1:true"
|
||||
"register_sha256_sha224_sha224_ecdsa_secp224r1:true"
|
||||
"register_sha256_sha256_sha224_ecdsa_secp224r1:true"
|
||||
"register_sha256_sha256_sha256_ecdsa_brainpoolP256r1:true"
|
||||
"register_sha256_sha256_sha256_ecdsa_brainpoolP384r1:true"
|
||||
"register_sha256_sha256_sha256_ecdsa_secp256r1:true"
|
||||
"register_sha256_sha256_sha256_ecdsa_secp384r1:true"
|
||||
"register_sha256_sha256_sha256_rsa_3_4096:true"
|
||||
"register_sha256_sha256_sha256_rsa_65537_4096:true"
|
||||
"register_sha256_sha256_sha256_rsapss_3_32_2048:true"
|
||||
"register_sha256_sha256_sha256_rsapss_65537_32_2048:true"
|
||||
"register_sha256_sha256_sha256_rsapss_65537_32_3072:true"
|
||||
"register_sha256_sha256_sha256_rsapss_65537_64_2048:true"
|
||||
"register_sha384_sha384_sha384_ecdsa_brainpoolP384r1:true"
|
||||
"register_sha384_sha384_sha384_ecdsa_brainpoolP512r1:true"
|
||||
"register_sha384_sha384_sha384_ecdsa_secp384r1:true"
|
||||
"register_sha384_sha384_sha384_rsapss_65537_48_2048:true"
|
||||
"register_sha512_sha512_sha256_rsa_65537_4096:true"
|
||||
"register_sha512_sha512_sha512_ecdsa_brainpoolP512r1:true"
|
||||
"register_sha512_sha512_sha512_ecdsa_secp521r1:true"
|
||||
"register_sha512_sha512_sha512_rsa_65537_4096:true"
|
||||
"register_sha512_sha512_sha512_rsapss_65537_64_2048:true"
|
||||
)
|
||||
|
||||
REGISTER_ID_CIRCUITS=(
|
||||
# eu id
|
||||
"register_id_sha1_sha1_sha1_ecdsa_brainpoolP224r1:true"
|
||||
"register_id_sha1_sha1_sha1_ecdsa_secp256r1:true"
|
||||
"register_id_sha1_sha1_sha1_rsa_65537_4096:true"
|
||||
"register_id_sha1_sha256_sha256_rsa_65537_4096:true"
|
||||
"register_id_sha224_sha224_sha224_ecdsa_brainpoolP224r1:true"
|
||||
"register_id_sha256_sha224_sha224_ecdsa_secp224r1:true"
|
||||
"register_id_sha256_sha256_sha224_ecdsa_secp224r1:true"
|
||||
"register_id_sha256_sha256_sha256_ecdsa_brainpoolP256r1:true"
|
||||
"register_id_sha256_sha256_sha256_ecdsa_brainpoolP384r1:true"
|
||||
"register_id_sha256_sha256_sha256_ecdsa_secp256r1:true"
|
||||
"register_id_sha256_sha256_sha256_ecdsa_secp384r1:true"
|
||||
"register_id_sha256_sha256_sha256_rsa_3_4096:true"
|
||||
"register_id_sha256_sha256_sha256_rsa_65537_4096:true"
|
||||
"register_id_sha256_sha256_sha256_rsapss_3_32_2048:true"
|
||||
"register_id_sha256_sha256_sha256_rsapss_65537_32_2048:true"
|
||||
"register_id_sha256_sha256_sha256_rsapss_65537_32_3072:true"
|
||||
"register_id_sha256_sha256_sha256_rsapss_65537_64_2048:true"
|
||||
"register_id_sha384_sha384_sha384_ecdsa_brainpoolP384r1:true"
|
||||
"register_id_sha384_sha384_sha384_ecdsa_brainpoolP512r1:true"
|
||||
"register_id_sha384_sha384_sha384_ecdsa_secp384r1:true"
|
||||
"register_id_sha384_sha384_sha384_rsapss_65537_48_2048:true"
|
||||
"register_id_sha512_sha512_sha256_rsa_65537_4096:true"
|
||||
"register_id_sha512_sha512_sha512_ecdsa_brainpoolP512r1:true"
|
||||
"register_id_sha512_sha512_sha512_ecdsa_secp521r1:true"
|
||||
"register_id_sha512_sha512_sha512_rsa_65537_4096:true"
|
||||
"register_id_sha512_sha512_sha512_rsapss_65537_64_2048:true"
|
||||
)
|
||||
|
||||
DISCLOSE_CIRCUITS=(
|
||||
"vc_and_disclose:true"
|
||||
"vc_and_disclose_id:true"
|
||||
)
|
||||
|
||||
DSC_CIRCUITS=(
|
||||
"dsc_sha1_ecdsa_brainpoolP256r1:true"
|
||||
"dsc_sha1_ecdsa_secp256r1:true"
|
||||
"dsc_sha1_rsa_65537_4096:true"
|
||||
"dsc_sha256_ecdsa_brainpoolP256r1:true"
|
||||
"dsc_sha256_ecdsa_brainpoolP384r1:true"
|
||||
"dsc_sha256_ecdsa_secp256r1:true"
|
||||
"dsc_sha256_ecdsa_secp384r1:true"
|
||||
"dsc_sha256_ecdsa_secp521r1:true"
|
||||
"dsc_sha256_rsa_65537_4096:true"
|
||||
"dsc_sha256_rsapss_3_32_3072:true"
|
||||
"dsc_sha256_rsapss_65537_32_3072:true"
|
||||
"dsc_sha256_rsapss_65537_32_4096:true"
|
||||
"dsc_sha384_ecdsa_brainpoolP384r1:true"
|
||||
"dsc_sha384_ecdsa_brainpoolP512r1:true"
|
||||
"dsc_sha384_ecdsa_secp384r1:true"
|
||||
"dsc_sha512_ecdsa_brainpoolP512r1:true"
|
||||
"dsc_sha512_ecdsa_secp521r1:true"
|
||||
"dsc_sha512_rsa_65537_4096:true"
|
||||
"dsc_sha512_rsapss_65537_64_4096:true"
|
||||
)
|
||||
|
||||
if [[ $1 == "register" ]]; then
|
||||
allowed_circuits=("${REGISTER_CIRCUITS[@]}")
|
||||
output="output/register"
|
||||
mkdir -p $output
|
||||
basepath="./circuits/circuits/register/instances"
|
||||
elif [[ $1 == "register_id" ]]; then
|
||||
allowed_circuits=("${REGISTER_ID_CIRCUITS[@]}")
|
||||
output="output/register"
|
||||
mkdir -p $output
|
||||
basepath="./circuits/circuits/register_id/instances"
|
||||
elif [[ $1 == "dsc" ]]; then
|
||||
allowed_circuits=("${DSC_CIRCUITS[@]}")
|
||||
output="output/dsc"
|
||||
mkdir -p $output
|
||||
basepath="./circuits/circuits/dsc/instances"
|
||||
elif [[ $1 == "disclose" ]]; then
|
||||
allowed_circuits=("${DISCLOSE_CIRCUITS[@]}")
|
||||
output="output/disclose"
|
||||
mkdir -p $output
|
||||
basepath="./circuits/circuits/disclose"
|
||||
fi
|
||||
|
||||
pids=()
|
||||
for item in "${allowed_circuits[@]}"; do
|
||||
filename=$(echo "$item" | cut -d':' -f1)
|
||||
allowed=$(echo "$item" | cut -d':' -f2)
|
||||
|
||||
if [[ $allowed == 'false' ]]; then
|
||||
echo "Skipping $filename (not in allowed circuits)"
|
||||
continue
|
||||
fi
|
||||
|
||||
while [[ ${#pids[@]} -ge 5 ]]; do
|
||||
new_pids=()
|
||||
for pid in "${pids[@]}"; do
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
new_pids+=("$pid")
|
||||
else
|
||||
echo "Process $pid finished"
|
||||
fi
|
||||
done
|
||||
pids=("${new_pids[@]}")
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo $filename $allowed
|
||||
filepath=${basepath}/${filename}.circom
|
||||
circom_pid=$!
|
||||
circuit_name="${filename%.*}"
|
||||
(
|
||||
circom $filepath \
|
||||
-l "node_modules" \
|
||||
-l "node_modules/@zk-kit/binary-merkle-root.circom/src" \
|
||||
-l "node_modules/circomlib/circuits" \
|
||||
--O1 --r1cs --wasm --output $output
|
||||
) &
|
||||
pids+=($!)
|
||||
done
|
||||
|
||||
echo "Waiting for all circuits to compile..."
|
||||
wait "${pids[@]}"
|
||||
echo "All circuits compiled successfully!"
|
||||
Reference in New Issue
Block a user