Skip to content

Commit

Permalink
Update rapidsnark lib to v0.0.3 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
olomix authored Jun 21, 2024
1 parent 0986cf0 commit 9323fbe
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/proof/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.18

require github.com/iden3/go-rapidsnark/prover v0.0.2

require github.com/iden3/go-rapidsnark/types v0.0.1 // indirect
require github.com/iden3/go-rapidsnark/types v0.0.3 // indirect

replace github.com/iden3/go-rapidsnark/prover => ../../prover
4 changes: 2 additions & 2 deletions cmd/proof/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/iden3/go-rapidsnark/types v0.0.1 h1:WTGzdFXKlKo0CzVk1jyN4FsTDKdR+EPfn2wR3pdeXKQ=
github.com/iden3/go-rapidsnark/types v0.0.1/go.mod h1:ApgcaUxKIgSRA6fAeFxK7p+lgXXfG4oA2HN5DhFlfF4=
github.com/iden3/go-rapidsnark/types v0.0.3 h1:f0s1Qdut1qHe1O67+m+xUVRBPwSXnq5j0xSrBi0jqM4=
github.com/iden3/go-rapidsnark/types v0.0.3/go.mod h1:ApgcaUxKIgSRA6fAeFxK7p+lgXXfG4oA2HN5DhFlfF4=
Binary file modified prover/rapidsnark_vendor/libgmp-darwin-amd64.a
Binary file not shown.
Binary file modified prover/rapidsnark_vendor/libgmp-darwin-arm64.a
Binary file not shown.
Binary file modified prover/rapidsnark_vendor/libgmp-linux-amd64.a
Binary file not shown.
Binary file modified prover/rapidsnark_vendor/libgmp-linux-arm64.a
Binary file not shown.
Binary file modified prover/rapidsnark_vendor/librapidsnark-darwin-amd64.a
Binary file not shown.
Binary file modified prover/rapidsnark_vendor/librapidsnark-darwin-arm64.a
Binary file not shown.
Binary file modified prover/rapidsnark_vendor/librapidsnark-linux-amd64-noasm.a
Binary file not shown.
Binary file modified prover/rapidsnark_vendor/librapidsnark-linux-amd64.a
Binary file not shown.
Binary file modified prover/rapidsnark_vendor/librapidsnark-linux-arm64.a
Binary file not shown.
58 changes: 48 additions & 10 deletions prover/rapidsnark_vendor/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:
* 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);

/**
* groth16_prover
* @return error code:
* PRPOVER_OK - in case of success.
* PPROVER_ERROR - in case of an error.
* 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(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_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

0 comments on commit 9323fbe

Please sign in to comment.