Update blst and remove hacks (#281)

This commit is contained in:
Justin Traglia 2023-04-07 07:58:17 -05:00 committed by GitHub
parent 928fd9d9b7
commit fe857cb3b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 20 deletions

View File

@ -159,7 +159,7 @@ void blst_fp12_frobenius_map(blst_fp12 *ret, const blst_fp12 *a, size_t n);
bool blst_fp12_is_equal(const blst_fp12 *a, const blst_fp12 *b);
bool blst_fp12_is_one(const blst_fp12 *a);
bool blst_fp12_in_group(const blst_fp12 *a);
const blst_fp12 *blst_fp12_one();
const blst_fp12 *blst_fp12_one(void);
#endif // SWIG
/*
@ -184,13 +184,13 @@ bool blst_p1_on_curve(const blst_p1 *p);
bool blst_p1_in_g1(const blst_p1 *p);
bool blst_p1_is_equal(const blst_p1 *a, const blst_p1 *b);
bool blst_p1_is_inf(const blst_p1 *a);
const blst_p1 *blst_p1_generator();
const blst_p1 *blst_p1_generator(void);
bool blst_p1_affine_on_curve(const blst_p1_affine *p);
bool blst_p1_affine_in_g1(const blst_p1_affine *p);
bool blst_p1_affine_is_equal(const blst_p1_affine *a, const blst_p1_affine *b);
bool blst_p1_affine_is_inf(const blst_p1_affine *a);
const blst_p1_affine *blst_p1_affine_generator();
const blst_p1_affine *blst_p1_affine_generator(void);
typedef struct { blst_fp2 x, y, z; } blst_p2;
typedef struct { blst_fp2 x, y; } blst_p2_affine;
@ -211,13 +211,13 @@ bool blst_p2_on_curve(const blst_p2 *p);
bool blst_p2_in_g2(const blst_p2 *p);
bool blst_p2_is_equal(const blst_p2 *a, const blst_p2 *b);
bool blst_p2_is_inf(const blst_p2 *a);
const blst_p2 *blst_p2_generator();
const blst_p2 *blst_p2_generator(void);
bool blst_p2_affine_on_curve(const blst_p2_affine *p);
bool blst_p2_affine_in_g2(const blst_p2_affine *p);
bool blst_p2_affine_is_equal(const blst_p2_affine *a, const blst_p2_affine *b);
bool blst_p2_affine_is_inf(const blst_p2_affine *a);
const blst_p2_affine *blst_p2_affine_generator();
const blst_p2_affine *blst_p2_affine_generator(void);
/*
* Multi-scalar multiplications and other multi-point operations.
@ -356,7 +356,7 @@ typedef struct {} blst_pairing;
typedef struct blst_opaque blst_pairing;
#endif
size_t blst_pairing_sizeof();
size_t blst_pairing_sizeof(void);
void blst_pairing_init(blst_pairing *new_ctx, bool hash_or_encode,
const byte *DST DEFNULL, size_t DST_len DEFNULL);
const byte *blst_pairing_get_dst(const blst_pairing *ctx);

View File

@ -50,7 +50,11 @@ void blst_sk_to_pk2_in_g2(byte out[192], blst_p2_affine *out_pk,
void blst_sign_pk2_in_g2(byte out[96], blst_p1_affine *out_sig,
const blst_p1 *hash, const blst_scalar *SK);
#ifdef __BLST_RUST_BINDGEN__
typedef struct {} blst_uniq;
#else
typedef struct blst_opaque blst_uniq;
#endif
size_t blst_uniq_sizeof(size_t n_nodes);
void blst_uniq_init(blst_uniq *tree);
@ -94,11 +98,11 @@ void blst_scalar_from_hexascii(blst_scalar *out, const byte *hex);
void blst_fr_from_hexascii(blst_fr *ret, const byte *hex);
void blst_fp_from_hexascii(blst_fp *ret, const byte *hex);
size_t blst_p1_sizeof();
size_t blst_p1_affine_sizeof();
size_t blst_p2_sizeof();
size_t blst_p2_affine_sizeof();
size_t blst_fp12_sizeof();
size_t blst_p1_sizeof(void);
size_t blst_p1_affine_sizeof(void);
size_t blst_p2_sizeof(void);
size_t blst_p2_affine_sizeof(void);
size_t blst_fp12_sizeof(void);
/*
* Single-shot SHA-256 hash function.

View File

@ -33,10 +33,6 @@ build: install clean
@cp -r ../../blst deps
@cp ../../src/c_kzg_4844.c deps/c-kzg
@cp ../../src/c_kzg_4844.h deps/c-kzg
@# Patch the blst_aux.h to fix a compiler error
@awk '{gsub(/typedef struct \{\} blst_uniq;/, "typedef struct { int dummy; } blst_uniq;")}1' \
deps/blst/bindings/blst_aux.h > blst_aux_temp.h
@mv blst_aux_temp.h deps/blst/bindings/blst_aux.h
@# Build the bindings
@$(YARN) node-gyp --loglevel=warn configure
@$(YARN) node-gyp --loglevel=warn build

View File

@ -29,7 +29,7 @@ fn main() {
let mut cc = cc::Build::new();
#[cfg(windows)]
cc.compiler("clang").flag("-D_CRT_SECURE_NO_WARNINGS");
cc.flag("-D_CRT_SECURE_NO_WARNINGS");
cc.include(blst_headers_dir.clone());
cc.warnings(false);

2
blst

@ -1 +1 @@
Subproject commit ca03e11a3ff24d818ae390a1e7f435f15bf72aee
Subproject commit e9dfc5ee724b5b25d50a3b6226bee8c2c9d5e65d

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.19
require (
github.com/stretchr/testify v1.8.1
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2
github.com/supranational/blst v0.3.11-0.20230406105308-e9dfc5ee724b
gopkg.in/yaml.v3 v3.0.1
)

4
go.sum
View File

@ -10,8 +10,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 h1:wh1wzwAhZBNiZO37uWS/nDaKiIwHz4mDo4pnA+fqTO0=
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/supranational/blst v0.3.11-0.20230406105308-e9dfc5ee724b h1:u49mjRnygnB34h8OKbnNJFVUtWSKIKb1KukdV8bILUM=
github.com/supranational/blst v0.3.11-0.20230406105308-e9dfc5ee724b/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=