Skip to content

Commit

Permalink
Merge pull request #422 from 0xPolygonID/fix/prover_fix_lib_update
Browse files Browse the repository at this point in the history
Fixed proof generation.
  • Loading branch information
5eeman authored Jul 24, 2024
2 parents 3943670 + ad61234 commit 42a9345
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 11 deletions.
Binary file modified android/src/main/jniLibs/arm64-v8a/librapidsnark.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/x86_64/librapidsnark.so
Binary file not shown.
60 changes: 49 additions & 11 deletions ios/Classes/prover.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,61 @@ extern "C" {
#endif

//Error codes returned by the functions.
#define PRPOVER_OK 0x0
#define PPROVER_ERROR 0x1
#define PPROVER_ERROR_SHORT_BUFFER 0x2
#define PROVER_OK 0x0
#define PROVER_ERROR 0x1
#define PROVER_ERROR_SHORT_BUFFER 0x2
#define PROVER_INVALID_WITNESS_LENGTH 0x3

/**
* Calculates buffer size to output public signals as json string
* @returns PROVER_OK in case of success, and the size of public buffer is written to public_size
*/
int
groth16_public_size_for_zkey_buf(const void *zkey_buffer, unsigned long zkey_size,
size_t *public_size,
char *error_msg, unsigned long error_msg_maxsize);

/**
* groth16_public_size_for_zkey_file calculates minimum buffer size for
* JSON-formatted public signals. The calculated buffer size is written
* to the public_size variable.
*
* @return error code:
* PRPOVER_OK - in case of success.
* PPROVER_ERROR - in case of an error.
* PROVER_OK (0) - in case of success
* PROVER_ERROR - in case of an error, error_msg contains the error message
*/
int
groth16_public_size_for_zkey_file(const char *zkey_fname,
unsigned long *public_size,
char *error_msg, unsigned long error_msg_maxsize);

extern int
groth16_prover(const void *zkey_buffer, unsigned long zkey_size,
const void *wtns_buffer, unsigned long wtns_size,
char *proof_buffer, unsigned long *proof_size,
char *public_buffer, unsigned long *public_size,
char *error_msg, unsigned long error_msg_maxsize);
/**
* groth16_prover
* @return error code:
* PROVER_OK - in case of success
* PPOVER_ERROR - in case of an error
* PROVER_ERROR_SHORT_BUFFER - in case of a short buffer error, also updates proof_size and public_size with actual proof and public sizess
*/
int
groth16_prover(const void *zkey_buffer, unsigned long zkey_size,
const void *wtns_buffer, unsigned long wtns_size,
char *proof_buffer, unsigned long *proof_size,
char *public_buffer, unsigned long *public_size,
char *error_msg, unsigned long error_msg_maxsize);

/**
* groth16_prover
* @return error code:
* PROVER_OK - in case of success
* PPOVER_ERROR - in case of an error
* PROVER_ERROR_SHORT_BUFFER - in case of a short buffer error, also updates proof_size and public_size with actual proof and public sizess
*/
int
groth16_prover_zkey_file(const char *zkey_file_path,
const void *wtns_buffer, unsigned long wtns_size,
char *proof_buffer, unsigned long *proof_size,
char *public_buffer, unsigned long *public_size,
char *error_msg, unsigned long error_msg_maxsize);

#ifdef __cplusplus
}
Expand Down
Binary file modified ios/libfq.a
Binary file not shown.
Binary file modified ios/libfr.a
Binary file not shown.
Binary file modified ios/libgmp.a
Binary file not shown.
Binary file modified ios/librapidsnark.a
Binary file not shown.

0 comments on commit 42a9345

Please sign in to comment.