prysm-pulse/tools/go/def.bzl
Preston Van Loon cebb62997d
Add beacon state unmarshal fuzzer, afl support (#6625)
* Add AFL third_party libraries

* add beacon state fuzzing, add afl fuzz bundle

* rm fuzzing engine

* fix and lint

* Check for array out of bounds when calculating proposer delta

* failing test

* fix

* Checkpoint progress

* Add requirement that inclusion distance is not zero, add regression test

* No need for HTR since that is covered in process slots

* Removing some fuzzit logic, old fuzz tests

* Add ssz encoder test and fix

* Fuzzing checkpoint, adding fuzzing to the p2p layer

* ignore some libfuzzer files

* Full testing of p2p processing of blocks, with some mocked stuff

* use tmpdir and always process blocks

* use checkptr

* Update ethereumapis

* go mod tidy

* benchmarks for ferran's fast ssz hash tree root

* Update fastssz

* fmt

* gaz

* goimports

* Fix

* fix ethereumapis

* fix again

* kafka

* fix gen file

* fix compute signing root

* gofmt

* checkpoint progress

* progress

* checkpoint

* updates

* updates

* merge fix

* WIP

* merge

* fix build

* fix merge related issues

* cleanup

* revert unrelated

* lint

* lint

* lint

* manual tags for fuzz

* Commentary on upload script

* some import fixes, but not all

* fix //fuzz:fuzz_tests

* rm unused test

* update generated ssz

* Set // +build libfuzzer

* remove debug code

* A bit of refactoring ot explain why there is a committee_disabled file

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-09-14 11:42:08 -07:00

41 lines
1.4 KiB
Python

load("@io_bazel_rules_go//go:def.bzl", _go_library = "go_library")
load("@bazel_gazelle//:deps.bzl", _go_repository = "go_repository")
def go_library(name, **kwargs):
gc_goopts = []
if "gc_goopts" in kwargs:
go_goopts = kwargs["gc_goopts"]
gc_goopts += select({
"@prysm//tools/go:libfuzz_enabled": ["-d=libfuzzer,checkptr"],
"//conditions:default": [],
})
kwargs["gc_goopts"] = gc_goopts
_go_library(name = name, **kwargs)
# Maybe download a repository rule, if it doesn't exist already.
def maybe(repo_rule, name, **kwargs):
if name not in native.existing_rules():
repo_rule(name = name, **kwargs)
# A wrapper around go_repository to add gazelle directives.
def go_repository(name, **kwargs):
# Some third party go tools may be used by the fuzzing pipeline to generate code. This causes
# an issue when running with --config=fuzz and is not necessary since the dependency is not
# part of the final binary.
if "nofuzz" in kwargs:
kwargs.pop("nofuzz", None)
return maybe(_go_repository, name, **kwargs)
directives = []
if "build_directives" in kwargs:
directives = kwargs["build_directives"]
directives += [
"gazelle:map_kind go_library go_library @prysm//tools/go:def.bzl",
]
kwargs["build_directives"] = directives
maybe(_go_repository, name, **kwargs)