Add blst for BLS (#6539)

* Add blst third party dep

* initial build

* add init

* blst passing tests

* add feature flag

* blst and herumi for spec tests

* maybe this works for mac

* Actually set feature flag

* Add stub for VerifyMultipleSignatures for blst

* verifyCompressed

* use correct cores sizes

* aggregate public keys

* add multi-sig verification

* encode not hash

* revert back

* go mod tidy

* update blst to latest commit

* add batch decompress

* fix

* add test

* gofmt

* update blst

* go mod tidy

* remove kubesec, fix

* mod tidy

* disable some remote cache

* disable some remote cache

* disable some remote cache

* disable some remote cache

* Switch to -D__ADX__

* update

* tidy

* fix build

* Make blst for only linux,amd64

* gofmt

* lint

* lint

* gazelle

* fix build tag

* more stub methods

* shift adx instructions to x86

* fix arm64

* Revert "fix arm64"

This reverts commit 4d34ac21b7.

* add one more in

* Revert "Revert "fix arm64""

This reverts commit 1c8ae24ad1.

* try darwin now

* Revert "try darwin now"

This reverts commit 6f884714b8.

* Add sha256

* remove TODO

* checkpoint

* finally builds

* fix up

* add tag

* try again

* explicit disabling

* remove

* select properly

* fix

* better

* make CI happy too

* Update .bazelrc

* Update .bazelrc

* fix tests

* revert back

* Update shared/bls/blst/public_key.go

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>

* Update shared/bls/blst/public_key.go

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>

* clean up tests

* more clean up

* clean up

* add

* Update shared/bls/blst/signature.go

* Update shared/bls/blst/signature.go

* Update .buildkite-bazelrc

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>

* try again

* remove go tag

* revert change

* gaz

* gazelle ignore

Co-authored-by: nisdas <nishdas93@gmail.com>
Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Preston Van Loon
2020-09-16 08:28:28 -05:00
committed by GitHub
parent b0917db4c7
commit 14dbc2b74d
38 changed files with 1400 additions and 84 deletions

106
third_party/blst/blst.BUILD vendored Normal file
View File

@@ -0,0 +1,106 @@
load("@prysm//tools/go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_library(
name = "go_default_library",
srcs = [
"bindings/go/blst.go",
"bindings/go/server.c",
],
cgo = True,
copts = [
"-D__BLST_CGO__",
"-Ibindings",
"-Isrc",
] + select({
"@io_bazel_rules_go//go/platform:amd64": [
"-mno-avx",
"-D__ADX__",
],
"//conditions:default": [],
}),
cdeps = [":blst"],
importpath = "github.com/supranational/blst/bindings/go",
visibility = ["//visibility:public"],
)
go_test(
name = "go_default_test",
srcs = [
"bindings/go/blst_htoc_test.go",
"bindings/go/blst_minpk_test.go",
"bindings/go/blst_minsig_test.go",
],
embed = [":go_default_library"],
data = glob([
"bindings/go/hash_to_curve/*.json",
]),
)
cc_library(
name = "blst",
srcs = [
"bindings/blst.h",
"bindings/blst_aux.h",
],
hdrs = [
"bindings/blst.h",
"bindings/blst_aux.h",
],
deps = [
":src",
":asm",
],
strip_include_prefix = "bindings",
visibility = ["//visibility:public"],
)
cc_library(
name = "asm_hdrs",
hdrs = glob([
"build/**/*.s",
"build/**/*.S",
], exclude = ["build/assembly.s"]),
)
cc_library(
name = "asm",
srcs = [
"build/assembly.S",
],
copts = [
] + select({
"@io_bazel_rules_go//go/platform:amd64": [
"-mno-avx",
"-D__ADX__",
],
"//conditions:default": [],
}),
deps = [":asm_hdrs"],
linkstatic = True,
)
cc_library(
name = "hdrs",
hdrs = glob(
[
"src/*.c",
"src/*.h",
],
exclude = [
"src/server.c",
"src/client_*.c",
],
),
strip_include_prefix = "src",
)
cc_library(
name = "src",
srcs = [
"src/server.c",
],
deps = [
":hdrs",
],
)