Skip to content

Commit

Permalink
Merge pull request #14 from 0xPolygonID/exceptions-circuits-V3
Browse files Browse the repository at this point in the history
Exceptions + circuits v3
  • Loading branch information
OBrezhniev authored Mar 4, 2024
2 parents ff65b99 + a111361 commit 9551033
Show file tree
Hide file tree
Showing 28 changed files with 55,634 additions and 638,390 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
submodules: "recursive"

- name: Cache gmp build
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
depends/gmp
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
cd ../
- name: Cache circuits
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
circuits
Expand All @@ -114,7 +114,7 @@ jobs:
set -e
if [[ ! -d "circuits" ]]; then
mkdir circuits
curl -o circuits/ci.zip -L https://iden3-circuits-bucket.s3.eu-west-1.amazonaws.com/ci.zip
curl -o circuits/ci.zip -L https://iden3-circuits-bucket.s3.eu-west-1.amazonaws.com/latest.zip
unzip -o circuits/ci.zip -d circuits
rm circuits/ci.zip
fi
Expand All @@ -126,23 +126,23 @@ jobs:
./run_tests.sh
- name: upload macOS arm64 artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: witnesscalc-macOS-arm64
path: |
package
if-no-files-found: error

- name: upload iOS artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: witnesscalc-iOS
path: |
package_ios
if-no-files-found: error

- name: upload iOS Simulator artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: witnesscalc-iOS-Simulator
path: |
Expand All @@ -163,7 +163,7 @@ jobs:
version: 1.0

- name: Cache gmp build
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
depends/gmp
Expand All @@ -189,23 +189,23 @@ jobs:
run: make android_x86_64

- name: upload Linux amd64 artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: witnesscalc-linux-amd64
path: |
package
if-no-files-found: error

- name: upload Android artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: witnesscalc-Android
path: |
package_android
if-no-files-found: error

- name: upload Android x86_64 artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: witnesscalc-Android-x86_64
path: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ typings/
.next

tmp
temp

.DS_Store

Expand Down
9 changes: 5 additions & 4 deletions build/fr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
#include <assert.h>
#include <string>
#include <stdexcept>


static mpz_t q;
Expand Down Expand Up @@ -65,8 +65,9 @@ char *Fr_element2str(PFrElement pE) {
mpz_t r;
if (!(pE->type & Fr_LONG)) {
if (pE->shortVal>=0) {
char *r = new char[32];
sprintf(r, "%d", pE->shortVal);
const size_t rLn = 32;
char *r = new char[rLn];
snprintf(r, rLn, "%d", pE->shortVal);
return r;
} else {
mpz_init_set_si(r, pE->shortVal);
Expand Down Expand Up @@ -162,7 +163,7 @@ void Fr_div(PFrElement r, PFrElement a, PFrElement b) {
}

void Fr_fail() {
assert(false);
throw std::runtime_error("Fr error");
}

void Fr_longErr()
Expand Down
1 change: 0 additions & 1 deletion build/fr_generic.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "fr.hpp"
#include <cstdint>
#include <cstring>
#include <cassert>

FrElement Fr_q = {0, 0x80000000, {0x43e1f593f0000001,0x2833e84879b97091,0xb85045b68181585d,0x30644e72e131a029}};
FrElement Fr_R2 = {0, 0x80000000, {0x1bb8e645ae216da7,0x53fe3ab1e35c59e3,0x8c49833d53bb8085,0x0216d0b17f4e44a5}};
Expand Down
2 changes: 1 addition & 1 deletion depends/json
Submodule json updated 286 files
18 changes: 10 additions & 8 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
set -e
set -x

mkdir -p temp

package/bin/authV2 \
testdata/authV2_input.json \
temp/authV2_witness.wtns
Expand Down Expand Up @@ -72,50 +74,50 @@ package/bin/credentialAtomicQueryV3 \
testdata/credentialAtomicQueryV3_Sig_input.json \
temp/credentialAtomicQueryV3_Sig_witness.wtns
snarkjs groth16 prove \
circuits/credentialAtomicQueryV3/circuit_final.zkey \
circuits/credentialAtomicQueryV3-beta.1/circuit_final.zkey \
temp/credentialAtomicQueryV3_Sig_witness.wtns \
temp/credentialAtomicQueryV3_Sig_proof.json \
temp/credentialAtomicQueryV3_Sig_public.json
snarkjs groth16 verify \
circuits/credentialAtomicQueryV3/verification_key.json \
circuits/credentialAtomicQueryV3-beta.1/verification_key.json \
temp/credentialAtomicQueryV3_Sig_public.json \
temp/credentialAtomicQueryV3_Sig_proof.json

package/bin/credentialAtomicQueryV3 \
testdata/credentialAtomicQueryV3_MTP_input.json \
temp/credentialAtomicQueryV3_MTP_witness.wtns
snarkjs groth16 prove \
circuits/credentialAtomicQueryV3/circuit_final.zkey \
circuits/credentialAtomicQueryV3-beta.1/circuit_final.zkey \
temp/credentialAtomicQueryV3_MTP_witness.wtns \
temp/credentialAtomicQueryV3_MTP_proof.json \
temp/credentialAtomicQueryV3_MTP_public.json
snarkjs groth16 verify \
circuits/credentialAtomicQueryV3/verification_key.json \
circuits/credentialAtomicQueryV3-beta.1/verification_key.json \
temp/credentialAtomicQueryV3_MTP_public.json \
temp/credentialAtomicQueryV3_MTP_proof.json

package/bin/credentialAtomicQueryV3OnChain \
testdata/credentialAtomicQueryV3OnChain_Sig_input.json \
temp/credentialAtomicQueryV3OnChain_Sig_witness.wtns
snarkjs groth16 prove \
circuits/credentialAtomicQueryV3OnChain/circuit_final.zkey \
circuits/credentialAtomicQueryV3OnChain-beta.1/circuit_final.zkey \
temp/credentialAtomicQueryV3OnChain_Sig_witness.wtns \
temp/credentialAtomicQueryV3OnChain_Sig_proof.json \
temp/credentialAtomicQueryV3OnChain_Sig_public.json
snarkjs groth16 verify \
circuits/credentialAtomicQueryV3OnChain/verification_key.json \
circuits/credentialAtomicQueryV3OnChain-beta.1/verification_key.json \
temp/credentialAtomicQueryV3OnChain_Sig_public.json \
temp/credentialAtomicQueryV3OnChain_Sig_proof.json

package/bin/credentialAtomicQueryV3OnChain \
testdata/credentialAtomicQueryV3OnChain_MTP_input.json \
temp/credentialAtomicQueryV3OnChain_MTP_witness.wtns
snarkjs groth16 prove \
circuits/credentialAtomicQueryV3OnChain/circuit_final.zkey \
circuits/credentialAtomicQueryV3OnChain-beta.1/circuit_final.zkey \
temp/credentialAtomicQueryV3OnChain_MTP_witness.wtns \
temp/credentialAtomicQueryV3OnChain_MTP_proof.json \
temp/credentialAtomicQueryV3OnChain_MTP_public.json
snarkjs groth16 verify \
circuits/credentialAtomicQueryV3OnChain/verification_key.json \
circuits/credentialAtomicQueryV3OnChain-beta.1/verification_key.json \
temp/credentialAtomicQueryV3OnChain_MTP_public.json \
temp/credentialAtomicQueryV3OnChain_MTP_proof.json
18 changes: 0 additions & 18 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,6 @@ set(LIB_SOURCES
witnesscalc.cpp
)

# # auth
# set(AUTH_SOURCES ${LIB_SOURCES}
# auth.cpp
# witnesscalc_auth.h
# witnesscalc_auth.cpp
# )
#
# add_library(witnesscalc_auth SHARED ${AUTH_SOURCES})
# add_library(witnesscalc_authStatic STATIC ${AUTH_SOURCES})
# set_target_properties(witnesscalc_authStatic PROPERTIES OUTPUT_NAME witnesscalc_auth)
#
# add_executable(auth main.cpp)
# target_link_libraries(auth witnesscalc_authStatic)
#
# target_compile_definitions(witnesscalc_auth PUBLIC CIRCUIT_NAME=auth)
# target_compile_definitions(witnesscalc_authStatic PUBLIC CIRCUIT_NAME=auth)
# target_compile_definitions(auth PUBLIC CIRCUIT_NAME=auth)

# authV2
set(AUTHV2_SOURCES ${LIB_SOURCES}
authV2.cpp
Expand Down
Loading

0 comments on commit 9551033

Please sign in to comment.