Skip to content

Commit

Permalink
Invert BLST Go Tag (#8725)
Browse files Browse the repository at this point in the history
* invert go tag

* fix rc

* try again

* Revert "try again"

This reverts commit 70ff765.

* fix fuzz

* Update shared/bls/blst/BUILD.bazel

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

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
  • Loading branch information
3 people authored Apr 11, 2021
1 parent 19a9b4b commit c65c6eb
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 69 deletions.
13 changes: 6 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ build --define kafka_enabled=false
test --define kafka_enabled=false
run --define kafka_enabled=false

# Enable blst by default, we use a config so that our fuzzer stops complaining.
build --config=blst_enabled
test --config=blst_enabled
run --config=blst_enabled
build --define blst_disabled=false
test --define blst_disabled=false
run --define blst_disabled=false

build:kafka_enabled --define kafka_enabled=true
build:kafka_enabled --define gotags=kafka_enabled

build:blst_enabled --define blst_enabled=true
build:blst_enabled --define gotags=blst_enabled
build:blst_disabled --define blst_disabled=true
build:blst_disabled --define gotags=blst_disabled

# Release flags
build:release --compilation_mode=opt
Expand Down Expand Up @@ -84,7 +83,7 @@ build:fuzz --linkopt -Wl,--no-as-needed
build:fuzz --define=gc_goopts=-d=libfuzzer,checkptr
build:fuzz --run_under=//tools:fuzz_wrapper
build:fuzz --compilation_mode=opt
build:fuzz --define=blst_enabled=false
build:fuzz --define=blst_disabled=true

test:fuzz --local_test_jobs="HOST_CPUS*.5"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Build
# Use blst tag to allow go and bazel builds for blst.
run: go build -v --tags=blst_enabled ./...
run: go build -v ./...

# Tests run via Bazel for now...
# - name: Test
Expand Down
98 changes: 49 additions & 49 deletions shared/bls/blst/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,70 @@ load("@io_bazel_rules_go//go:def.bzl", "go_test")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@prysm//tools/go:def.bzl", "go_library")

# Build with --define=blst_enabled=false to exclude blst library.
# Build with --define=blst_disabled=true to exclude blst library.
config_setting(
name = "blst_enabled_linux_amd64",
name = "linux_amd64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
values = {
"define": "blst_enabled=true",
"define": "blst_disabled=false",
},
)

config_setting(
name = "blst_enabled_darwin_amd64",
name = "darwin_amd64",
constraint_values = [
"@platforms//os:osx",
"@platforms//cpu:x86_64",
],
values = {
"define": "blst_enabled=true",
"define": "blst_disabled=false",
},
)

config_setting(
name = "blst_enabled_windows_amd64",
name = "windows_amd64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
values = {
"define": "blst_enabled=true",
"define": "blst_disabled=false",
},
)

config_setting(
name = "blst_enabled_linux_arm64",
name = "linux_arm64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
values = {
"define": "blst_enabled=true",
"define": "blst_disabled=false",
},
)

config_setting(
name = "blst_enabled_android_amd64",
name = "android_amd64",
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:x86_64",
],
values = {
"define": "blst_enabled=true",
"define": "blst_disabled=false",
},
)

config_setting(
name = "blst_enabled_android_arm64",
name = "android_arm64",
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:aarch64",
],
values = {
"define": "blst_enabled=true",
"define": "blst_disabled=false",
},
)

Expand All @@ -76,12 +76,12 @@ go_library(
srcs =
selects.with_or({
(
":blst_enabled_linux_amd64",
":blst_enabled_linux_arm64",
":blst_enabled_darwin_amd64",
":blst_enabled_windows_amd64",
":blst_enabled_android_amd64",
":blst_enabled_android_arm64",
":linux_amd64",
":linux_arm64",
":darwin_amd64",
":windows_amd64",
":android_amd64",
":android_arm64",
): [
"aliases.go",
"doc.go",
Expand All @@ -100,12 +100,12 @@ go_library(
],
deps = selects.with_or({
(
":blst_enabled_linux_amd64",
":blst_enabled_linux_arm64",
":blst_enabled_darwin_amd64",
":blst_enabled_windows_amd64",
":blst_enabled_android_amd64",
":blst_enabled_android_arm64",
":linux_amd64",
":linux_arm64",
":darwin_amd64",
":windows_amd64",
":android_amd64",
":android_arm64",
): [
"//shared/bls/common:go_default_library",
"//shared/featureconfig:go_default_library",
Expand All @@ -124,12 +124,12 @@ go_test(
name = "go_default_test",
srcs = selects.with_or({
(
":blst_enabled_linux_amd64",
":blst_enabled_linux_arm64",
":blst_enabled_darwin_amd64",
":blst_enabled_windows_amd64",
":blst_enabled_android_amd64",
":blst_enabled_android_arm64",
":linux_amd64",
":linux_arm64",
":darwin_amd64",
":windows_amd64",
":android_amd64",
":android_arm64",
): [
"public_key_test.go",
"secret_key_test.go",
Expand All @@ -138,12 +138,12 @@ go_test(
}),
deps = selects.with_or({
(
":blst_enabled_linux_amd64",
":blst_enabled_linux_arm64",
":blst_enabled_darwin_amd64",
":blst_enabled_windows_amd64",
":blst_enabled_android_amd64",
":blst_enabled_android_arm64",
":linux_amd64",
":linux_arm64",
":darwin_amd64",
":windows_amd64",
":android_amd64",
":android_arm64",
): [
"//shared/bls/blst:go_default_library",
"//shared/bls/common:go_default_library",
Expand All @@ -160,12 +160,12 @@ go_test(
name = "go_signature_test",
srcs = selects.with_or({
(
":blst_enabled_linux_amd64",
":blst_enabled_linux_arm64",
":blst_enabled_darwin_amd64",
":blst_enabled_windows_amd64",
":blst_enabled_android_amd64",
":blst_enabled_android_arm64",
":linux_amd64",
":linux_arm64",
":darwin_amd64",
":windows_amd64",
":android_amd64",
":android_arm64",
): [
"signature_test.go",
],
Expand All @@ -174,12 +174,12 @@ go_test(
embed = [":go_default_library"],
deps = selects.with_or({
(
":blst_enabled_linux_amd64",
":blst_enabled_linux_arm64",
":blst_enabled_darwin_amd64",
":blst_enabled_windows_amd64",
":blst_enabled_android_amd64",
":blst_enabled_android_arm64",
":linux_amd64",
":linux_arm64",
":darwin_amd64",
":windows_amd64",
":android_amd64",
":android_arm64",
): [
"//shared/bls/common:go_default_library",
"//shared/bytesutil:go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion shared/bls/blst/aliases.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst

Expand Down
2 changes: 1 addition & 1 deletion shared/bls/blst/bls_benchmark_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst_test

Expand Down
1 change: 0 additions & 1 deletion shared/bls/blst/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
//
// This implementation uses the library written by Supranational, blst.
//
// Only linux_amd64 is supported at the moment.
package blst
2 changes: 1 addition & 1 deletion shared/bls/blst/init.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst

Expand Down
2 changes: 1 addition & 1 deletion shared/bls/blst/public_key.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst

Expand Down
2 changes: 1 addition & 1 deletion shared/bls/blst/public_key_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst_test

Expand Down
2 changes: 1 addition & 1 deletion shared/bls/blst/secret_key.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst

Expand Down
2 changes: 1 addition & 1 deletion shared/bls/blst/secret_key_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst_test

Expand Down
2 changes: 1 addition & 1 deletion shared/bls/blst/signature.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst

Expand Down
2 changes: 1 addition & 1 deletion shared/bls/blst/signature_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build linux,amd64 linux,arm64 darwin,amd64 windows,amd64
// +build blst_enabled
// +build !blst_disabled

package blst

Expand Down
4 changes: 2 additions & 2 deletions shared/bls/blst/stub.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !blst_enabled
// +build blst_disabled libfuzzer

package blst

Expand All @@ -7,7 +7,7 @@ import (
)

// This stub file exists until build issues can be resolved for libfuzz.
const err = "blst is only supported on linux,darwin,windows with blst_enabled gotag"
const err = "blst is only supported on linux,darwin,windows"

// SecretKey -- stub
type SecretKey struct{}
Expand Down

0 comments on commit c65c6eb

Please sign in to comment.